diff --git a/Src/Plugins/DSP/sc_serv3/ADTSHeader.cpp b/Src/Plugins/DSP/sc_serv3/ADTSHeader.cpp deleted file mode 100644 index 36242e07..00000000 --- a/Src/Plugins/DSP/sc_serv3/ADTSHeader.cpp +++ /dev/null @@ -1,225 +0,0 @@ -#include "ADTSHeader.h" -#include "nmrCommon/services/stdServiceImpl.h" - - -enum -{ - ADTS_NOT_PROTECTED = 1, - ADTS_PROTECTED = 0, - ADTS_SYNC = 0xFFF, - ADTS_MAIN = 0x00, - ADTS_LC = 0x01, - ADTS_SSR = 0x10, - ADTS_LTP = 0x11 -}; - -const int aac_adts_parse(const aac_adts_header_t header, const __uint8 *buffer) -{ - header->syncword = ((buffer[0] << 4) | (buffer[1] >> 4)); - - if (header->syncword != ADTS_SYNC) - { - return NErr_LostSynchronization; - } - - header->id = ((buffer[1] >> 3) & 1); - header->layer = ((buffer[1] >> 1) & 3); - if (header->layer != 0) - { - return NErr_WrongFormat; - } - - header->protection = ((buffer[1]) & 1); - header->profile = ((buffer[2] >> 6) & 3); - header->sample_rate_index = ((buffer[2] >> 2) & 0xF); - if (header->sample_rate_index == 15) - { - return NErr_UnsupportedFormat; // might actually be OK if we can separately signal the sample rate - } - - if (header->sample_rate_index > 13) - { - return NErr_Reserved; - } - - header->private_bit = ((buffer[2] >> 1) & 1); - header->channel_configuration = ((buffer[2] & 1) << 2) | ((buffer[3] >> 6) & 3); - header->original = ((buffer[3] >> 5) & 1); - header->home = ((buffer[3] >> 4) & 1); - - header->frame_length = ((buffer[3] & 3) << 11) | (buffer[4]<<3) | ((buffer[5] >> 5) & 7); - header->buffer_fullness = ((buffer[5] & 0x1F) << 6) | (buffer[6] >> 2); - header->num_data_blocks = (buffer[6] & 3); - return NErr_Success; -} - -static const unsigned int aac_sratetab[] = -{ - 96000, - 88200, - 64000, - 48000, - 44100, - 32000, - 24000, - 22050, - 16000, - 12000, - 11025, - 8000, - 7350, -}; -#if 0 -const int aac_adts_match(const aac_adts_header_t header1, const aac_adts_header_t header2) -{ - if (header1->id != header2->id) - { - return NErr_False; - } - - if (header1->profile != header2->profile) - { - return NErr_False; - } - - if (header1->sample_rate_index != header2->sample_rate_index) - { - return NErr_False; - } - - if (header1->channel_configuration != header2->channel_configuration) - { - return NErr_False; - } - - return NErr_True; -} -#endif -const int aac_adts_get_channel_count(const aac_adts_header_t header) -{ - switch (header->channel_configuration) - { - case 7: - { - return 8; - } - default: - { - return header->channel_configuration; - } - } -} - -const __uint16 getADTSFrameInfo(const char *hdr, unsigned int *samplerate, __uint8 *asc_header) -{ - ADTSHeader header = {0}; - if (aac_adts_parse(&header, (const __uint8 *)hdr) == NErr_Success) - { - *samplerate = aac_sratetab[header.sample_rate_index]; - - // we need this when generating flv frames - // as it creates the AudioSpecificConfig - // from the existing ADTS header details - // (is like a mini-ADTS header to create) - if (asc_header) - { - asc_header[0] |= (((header.profile + 1) & 31) << 3) + (header.sample_rate_index >> 1); - asc_header[1] |= ((header.sample_rate_index & 0x1) << 7) + (header.channel_configuration << 3); - } - - //*bitrate = (int)(((header.frame_length / 1/*frames*/) * (aac_sratetab[header.sample_rate_index] / 1024.0)) + 0.5) * 8; - return (__uint16)header.frame_length; - } - return 0; -} - -const char *AAC_FrameInfo::getVersionName() const -{ - if (m_version) - return "v2"; - return "v4"; -} - -const char *AAC_FrameInfo::getAOT() const -{ - switch (m_aot) - { - case 2: return "LC"; - case 5: return "SBR"; - case 29: return "PS"; - default: return "unknown profile"; - } -} - - -int getAACFrameLength (const unsigned char *p, unsigned int len) -{ - if (len < 6) - return -1; - return ((p[3] & 0x3) << 11) + (p[4] << 3) + ((p[5] & 0xE0) >> 5); -} - -int getAACFrameInfo (const unsigned char *p, unsigned int len, AAC_FrameInfo &info) -{ - if (len < 6) - return -1; - if ((((long)p[0])<<4 | (p[1]>>4)) != 0xfff) - return -1; - - int layer = ((p[1] >> 1) & 3); - if (layer != 0) - return -1; - int sample_rate_index = ((p[2] >> 2) & 0xF); - - if (sample_rate_index > 13) - return -1; - int samplerate = aac_sratetab [sample_rate_index]; - if (info.m_samplerate) - { - if (info.m_samplerate != samplerate) - return -1; - } - else - info.m_samplerate = samplerate; - info.m_blocks = (p[6] & 0x3) + 1; - info.m_pattern = (((unsigned long)(p[0])<<24) | (p[1]<<16) | (p[2]<<8) | p[0]) & info.m_mask; - - return getAACFrameLength (p, len); -} - - -int AAC_FrameInfo::verifyFrame (const unsigned char *buf, unsigned int len) -{ - if (len > 6) - { - unsigned long v = (unsigned long)(buf[0])<<24 | (buf[1]<<16) | (buf[2]<<8) | buf[0]; - - if ((v & m_mask) == m_pattern) - { - m_blocks = (buf[6] & 0x3) + 1; - m_version = (buf[1] >> 3) & 1; // 1 mpeg2, 0 mpeg4 - m_aot = ((buf[2] >> 6) & 3) + 1; - return getAACFrameLength (buf, len); - } - // DLOG ("AAC failed sync, retry.."); - return -1; - } - return 0; -} - - -AAC_FrameInfo::AAC_FrameInfo (unsigned long value) : parserInfo (0xFFFEFDC0, value) -{ - m_description = "AAC"; - m_blocks = 0; - m_aot = 0; -} - -AAC_FrameInfo::AAC_FrameInfo(const unsigned char *p, unsigned int len) : parserInfo() -{ - m_mask = 0xFFFEFDC0; - m_description = "AAC"; - m_blocks = 0; - getAACFrameInfo (p, len, *this); -} - diff --git a/Src/Plugins/DSP/sc_serv3/ADTSHeader.h b/Src/Plugins/DSP/sc_serv3/ADTSHeader.h deleted file mode 100644 index ef849f87..00000000 --- a/Src/Plugins/DSP/sc_serv3/ADTSHeader.h +++ /dev/null @@ -1,62 +0,0 @@ -#pragma once -#ifndef _ADTS_HEADER_H -#define _ADTS_HEADER_H - -#include "nmrCommon/intTypes.h" -#include "global.h" -#include "uvox2Common.h" - - -typedef struct ADTSHeader -{ - unsigned int syncword; - unsigned int layer; - unsigned int id; - unsigned int protection; - unsigned int profile; - unsigned int sample_rate_index; - unsigned int private_bit; - unsigned int channel_configuration; - unsigned int original; - unsigned int home; - int frame_length; - unsigned int buffer_fullness; - unsigned int num_data_blocks; -} ADTSHeader, *aac_adts_header_t; - -enum -{ - NErr_Success = 0, - NErr_True = 0, - NErr_False = 8, // returned from a bool-like function to indicate "false" as opposed to "i had an error while figuring it out" - NErr_UnsupportedFormat = 13, - NErr_LostSynchronization = 17, - NErr_WrongFormat = 24, // data was understood but is indicating a different format than expected. e.g. an layer 2 header being encountered by a layer 3 parser - NErr_Reserved = 25 // typically returned when a parser encounters data with a reserved flag set to true -}; - -struct AAC_FrameInfo : public parserInfo -{ - int m_blocks; - int m_aot; - - int verifyFrame (const unsigned char *buf, unsigned int len); - int getUvoxType() { return AAC_LC_DATA; } - const char *getVersionName() const; - const char *getAOT() const; - - AAC_FrameInfo (unsigned long value = 0); - AAC_FrameInfo (const unsigned char *p, unsigned int len); -}; - -int getAACFrameInfo (const unsigned char *hdr, unsigned int len, AAC_FrameInfo &info); - -/* must be 7 bytes */ -const int aac_adts_parse(const aac_adts_header_t header, const __uint8 *buffer); -const int aac_adts_get_channel_count(const aac_adts_header_t header); -#if 0 -const int aac_adts_match(const aac_adts_header_t header1, const aac_adts_header_t header2); -#endif -const __uint16 getADTSFrameInfo(const char *hdr, unsigned int *samplerate, __uint8 *asc_header = 0); - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/FLV.cpp b/Src/Plugins/DSP/sc_serv3/FLV.cpp deleted file mode 100644 index b42063b3..00000000 --- a/Src/Plugins/DSP/sc_serv3/FLV.cpp +++ /dev/null @@ -1,322 +0,0 @@ -#include "FLV.h" -#ifdef _WIN32 -#include -#endif -#include "streamData.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -/* -** This is a bit messy but it'll generate -** FLV tags for the purpose of streaming. -** -** Where possible values are hard-coded -** so we just re-insert into the output. -*/ - -#define FLV_SIGNATURE {'F', 'L', 'V'} -#define FLV_VERSION ((__uint8)0x1) - -#define FLV_FLAG_VIDEO ((__uint8)0x1) -#define FLV_FLAG_AUDIO ((__uint8)0x4) - -#define FLV_HDR_SIZE ((__uint32)0x9000000) // pre-converted to big-endian - -// ensure we've got the structures correctly packed -#pragma pack(push, 1) -typedef struct { - __uint8 signature[3]; // FLV_SIGNATURE - __uint8 version; // FLV_VERSION - __uint8 flags; // FLV_FLAG_* - __uint32 header_size; // FLV_HDR_SIZE - __uint32 prev_size; // 0 (this is the size of the previous tag including - // its header in bytes i.e. 11 + the 'data_size' - // of the previous tag). we include this in the - // header so that we're always outputting a valid - // start point before the tag structure is added. -} flv_header; -#pragma pack(pop) - -#pragma pack(push, 1) -typedef struct { - __uint8 type; // for first packet set to AMF Metadata ??? - __uint8 data_size[3]; // size of packet data only (24) - __uint8 ts_lower[3]; // for first packet set to NULL (24) - __uint8 ts_upper; // extension to create a __uint32 value - __uint8 stream_id[3]; // for first stream of same type set to NULL (24) - /* data comes after this*/ -} flv_tag; -#pragma pack(pop) - -/* -__uint32 prev_size; // for first packet set to NULL otherwise this is the - // size of the previous tag including its header in B - // and is 11 plus the 'data_size' of the previous tag. -*/ - -// these are pre-encoded for the correct endianess -// though for metadata usage, we convert them back -#define FLV_MP3_AUDIO ((__uint8)0x20) // (((__uint8)0x2) << 4) -#define FLV_AAC_AUDIO ((__uint8)0xA0) // (((__uint8)0xA) << 4) - -#define FLV_SAMPLE_RATE_5 ((__uint8)0x0) // (((__uint8)0x0) << 2) -#define FLV_SAMPLE_RATE_11 ((__uint8)0x4) // (((__uint8)0x1) << 2) -#define FLV_SAMPLE_RATE_22 ((__uint8)0x8) // (((__uint8)0x2) << 2) -#define FLV_SAMPLE_RATE_44 ((__uint8)0xC) // (((__uint8)0x3) << 2) - -#define FLV_SAMPLE_SIZE_8 ((__uint8)0x0) // (((__uint8)0x0) << 1) -#define FLV_SAMPLE_SIZE_16 ((__uint8)0x2) // (((__uint8)0x1) << 1) - -#define FLV_MONO_AUDIO ((__uint8)0x0) -#define FLV_STEREO_AUDIO ((__uint8)0x1) - - -// reads 24 bits from data, converts from big endian, and returns as a 32bit int -inline __uint32 Read24(__uint8* data) -{ - __uint32 returnVal = 0; - __uint8* swap = (__uint8*)&returnVal; - - swap[0] = data[2]; - swap[1] = data[1]; - swap[2] = data[0]; - - return returnVal; -} - -int dataString(vector<__uint8> &out_data, const char *buf) -{ - int amt = (int)strlen(buf); - __uint8 bytes[2] = {(__uint8)((amt >> 8) & 0xff), (__uint8)((amt >> 0) & 0xff)}; - // length of the data string - out_data.insert(out_data.end(), (const __uint8*)&bytes, (const __uint8*)&bytes + sizeof(bytes)); - // body of the data string - out_data.insert(out_data.end(), (const __uint8*)buf, (const __uint8*)buf + amt); - return amt + 2; -} - -int scriptDataType(vector<__uint8> &out_data, const __uint8 type) -{ - out_data.insert(out_data.end(), (const __uint8*)&type, ((const __uint8*)&type) + sizeof(type)); - return 1; -} - -int scriptDataString(vector<__uint8> &out_data, const char *name, const char *value) -{ - return dataString(out_data, name) + scriptDataType(out_data, 0x2) + dataString(out_data, value); -} - -int scriptDataBool(vector<__uint8> &out_data, const char *name, const bool value) -{ - return dataString(out_data, name) + scriptDataType(out_data, 0x1) + scriptDataType(out_data, !!value); -} - -int scriptDataDouble(vector<__uint8> &out_data, const char *name, const double value) -{ - int amt = dataString(out_data, name) + scriptDataType(out_data, 0x0); - - union - { - __uint8 dc[8]; - double dd; - } d; - d.dd = value; - - unsigned char b[8]; - b[0] = d.dc[7]; - b[1] = d.dc[6]; - b[2] = d.dc[5]; - b[3] = d.dc[4]; - b[4] = d.dc[3]; - b[5] = d.dc[2]; - b[6] = d.dc[1]; - b[7] = d.dc[0]; - - out_data.insert(out_data.end(), (const __uint8*)b, (const __uint8*)b + sizeof(b)); - - return amt + 8; -} - -void createMetadataTag(vector<__uint8> &out_data, const bool mp3, - const bool mono, const int bitrate, - const __uint8 flv_sr, const streamData::streamID_t sid) -{ - __uint8 m[] = {'\x12', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00'}; - out_data.insert(out_data.end(), (const __uint8*)m, (const __uint8*)m + sizeof(m)); - - __uint32 s = scriptDataType(out_data, 0x2) + - dataString(out_data, "onMetadata") + - // start of the script array data blocks - scriptDataType(out_data, 0x8); - - __uint8 data_size[4] = {'\x00', '\x00', '\x00', '\x0C'/* number of items in the array */}; - out_data.insert(out_data.end(), (const __uint8*)&data_size, ((const __uint8*)&data_size) + sizeof(data_size)); - s += 4; - - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(sid, info, extra); - - s += scriptDataString(out_data, "name", (!info.m_streamName.empty() ? info.m_streamName.hideAsString().c_str() : "")); - // TODO - as we're not updating as we go at the moment, this will be set to the station name so there's something set - s += scriptDataString(out_data, "title", (!info.m_streamName.empty() ? info.m_streamName.hideAsString().c_str() : "")); - //s += scriptDataString(out_data, "title", (!info.m_currentSong.empty() ? info.m_currentSong.hideAsString().c_str() : "")); - s += scriptDataString(out_data, "genre", (!info.m_streamGenre[0].empty() ? info.m_streamGenre[0].hideAsString().c_str() : "")); - - //s += scriptDataBool(out_data, "hasMetadata", false/* TODO */); - s += scriptDataBool(out_data, "hasAudio", true); - s += scriptDataBool(out_data, "hasVideo", false); - s += scriptDataBool(out_data, "hasKeyframes", false); - - s += scriptDataBool(out_data, "canSeekToEnd", false); - - s += scriptDataBool(out_data, "stereo", !mono); - - s += scriptDataDouble(out_data, "audiodatarate", (double)bitrate); - s += scriptDataDouble(out_data, "audiocodecid", (double)((mp3 ? FLV_MP3_AUDIO : FLV_AAC_AUDIO) >> 4)); - s += scriptDataDouble(out_data, "audiosamplerate", (double)(flv_sr >> 2)); - s += scriptDataDouble(out_data, "audiosamplesize", (double)(FLV_SAMPLE_SIZE_16 >> 1)); - - unsigned char end[] = {'\x00', '\x00', '\x09'}; - out_data.insert(out_data.end(), (const __uint8*)end, (const __uint8*)end + sizeof(end)); - s += 3; - - // now we know how much we've got - // we can update the tags' length - __uint32 s2 = s + 11; - out_data[16] = (s & 0xFF); - s >>= 8; - out_data[15] = (s & 0xFF); - s >>= 8; - out_data[14] = (s & 0xFF); - - // we set this at the end so if we terminate the stream - // then there's more chance of it validating correctly. - data_size[3] = (s2 & 0xFF); - s2 >>= 8; - data_size[2] = (s2 & 0xFF); - s2 >>= 8; - data_size[1] = (s2 & 0xFF); - s2 >>= 8; - data_size[0] = (s2 & 0xFF); - - out_data.insert(out_data.end(), (const __uint8*)&data_size, ((const __uint8*)&data_size) + sizeof(data_size)); -} - -void createFLVTag(vector<__uint8> &out_data, const char *buf, - const int amt, int ×tamp, const bool mp3, - const bool mono, const unsigned int samplerate, - const int bitrate, const __uint8 *asc_header, - const streamData::streamID_t sid) -{ - if (amt > 0) - { - // we need to generate this early so we've got - // it for being provided in createMetadataTag - __uint8 flv_sr = FLV_SAMPLE_RATE_44; - if (mp3) - { - // how do we handle the formats not allowed...? - switch (samplerate) - { - case 22050: - { - flv_sr = FLV_SAMPLE_RATE_22; - break; - } - case 11025: - { - flv_sr = FLV_SAMPLE_RATE_11; - break; - } - } - } - - const bool first = (timestamp == 0); - if (first) - { - const flv_header hdr = {FLV_SIGNATURE, FLV_VERSION, FLV_FLAG_AUDIO, FLV_HDR_SIZE, 0}; - out_data.insert(out_data.end(), (const __uint8*)&hdr, ((const __uint8*)&hdr) + sizeof(flv_header)); - - createMetadataTag(out_data, mp3, mono, bitrate, flv_sr, sid); - - if (!mp3) - { - // we send a simple frame at this point just so for AAC the decoder - // is able to be setup correctly as needed else it'll fail to play. - __uint8 p[] = {'\x08', '\x00', '\x00', '\x04', '\x00', '\x00', '\x00', '\x00', - '\x00', '\x00', '\x00', (__uint8)'\xAF', '\x00', asc_header[0], - asc_header[1], '\x00', '\x00', '\x00', '\x0F'}; - out_data.insert(out_data.end(), (const __uint8*)p, (const __uint8*)p + sizeof(p)); - } - } - - // if we were to do something else, then we'd need to - // change the initial value as needed for it's format - flv_tag tag = {((__uint8)0x8), {0}, {0}, 0, {0}}; - // we need to know the size of things before we output - // the actual frame, so we calculate now and adjust it - // based on the format of the frame needing to be sent - __uint32 v = (first ? (!mp3 ? 2 : 1) : 1 + !mp3) + amt; - - tag.data_size[2] = (v & 0xFF); - v >>= 8; - tag.data_size[1] = (v & 0xFF); - v >>= 8; - tag.data_size[0] = (v & 0xFF); - - // this sets the 24-bit time - v = timestamp; - tag.ts_lower[2] = (v & 0xFF); - v >>= 8; - tag.ts_lower[1] = (v & 0xFF); - v >>= 8; - tag.ts_lower[0] = (v & 0xFF); - // this sets the extended time - // so we provide a 32-bit time - v >>= 8; - tag.ts_upper = (v & 0xFF); - - // depending on the format, we adjust timestamp - // for MP3, we're looking at 26ms / frame - // for AAC, we're looking at 1024 samples / frame - timestamp += (mp3 ? 26 : (1024000 / samplerate)); - - out_data.insert(out_data.end(), (const __uint8*)&tag, ((const __uint8*)&tag) + sizeof(flv_tag)); - - // for AAC data, the default has to be set as 16-bit 44kHZ stereo - // though the decoder will actuall figure things out as required. - // for MP3 data, we fill in things based on the frame data found - __uint8 flv_audio_data_tag = ((mp3 ? FLV_MP3_AUDIO : FLV_AAC_AUDIO) | flv_sr | FLV_SAMPLE_SIZE_16 | (!mono ? FLV_STEREO_AUDIO : FLV_MONO_AUDIO)); - out_data.insert(out_data.end(), (const __uint8*)&flv_audio_data_tag, ((const __uint8*)&flv_audio_data_tag) + sizeof(flv_audio_data_tag)); - - if (!mp3) - { - // this is done so we now distinguish the actual - // raw AAC data sans ADTS header vs the required - // AAC sequence header which is sent before the - // first AAC data frame is sent - __uint8 packet_type = 0x1; - out_data.insert(out_data.end(), (const __uint8*)&packet_type, ((const __uint8*)&packet_type) + sizeof(packet_type)); - } - - // body of the data - out_data.insert(out_data.end(), (const __uint8*)buf, ((const __uint8*)buf) + amt); - - // we set this at the end so if we terminate the stream - // then there's more chance of it validating correctly. - v = (11 + Read24(tag.data_size)); - __uint8 data_size[4] = {0}; - data_size[3] = (v & 0xFF); - v >>= 8; - data_size[2] = (v & 0xFF); - v >>= 8; - data_size[1] = (v & 0xFF); - v >>= 8; - data_size[0] = (v & 0xFF); - - out_data.insert(out_data.end(), (const __uint8*)&data_size, ((const __uint8*)&data_size) + sizeof(data_size)); - } -} diff --git a/Src/Plugins/DSP/sc_serv3/FLV.h b/Src/Plugins/DSP/sc_serv3/FLV.h deleted file mode 100644 index 182e65ef..00000000 --- a/Src/Plugins/DSP/sc_serv3/FLV.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once -#ifndef _FLV_HEADER_H -#define _FLV_HEADER_H - -#include -#include -#include "nmrCommon/intTypes.h" -#ifdef _WIN32 -#include -#endif -#include "streamData.h" - -void createFLVTag(std::vector<__uint8> &out_data, const char *buf, - const int amt, int ×tamp, const bool mp3, - const bool mono, const unsigned int samplerate, - const int bitrate, const __uint8 *asc_header, - const streamData::streamID_t sid); - -void createMetadataTag(std::vector<__uint8> &out_data, const bool mp3, - const bool mono, const int bitrate, - const __uint8 flv_sr, const streamData::streamID_t sid); - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/GNUmakefile b/Src/Plugins/DSP/sc_serv3/GNUmakefile deleted file mode 100644 index eebf3052..00000000 --- a/Src/Plugins/DSP/sc_serv3/GNUmakefile +++ /dev/null @@ -1,237 +0,0 @@ -SHELL = /bin/sh - -.SUFFIXES: -.SUFFIXES: .cpp .o .d .h - -OS := $(shell uname | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/') -x64 := $(shell uname -m) -ENDIAN := $(shell uname -m) -ENDIAN := $(patsubst i%86,LITTLE_ENDIAN,$(ENDIAN)) -ENDIAN := $(patsubst x86_64,LITTLE_ENDIAN,$(ENDIAN)) -ENDIAN := $(patsubst Power Macintosh,BIG_ENDIAN,$(ENDIAN)) -CXX=g++ -std=c++11 -Wno-deprecated - -########################################################## -########### Platform specific stuff ##################### -########################################################## - -ifeq ($(OS),LINUX) - - ### Raspbian is reported as a Linux OS - ### and reports 'armv6l' via uname -m - ### so we check -m to detect it properly - ifeq ($(x64),armv6l) - - #PLATFORM_DEFINES=-DPLATFORM_ARMv6 - # this is for GCC 4.6.x to make a legacy compatible compile ?? - PLATFORM_DEFINES=-DPLATFORM_ARMv6 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -ffunction-sections -fdata-sections -Wl,--gc-sections - - PLATFORM_LIBS=\ - libs/Aol_XML/ARMv6/libexpat.a\ - libs/libcurl/ARMv6/libcurl.a\ - libs/libcurl/ARMv6/libssl.a\ - libs/libcurl/ARMv6/libcrypto.a\ - libs/zlib/ARMv6/libz.a\ - -lrt\ - -lpthread\ - -ldl - ### the RPi2 is reported as a Linux OS - ### and reports 'armv7l' via uname -m - ### so we check -m to detect it properly - else ifeq ($(x64),armv7l) - # https://www.raspberrypi.org/forums/viewtopic.php?p=684549#p684549 - # this is for GCC 4.6.x - #PLATFORM_DEFINES=-DPLATFORM_ARMv7 -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard - # this is for GCC 4.8.x (default is 4.6.x on Raspbian) - PLATFORM_DEFINES=-DPLATFORM_ARMv7 -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -Wno-unused-result -Wno-ignored-qualifiers -Wno-long-long -Wno-missing-field-initializers -ffunction-sections -fdata-sections -Wl,--gc-sections - # this is for GCC 4.6.x to make a legacy compatible compile ?? - #PLATFORM_DEFINES=-DPLATFORM_ARMv6 -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard - - PLATFORM_LIBS=\ - libs/Aol_XML/ARMv7/libexpat.a\ - libs/libcurl/ARMv7/libcurl.a\ - libs/libcurl/ARMv7/libssl.a\ - libs/libcurl/ARMv7/libcrypto.a\ - libs/zlib/ARMv7/libz.a\ - -lrt\ - -lpthread\ - -ldl - else - PLATFORM_DEFINES=-DPLATFORM_LINUX -Wno-unused-result -Wno-ignored-qualifiers -Wno-long-long -Wno-missing-field-initializers -ffunction-sections -fdata-sections -Wl,--gc-sections - - ### Linux platform specific includes - ### with 32-bit and 64-bit handling - ifeq ($(x64),x86_64) - INCLUDES=-Ideps/x86_64/include - PLATFORM_LIBS=\ - -Ldeps/x86_64/lib -lexpat -lcurl -lssl -lcrypto -lpthread -lz -lrt -ldl - else - CXX += -m32 - INCLUDES=-Ideps/i686/include - PLATFORM_LIBS=\ - -Ldeps/i686/lib -lexpat -lcurl -lssl -lcrypto -lpthread -lz -lrt -ldl - endif - endif - -################################### - -else - ifeq ($(OS),FREEBSD) -# CXX=g++44 - PLATFORM_DEFINES=-DPLATFORM_BSD -Wno-long-long -Wno-missing-field-initializers - - PLATFORM_LIBS=\ - libs/Aol_XML/BSD/libexpat.a\ - libs/libcurl/BSD/libcurl.a\ - libs/libcurl/BSD/libssl.a\ - libs/libcurl/BSD/libcrypto.a\ - libs/zlib/BSD/libz.a\ - -lpthread\ -# -R /usr/local/lib/gcc44 - - else - ifeq ($(OS),DARWIN) - PLATFORM_DEFINES=-DPLATFORM_MAC -Wno-long-long -Wno-missing-field-initializers - - PLATFORM_LIBS=\ - libs/Aol_XML/Darwin/libexpat.a\ - libs/libcurl/Darwin/libcurl.a\ - libs/libcurl/Darwin/libssl.a\ - libs/libcurl/Darwin/libcrypto.a\ - libs/zlib/Darwin/libz.a\ - -lpthread - else - ERR = $(error Unknown operating system $(OS)) - endif - endif -endif - -ifneq ($(ENDIAN),LITTLE_ENDIAN) - ifneq ($(ENDIAN),BIG_ENDIAN) - ERR = $(error Unknown endian $(ENDIAN)) - endif -endif - -########################################################## -########################################################## -########################################################## -########################################################## -########################################################## - -INCLUDES += -I. -InmrCommon -#INCLUDES=-I. -InmrCommon -Izlib -Ilibcurl/include -IGeoIP/libGeoIP - -LIBS=$(PLATFORM_LIBS) - -CPPFLAGS=$(PLATFORM_DEFINES) -MMD -MP -D_REENTRANT -DCURL_STATICLIB -Wno-unused-function -Wno-sign-compare -Wno-unknown-pragmas -Wall -Wextra -pedantic - -CFLAGS_RELEASE=-O2 -static-libgcc -static-libstdc++ -rdynamic -CPPFLAGS_RELEASE=$(CPPFLAGS) -O2 -DNDEBUG -g - -CFLAGS_DEBUG=-static-libgcc -static-libstdc++ -rdynamic -CPPFLAGS_DEBUG=$(CPPFLAGS) -ggdb -DDEBUG - -VPATH=nmrCommon/threading nmrCommon/stacktrace nmrCommon/services nmrCommon/file nmrCommon/unicode webNet aolxml -#VPATH=nmrCommon/threading nmrCommon/stacktrace nmrCommon/services nmrCommon/file nmrCommon/unicode webNet aolxml GeoIP/libGeoIP - -C_SOURCES=\ - $(wildcard *.c) - -#C_SOURCES=\ -# $(wildcard *.c)\ -# $(wildcard GeoIP/libGeoIP/*.c) - -CXX_SOURCES=\ - $(wildcard *.cpp)\ - $(wildcard nmrCommon/threading/thread.cpp)\ - $(wildcard nmrCommon/stacktrace/StackTrace.cpp)\ - $(wildcard nmrCommon/services/logger.cpp)\ - $(wildcard nmrCommon/services/serviceMain.cpp)\ - $(wildcard nmrCommon/services/stdServiceImpl.cpp)\ - $(wildcard nmrCommon/file/fileUtils.cpp)\ - $(wildcard nmrCommon/unicode/*.cpp)\ - $(wildcard webNet/*.cpp)\ - $(wildcard aolxml/*.cpp) - -SOURCE_FILES=$(C_SOURCES) $(CXX_SOURCES) - -OBJECT_FILES=$(addsuffix .o,$(basename $(notdir $(SOURCE_FILES)))) -DEBUG_OBJECTS=$(addprefix debug/,$(OBJECT_FILES)) -RELEASE_OBJECTS=$(addprefix release/,$(OBJECT_FILES)) - -.PHONY: default -default: release - -release/config.o debug/config.o: unixversion.h -release/serviceMain.o debug/serviceMain.o: unixversion.h - -############################################################## -### Create unix version header from Win32 resource file -unixversion.h: sc_serv.rc - @grep --text 'PRODUCTVERSION' sc_serv.rc | sed 's/PRODUCTVERSION/static int & \[VENT\]=\{/' | sed 's/[0-9]*,[0-9]*,[0-9]*,[0-9]*/&\};/' > unixversion_tmp.h - @echo '#define VENT 4' | cat - unixversion_tmp.h > unixversion.h - @rm -f unixversion_tmp.h - -################# File rules #########################3 - -debug/%.o: %.cpp - $(CXX) $(CPPFLAGS_DEBUG) $(INCLUDES) -c $< -o $@ - -debug/%.o: %.c - $(CXX) $(CPPFLAGS_DEBUG) $(INCLUDES) -c $< -o $@ - -release/%.o: %.cpp - $(CXX) $(CPPFLAGS_RELEASE) $(INCLUDES) -c $< -o $@ - -release/%.o: %.c - $(CXX) $(CPPFLAGS_RELEASE) $(INCLUDES) -c $< -o $@ - -#release/%.o: GeoIP/libGeoIP/%.c -# $(CXX) $(CPPFLAGS_RELEASE) $(INCLUDES) -c $< -o $@ - -############################################################ - -sc_serv_debug: $(DEBUG_OBJECTS) - $(CXX) -o sc_serv_debug $(CFLAGS_DEBUG) $(DEBUG_OBJECTS) $(LIBS) - @./sc_serv_debug -v - @echo - -sc_serv: sc_serv_notstripped - strip -o sc_serv sc_serv_notstripped - @echo - -sc_serv_notstripped: $(RELEASE_OBJECTS) - $(CXX) -o sc_serv_notstripped $(CFLAGS_RELEASE) $(RELEASE_OBJECTS) $(LIBS) - @./sc_serv_notstripped -v - -releasedir: - @mkdir -p release - -debugdir: - @mkdir -p debug - -.PHONY: clean -.PHONY: release -.PHONY: debug - -release: releasedir sc_serv -release_nostrip: releasedir sc_serv_notstripped -debug: debugdir sc_serv_debug - -clean: - @rm -rf debug - @rm -rf release - @rm -f unixversion.h - -.PHONY: err -err: ; $(ERR) - -##################################################3 - -ifeq ($(MAKECMDGOALS),release) --include $(RELEASE_OBJECTS:.o=.d) -else -ifneq ($(MAKECMDGOALS),clean) --include $(DEBUG_OBJECTS:.o=.d) -endif -endif diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/AUTHORS b/Src/Plugins/DSP/sc_serv3/GeoIP/AUTHORS deleted file mode 100644 index b1295b9b..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -T.J. Mather diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/COPYING b/Src/Plugins/DSP/sc_serv3/GeoIP/COPYING deleted file mode 100644 index 45574c3c..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/COPYING +++ /dev/null @@ -1,509 +0,0 @@ -[ Note that while the core GeoIP library is licensed under the -LGPL, the libGeoIPUpdate library depends on md5.c and types.h -which are licensed under the GPL. ] - - - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, 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 Street, 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! - - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/ChangeLog b/Src/Plugins/DSP/sc_serv3/GeoIP/ChangeLog deleted file mode 100644 index 572960f0..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/ChangeLog +++ /dev/null @@ -1,628 +0,0 @@ -1.4.8 - * Fix GEOIP_DOMAIN_EDITION_V6 ( Boris Zentner ) - * Add new Datatypes GEOIP_NETSPEED_EDITION_REV1_V6 and - GEOIP_NETSPEED_EDITION_REV1 ( Boris Zentner ) - * Fix possible directory traversal weakness in geoipupdate-pureperl.pl with - malicious update server ( Boris Zentner ) - * Fix GEOIP_ORG_EDITION_V6 and GEOIP_ISP_EDITION_V6 ( Boris Zentner ) -1.4.7 - * Upd timezone.c Add SX, BQ and CW remove AN and FX ( Boris Zentner ) - * Add support for the new types in geoiplookup6 ( Boris Zentner ) - * Add new database types GEOIP_CITY_EDITION_REV0_V6, - GEOIP_CITY_EDITION_REV1_V6, GEOIP_DOMAIN_EDITION_V6, - GEOIP_ORG_EDITION_V6 and GEOIP_ISP_EDITION_V6 ( Boris Zentner ) - * Remove AN and FX. Add SX, BQ and CW ( Boris Zentner ) - * Fix possible segfault in geoipupdate if the connection disappear - unexpected. ( Boris Zentner ) - * Add sanity check for geoipupdate-pureperl.pl ( Boris Zentner ) - * Add GEOIP_USERTYPE_EDITION and GEOIP_USERTYPE_EDITION_V6 - datatypes ( Boris Zentner ) - * Add new functions GeoIP_is_private_ipnum_v4 and GeoIP_is_private_v4 - ( Boris Zentner ) - * Add new functions GeoIP_teredo and GeoIP_enable_teredo. - teredo is enabled by default ( Boris Zentner ) - * Fix output of geoiplookup for unknown or private regions. - ( Boris Zentner ) - * Fix geoipupdate-pureperl.pl to accept more product codes. - ( Boris Zentner ) - * Fix minor output issue in geoipupdate -v ( Boris Zentner ) - * Add support for various databases. ( Boris Zentner ) - * Add experimental teredo support ( Boris Zentner ) - * Fix possible buffer overflow in conjunction with - http_proxies ( Elso Andras ) - * Remove memcpy/bcopy macro for BSD ( Boris Zentner ) - * Add GeoIP_lib_version and GeoIP_cleanup ( Ladar Levison ) - * Upd Makefile.vc ( Thomas Winzig ) - * Fix typo in DK,18,Midtjylland ( Boris Zentner ) - * Update libGeoIP/regionName.c with FIPS codes 20100810 ( Boris Zentner ) - * Fix continent codes ( Boris Zentner ) - * Fix 3letter country codes for ATA, BVT, IOT, CXR, CCK, ATF, HMD, - MYT, SGS and UMI ( Boris Zentner ) - * Fix typo/segfault in GeoIP_id_by_name_v6 ( Boris Zentner ) - * Update libGeoIP/regionName.c with FIPS codes 20100529 ( Boris Zentner ) - * Remove buffered IO functions, to fix issues with dup'ed file - descriptors ( Boris Zentner ) - * Fix very minor memleak in geoipupdate ( Boris Zentner ) - * Add GEOIP_CITYCONFIDENCEDIST_EDITION, GEOIP_LARGE_COUNTRY_EDITION - and GEOIP_LARGE_COUNTRY_EDITION_V6 database types ( Boris Zentner ) - * Update libGeoIP/regionName.c with FIPS codes 20100422 ( Boris Zentner ) - * Update libGeoIP/regionName.c with FIPS codes 20100420 ( Boris Zentner ) - * Update libGeoIP/regionName.c with FIPS codes 20100221 ( Boris Zentner ) - * Add missing timezones ( Boris Zentner ) - * Add missing include for Windows 2000 ( Jaap Keute ) - * 'GeoIP Database up to date' and 'Updated database' prints to stdout - instead of stderr ( Boris Zentner ) - * Add missing GeoIPRecord_delete to geoiplookup.c ( Piotr Kaczuba ) - * Add some IPv4 helper functions - unsigned long GeoIP_addr_to_num(const char *addr); - char * GeoIP_num_to_addr(unsigned long ipnum); ( Boris Zentner ) - * Fix default name for the accuracy radius database to GeoIPDistance.dat ( Boris Zentner ) - * Add GEOIP_CITYCONFIDENCE_EDITION database type. ( Boris Zentner ) - * geoiplookup use GeoIPDistance.dat files if avail ( Boris Zentner ) - * Fix geoiplookup/geoiplookup6 output, when the databaseinfo string is - not avail. ( Boris Zentner ) - * Change continent code for RU from AS to EU ( Boris Zentner ) - * Add GEOIP_ACCURACYRADIUS_EDITION database type. ( Boris Zentner ) - * Add GEOIP_LOCATIONA_EDITION the database to map back from binary to - the csv database ( Boris Zentner ) - * Change Turkey's continent code from Asia to Europe ( Boris Zentner ) - * Rename _iso_8859_1__utf8 to _GeoIP_iso_8859_1__utf8 ( Boris Zentner ) - * GEOIP_ORG_EDITION, GEOIP_ISP_EDITION, GEOIP_DOMAIN_EDITION and - GEOIP_ASNUM_EDITION databases return UTF8 results, if gi->charset is set - to GEOIP_CHARSET_UTF8 ( Boris Zentner ) - * Avoid unnecesary call to gettimeofday when GEOIP_CHECK_CACHE is not set ( John Douglass ) - * Delayed loading of changed database files for 60 seconds. To avoid - reading halve written databases ( Boris Zentner ) - * Update README.OSX for Leopard and Snow Leopard ( Boris Zentner ) - * Add more IPv6 functions ( Boris Zentner ) - const char *GeoIP_country_code_by_addr_v6 (GeoIP* gi, const char *addr); - const char *GeoIP_country_code_by_name_v6 (GeoIP* gi, const char *host); - const char *GeoIP_country_code3_by_addr_v6 (GeoIP* gi, const char *addr); - const char *GeoIP_country_code3_by_name_v6 (GeoIP* gi, const char *host); - const char *GeoIP_country_name_by_addr_v6 (GeoIP* gi, const char *addr); - const char *GeoIP_country_name_by_name_v6 (GeoIP* gi, const char *host); - * Make sure that GeoIP_*_v6 functions refuse GEOIP_PROXY_EDITION and - GEOIP_NETSPEED_EDITION databases ( Boris Zentner ) - * Update libGeoIP/regionName.c with FIPS codes from 20090723 ( Boris Zentner ) - * Fix geoipupdate's -v option to not change the license filename ( Thom May ) - * Fix geoipupdate's exit code ( Thom May ) - * Add support for ASNUM_EDITION ( Boris Zentner ) - * Fix -i output for larger values, sign issue ( Boris Zentner ) - * Add -i flag for more information on netmask, range_by_ip and the current network range ( Boris Zentner ) - * Add support for DOMAIN_EDITION database type ( Boris Zentner ) - * Fix apps/geoipupdate-pureperl.pl output layer on W32 ( Boris Zentner ) -1.4.6 2009-02-25 - * Fix geoipupdate's my_printf function ( Boris Zentner ) - * Fix typo in apps/geoipupdate-pureperl.pl replace PerlIO::Gzip with PerlIO::gzip ( Boris Zentner ) - * Update region codes in libGeoIP/regionName.c ( Boris Zentner ) - * Fix regioncode/generate_regionName.pl to handle regioncodes with ',' correct ( Boris Zentner ) - * Update fips codes 20090201 ( Boris Zentner ) - * Fix unicode builds on WIN32 and eliminate some warnings ( Stu Redman ) - * Fix sign error in _iso_8859_1__utf8 for PPC64 ( Boris Zentner ) - * Change WIN32 to _WIN32, since _WIN32 is defined by default. _WIN32 is also defined for WIN64 machines ( Boris Zentner ) - ! Remove the WSAStartup call from GeoIP_open. All Applications need to call WSAStartup and WSACleanup to initialize the Windows Socket library. Before they use any of the GeoIP_*_by_name functions. ( Boris Zentner ) - * geoiplookup and test-geoip-* output N/A instead of (null) ( Boris Zentner ) - * Silence various warnings. ( Boris Zentner ) - * Add more timezone region's for Australia - * Fix possible segfault in apps/geoiplookup with null pointers in non gnu printf implementations for example solaris ( Boris Zentner ) - * Add README.OSX to build fat binaries easy ( Boris Zentner ) - * Silence vasprintf warning via AC_GNU_SOURCE ( Boris Zentner ) - * Add several Makefiles to build a static GeoIP.lib for w32 ( Stanislaw Pusep and Randy Kobes ) - * Silence signedness warnings ( Peter Volkov ) - * Remove --with-city configure option. ( Boris Zentner ) - * Remove configure's --with-dbdir option. Use the similar --datadir instead ( Peter Volkov ) - * Various autotools improvements and cleanups. Including parallel - build fix ( Peter Volkov ) - * Fix libGeoIP/timeZone.c ( Martin Haller ) - * Fix timezone/generate_timeZone.pl ( Boris Zenter ) - * Sync FIPS codes again Jan 14th, 2009 ( Boris Zentner ) - * Fix CA,NL regioncode. ( Boris Zentner ) - * Change logic in generate_regionName.pl and GeoIP_region_name_by_code to handle any mixture of two letter fips codes matching [A-Z0-9]{2} the change allow GZ and WE region codes ( Boris Zentner ) - * Sync regionName.c with http://www.maxmind.com/app/fips10_4 from Dec 17th, 2008 ( Boris Zentner ) - * Fix _GeoIP_lookupaddress for 64bit big endian systems like ppc64 ( Peter Volkov ) - * Add proper WIN32/64 support ( Gerald Combs ) - * Escape - in all manpages ( Patrick Matthaei ) - * Add manpage for geoiplookup6 ( Boris Zentner ) - * Fix -d command line option ( Klaus Heinz ) - * GeoIPUpdate.c use vasprintf if avail, otherwise try vsnprintf and sprintf ( Boris Zentner ) - * avoid pre/postincrement and assignment on the same variable ( Boris Zentner ) -1.4.5 2008-09-16 - * metro_code replace the depreciated dma_code field ( Boris Zentner ) - * Add new function GeoIP_range_by_ip_delete - r = GeoIP_range_by_ip(gi, '24.24.24.24'); - ... - GeoIP_range_by_ip_delete(r); ( Boris Zentner ) - * Fix small memoryleak and wrap around in GeoIP_range_by_ip ( Boris Zentner ) - * CHECK_CACHE stat the database file not faster than once a second anymore ( Patrick McManus ) - * Fixed a typo in the geoipupdate(1) manpage and also an non-existent path on Debian (Patrick Matthäi) - * Fixes two little format errors (hyphen used as minus sign) in both manpages (Patrick Matthäi) - * Sync regionName.c with a recent fips code list ( Boris Zentner ) - * Fix segfault when open failed for a custom file (-f) ( Boris Zentner ) - * Fix sync geoiplookup's man page with the code ( Klaus Heinz ) - * remove unused code from GeoIP_country_name_by_addr and GeoIP_country_code3_by_addr ( Boris Zentner ) - * Fix geoiplookup and geoiplookup6 to distinguish between failed namelookups and unknown ips ( Boris Zentner ) - * add geoiplookup6 that can handle the new database type GEOIP_COUNTRY_EDITION_V6 ( Boris Zentner ) - * add new functions to handle ipv6 - - GEOIP_API const char *GeoIP_country_name_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); - GEOIP_API const char *GeoIP_country_code_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); - GEOIP_API const char *GeoIP_country_code3_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); - GEOIP_API char *GeoIP_org_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); - GEOIP_API char *GeoIP_org_by_addr_v6 (GeoIP* gi, const char *addr); - GEOIP_API char *GeoIP_org_by_name_v6 (GeoIP* gi, const char *name); - GEOIP_API int GeoIP_id_by_addr_v6 (GeoIP* gi, const char *addr); - GEOIP_API int GeoIP_id_by_name_v6 (GeoIP* gi, const char *host); - GEOIP_API int GeoIP_id_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); - GEOIP_API GeoIPRegion * GeoIP_region_by_addr_v6 (GeoIP* gi, const char *addr); - GEOIP_API GeoIPRegion * GeoIP_region_by_name_v6 (GeoIP* gi, const char *host); - GEOIP_API GeoIPRegion * GeoIP_region_by_ipnum_v6 (GeoIP *gi, geoipv6_t ipnum); - GEOIP_API void GeoIP_assign_region_by_inetaddr_v6(GeoIP* gi, geoipv6_t inetaddr, GeoIPRegion *gir); - GEOIP_API char *GeoIP_name_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); - GEOIP_API char *GeoIP_name_by_addr_v6 (GeoIP* gi, const char *addr); - GEOIP_API char *GeoIP_name_by_name_v6 (GeoIP* gi, const char *name); - - # allowed input for addr - 2001:4860:0:1001::68 - ::85.8.93.71 - ::1 - ::5508::5d47 - ::ffff:5508::5d47 - - # allowed input for host - ipv6.google.com - 2001:4860:0:1001::68 - ::85.8.93.71 - ::1 - ::5508::5d47 - ::ffff:5508::5d47 - ( Boris Zentner ) - * Fix geoiplookup usage string ( add -d -f ) ( Boris Zentner ) - * Added GeoIP_range_by_ip, returns the start and end IP address for the range containing the IP address. - This range has a constant value in the GeoIP database. - * Add geoipupdate-pureperl.pl a alternative geoipupdate version. with Proxy Server support via via the "http_proxy" environment variable. Easy to customize. ( Boris Zentner ) - * Add WIN64 since WIN32 is not defined on WIN64 Systems ( Boris Zentner ) - * Fix WIN32 compilation by encircle all MMAP functions with #ifdef WIN32 #endif pairs. MMAP is not avail in W32 ( Boris Zentner ) - * Update timezone/generate_timeZone.pl ( Boris Zentner ) - * Update libGeoIP/timeZone.c ( Boris Zentner ) - * Added GeoIP_printf and GeoIP_fprintf as a experimental feature to - libGeoIPUpdate. ( Boris Zentner, Andrew Droffner ) - * Added cast in _iso_8859_1__utf8 function to fix NetWare/Win32 compilation issue (Guenter Knauf) - * Add HTTP Proxy Server support for geoipupdate via the "http_proxy" - environment variable. - ie: export http_proxy="http://proxy-hostname:port" - ( Andrew Droffner, Derek Nicol ) - * Notice, that __YOU__ need to free the results of - - GeoIP_database_info - GeoIP_name_by_ipnum - GeoIP_name_by_addr - GeoIP_name_by_name - GeoIP_org_by_ipnum - GeoIP_org_by_addr - GeoIP_org_by_name - - not libgeoip - ( Boris Zentner, Andrew Cheung ) - * Fixed segfault with geoiplookup, if used with a custom_file database, that - could not be opened. ( Boris Zentner ) - * Add Usage info for options -f and -d in geoipupdate ( Boris Zentner ) - * Fixed segfault with geoipupdate when called with a illformed license file - ( Boris Zentner ) - * Update add more timezones to GeoIP_time_zone_by_country_and_region - ( Boris Zentner ) - * Add array access functions so programs can avoid accessing the - arrays directly which whould break binary compatability (Ludwig Nussel at SUSE) - * Updated README to state API is only thread-safe if GEOIP_CHECK_CACHE is not used - -1.4.4 2008-1-21 - * Updated original geoipupdate to return "Invalid product ID or subscription expired" - * Added BL/Saint Barthelemy, MF/Saint Martin (ISO-3166-1 additions) - * Check for illegal IP strings, return 0 if IP is not well formed IPv4 e.g. 1.2.3.4.5 and 1.2.3 - * Clarified that while core GeoIP library is LGPL, libGeoIPUpdate depends on md5.c and types.h which are GPL. - * speedup the conversion from ipstring to ipnum in _GeoIP_addr_to_num. Doubles the speed of GEOIP_MEMORY_CACHE and GEOIP_MMAP_CACHE - * Added new mmap shared memory caching option, GEOIP_MMAP_CACHE (Peter Shipley, LookSmart) - - mmaps: our maps are shared, but we need only private readonly pages - -1.4.3 2007-8-30 - ! CHANGE with geoiplookup facility: -v flag now returns database info for all databases, not just GeoIP Country - * Added ability to get netmask of network block from last lookup using GeoIP_last_netmask - * Fixed GeoIP_database_info bug with GeoLite City - * Replaced 4 with sizeof(char*) to fix issues with geoipupdate on 64 Bit machines - * Added GeoIP_set_charset function - enables UTF8 output of city name if GEOIP_CHARSET_UTF8 flag is passed - to GeoIP_set_charset - * Fixed segfault issue if calling GeoIP_db_avail before opening a database - * Added continent_code to GeoIP City's record struct (Frank Mather) - -1.4.2 2007-2-8 - * Added -d flag to enable custom path for geoipupdate utility program (Frank Mather) - * Replaced _WIN32 with WIN32 since WIN32 is already set by compilers - * Moved var definitions to top of code, defined size_t (Guenter Knauf) - * Added Makefile.win32, Makefile.netware, get_ver.awk, geoip.ico to EXTRA_DIST in Makefile.am (Guenter Knauf) - -1.4.1 2007-1-2 - * Replaced CS/Serbia and Montenegro with RS/Serbia, removed ZR/Zaire, added ME/Montenegro - * Added AX/Aland Islands, GG/Guernsey, IM/Isle of Man, JE/Jersey (ISO-3166-1 changes) - * Added GeoIP_time_zone_by_country_and_region, to lookup zoneinfo timezone by country and region (Frank Mather) - * Added GeoIP_region_name_by_code, to lookup region name from region code (Frank Mather) - * added -f and -d flags to enable custom paths for geoiplookup utility program (Frank Mather) - * Added benchmarks for GeoIP Region and City in test/benchmark.c (Frank Mather) - * Fixed build issue when using --as-needed flag (Diego 'Flameeyes' Pettenò) - * Add sanity checking for filename returned by MaxMind.com server for geoipupdate filename - (Dean Gaudet, arctic.org) - * Fixed memory leaks under error conditions, buffer overflow using sprintf, - and issue where a corrupted cache file could core dump the file - (Nick Galbreath, Right Media Inc) - -1.4.0 2006-8-7 - * Changed license from GPL to LGPL, so that PHP Extension can be included in PECL (Olivier Hill) - * Rewrote GEOIP_CHECK_CACHE code, fixed numerous bugs - - CheckCache now works if GeoIP file is overwriten by mv command - - Fixed bug where CheckCache kept reloading in GEOIP_STANDARD_MODE - - Fixed segfault issue in GEOIP_MEMORY_CACHE mode - - Fixed garbage data appearing in GEOIP_INDEX_CACHE mode - - Fixed realloc in case realloc returns new memory block (Andre Morozov of Stone Steps) - * Updated geoipupdate to print status messages for each database instead of just last database - * Check that gi is not null before running code in GeoIP_delete - * Fixed alpha-3 codes ordering, replaced TLS,TKM,TUN,TON with TKM,TUN,TON,TLS - * TP/East Timor changed to TL/Timor-Leste, reflecting changes in ISO-3166 - * Added Netware and Windows makefiles (Guenter Knauf) - * Fixed NetWare compiler issue with char block[block_size] declaration (Guenter Knauf) - * Updated geoipupdate example to run weekly - -1.3.17 2006-5-14 - * Fixed headers for Windows/Netware compilation (Guenter Knauf) - * Fixed Received Error -21 (Sanity check database_info string failed) - when running geoipupdate with GeoIP Country when UserId and - productIds were not specified. Bug was introduced in 1.3.15. - -1.3.16 2006-4-17 - * Fixed compliation error in GeoIPUpdate.c - -1.3.15 2006-4-14 - * Updated README documentation - * Updated geoipupdate so that it writes file as it is uncompressed instead - of storing entire GeoIP.dat file in memory (Frank Mather) - * Updated geoiplookup so that it returns GeoIP Domain Name if available - (Frank Mather) - * Updated geoipupdate so that it reports whether databases are updated - in non-verbose mode (Frank Mather) - -1.3.14 2005-9-7 - * Check if byte, ushort, ulong, u16, u32 are defined in configure - script. Fixes compilation issue on FreeBSD systems. - * Check for Big Endian byte order (needed for MD5 code in geoipupdate - to work properly on Mac OS X and other Big Endian processors) - * Fixed GEOIP_CHECK_CACHE mode when used with GEOIP_STANDARD to - only refresh upon file change - * Fixed memory leak when refreshing file in GEOIP_CHECK_CACHE mode - * Updated ltmain.sh to support Debian GNU/k*BSD bug #315425 (Marek Habersack) - * Added lookup functions using IP numeric representation as input (Frank Mather) - * Removed geoipexport - * Replaced Yugoslavia with Serbia and Montenegro - * Updated geoiplookup to only perform country lookup once instead of twice by using GeoIP_id_by_name - -1.3.13 2005-8-1 - * Fixed autoconf weirdness that resulted in libraries being - installed without .so suffix - -1.3.12 2005-7-19 - * Removed -lGeoIP from libGeoIPUpdate_la_LIBADD - fixes compilation error - if GeoIP isn't already installed (Thomas Steudten) - -1.3.11 2005-7-7 - * Fixed gcc warnings and bug. Use int - instead of char for checking the return value of getopt in geoipupdate.c. - Moved the internal functions to GeoIP_internal.h to get rid - of those 'implicit declaration' warnings. (Ludwig Nussel/SUSE) - * Cleaned up name space by prefixing internal functions with - _GeoIP* (Ludwig Nussel/SUSE) - * Memory Leak fix for GeoIP City if fread error - * Added more verbose error messages for geoipupdate (Frank Mather) - * Added check for zlib.h to configure.in - -1.3.10 2005-4-17 - * Added types.h to Makefile.am - fixes compilation error - -1.3.9 2005-4-14 - * fixed bug with GEOIP_INDEX_CACHE (Frank Mather) - * fixed segfault issue if GeoIP.dat not found (Frank Mather) - * Updated MD5 checksum code to use GnuPG code which works - on 64bit machines (Frank Mather) - * Fixed memory leak in test-geoip-isp.c and test-geoip-org.c - * Added support for GeoIP Domain Names in geoipupdate - -1.3.8 2004-11-7 - * Updated geoipupdate to report invalid userID and productID errors - * Check if gethostbyname_r is version that returns int or is other version - - should fix compile errors on Solaris and FreeBSD - * Updated URL to get license key, userId, and product Ids in conf/GeoIP.conf.default - * Updated test case, removed www.asahi.com - * Added support for GEOIP_INDEX_CACHE - which just caches - the most frequently access index portion of the database, resulting - in faster lookups than GEOIP_STANDARD, but less memory usage than - GEOIP_MEMORY_CACHE (Frank Mather) - -1.3.7 2004-10-5 - * Updated test case, removed www.bundesregierung.de added www.asahi.com - -1.3.6 2004-8-8 - * Check for gethostbyname_r support in configure (Mac OS X doesn't support gethostbyname_r) - * Made GeoIP City code thread safe - * Fixed bug with geoipupdate reading in product ids - * Added support for GeoIP Netspeed geoipupdate - * Fix memleak in lookupaddress (Ludwig Nussel/SUSE) - * Add prototype for _full_path_to to make 64bit clean - (Ludwig Nussel/SUSE) - * Add return values to test programs (Ludwig Nussel/SUSE) - -1.3.5 2004-7-5 - * Added more documentation to README file - * Made GEOIP_CHECK_CACHE work with GEOIP_STANDARD mode - reloads filehandle - in case file changes. - * Added GeoIP_country_code_by_ipnum and GeoIP_id_by_ipnum to use - existing ulong IP Address in numeric form instead of having to - convert it to string (Boris Hajduk) - * Made code thread safe by replacing gethostbyname with gethostbyname_r - -1.3.4 2004-6-4 - * Fixed bug where *.gz file(s) didn't get removed after geoipupdate - -1.3.3 2004-6-2 - * Added support for NetSpeed lookup to geoiplookup - * inet_addr patch for 64 bit systems (Thomas Steudten) - * Added Support for automated downloads of GeoIP Region, City, ISP and Organization databases (Frank Mather) - * INADDR_NONE Patch for Solaris 9 (John Young) - -1.3.2 2004-4-20 - * Added support for Maxmind NetSpeed - -MinGW patch from Stanislaw Pusep - -I was re-compiling Geolizer (http://sysd.org/log.php#glzr) on Win32 so I firstly needed to put up-to-date Win32 compatibility of libGeoIP itself. Fortunately MinGW plataform evolved a lot since last time I used it to compile libGeoIP. I'm sending you the patch with changes required for libGeoIP to work on both Win32 and UN*X. UN*X behavior is unaffected. Now, detailed explanation of what I did at all: -1) Made correct header imports for both Win32 and UN*X. UN*X imports netdb.h & netinet/in.h and Win32 imports windows.h & winsock.h -2) Win32 gethostbyname() is only able to resolve hostnames, it can't convert "127.0.0.1" string to 32-bit IP address. Thus I added lookupaddress() function that safely resolves any string to IP address and replaced all gethostbyname() calls by it. -3) Database files were referenced by pre-compiled static strings. I malloc()ed buffers for file names so they can be changed "on fly". Thus, on Win32 version GeoIP.dat & other files are being seeked in the same directory as executable file or library. -4) Added README.MinGW file with brief explanation on how to get GeoIP working under MinGW system. - -1.3.1 2003-11-11 - * Check for stdint.h in autoconf (Sean Chittenden) - * prevent the geoipupdate man page from trying to install itself directly in the system directory (Gyepi Sam) - -1.3.0 2003-09-29 - * Fixed includes to compile on Windows (Fabrice Colin) - * Removed the _addr_to_num() calls from GeoIP_*_by_name() - * _seek_record() optimizations (Maurice Cinquini) -  1) Use a single buf ptr inside the loops. -     Set to the stack buffer or the cached memory the start of the function. -  2) Unroll the i=0,1 loop to allow constant folding. -  3) Unroll the j loop for the common case of j = STANDARD_RECORD_LENGTH -     (I've already done the above changes see attached function.) -     With gcc -O2 calculating x[0] and x[1] for STANDARD_RECORD_LENGTH now -     only takes 15 (was > 100) i80x86 instructions with 6 byte accesses of RAM. 4) only calculate x[0], x[1] when needed, may be a bigger win - than the above since all the other optimizations above only reduced - CPU instructions operating on CPU cached RAM. - ! IMPORTANT API Change: Changed GeoIPRegion to have region in structure. Saves space and a malloc. - Since GeoIPRegion.region is no longer a pointer but an in-structure - array so test the first byte of region == 0 rather testing if the region - pointer is NULL. (Maurice Cinquini) - * Added GeoIP_assign_region_by_inetaddr which doesn't do any mallocs and made all other region APIs go thru it (Maurice Cinquini) - * Replaced _h_addr_to_num() with ntohl() and removed _h_addr_to_num() (Maurice Cinquini) - * Fixed bug when IP address not found in region rev1 database (Jason Linhart) - * Added added extern "C" to GeoIPCity.h fixes problems when included in C++ library - -1.2.2 2003-08-10 - * Added support for GeoIP ISP Edition identifier - * Fixed bug in GeoIP_database_info (Jason Linhart) - * Added support for GeoIP AS Number Edition - ! renamed GeoIP_org_by_* functions to GeoIP_name_by_* to reduce confusion - since these functions are used by GeoIP ISP and GeoIP ASNum as well - as GeoIP Organization - * Added support for GeoIP Proxy Edition - ! renamed GeoIP_country_id_by_* functions to GeoIP_id_by_* - -1.2.1 2003-07-12 - * Added GeoIP_record_id_by_addr and GeoIP_next_record functions - * Added support for new GeoIP Region format, including Canadian Provinces - -1.2.0 2003-04-26 - * Added support for GeoIP City format revision 1, including dma code and area code - * geoiplookup returns results from GeoIP Region, City, ISP and Organization databases - * Standardized location for GeoIP Region, City, ISP and Organization databases - * Added GeoIP_open_type to open database from default location for other dbs besides country - * Added check to make sure that the appropriate database is loaded for each lookup method - * Updated update code to check for first 12 characters of license key - * Added GeoIP_country_continent array to lookup continent by country ID - -1.1.9 2003-03-10 - * merged windows patch into main code base (Kenneth R. Robinette) - * Changed const int to #define for windows compatibility - -1.1.8 2003-03-04 - * Fixed bug with city database introduced in 1.1.6 - -1.1.7 2003-03-04 - * Fixed bug introduced in 1.1.6 when run in GEOIP_STANDARD mode - * Added test to test GEOIP_STANDARD - -1.1.6 2003-03-03 - * Added spec for building RPMs (Ryan Weaver) - * Added support for 4byte records for Organization database - * Changed Taiwan, Province of China to Taiwan - -1.1.5 2003-02-10 - * Added support for GeoIP Organization database - -1.1.4 2002-12-30 - * Cast number to int in _num_to_addr in geoipexport (Ralf S. Engelschall) - * Removed printf debug statements from geoipexport - * correct library build ordering (Ralf S. Engelschall) - * ulong -> unsigned long (Sean Chittenden) - -1.1.3 2002-12-24 - * Added GeoIPUpdate.h to EXTRA_DISTS - * Compile fixes for Solaris, FreeBSD (Michael McClennen, Corris Randall) - * Handle NULL in printf in test-geoip-region - -1.1.2 2002-12-16 - * Added support for postal codes - * Added geoipexport, program to export bit binary file to - binary tree format and csv format - * Split update code into separate library, GeoIPUpdate.la - * Allow passing NULL callback to GeoIP_update_database function - (Sean Chittenden) - * Added geoipexport program, exports to CSV file - * Added GeoIP_database_edition method - * Changed DATADIR to GEOIPDATADIR - -1.1.1 2002-11-07 - * Fixed segfault issue with GeoIPRegion_delete - * Handle test failures where lookup returns NULL more gracefully - -1.1.0 2002-11-06 - * Perform sanity checking before installing datebase using geoipupdate - * Removed file locking, since we install file by renaming instead of writing to it. - * Fixed geoipupdate to check for NULL return value - * Added constants for different editions - * Added O1 code for "Other country", used in per-country city editions - * fixed multi-line string literals warning in test-geoip.c - * Use enum constants for GeoIP_update_database values - * Added GEOIP_CHECK_CACHE option (not working yet) - -1.0.10 2002-10-28 - * IMPORTANT API Change - Return NULL instead of '--' and 'N/A' - Be sure to check the return value for NULL to avoid segmentation faults!!!! - * Added callback to print messages from GeoIP_update_database - * Moved GeoIPConfFile to geoipupdate.c - * Changed databaseSegments to unsigned int (Chris Gibbs) - * Fixed compiler warnings (Chris Gibbs) - * API Change - GeoIPRegion region member set to NULL when no region available - * Change short int to int (Chris Gibbs) - * Added write/read file locking for GeoIPUpdate.c/GeoIP.c - -1.0.9 2002-10-16 - * removed -ansi from Makefile.am to avoid compile error on Solaris 8 - * Compile fix for FreeBSD Stable (Kimura Fuyuki) - -1.0.8 2002-10-05 - * Included header required for *BSD (Akinori Musha) - -1.0.7 2002-10-05 - * Fixed compilation error with GeoIPUpdate.c - -1.0.6 2002-10-04 - * Moved update code into separate file - * Added md5 checksums to update code - * Fixed memory leak when running geoiplookup -v - * Moved const RECORD_LENGTH to #define RECORD_LENGTH for Windows compatibility - (Randy Kobes) - * Cleaned up GeoIP_new code - -1.0.5 2002-09-23 - * Supports GeoIP Regional Edition - * Macau is now "Macao" per ISO 3166-1 change - * Romania "ROM" is now "ROU" per ISO 3166-1 change - * Added #define for memcpy -> BSD's bcopy (Chris Gibbs) - * Removed "private" functions from GeoIP.h - -1.0.4 2002-08-27 - * rewrote _seek_country to use loop instead of recursion for faster performance - * Removed "orphan" nodes from demo database resulting in smaller size (Jason Linhart) - * Moved changes for building windows DLL into separate patch - * Fixed segfaults when passed malformed IP addresses - -1.0.3 2002-08-26 - * Added more changes for windows compatibility - (Stanislaw Pusep) - * Added benchmark program - -1.0.2 2002-08-21 - * Open database using "rb" for windows compatibility - (Stanislaw Pusep) - * Removed superfluous inet_ntop command (Stanislaw Pusep) - -1.0.1 2002-08-20 - * Fixed bug with resolving hostnames - * More fixes for compiler warnings (Chris Gibbs) - * Changed int to unsigned int in _is_ipaddr (Chris Gibbs) - -1.0.0 2002-08-12 - * Changed license to GPL - * Don't perform Reverse DNS lookups on IP addresses - * Only include getopt.h on Linux (OpenPKG patch) - * Avoid the_license_key_str warning (OpenPKG patch) - * Added license for March 2002 database - -0.3.0 2002-08-04 - * Added support for 'A2', Satellite Providers - -0.2.8 2002-07-30 - * Handle malformed input gracefully - * Added section to README on Solaris workarounds - * Added geoipupdate man page - -0.2.7 2002-07-27 - * Added section to README on automatic updates - * link to socket library on solaris - -0.2.6 2002-07-25 - * optimized GeoIP_open (Chris Gibbs) - * check for partial file read in GeoIP_open (Chris Gibbs) - * optimized _addr_to_num() (Chris Gibbs) - * changed write and read to send and recv for sockets - * Only install GeoIP.conf and GeoIP.dat if not already installed - -0.2.5 2002-07-22 - * Added verbose option to GeoIP_update_database - -0.2.4 2002-07-22 - * Fix for GeoIP_update_database - -0.2.3 2002-07-22 - * Fixes for FreeBSD - * All calls to malloc are checked for NULL pointer (Chris Gibbs) - * Fixed spelling of "Kazakhstan" (Chris Gibbs) - * Initialize cache_buf to NULL (Chris Gibbs) - * More memory leak fixes (Chris Gibbs) - -0.2.2 2002-07-18 - * Added update database function - * Fixed memory leak in GeoIP_new (Chris Gibbs) - -0.2.1 2002-07-03 - * Added support for anonymous proxies - -0.2.0 2002-06-23 - * Added new memory caching option for improved performance - -0.1.7 2002-05-29 - * Only add -lnsl for systems that support libnsl - * Added decl for 3 letter country code array to GeoIP.h - -0.1.6 2002-05-25 - * Added 3 letter country code - -0.1.5 2002-05-23 - * Added -lnsl fixed compile errors - -0.1.4 2002-05-11 - * Fixed bugs in demo March 2002 database - -0.1.3 2002-04-21 - * Fixed bug related to signed int (Brian Grossman) - * Better error handling when hostname not found - * Fixed bug when netmask=32 for netblock - -0.1.2 2002-04-20 - * Added two new functions, GeoIP_country_id_by_addr - and GeoIP_country_id_by_name. - * Made GeoIP_country_code and GeoIP_country_name - viewable outside of library, to be with with - GeoIP_country_id_by_* functions. - -0.1.1 2002-04-07 - * GeoIP.h is now installed to includedir - * constructor and destructor are now provided by - GeoIP_new, GeoIP_open, and GeoIP_delete - -0.1.0 2002-04-07 - * Initial release diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/GeoIP.spec.in b/Src/Plugins/DSP/sc_serv3/GeoIP/GeoIP.spec.in deleted file mode 100644 index 072cd1f5..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/GeoIP.spec.in +++ /dev/null @@ -1,80 +0,0 @@ -Name: @PACKAGE@ -Version: @VERSION@ -Summary: GeoIP is a C library finds the location of an IP address. -Release: 1 -Group: System Environment/Libraries -URL: http://www.maxmind.com/app/c -Vendor: MaxMind LLC -Source0: http://www.maxmind.com/download/geoip/api/c/GeoIP-%{version}.tar.gz -License: GPL -BuildRoot: %{_tmppath}/%{name}-%{version}-root - -%description -GeoIP is a C library that enables the user to find geographical and -network information of an IP address. -Included is a free GeoLite Country database -that is updated at the beginning of every month. -To download the latest free GeoLite Country database, go to: -http://www.maxmind.com/app/geoip_country - -There is also a free city-level geolocation database, GeoLite City, -available from: -http://www.maxmind.com/app/geolitecity - -%package devel -Summary: GeoIP headers, libraries -Group: Development/Libraries -Requires: %name = %{version} - -%description devel -This package contain the devel files for GeoIP. - -%prep -%setup -q - -%build -%configure -make -make check - -%install -[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT -%makeinstall -# Fixup permissions on shared libraries so that findreqs will work right. -chmod 755 $RPM_BUILD_ROOT/%{_libdir}/* - -%clean -[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - -%files -%defattr(-,root,root) -%doc AUTHORS COPYING ChangeLog README TODO -%attr(0755,root,root) %{_libdir}/*.so.*.* -%{_bindir}/* -%{_sysconfdir}/* -%dir %{_datadir}/GeoIP -%{_datadir}/GeoIP/* -%{_libdir}/*.so -%{_mandir}/*/* - -%files devel -%{_includedir}/* -%{_libdir}/*.a -%{_libdir}/*.la - -%changelog -* Fri Apr 14 2006 Thomas Mather -- Updated description to reference free GeoLite City database - -* Thu Jul 7 2005 Thomas Mather -- Updated description to reflect monthly updates for free country database. - -* Mon Sep 8 2003 Dr. Peter Bieringer -- Fix for RHL 9, created a new devel package definition. - -* Thu Feb 27 2003 Ryan Weaver -- Initial RPM Build diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/GeoIPWinDLL.patch b/Src/Plugins/DSP/sc_serv3/GeoIP/GeoIPWinDLL.patch deleted file mode 100644 index 98119fc2..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/GeoIPWinDLL.patch +++ /dev/null @@ -1,183 +0,0 @@ -Index: GeoIP.c -=================================================================== -RCS file: /home/maxmind/geoip/c/libGeoIP/GeoIP.c,v -retrieving revision 1.32 -retrieving revision 1.33 -diff -u -r1.32 -r1.33 ---- GeoIP.c 25 Aug 2002 22:42:48 -0000 1.32 -+++ GeoIP.c 27 Aug 2002 06:50:02 -0000 1.33 -@@ -23,16 +23,24 @@ - #include - #include - #include -+#ifndef _WIN32 - #include -+#endif /* _WIN32 */ - #include - #include /* for fstat */ - #include /* for fstat */ - #include "zlib.h" - #include "time.h" - -+#ifndef _WIN32 -+#include - #include - #include - #include -+#else -+#include -+#include -+#endif /* _WIN32 */ - - #define COUNTRY_BEGIN 16776960; - const int RECORD_LENGTH = 3; -@@ -57,9 +65,66 @@ - const char *GeoIPUpdateHost = "updates.maxmind.com"; - const char *GeoIPHTTPRequest = "GET /app/update?license_key=%s HTTP/1.0\nHost: updates.maxmind.com\n\n"; - -+#ifdef _WIN32 -+char * _dat_in_module_path () { -+ HMODULE GeoIPdll; -+ struct _stat st; -+ int i; -+ char * buf; -+ -+ buf = (char *) malloc(MAX_PATH); -+ -+ GeoIPdll = GetModuleHandle("GeoIP.dll"); -+ if (!GeoIPdll) -+ { -+ GeoIPdll = GetModuleHandle(NULL); -+ if (!GeoIPdll) -+ return NULL; -+ } -+ GetModuleFileName(GeoIPdll, buf, MAX_PATH); -+ for (i = strlen(buf); (i >= 0) && (buf[i] != '\\'); i--); -+ if (i) -+ { -+ buf[i] = '\0'; -+ strcat(buf, "\\"); -+ strcat(buf, GeoIPDBFileName); -+ if (_stat(buf, &st) == 0) -+ return buf; -+ } -+ -+ free(buf); -+ return NULL; -+} -+ -+char * _dat_path_in_regkey () { -+ DWORD lpdwDisposition, type, size = MAX_PATH; -+ HKEY hkGeoIP; -+ char * buf, * filename; -+ -+ buf = (char *) malloc(MAX_PATH); -+ filename = (char *) malloc(MAX_PATH); -+ -+ if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\MaxMind\\GeoIP", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkGeoIP, &lpdwDisposition) != ERROR_SUCCESS) -+ return NULL; -+ if (RegQueryValueEx(hkGeoIP, "DATADIR", 0, &type, buf, &size) != ERROR_SUCCESS) -+ strcpy(buf, "%SystemRoot%\\SYSTEM32"); -+ if (RegSetValueEx(hkGeoIP, "DATADIR", 0, REG_EXPAND_SZ, buf, strlen(buf)) != ERROR_SUCCESS) -+ return NULL; -+ ExpandEnvironmentStrings(buf, filename, MAX_PATH); -+ -+ free(buf); -+ strcat(filename, "\\"); -+ strcat(filename, GeoIPDBFileName); -+ -+ return filename; -+} -+#endif /* _WIN32 */ -+ - GeoIP* GeoIP_new (int flags) { - char * filename; - GeoIP * gi; -+ -+#ifndef _WIN32 - filename = malloc(sizeof(char) * (strlen(DATADIR)+strlen(GeoIPDBFileName)+2)); - if (filename == NULL) - return NULL; -@@ -67,6 +132,17 @@ - strcat(filename, DATADIR); - strcat(filename, "/"); - strcat(filename, GeoIPDBFileName); -+#else -+ filename = _dat_in_module_path(); -+ if (filename == NULL) -+ filename = _dat_path_in_regkey(); -+ if (filename == NULL) -+ { -+ fprintf(stderr,"Unable to query registry for database location\n"); -+ return NULL; -+ } -+#endif /* _WIN32 */ -+ - gi = GeoIP_open (filename, flags); - free(filename); - return gi; -@@ -96,7 +172,7 @@ - } - gi->cache = (unsigned char *) malloc(sizeof(unsigned char) * buf.st_size); - if (gi->cache != NULL) { -- if (fread(gi->cache, sizeof(unsigned char), buf.st_size, gi->GeoIPDatabase) != buf.st_size) { -+ if (fread(gi->cache, sizeof(unsigned char), buf.st_size, gi->GeoIPDatabase) != (unsigned) buf.st_size) { - fprintf(stderr,"Error reading file %s\n",filename); - free(gi->cache); - free(gi); -Index: GeoIP.h -=================================================================== -RCS file: /home/maxmind/geoip/c/libGeoIP/GeoIP.h,v -retrieving revision 1.19 -retrieving revision 1.20 -diff -u -r1.19 -r1.20 ---- GeoIP.h 20 Aug 2002 00:52:00 -0000 1.19 -+++ GeoIP.h 27 Aug 2002 06:50:02 -0000 1.20 -@@ -45,25 +45,31 @@ - extern const char * GeoIP_country_name[246]; - extern const char * GeoIPConfFile; - --GeoIP* GeoIP_new(int flags); --GeoIP* GeoIP_open(char * filename, int flags); --void GeoIP_delete(GeoIP* gi); --const char *GeoIP_country_code_by_addr (GeoIP* gi, const char *addr); --const char *GeoIP_country_code_by_name (GeoIP* gi, const char *host); --const char *GeoIP_country_code3_by_addr (GeoIP* gi, const char *addr); --const char *GeoIP_country_code3_by_name (GeoIP* gi, const char *host); --const char *GeoIP_country_name_by_addr (GeoIP* gi, const char *addr); --const char *GeoIP_country_name_by_name (GeoIP* gi, const char *host); --short int GeoIP_country_id_by_addr (GeoIP* gi, const char *addr); --short int GeoIP_country_id_by_name (GeoIP* gi, const char *host); -+#ifdef _WIN32 -+#define GEOIP_API __declspec(dllexport) -+#else -+#define GEOIP_API -+#endif /* _WIN32 */ - --char *GeoIP_database_info (GeoIP* gi); --short int GeoIP_update_database (GeoIP* gi, char * license_key, int verbose); -+GEOIP_API GeoIP* GeoIP_new(int flags); -+GEOIP_API GeoIP* GeoIP_open(char * filename, int flags); -+GEOIP_API void GeoIP_delete(GeoIP* gi); -+GEOIP_API const char *GeoIP_country_code_by_addr (GeoIP* gi, const char *addr); -+GEOIP_API const char *GeoIP_country_code_by_name (GeoIP* gi, const char *host); -+GEOIP_API const char *GeoIP_country_code3_by_addr (GeoIP* gi, const char *addr); -+GEOIP_API const char *GeoIP_country_code3_by_name (GeoIP* gi, const char *host); -+GEOIP_API const char *GeoIP_country_name_by_addr (GeoIP* gi, const char *addr); -+GEOIP_API const char *GeoIP_country_name_by_name (GeoIP* gi, const char *host); -+GEOIP_API short int GeoIP_country_id_by_addr (GeoIP* gi, const char *addr); -+GEOIP_API short int GeoIP_country_id_by_name (GeoIP* gi, const char *host); - --int _seek_country (GeoIP* gi, const int offset, unsigned long ipnum, int depth); --unsigned long _addr_to_num (const char *addr); --unsigned long _h_addr_to_num (unsigned char *addr); --short int _is_ipaddr (const char *name); -+GEOIP_API char *GeoIP_database_info (GeoIP* gi); -+GEOIP_API short int GeoIP_update_database (GeoIP* gi, char * license_key, int verbose); -+ -+GEOIP_API int _seek_country (GeoIP* gi, const int offset, unsigned long ipnum, int depth); -+GEOIP_API unsigned long _addr_to_num (const char *addr); -+GEOIP_API unsigned long _h_addr_to_num (unsigned char *addr); - - #ifdef __cplusplus - } diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/INSTALL b/Src/Plugins/DSP/sc_serv3/GeoIP/INSTALL deleted file mode 100644 index 7d1c323b..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/INSTALL +++ /dev/null @@ -1,365 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006, 2007, 2008, 2009 Free Software Foundation, Inc. - - Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. This file is offered as-is, -without warranty of any kind. - -Basic Installation -================== - - Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for -instructions specific to this package. Some packages provide this -`INSTALL' file but do not implement all of the features documented -below. The lack of an optional feature in a given package is not -necessarily a bug. More recommendations for GNU packages can be found -in *note Makefile Conventions: (standards)Makefile Conventions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. - - The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. - - Running `configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package, generally using the just-built uninstalled binaries. - - 4. Type `make install' to install the programs and any data files and - documentation. When installing into a prefix owned by root, it is - recommended that the package be configured and built as a regular - user, and only the `make install' phase executed with root - privileges. - - 5. Optionally, type `make installcheck' to repeat any self-tests, but - this time using the binaries in their final installed location. - This target does not install anything. Running this target as a - regular user, particularly if the prior `make install' required - root privileges, verifies that the installation completed - correctly. - - 6. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - - 7. Often, you can also type `make uninstall' to remove the installed - files again. In practice, not all packages have tested that - uninstallation works correctly, even though it is required by the - GNU Coding Standards. - - 8. Some packages, particularly those that use Automake, provide `make - distcheck', which can by used by developers to test that all other - targets like `make install' and `make uninstall' work correctly. - This target is generally not run by end users. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. Run `./configure --help' -for details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. This -is known as a "VPATH" build. - - With a non-GNU `make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before -reconfiguring for another architecture. - - On MacOS X 10.5 and later systems, you can create libraries and -executables that work on multiple system types--known as "fat" or -"universal" binaries--by specifying multiple `-arch' options to the -compiler but only a single `-arch' option to the preprocessor. Like -this: - - ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CPP="gcc -E" CXXCPP="g++ -E" - - This is not guaranteed to produce working output in all cases, you -may have to build one architecture at a time and combine the results -using the `lipo' tool if you have problems. - -Installation Names -================== - - By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX', where PREFIX must be an -absolute file name. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. In general, the -default for these options is expressed in terms of `${prefix}', so that -specifying just `--prefix' will affect all of the other directory -specifications that were not explicitly provided. - - The most portable way to affect installation locations is to pass the -correct locations to `configure'; however, many packages provide one or -both of the following shortcuts of passing variable assignments to the -`make install' command line to change installation locations without -having to reconfigure or recompile. - - The first method involves providing an override variable for each -affected directory. For example, `make install -prefix=/alternate/directory' will choose an alternate location for all -directory configuration variables that were expressed in terms of -`${prefix}'. Any directories that were specified during `configure', -but not in terms of `${prefix}', must each be overridden at install -time for the entire installation to be relocated. The approach of -makefile variable overrides for each directory variable is required by -the GNU Coding Standards, and ideally causes no recompilation. -However, some platforms have known limitations with the semantics of -shared libraries that end up requiring recompilation when using this -method, particularly noticeable in packages that use GNU Libtool. - - The second method involves providing the `DESTDIR' variable. For -example, `make install DESTDIR=/alternate/directory' will prepend -`/alternate/directory' before all installation names. The approach of -`DESTDIR' overrides is not required by the GNU Coding Standards, and -does not work on platforms that have drive letters. On the other hand, -it does better at avoiding recompilation issues, and works well even -when some directory options were not specified in terms of `${prefix}' -at `configure' time. - -Optional Features -================= - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - - Some packages offer the ability to configure how verbose the -execution of `make' will be. For these packages, running `./configure ---enable-silent-rules' sets the default to minimal output, which can be -overridden with `make V=1'; while running `./configure ---disable-silent-rules' sets the default to verbose, which can be -overridden with `make V=0'. - -Particular systems -================== - - On HP-UX, the default C compiler is not ANSI C compatible. If GNU -CC is not installed, it is recommended to use the following options in -order to use an ANSI C compiler: - - ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" - -and if that doesn't work, install pre-built binaries of GCC for HP-UX. - - On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot -parse its `' header file. The option `-nodtk' can be used as -a workaround. If GNU CC is not installed, it is therefore recommended -to try - - ./configure CC="cc" - -and if that doesn't work, try - - ./configure CC="cc -nodtk" - - On Solaris, don't put `/usr/ucb' early in your `PATH'. This -directory contains several dysfunctional programs; working variants of -these programs are available in `/usr/bin'. So, if you need `/usr/ucb' -in your `PATH', put it _after_ `/usr/bin'. - - On Haiku, software installed for all users goes in `/boot/common', -not `/usr/local'. It is recommended to use the following options: - - ./configure --prefix=/boot/common - -Specifying the System Type -========================== - - There may be some features `configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, `configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS - KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - - Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). - -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf bug. Until the bug is fixed you can use this workaround: - - CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash - -`configure' Invocation -====================== - - `configure' recognizes the following options to control how it -operates. - -`--help' -`-h' - Print a summary of all of the options to `configure', and exit. - -`--help=short' -`--help=recursive' - Print a summary of the options unique to this package's - `configure', and exit. The `short' variant lists options used - only in the top level, while the `recursive' variant lists options - also present in any nested packages. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--prefix=DIR' - Use DIR as the installation prefix. *note Installation Names:: - for more details, including other options available for fine-tuning - the installation locations. - -`--no-create' -`-n' - Run the configure checks, but stop before creating any output - files. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/Makefile.am b/Src/Plugins/DSP/sc_serv3/GeoIP/Makefile.am deleted file mode 100644 index bd4da3a3..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -INCLUDES = -Wall -ansi - -SUBDIRS = \ - libGeoIP \ - apps \ - conf \ - data \ - test \ - man - -EXTRA_DIST = README.OSX READMEwin32static.txt README.MinGW READMEwin32.txt GeoIPWinDLL.patch TODO bootstrap GeoIP.spec GeoIP.spec.in Makefile.netware Makefile.vc Makefile.win32 get_ver.awk geoip.ico diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/Makefile.in b/Src/Plugins/DSP/sc_serv3/GeoIP/Makefile.in deleted file mode 100644 index c2a5d3f5..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/Makefile.in +++ /dev/null @@ -1,707 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in 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. - -@SET_MAKE@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = . -DIST_COMMON = README $(am__configure_deps) $(srcdir)/GeoIP.spec.in \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ - TODO config.guess config.sub depcomp install-sh ltmain.sh \ - missing -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno config.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = GeoIP.spec -CONFIG_CLEAN_VPATH_FILES = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ - $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ - distdir dist dist-all distcheck -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - { test ! -d "$(distdir)" \ - || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr "$(distdir)"; }; } -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -INCLUDES = -Wall -ansi -SUBDIRS = \ - libGeoIP \ - apps \ - conf \ - data \ - test \ - man - -EXTRA_DIST = README.OSX READMEwin32static.txt README.MinGW READMEwin32.txt GeoIPWinDLL.patch TODO bootstrap GeoIP.spec GeoIP.spec.in Makefile.netware Makefile.vc Makefile.win32 get_ver.awk geoip.ico -all: all-recursive - -.SUFFIXES: -am--refresh: - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ - $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - $(am__cd) $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -$(am__aclocal_m4_deps): -GeoIP.spec: $(top_builddir)/config.status $(srcdir)/GeoIP.spec.in - cd $(top_builddir) && $(SHELL) ./config.status $@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool config.lt - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(am__remove_distdir) - test -d "$(distdir)" || mkdir "$(distdir)" - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done - -test -n "$(am__skip_mode_fix)" \ - || find "$(distdir)" -type d ! -perm -755 \ - -exec chmod u+rwx,go+rx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r "$(distdir)" -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) - -dist-xz: distdir - tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz - $(am__remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ - *.tar.xz*) \ - xz -dc $(distdir).tar.xz | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - test -d $(distdir)/_build || exit 0; \ - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ - && cd "$$am__cwd" \ - || exit 1 - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @$(am__cd) '$(distuninstallcheck_dir)' \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ - install-am install-strip tags-recursive - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am am--refresh check check-am clean clean-generic \ - clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ - dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ - distcheck distclean distclean-generic distclean-libtool \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/Makefile.netware b/Src/Plugins/DSP/sc_serv3/GeoIP/Makefile.netware deleted file mode 100644 index 44a569de..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/Makefile.netware +++ /dev/null @@ -1,301 +0,0 @@ -################################################################### -# -## Makefile for building GeoIP stuff (NetWare version - gnu make) -## To build the binaries you need awk, GNU make and gcc / nlmconv -## or Metrowerks CodeWarrior CommandlineTools. -## Usage: make -f Makefile.netware [all|dist|clean|distclean] -## -## hacked by: Guenter Knauf -# -################################################################### - -# Edit the path below to point to the base of your Novell NDK. -ifndef NDKBASE -NDKBASE = c:/novell -endif - -# Edit the path below to point to your zlib sources and libs. -ifndef ZLIBSDK -ZLIBSDK = d:/projects/cw/zlib-1.2.3 -endif - -ifndef DISTDIR -DISTDIR = GeoIP-$(GEOIP_VERSION_STR)-bin-nw -endif -ARCHIVE = $(DISTDIR).zip - -# Edit the vars below to change NLM target settings. -TARGETS := $(patsubst apps/%.c,%.nlm,$(wildcard apps/*.c)) -DESCR = $(subst .def,,$(notdir $@)) $(GEOIP_VERSION_STR) -COMPANY = MaxMind LLC -COPYR = Copyright (C) 2003-2006 MaxMind LLC All Rights Reserved. -WWWURL = http://www.maxmind.com/app/c -MTSAFE = YES -STACK = 64000 -#SCREEN = none -DATADIR = sys:/etc/GeoIP -CONFDIR = sys:/etc - -# Comment the line below if you dont want to link with the static libz.lib. -LSTATIC = 1 - -# Edit the var below to point to your lib architecture. -ifndef LIBARCH -LIBARCH = LIBC -endif - -# must be equal to DEBUG or NDEBUG -DB = NDEBUG -# DB = DEBUG -# Optimization: -O or debugging: -g -ifeq ($(DB),NDEBUG) - OPT = -O2 - OBJDIR = release -else - OPT = -g - OBJDIR = debug -endif -OBJLIB = lib-$(OBJDIR) - -# Include the version info retrieved from header. --include $(OBJDIR)/version.inc - -# Global tools and toolflags used with all compilers. -ZIP = zip -qzR9 -CP = cp -afv -MV = mv -fv -# RM = rm -f -# if you want to mark the target as MTSAFE you will need a tool for -# generating the xdc data for the linker; here's a minimal tool: -# http://www.gknw.com/development/prgtools/mkxdc.zip -MPKXDC = mkxdc - -# The following line defines your compiler. -ifdef METROWERKS - CC = mwccnlm -else - CC = gcc -endif - -# Global flags for all compilers -CFLAGS = $(OPT) -D$(DB) -DNETWARE -nostdinc -CFLAGS += -DGEOIPDATADIR=\"$(DATADIR)\" -CFLAGS += -DSYSCONFDIR=\"$(CONFDIR)\" - -ifeq ($(CC),mwccnlm) -LD = mwldnlm -LDFLAGS = -nostdlib $(PRELUDE) $(LDLIBS) $(LIBOBJS) $(OBJDIR)/$(basename $@).o -o $@ -commandfile -AR = mwldnlm -ARFLAGS = -type library -w nocmdline $(OBJDIR)/*.o -o -LIBEXT = lib -CFLAGS += -msgstyle gcc -gccinc -opt nointrinsics -proc 586 -CFLAGS += -relax_pointers -#CFLAGS += -w on -ifeq ($(LIBARCH),LIBC) - PRELUDE = $(SDK_LIBC)/imports/libcpre.o - CFLAGS += -align 4 -else - PRELUDE = "$(METROWERKS)/Novell Support/Libraries/runtime/prelude.obj" -# CFLAGS += -include "$(METROWERKS)/Novell Support/Headers/nlm_prefix.h" - CFLAGS += -align 1 -endif -else -LD = nlmconv -LDFLAGS = -T -AR = ar -ARFLAGS = -cq -LIBEXT = lib -CFLAGS += -fno-builtin -fpack-struct -fpcc-struct-return -fno-strict-aliasing -CFLAGS += -Wall -Wno-unused #-Wno-format # -pedantic -ifeq ($(LIBARCH),LIBC) - PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o -else - PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o - CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h -endif -endif -DESCR += ($(LIBARCH)) - $(CC) build - -NDK_ROOT = $(NDKBASE)/ndk -SDK_CLIB = $(NDK_ROOT)/nwsdk -SDK_LIBC = $(NDK_ROOT)/libc - -ifeq ($(LIBARCH),LIBC) - INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks - # INCLUDES += -I$(SDK_LIBC)/include/winsock - CFLAGS += -D_POSIX_SOURCE - # CFLAGS += -D__ANSIC__ -else - INCLUDES += -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include - # INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete - CFLAGS += -DNETDB_USE_INTERNET -endif - -INCLUDES += -I./libGeoIP -INCLUDES += -I$(ZLIBSDK) -CFLAGS += $(INCLUDES) - -ifeq ($(MTSAFE),YES) - XDCOPT = -n -endif -ifeq ($(MTSAFE),NO) - XDCOPT = -u -endif - -LIBPATH += -L$(ZLIBSDK)/nw/release -ifdef LSTATIC - LDLIBS += $(ZLIBSDK)/nw/release/libz.$(LIBEXT) -else - IMPORTS += @$(ZLIBSDK)/nw/release/libz.imp - MODULES += libz -endif - -ifeq ($(findstring linux,$(OSTYPE)),linux) -DL = ' -#-include $(NDKBASE)/nlmconv/ncpfs.inc -endif - -vpath %.c ./apps ./libGeoIP - -LIBOBJS = $(OBJLIB)/GeoIP.o $(OBJLIB)/GeoIPCity.o -UPDOBJS = $(OBJLIB)/GeoIPUpdate.o $(OBJLIB)/md5.o -LIBOBJS += $(UPDOBJS) - -.PRECIOUS: $(OBJLIB)/%.o $(OBJDIR)/%.o $(OBJDIR)/%.def - - -all: prebuild $(TARGETS) - -prebuild: $(OBJLIB) $(OBJDIR) $(OBJDIR)/version.inc - -dist: $(DISTDIR) all $(DISTDIR)/readme_bin.txt - @$(CP) *.nlm $(DISTDIR) - @$(CP) Changelog $(DISTDIR) - @$(CP) README $(DISTDIR) - @$(CP) conf/GeoIP.conf.default $(DISTDIR) - @$(CP) data/GeoIP.dat $(DISTDIR) - @echo Creating $(ARCHIVE) - @$(ZIP) $(ARCHIVE) $(DISTDIR)/* < $(DISTDIR)/readme_bin.txt - -clean: - -$(RM) -r $(OBJDIR) $(OBJLIB) - -$(RM) $(TARGETS) - -distclean: - -$(RM) -r $(DISTDIR) - -$(RM) $(ARCHIVE) - -%.nlm: $(OBJDIR)/%.def $(LIBOBJS) $(OBJDIR)/%.o $(OBJDIR)/%.xdc - @echo Linking $@ - @-$(RM) $@ - @$(LD) $(LDFLAGS) $< - -$(DISTDIR): - @mkdir $@ - -$(OBJDIR): - @mkdir $@ - -$(OBJLIB): - @mkdir $@ - -$(OBJDIR)/%.o: %.c -# @echo Compiling $< - $(CC) $(CFLAGS) -c $< -o $@ - -$(OBJLIB)/%.o: %.c -# @echo Compiling $< - $(CC) $(CFLAGS) -c $< -o $@ - -$(OBJDIR)/version.inc: configure.in $(OBJDIR) - @echo Creating $@ - @awk -f get_ver.awk $< > $@ - -$(OBJDIR)/%.xdc: Makefile.netware - @echo Creating $@ - @$(MPKXDC) $(XDCOPT) $@ - -$(OBJDIR)/%.def: Makefile.netware - @echo Creating $@ - @echo $(DL)# DEF file for linking with $(LD)$(DL) > $@ - @echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@ - @echo $(DL)# All your changes will be lost!!$(DL) >> $@ - @echo $(DL)#$(DL) >> $@ - @echo $(DL)copyright "$(COPYR)"$(DL) >> $@ - @echo $(DL)description "$(DESCR)"$(DL) >> $@ - @echo $(DL)version $(GEOIP_VERSION)$(DL) >> $@ -ifdef NLMTYPE - @echo $(DL)type $(NLMTYPE)$(DL) >> $@ -endif -ifdef STACK - @echo $(DL)stack $(STACK)$(DL) >> $@ -endif -ifdef SCREEN - @echo $(DL)screenname "$(SCREEN)"$(DL) >> $@ -else - @echo $(DL)screenname "DEFAULT"$(DL) >> $@ -endif -ifeq ($(DB),DEBUG) - @echo $(DL)debug$(DL) >> $@ -endif - @echo $(DL)threadname "$(subst .def,,$(notdir $@))"$(DL) >> $@ -ifdef XDCOPT - @echo $(DL)xdcdata $(@:.def=.xdc)$(DL) >> $@ -endif -ifeq ($(LDRING),0) - @echo $(DL)flag_on 16$(DL) >> $@ -endif -ifeq ($(LDRING),3) - @echo $(DL)flag_on 512$(DL) >> $@ -endif -ifeq ($(LIBARCH),CLIB) - @echo $(DL)start _Prelude$(DL) >> $@ - @echo $(DL)exit _Stop$(DL) >> $@ - @echo $(DL)import @$(SDK_CLIB)/imports/clib.imp$(DL) >> $@ - @echo $(DL)import @$(SDK_CLIB)/imports/threads.imp$(DL) >> $@ - @echo $(DL)import @$(SDK_CLIB)/imports/nlmlib.imp$(DL) >> $@ - @echo $(DL)module clib$(DL) >> $@ -else - @echo $(DL)flag_on 64$(DL) >> $@ - @echo $(DL)pseudopreemption$(DL) >> $@ - @echo $(DL)start _LibCPrelude$(DL) >> $@ - @echo $(DL)exit _LibCPostlude$(DL) >> $@ - @echo $(DL)check _LibCCheckUnload$(DL) >> $@ - @echo $(DL)import @$(SDK_LIBC)/imports/libc.imp$(DL) >> $@ - @echo $(DL)import @$(SDK_LIBC)/imports/netware.imp$(DL) >> $@ - @echo $(DL)module libc$(DL) >> $@ -endif -ifdef MODULES - @echo $(DL)module $(MODULES)$(DL) >> $@ -endif -ifdef EXPORTS - @echo $(DL)export $(EXPORTS)$(DL) >> $@ -endif -ifdef IMPORTS - @echo $(DL)import $(IMPORTS)$(DL) >> $@ -endif -ifeq ($(LD),nlmconv) -ifdef LDLIBS - @echo $(DL)input $(LDLIBS)$(DL) >> $@ -endif - @echo $(DL)input $(PRELUDE)$(DL) >> $@ - @echo $(DL)input $(LIBOBJS)$(DL) >> $@ - @echo $(DL)input $(@:.def=.o)$(DL) >> $@ - @echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@ -endif - -$(DISTDIR)/readme_bin.txt: Makefile.netware - @echo Creating $@ - @echo $(DL)This is a binary distribution for NetWare platform.$(DL) > $@ - @echo $(DL)GeoIP version $(GEOIP_VERSION_STR)$(DL) >> $@ -ifndef LSTATIC - @echo $(DL)These binaries depend on libz.nlm in the search path!$(DL) >> $@ -endif - @echo $(DL)Please download the complete GeoIP package for$(DL) >> $@ - @echo $(DL)any further documentation:$(DL) >> $@ - @echo $(DL)$(WWWURL)$(DL) >> $@ - -info: - @echo Targets to build: $(TARGETS) - - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/Makefile.vc b/Src/Plugins/DSP/sc_serv3/GeoIP/Makefile.vc deleted file mode 100644 index bd575955..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/Makefile.vc +++ /dev/null @@ -1,84 +0,0 @@ -#NMAKE makefile for Windows developers. -#Produces a static library (GeoIP.lib). - -################################################################# -# configuration section -################################################################ - -# place to put the GeoIP.dat database file -# !!! Please keep the 2 \\ as directory separators !!! -# -GEOIPDATADIR="C:\\Windows\\SYSTEM32" -# -# System inc, lib, and bin directories -!ifndef INSTDIR -INSTDIR="C:\GeoIP-1.4.5" -!endif - -# Location where GeoIP.lib should be installed my "make install" -INSTALL_LIB=$(INSTDIR)\Lib - -#Location where .h files should be installed by "make install". -INSTALL_INC=$(INSTDIR)\Include - -#Location where programs should be installed by "make install". -INSTALL_BIN=$(INSTDIR)\Bin - -################################################################ -# end configuration section -################################################################ - -DATA_DIR=data - -DATA_FILE=GeoIP.dat - -LIB_DIR = libGeoIP - -TEST_DIR=test - -APP_DIR=apps - -GEOIP_LIB = GeoIP.lib - -APP_PROGRAMS = geoiplookup.exe - -TEST_PROGRAMS = benchmark.exe test-geoip.exe - -all: GeoIP.lib test_progs app_progs - -$(GEOIP_LIB): - cd $(LIB_DIR) - $(MAKE) -nologo -f Makefile.vc GEOIPDATADIR=$(GEOIPDATADIR) - cd .. - -test_progs: - cd $(TEST_DIR) - $(MAKE) -nologo -f Makefile.vc - cd .. - -app_progs: - cd $(APP_DIR) - $(MAKE) -nologo -f Makefile.vc - cd .. - -test: $(GEOIP_LIB) test_progs - cd $(TEST_DIR) - benchmark.exe - test-geoip.exe - cd .. - -install: $(GEOIP_LIB) app_progs - cd $(LIB_DIR) - copy $(GEOIP_LIB) $(INSTALL_LIB) - copy *.h $(INSTALL_INC) - cd ..\$(APP_DIR) - copy $(APP_PROGRAMS) $(INSTALL_BIN) - cd ..\$(DATA_DIR) - copy $(DATA_FILE) $(GEOIPDATADIR) - cd .. - -clean: - del $(LIB_DIR)\*.obj $(LIB_DIR)\*.lib \ - $(APP_DIR)\*.obj $(APP_DIR)\*.exe \ - $(TEST_DIR)\*.obj $(TEST_DIR)\*.exe - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/Makefile.win32 b/Src/Plugins/DSP/sc_serv3/GeoIP/Makefile.win32 deleted file mode 100644 index a8902d67..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/Makefile.win32 +++ /dev/null @@ -1,232 +0,0 @@ -################################################################### -# -## Makefile for building GeoIP stuff (Win32 version - gnu make) -## To build the binaries you need awk, GNU make and MingW32 gcc -## or Metrowerks CodeWarrior CommandlineTools. -## Usage: make -f Makefile.win32 [all|dist|clean|distclean] -## -## hacked by: Guenter Knauf -# -################################################################### - -# Edit the path below to point to your zlib sources and libs. -ifndef ZLIBSDK -ZLIBSDK = d:/projects/mingw32/zlib-1.2.3 -endif - -ifndef DISTDIR -DISTDIR = GeoIP-$(GEOIP_VERSION_STR)-bin-w32 -endif -ARCHIVE = $(DISTDIR).zip - -# Edit the vars below to change EXE target settings. -TARGETS := $(patsubst apps/%.c,%.exe,$(wildcard apps/*.c)) -DESCR = $(subst .rc,,$(notdir $@)) $(GEOIP_VERSION_STR) -COMPANY = MaxMind LLC -COPYR = © 2003-2006 MaxMind LLC All Rights Reserved. -WWWURL = http://www.maxmind.com/app/c -LICENSE = Licensed under LGPL -ICON = geoip.ico -DATADIR = c:/GeoIP -CONFDIR = c:/GeoIP - -# Comment the line below if you dont want to link with the static libz.lib. -LSTATIC = 1 - -# must be equal to DEBUG or NDEBUG -DB = NDEBUG -# DB = DEBUG -# Optimization: -O or debugging: -g -ifeq ($(DB),NDEBUG) - OPT = -O2 - OBJDIR = release -else - OPT = -g - OBJDIR = debug -endif -OBJLIB = lib-$(OBJDIR) - -# Include the version info retrieved from header. --include $(OBJDIR)/version.inc - -# Global tools and toolflags used with all compilers. -ZIP = zip -qzR9 -CP = cp -afv -MV = mv -fv -# RM = rm -f -RE = reimp -d -DLLTOOL = dlltool -DTFLAGS = -k - -# The following line defines your compiler. -ifdef METROWERKS - CC = mwcc -else - CC = gcc -endif - -# Global flags for all compilers -CFLAGS = $(OPT) -D$(DB) -D_WIN32 -# -nostdinc -CFLAGS += -DHAVE_STDINT_H -CFLAGS += -DGEOIPDATADIR=\"$(DATADIR)\" -CFLAGS += -DSYSCONFDIR=\"$(CONFDIR)\" - -ifeq ($(CC),mwcc) -LD = mwld -LDFLAGS = -nostdlib -LIBPATH = -lr "$(METROWERKS)/MSL" -lr "$(METROWERKS)/Win32-x86 Support/Libraries" -CWLIBS = -lMSL_Runtime_x86.lib -lMSL_C_x86.lib -lMSL_Extras_x86.lib -LDLIBS = -lkernel32.lib -luser32.lib $(CWLIBS) -AR = mwld -ARFLAGS = -type library -w nocmdline $(OBJDIR)/*.o -o -LIBEXT = lib -RC = mwwinrc -CFLAGS += -nostdinc -CFLAGS += -msgstyle gcc -gccinc -opt nointrinsics -proc 586 -CFLAGS += -relax_pointers -#CFLAGS += -w on -CFLAGS += -ir "$(METROWERKS)/MSL" -ir "$(METROWERKS)/Win32-x86 Support/Headers" -else -LD = gcc -LDFLAGS = -s -AR = ar -ARFLAGS = -cq -LIBEXT = a -RC = windres -RCFLAGS = -I rc -O coff -i -CFLAGS += -Wall -Wno-unused # -Wno-format #-pedantic -endif - -INCLUDES += -I./libGeoIP -INCLUDES += -I$(ZLIBSDK) -CFLAGS += $(INCLUDES) - -LDLIBS += -lwsock32 -LIBPATH += -L$(ZLIBSDK) -ifdef LSTATIC - LDLIBS += -lz -else - LDLIBS += -lzdll -endif - -ifeq ($(findstring linux,$(OSTYPE)),linux) -DL = ' -#-include $(NDKBASE)/nlmconv/ncpfs.inc -endif - -vpath %.c ./apps ./libGeoIP - -LIBOBJS = $(OBJLIB)/GeoIP.o $(OBJLIB)/GeoIPCity.o -UPDOBJS = $(OBJLIB)/GeoIPUpdate.o $(OBJLIB)/md5.o -LIBOBJS += $(UPDOBJS) - -.PRECIOUS: $(OBJLIB)/%.o $(OBJDIR)/%.o $(OBJDIR)/%.rc - -all: prebuild $(TARGETS) - -prebuild: $(OBJLIB) $(OBJDIR) $(OBJDIR)/version.inc - -dist: $(DISTDIR) all $(DISTDIR)/readme_bin.txt - @$(CP) *.exe $(DISTDIR) - @$(CP) Changelog $(DISTDIR) - @$(CP) README $(DISTDIR) - @$(CP) conf/GeoIP.conf.default $(DISTDIR) - @$(CP) data/GeoIP.dat $(DISTDIR) - @echo Creating $(ARCHIVE) - @$(ZIP) $(ARCHIVE) $(DISTDIR)/* < $(DISTDIR)/readme_bin.txt - -clean: - -$(RM) -r $(OBJDIR) $(OBJLIB) - -$(RM) $(TARGETS) - -distclean: - -$(RM) -r $(DISTDIR) - -$(RM) $(ARCHIVE) - -%.exe: $(OBJDIR)/%.res $(LIBOBJS) $(OBJDIR)/%.o - @echo Linking $@ - @-$(RM) $@ - $(LD) $(LDFLAGS) -o $@ $^ $(LIBPATH) $(LDLIBS) -# $(LD) $(LDFLAGS) $(LIBPATH) $(LIBFILES) -o $@ $^ - -$(DISTDIR): - @mkdir $@ - -$(OBJDIR): - @mkdir $@ - -$(OBJLIB): - @mkdir $@ - -$(OBJDIR)/%.o: %.c -# @echo Compiling $< - $(CC) $(CFLAGS) -c $< -o $@ - -$(OBJLIB)/%.o: %.c -# @echo Compiling $< - $(CC) $(CFLAGS) -c $< -o $@ - -$(OBJDIR)/version.inc: configure.in $(OBJDIR) - @echo Creating $@ - @awk -f get_ver.awk $< > $@ - -$(OBJDIR)/%.res: $(OBJDIR)/%.rc - @echo Creating $@ - @$(RC) $(RCFLAGS) $< -o $@ - -$(OBJDIR)/%.rc: Makefile.win32 - @echo 1 VERSIONINFO > $@ - @echo FILEVERSION $(GEOIP_VERSION),0 >> $@ - @echo PRODUCTVERSION $(GEOIP_VERSION),0 >> $@ - @echo FILEFLAGSMASK 0x3fL >> $@ - @echo FILEOS 0x40004L >> $@ - @echo FILEFLAGS 0x0L >> $@ - @echo FILETYPE 0x1L >> $@ - @echo FILESUBTYPE 0x0L >> $@ - @echo BEGIN >> $@ - @echo BLOCK "StringFileInfo" >> $@ - @echo BEGIN >> $@ - @echo BLOCK "040904E4" >> $@ - @echo BEGIN >> $@ - @echo VALUE "LegalCopyright","$(COPYR)\0" >> $@ -ifdef COMPANY - @echo VALUE "CompanyName","$(COMPANY)\0" >> $@ -endif -ifdef LICENSE - @echo VALUE "License","$(LICENSE)\0" >> $@ -endif - @echo VALUE "ProductName","$(basename $(notdir $@))\0" >> $@ - @echo VALUE "ProductVersion","$(GEOIP_VERSION_STR)\0" >> $@ - @echo VALUE "FileDescription","$(DESCR)\0" >> $@ - @echo VALUE "FileVersion","$(GEOIP_VERSION_STR)\0" >> $@ - @echo VALUE "InternalName","$(basename $(notdir $@))\0" >> $@ - @echo VALUE "OriginalFilename","$(basename $(notdir $@)).exe\0" >> $@ - @echo VALUE "WWW","$(WWWURL)\0" >> $@ - @echo END >> $@ - @echo END >> $@ - @echo BLOCK "VarFileInfo" >> $@ - @echo BEGIN >> $@ - @echo VALUE "Translation", 0x409, 1252 >> $@ - @echo END >> $@ - @echo END >> $@ -ifdef ICON - @echo 10 ICON DISCARDABLE "$(ICON)" >> $@ -endif - -$(DISTDIR)/readme_bin.txt: Makefile.win32 - @echo Creating $@ - @echo $(DL)This is a binary distribution for Win32 platform.$(DL) > $@ - @echo $(DL)GeoIP version $(GEOIP_VERSION_STR)$(DL) >> $@ -ifndef LSTATIC - @echo $(DL)These binaries depend on zlib1.dll in the search path!$(DL) >> $@ -endif - @echo $(DL)Please download the complete GeoIP package for$(DL) >> $@ - @echo $(DL)any further documentation:$(DL) >> $@ - @echo $(DL)$(WWWURL)$(DL) >> $@ - -info: - @echo Targets to build: $(TARGETS) - - - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/NEWS b/Src/Plugins/DSP/sc_serv3/GeoIP/NEWS deleted file mode 100644 index e69de29b..00000000 diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/README b/Src/Plugins/DSP/sc_serv3/GeoIP/README deleted file mode 100644 index a1b67256..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/README +++ /dev/null @@ -1,208 +0,0 @@ - GeoIP 1.4.8 - ----------- - -*** Experimental IPv6 notice *** - -- the experimental IPv6 part of libGeoIP may change in the future. -- It is possible, that geoiplookup and geoiplookup6 will merged. - -*** - -The new perl script geoipupdate-pureperl.pl is a drop in replacement for -geoipupdate. Useful, if you like to customize, pre or postprocess new or -old databases. To archive the databases or signal apache whatever. -Another advantage is, that geoipupdate-pureperl.pl is able to handle proxy -requests even with authentication. - -IMPORTANT API Change for 1.3.x and above users for GeoIP Region database -GeoIPRegion.region is no longer a pointer but an in-structure -array so test the first byte of region == 0 rather testing if the region -pointer is NULL. - -IMPORTANT API Change for 1.1.x and above users - as of GeoIP 1.1.0 the -GeoIP_country_xxx_by_xxx functions return NULL if a country can not -be found (it used to return '--' or 'N/A'. Be sure to check the -return value for NULL, to avoid segmentation faults! - -GeoIP is a C library that enables the user to find geographical and -network information of an IP address. -Included is a free GeoLite Country database -that is updated at the beginning of every month. -To download the latest free GeoLite Country database, go to: -http://www.maxmind.com/app/geoip_country - -There is also a free city-level geolocation database, GeoLite City, -available from: -http://www.maxmind.com/app/geolitecity - -We also offer commercial GeoIP databases with greater accuracy and -additional network information, for more details, see: -http://www.maxmind.com/app/products - -As of version 1.4.5 geoipupdate can handle updates via HTTP Proxy Server. -If the environ variable http_proxy="http://proxy-host:port" is set. -The username:password (as in FTP URLs) is not supported! -Thanks to Andrew Droffner for the patch! - -As of version 1.3.6, the GeoIP C library is thread safe, as long as -GEOIP_CHECK_CACHE is not used. - -This module can be used to automatically select the geographically closest -mirror, to analyze your web server logs to determine the countries of your -visitors, for credit card fraud detection, and for software export controls. - -If you use GeoIP to block access from high risk countries in order -to reduce fraud or abuse, you should also block access from known -proxy servers. For more details, see: -http://www.maxmind.com/app/proxy - -To install, run: - -./configure -make -make check -make install - -The GeoIP C library relies on GNU make, not on BSD make - -MEMORY CACHING AND OTHER OPTIONS - -There are four options available: - -GEOIP_STANDARD - read database from filesystem, uses least memory. - -GEOIP_MEMORY_CACHE - load database into memory, faster performance - but uses more memory - -GEOIP_CHECK_CACHE - check for updated database. If database has been updated, - reload filehandle and/or memory cache. - -GEOIP_INDEX_CACHE - just cache - the most frequently accessed index portion of the database, resulting - in faster lookups than GEOIP_STANDARD, but less memory usage than - GEOIP_MEMORY_CACHE - useful for larger databases such as - GeoIP Organization and GeoIP City. Note, for GeoIP Country, Region - and Netspeed databases, GEOIP_INDEX_CACHE is equivalent to GEOIP_MEMORY_CACHE - -GEOIP_MMAP_CACHE - load database into mmap shared memory ( MMAP is not avail for WIN32 ) - -The options can be combined using bit operators. For example you can -use both GEOIP_MEMORY_CACHE and GEOIP_CHECK_CACHE by calling: - - GeoIP_open("/path/to/GeoIP.dat", GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE); - -By default, the city name is returned in iso-8859-1 charset. To obtain the -city name in utf8 instead, run: - - GeoIP_set_charset(gi, GEOIP_CHARSET_UTF8); - -To get the netmask of the netblock of the last lookup, use GeoIP_last_netblock(gi). - -EXAMPLES - -See -test/ - test-geoip.c - test-geoip-region.c - test-geoip-city.c - test-geoip-isp.c - test-geoip-org.c - test-geoip-netspeed.c - -for examples of how to use the API. The test-geoip.c program works with both the GeoLite and -GeoIP Country databases. The test-geoip-city.c program works with both the GeoLite and -GeoIP City databases. The other example programs require the paid databases available -from http://www.maxmind.com/app/products - -AUTOMATIC UPDATES - -MaxMind offers a service where you can have your database updated -automically each week. For more details see: - -http://www.maxmind.com/app/license_key - -RESOURCES Mailinglists - -Please join the very low traffic mailinglists you are interested in. - -http://sourceforge.net/mail/?group_id=66844 - -Preformance Patches. - -Patrick McManus provide a patch to enhance the lookupspeed in MEMORY_CACHE mode. If you feel, that the current MEMORY_CACHE mode is to slow try the patch: - -http://sourceforge.net/mailarchive/forum.php?forum_name=geoip-c-discuss&max_rows=25&style=nested&viewmonth=200803 - -TROUBLESHOOTING - -If you run into trouble building your application with GeoIP support, try adding -fms-extensions to your CFLAGS. If you use Solaris and there C-Compiler use -features=extensions instead. These options enable unnamed union support and fix problems like: 'improper member use: dma_code' or 'GeoIPRecord' has no member named 'dma_code'. - -Note that it is recommended that you use GNU make. Also, if you are using -OpenBSD, GeoIP requires OpenBSD 3.1 or greater. - -if you get "cannot load shared object file: No such file or directory" -error, add the directory libGeoIP.so was installed to to /etc/ld.so.conf -and run ldconfig - -On Solaris, if you get a -ld: fatal: relocations remain against allocatable but non-writable sections -error, try running - -# make clean -# ./configure --disable-shared -# make - -If you get a "ar : command not found" error, make sure that ar is -in your path. On Solaris, ar is typically found in /usr/ccs/bin - -If you get a "geoipupdate.c:24: getopt.h: No such file or directory" -error, run - -# export CPPFLAGS="-I/usr/local/include" - -(assuming that getopt.h is in /usr/local/include) - -If you get a "zlib.h: No such file or directory" error, make sure -that the zlib development libraries are installed on your server. -These are typically included in a "zlib-devel" package. - -If you get a "bad interpreter: No such file or directory" error -when running ./configure, make sure that there are no DOS -returns in the configure script. To remove DOS returns, -run perl -pi -e 's!\r!!g' configure. - -If gcc fails while consuming a large amount of memory, try -compiling with CFLAGS=-O1 (or -O0) instead of the default -O2. -It seems that some -versions of gcc have a bug and consume 1 GB of memory when optimizing -certain source files (the other source file where this was reported is -from XORG X-Server). It happens at least with gcc 3.3.1 and with gcc -4.2(.0). Thanks to Kai Schätzl for the report. - -If GEOIP_MMAP_CACHE doesn't work on a 64bit machine, try adding -the flag "MAP_32BIT" to the mmap call. - -If you get a "passing argument 3 of 'gethostbyname_r' from incompatible pointer type" -error on AIX, download and/or untar a fresh copy of GeoIP. ( To avoid cached -results from a previous ./configure run ) - -cd ./GeoIP-1.4.6 -then edit the file ./configure - -and delete these two lines: - -#define HAVE_GETHOSTBYNAME_R 1 - -#define GETHOSTBYNAME_R_RETURNS_INT 1 - -then save the configure script - -and build it as usual - -./configure -make -sudo make install - - - -To submit a patch, please contact support@maxmind.com diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/README.MinGW b/Src/Plugins/DSP/sc_serv3/GeoIP/README.MinGW deleted file mode 100644 index 8a192f95..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/README.MinGW +++ /dev/null @@ -1,13 +0,0 @@ -# how to build under MinGW/MSYS: -# (first you need to build & "install" zlib) - -export "CFLAGS=-O3 -I/usr/local/include" -export "LDFLAGS=-L/usr/local/lib -lwsock32" -./configure -make -cp data/GeoIP.dat test/ -make check - -# note that GeoIP.dat file should be placed in the -# same place as GeoIP-enabled executable modules! -# there's NO DEFAULT PATH concept on Win32 :) diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/README.OSX b/Src/Plugins/DSP/sc_serv3/GeoIP/README.OSX deleted file mode 100644 index 4dddf08c..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/README.OSX +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# -# Building OSX fat binaries is easy. -# -# - start in a clean directory. -# - copy the shell script below to a file and edit the file to your needs. -# -# 1.) modify export GEOIP_ARCH='-arch i386 -arch x86_64 -arch ppc -arch ppc64' -# to include all architectures you need. -# 2.) add whatever you want to the ./configure line. -# 3.) execute the script. -# 4.) do a 'make install' -# -# -# make clean or make distclean before building this -# -# tell systems before leopard that we like to build for 10.5 or higher -# with MACOSX_DEPLOYMENT_TARGET=10.5 -# starting with leopard we have to add -mmacosx-version-min=10.5 -# to the CFLAGS and export MACOSX_DEPLOYMENT_TARGET!? - -## for tiger, leopard and snow leopard you might use this -## export GEOIP_ARCH='-arch i386 -arch x86_64 -arch ppc -arch ppc64' -## export MACOSX_DEPLOYMENT_TARGET=10.4 -## export LDFLAGS=$GEOIP_ARCH -## export CFLAGS="-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk $GEOIP_ARCH" - -# here we go for leopard and snow leopard -export GEOIP_ARCH='-arch i386 -arch x86_64 -arch ppc' -export MACOSX_DEPLOYMENT_TARGET=10.5 -export LDFLAGS=$GEOIP_ARCH -export CFLAGS="-g -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk $GEOIP_ARCH" -./configure --disable-dependency-tracking -perl -i.bak -pe'/^archive_cmds=/ and !/\bGEOIP_ARCH\b/ and s/-dynamiclib\b/-dynamiclib \\\$(GEOIP_ARCH)/' ./libtool -make diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/READMEwin32.txt b/Src/Plugins/DSP/sc_serv3/GeoIP/READMEwin32.txt deleted file mode 100644 index a81795cf..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/READMEwin32.txt +++ /dev/null @@ -1,44 +0,0 @@ -======================================================= - -Environmental variables: - -1. GeoIPDBFileName is hardcoded to "\\windows\\system32\\GeoIP.dat" on -windows in GeoIP.c -2. #ifdef DLL is used to determine whether you want to have a DLL built -in GeoIP.h - -You may want to change these depending on your system configuration -and compiler. - -======================================================= -Thanks to Chris Gibbs for supplying these instructions. - -The GeoIP C library should work under windows. Note that it requires the zlib -DLL. - -To install zlib with GeoIP: - -i) Downloda the zlib prebuilt DLL and static library from -http://www.winimage.com/zLibDll/ look for "pre-built zlib DLL". - -Unzip it to some location on your hard drive, and in Project-->Settings , -go to the Link tab, and add the following 3 libraries: - -ws2_32.lib -zlib.lib -zlibstat.lib - -iii) Go to Tools-->Options, then the Directories tab, and add library paths to -the locations of the zlib static libraries. You will also need to add the -include path to zlib.h to the include paths. - -iv) NOTE: These instructions are for MS VC++ 6.0, but should be similar for -previous versions, and for VC .NET. - -======================================================= -Building GeoIP as a DLL - -Stanislaw Pusep has contributed a patch for building GeoIP as a DLL. -You can find the patch in GeoIPWinDLL.patch - -Note a modified version of this patch is now merged into the main code. diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/READMEwin32static.txt b/Src/Plugins/DSP/sc_serv3/GeoIP/READMEwin32static.txt deleted file mode 100644 index ba403836..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/READMEwin32static.txt +++ /dev/null @@ -1,17 +0,0 @@ -To make a static GeoIP.lib, edit the top level -Makefile.vc to reflect where the GeoIP.dat database -file should be placed, as well as the locations -of the lib, include, and bin directories for installation. -Then give the command - nmake /f Makefile.vc -This will build the GeoIP.lib library, as well as available -application and test programs. The command - nmake /f Makefile.vc test -will run available tests in the test/ subdirectory. - nmake /f Makefile.vc install -will then copy the lib and header files to the locations -specified in the top-level Makefile.vc, as well as -available application programs in the apps/ subdirectory. - nmake /f Makefile.vc clean -will remove intermediate object and executable files. - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/TODO b/Src/Plugins/DSP/sc_serv3/GeoIP/TODO deleted file mode 100644 index 32a6c805..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/TODO +++ /dev/null @@ -1,54 +0,0 @@ -Rutger Okhuizen 7/31/2006 - -Implement waiting algorithm for GEOIP_CHECK_CACHE, -so stat is called on every lookup. - ------------------------ - -Maurice Cinquini - -*** ifndef WIN32 on netdb.h ? *** -In GeoIPCity.c you don't "#ifndef WIN32" the netdb.h include, -but in GeoIP.c you do.  Which one is right? - -*** Warnings in GeoIP-1.2.1 before I made changes *** -GeoIPUpdate.c:73: warning: implicit declaration of function `_setup_dbfilename' -    I suggest a GeoIP_private.h file to include prototypes for -    _setup_dbfilename and other private functions also used by GeoIPCity.c - -*** Drop the GeoIP_*_by_addr API calls *** -And now that I think of it, why do you need a seperate -GeoIP_region_by_addr and GeoIP_region_by_name since -the later does the work of the former just as efficently. -For backward compatibility you could #define GeoIP_region_by_addr -to GeoIP_region_by_name - - - - -Performance improvements suggested by Jason Linhart -1. cluster nodes to improve disk performance when using GEOIP_STANDARD -2. evaluate preformance of replacing binary tree with nodes containing 4 children - -Write function to list countries, sorted by name. Chris Gibbs contributed this which could be -used: - - int GeoIP_country_sorted_index[246] = { - 0, 5, 8, 61, 14, 3, 11, 7, 12, 6, 13, 9, 17, 1, 16, 15, 18, 32, 25, 21, - 20,36, 22, 37, 27, 28, 33, 30, 19, 35, 34, 31, 104, 29, 24, 23, 26, -114, 47, 38, 52,121, 41, 207, 46, 48, 53, 39, 49, 116, 42, 40, 45, - 50, 44, 97, 51, 54, 55, 58, 57, 59, 60, 216, 62, 64, 203, 87, 66, - 63, 68, 2, 71, 73, 70, 69, 74, 75, 80, 170,208, 76, 84, 79, 56, 81, -82, 88, 83, 78, 86, 91, 90, 85, 92, 93, 98, 95, 228, 96,94, 99, 107, - 103, 100, 106, 105, 101, 102, 108, 109, 111, 110, 122, 112, 115, - 118,119, 120, 113, 123, 132, 124, 129, 128, 133, 126, 130, 131, - 143, 139, 137,151,153, 150, 140, 148, 138, 145, 146, 149, 238, - 152, 72, 136, 135, 142, 147, 134,154, 141, 155, 164, 163, 161, -10, 156, 166, 160, 157, 159, 165, 158, 144, 162, 167,173, 180, -178, 168, 171, 181, 169, 172, 176, 174, 179, 177, 182, 183, 184, -185,186, 193, 117, 125, 175, 229, 236, 198, 202, 187, 199, 189, -197, 192, 196,194,188, 200, 240, 89, 67, 127, 190, 201, 195, 205, -191, 43, 204, 220, 211, 221,210,209, 212, 215, 218, 214, 217, -213,206, 219, 223, 222, 4, 77, 225, 224, 226,227,234, 230, 233, - 231,232, 235, 65, 237, 239, 242, 241, 243, 244, 245}; - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/aclocal.m4 b/Src/Plugins/DSP/sc_serv3/GeoIP/aclocal.m4 deleted file mode 100644 index 91c7b241..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/aclocal.m4 +++ /dev/null @@ -1,8917 +0,0 @@ -# generated automatically by aclocal 1.11.1 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],, -[m4_warning([this file was generated for autoconf 2.65. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically `autoreconf'.])]) - -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -m4_define([_LT_COPYING], [dnl -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -]) - -# serial 56 LT_INIT - - -# LT_PREREQ(VERSION) -# ------------------ -# Complain and exit if this libtool version is less that VERSION. -m4_defun([LT_PREREQ], -[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, - [m4_default([$3], - [m4_fatal([Libtool version $1 or higher is required], - 63)])], - [$2])]) - - -# _LT_CHECK_BUILDDIR -# ------------------ -# Complain if the absolute build directory name contains unusual characters -m4_defun([_LT_CHECK_BUILDDIR], -[case `pwd` in - *\ * | *\ *) - AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; -esac -]) - - -# LT_INIT([OPTIONS]) -# ------------------ -AC_DEFUN([LT_INIT], -[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT -AC_BEFORE([$0], [LT_LANG])dnl -AC_BEFORE([$0], [LT_OUTPUT])dnl -AC_BEFORE([$0], [LTDL_INIT])dnl -m4_require([_LT_CHECK_BUILDDIR])dnl - -dnl Autoconf doesn't catch unexpanded LT_ macros by default: -m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl -m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl -dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 -dnl unless we require an AC_DEFUNed macro: -AC_REQUIRE([LTOPTIONS_VERSION])dnl -AC_REQUIRE([LTSUGAR_VERSION])dnl -AC_REQUIRE([LTVERSION_VERSION])dnl -AC_REQUIRE([LTOBSOLETE_VERSION])dnl -m4_require([_LT_PROG_LTMAIN])dnl - -dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -_LT_SETUP - -# Only expand once: -m4_define([LT_INIT]) -])# LT_INIT - -# Old names: -AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) -AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PROG_LIBTOOL], []) -dnl AC_DEFUN([AM_PROG_LIBTOOL], []) - - -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -m4_defun([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` -]) - - -# _LT_FILEUTILS_DEFAULTS -# ---------------------- -# It is okay to use these file commands and assume they have been set -# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. -m4_defun([_LT_FILEUTILS_DEFAULTS], -[: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} -])# _LT_FILEUTILS_DEFAULTS - - -# _LT_SETUP -# --------- -m4_defun([_LT_SETUP], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -_LT_DECL([], [host_alias], [0], [The host system])dnl -_LT_DECL([], [host], [0])dnl -_LT_DECL([], [host_os], [0])dnl -dnl -_LT_DECL([], [build_alias], [0], [The build system])dnl -_LT_DECL([], [build], [0])dnl -_LT_DECL([], [build_os], [0])dnl -dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -test -z "$LN_S" && LN_S="ln -s" -_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl -dnl -AC_REQUIRE([LT_CMD_MAX_LEN])dnl -_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl -_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl -dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -m4_require([_LT_CMD_RELOAD])dnl -m4_require([_LT_CHECK_MAGIC_METHOD])dnl -m4_require([_LT_CMD_OLD_ARCHIVE])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl - -_LT_CONFIG_LIBTOOL_INIT([ -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi -]) -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -_LT_CHECK_OBJDIR - -m4_require([_LT_TAG_COMPILER])dnl -_LT_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([["`\\]]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -_LT_CC_BASENAME([$compiler]) - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - _LT_PATH_MAGIC - fi - ;; -esac - -# Use C for the default configuration in the libtool script -LT_SUPPORTED_TAG([CC]) -_LT_LANG_C_CONFIG -_LT_LANG_DEFAULT_CONFIG -_LT_CONFIG_COMMANDS -])# _LT_SETUP - - -# _LT_PROG_LTMAIN -# --------------- -# Note that this code is called both from `configure', and `config.status' -# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, -# `config.status' has no value for ac_aux_dir unless we are using Automake, -# so we pass a copy along to make sure it has a sensible value anyway. -m4_defun([_LT_PROG_LTMAIN], -[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl -_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) -ltmain="$ac_aux_dir/ltmain.sh" -])# _LT_PROG_LTMAIN - - - -# So that we can recreate a full libtool script including additional -# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS -# in macros and then make a single call at the end using the `libtool' -# label. - - -# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) -# ---------------------------------------- -# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL_INIT], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_INIT], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_INIT]) - - -# _LT_CONFIG_LIBTOOL([COMMANDS]) -# ------------------------------ -# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) - - -# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) -# ----------------------------------------------------- -m4_defun([_LT_CONFIG_SAVE_COMMANDS], -[_LT_CONFIG_LIBTOOL([$1]) -_LT_CONFIG_LIBTOOL_INIT([$2]) -]) - - -# _LT_FORMAT_COMMENT([COMMENT]) -# ----------------------------- -# Add leading comment marks to the start of each line, and a trailing -# full-stop to the whole comment if one is not present already. -m4_define([_LT_FORMAT_COMMENT], -[m4_ifval([$1], [ -m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], - [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) -)]) - - - - - -# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) -# ------------------------------------------------------------------- -# CONFIGNAME is the name given to the value in the libtool script. -# VARNAME is the (base) name used in the configure script. -# VALUE may be 0, 1 or 2 for a computed quote escaped value based on -# VARNAME. Any other value will be used directly. -m4_define([_LT_DECL], -[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], - [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], - [m4_ifval([$1], [$1], [$2])]) - lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) - m4_ifval([$4], - [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) - lt_dict_add_subkey([lt_decl_dict], [$2], - [tagged?], [m4_ifval([$5], [yes], [no])])]) -]) - - -# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) -# -------------------------------------------------------- -m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) - - -# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_tag_varnames], -[_lt_decl_filter([tagged?], [yes], $@)]) - - -# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) -# --------------------------------------------------------- -m4_define([_lt_decl_filter], -[m4_case([$#], - [0], [m4_fatal([$0: too few arguments: $#])], - [1], [m4_fatal([$0: too few arguments: $#: $1])], - [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], - [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], - [lt_dict_filter([lt_decl_dict], $@)])[]dnl -]) - - -# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) -# -------------------------------------------------- -m4_define([lt_decl_quote_varnames], -[_lt_decl_filter([value], [1], $@)]) - - -# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_dquote_varnames], -[_lt_decl_filter([value], [2], $@)]) - - -# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_varnames_tagged], -[m4_assert([$# <= 2])dnl -_$0(m4_quote(m4_default([$1], [[, ]])), - m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), - m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) -m4_define([_lt_decl_varnames_tagged], -[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) - - -# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_all_varnames], -[_$0(m4_quote(m4_default([$1], [[, ]])), - m4_if([$2], [], - m4_quote(lt_decl_varnames), - m4_quote(m4_shift($@))))[]dnl -]) -m4_define([_lt_decl_all_varnames], -[lt_join($@, lt_decl_varnames_tagged([$1], - lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl -]) - - -# _LT_CONFIG_STATUS_DECLARE([VARNAME]) -# ------------------------------------ -# Quote a variable value, and forward it to `config.status' so that its -# declaration there will have the same value as in `configure'. VARNAME -# must have a single quote delimited value for this to work. -m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) - - -# _LT_CONFIG_STATUS_DECLARATIONS -# ------------------------------ -# We delimit libtool config variables with single quotes, so when -# we write them to config.status, we have to be sure to quote all -# embedded single quotes properly. In configure, this macro expands -# each variable declared with _LT_DECL (and _LT_TAGDECL) into: -# -# ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' -m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], -[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), - [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAGS -# ---------------- -# Output comment and list of tags supported by the script -m4_defun([_LT_LIBTOOL_TAGS], -[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl -available_tags="_LT_TAGS"dnl -]) - - -# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) -# ----------------------------------- -# Extract the dictionary values for VARNAME (optionally with TAG) and -# expand to a commented shell variable setting: -# -# # Some comment about what VAR is for. -# visible_name=$lt_internal_name -m4_define([_LT_LIBTOOL_DECLARE], -[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], - [description])))[]dnl -m4_pushdef([_libtool_name], - m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl -m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), - [0], [_libtool_name=[$]$1], - [1], [_libtool_name=$lt_[]$1], - [2], [_libtool_name=$lt_[]$1], - [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl -m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl -]) - - -# _LT_LIBTOOL_CONFIG_VARS -# ----------------------- -# Produce commented declarations of non-tagged libtool config variables -# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' -# script. Tagged libtool config variables (even for the LIBTOOL CONFIG -# section) are produced by _LT_LIBTOOL_TAG_VARS. -m4_defun([_LT_LIBTOOL_CONFIG_VARS], -[m4_foreach([_lt_var], - m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAG_VARS(TAG) -# ------------------------- -m4_define([_LT_LIBTOOL_TAG_VARS], -[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) - - -# _LT_TAGVAR(VARNAME, [TAGNAME]) -# ------------------------------ -m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) - - -# _LT_CONFIG_COMMANDS -# ------------------- -# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of -# variables for single and double quote escaping we saved from calls -# to _LT_DECL, we can put quote escaped variables declarations -# into `config.status', and then the shell code to quote escape them in -# for loops in `config.status'. Finally, any additional code accumulated -# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. -m4_defun([_LT_CONFIG_COMMANDS], -[AC_PROVIDE_IFELSE([LT_OUTPUT], - dnl If the libtool generation code has been placed in $CONFIG_LT, - dnl instead of duplicating it all over again into config.status, - dnl then we will have config.status run $CONFIG_LT later, so it - dnl needs to know what name is stored there: - [AC_CONFIG_COMMANDS([libtool], - [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], - dnl If the libtool generation code is destined for config.status, - dnl expand the accumulated commands and init code now: - [AC_CONFIG_COMMANDS([libtool], - [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) -])#_LT_CONFIG_COMMANDS - - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], -[ - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -_LT_CONFIG_STATUS_DECLARATIONS -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# Quote evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Fix-up fallback echo if it was mangled by the above quoting rules. -case \$lt_ECHO in -*'\\\[$]0 --fallback-echo"')dnl " - lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` - ;; -esac - -_LT_OUTPUT_LIBTOOL_INIT -]) - - -# LT_OUTPUT -# --------- -# This macro allows early generation of the libtool script (before -# AC_OUTPUT is called), incase it is used in configure for compilation -# tests. -AC_DEFUN([LT_OUTPUT], -[: ${CONFIG_LT=./config.lt} -AC_MSG_NOTICE([creating $CONFIG_LT]) -cat >"$CONFIG_LT" <<_LTEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate a libtool stub with the current configuration. - -lt_cl_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AS_SHELL_SANITIZE -_AS_PREPARE - -exec AS_MESSAGE_FD>&1 -exec AS_MESSAGE_LOG_FD>>config.log -{ - echo - AS_BOX([Running $as_me.]) -} >&AS_MESSAGE_LOG_FD - -lt_cl_help="\ -\`$as_me' creates a local libtool stub from the current configuration, -for use in further configure time tests before the real libtool is -generated. - -Usage: $[0] [[OPTIONS]] - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - -Report bugs to ." - -lt_cl_version="\ -m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl -m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) -configured by $[0], generated by m4_PACKAGE_STRING. - -Copyright (C) 2008 Free Software Foundation, Inc. -This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." - -while test $[#] != 0 -do - case $[1] in - --version | --v* | -V ) - echo "$lt_cl_version"; exit 0 ;; - --help | --h* | -h ) - echo "$lt_cl_help"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --quiet | --q* | --silent | --s* | -q ) - lt_cl_silent=: ;; - - -*) AC_MSG_ERROR([unrecognized option: $[1] -Try \`$[0] --help' for more information.]) ;; - - *) AC_MSG_ERROR([unrecognized argument: $[1] -Try \`$[0] --help' for more information.]) ;; - esac - shift -done - -if $lt_cl_silent; then - exec AS_MESSAGE_FD>/dev/null -fi -_LTEOF - -cat >>"$CONFIG_LT" <<_LTEOF -_LT_OUTPUT_LIBTOOL_COMMANDS_INIT -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AC_MSG_NOTICE([creating $ofile]) -_LT_OUTPUT_LIBTOOL_COMMANDS -AS_EXIT(0) -_LTEOF -chmod +x "$CONFIG_LT" - -# configure is writing to config.log, but config.lt does its own redirection, -# appending to config.log, which fails on DOS, as config.log is still kept -# open by configure. Here we exec the FD to /dev/null, effectively closing -# config.log, so it can be properly (re)opened and appended to by config.lt. -if test "$no_create" != yes; then - lt_cl_success=: - test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" - exec AS_MESSAGE_LOG_FD>/dev/null - $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false - exec AS_MESSAGE_LOG_FD>>config.log - $lt_cl_success || AS_EXIT(1) -fi -])# LT_OUTPUT - - -# _LT_CONFIG(TAG) -# --------------- -# If TAG is the built-in tag, create an initial libtool script with a -# default configuration from the untagged config vars. Otherwise add code -# to config.status for appending the configuration named by TAG from the -# matching tagged config vars. -m4_defun([_LT_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_CONFIG_SAVE_COMMANDS([ - m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl - m4_if(_LT_TAG, [C], [ - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -_LT_COPYING -_LT_LIBTOOL_TAGS - -# ### BEGIN LIBTOOL CONFIG -_LT_LIBTOOL_CONFIG_VARS -_LT_LIBTOOL_TAG_VARS -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - _LT_PROG_LTMAIN - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - _LT_PROG_XSI_SHELLFNS - - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -], -[cat <<_LT_EOF >> "$ofile" - -dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded -dnl in a comment (ie after a #). -# ### BEGIN LIBTOOL TAG CONFIG: $1 -_LT_LIBTOOL_TAG_VARS(_LT_TAG) -# ### END LIBTOOL TAG CONFIG: $1 -_LT_EOF -])dnl /m4_if -], -[m4_if([$1], [], [ - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile'], []) -])dnl /_LT_CONFIG_SAVE_COMMANDS -])# _LT_CONFIG - - -# LT_SUPPORTED_TAG(TAG) -# --------------------- -# Trace this macro to discover what tags are supported by the libtool -# --tag option, using: -# autoconf --trace 'LT_SUPPORTED_TAG:$1' -AC_DEFUN([LT_SUPPORTED_TAG], []) - - -# C support is built-in for now -m4_define([_LT_LANG_C_enabled], []) -m4_define([_LT_TAGS], []) - - -# LT_LANG(LANG) -# ------------- -# Enable libtool support for the given language if not already enabled. -AC_DEFUN([LT_LANG], -[AC_BEFORE([$0], [LT_OUTPUT])dnl -m4_case([$1], - [C], [_LT_LANG(C)], - [C++], [_LT_LANG(CXX)], - [Java], [_LT_LANG(GCJ)], - [Fortran 77], [_LT_LANG(F77)], - [Fortran], [_LT_LANG(FC)], - [Windows Resource], [_LT_LANG(RC)], - [m4_ifdef([_LT_LANG_]$1[_CONFIG], - [_LT_LANG($1)], - [m4_fatal([$0: unsupported language: "$1"])])])dnl -])# LT_LANG - - -# _LT_LANG(LANGNAME) -# ------------------ -m4_defun([_LT_LANG], -[m4_ifdef([_LT_LANG_]$1[_enabled], [], - [LT_SUPPORTED_TAG([$1])dnl - m4_append([_LT_TAGS], [$1 ])dnl - m4_define([_LT_LANG_]$1[_enabled], [])dnl - _LT_LANG_$1_CONFIG($1)])dnl -])# _LT_LANG - - -# _LT_LANG_DEFAULT_CONFIG -# ----------------------- -m4_defun([_LT_LANG_DEFAULT_CONFIG], -[AC_PROVIDE_IFELSE([AC_PROG_CXX], - [LT_LANG(CXX)], - [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) - -AC_PROVIDE_IFELSE([AC_PROG_F77], - [LT_LANG(F77)], - [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) - -AC_PROVIDE_IFELSE([AC_PROG_FC], - [LT_LANG(FC)], - [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) - -dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal -dnl pulling things in needlessly. -AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([LT_PROG_GCJ], - [LT_LANG(GCJ)], - [m4_ifdef([AC_PROG_GCJ], - [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([A][M_PROG_GCJ], - [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([LT_PROG_GCJ], - [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) - -AC_PROVIDE_IFELSE([LT_PROG_RC], - [LT_LANG(RC)], - [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) -])# _LT_LANG_DEFAULT_CONFIG - -# Obsolete macros: -AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) -AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) -AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) -AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_CXX], []) -dnl AC_DEFUN([AC_LIBTOOL_F77], []) -dnl AC_DEFUN([AC_LIBTOOL_FC], []) -dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) - - -# _LT_TAG_COMPILER -# ---------------- -m4_defun([_LT_TAG_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl -_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl -_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_TAG_COMPILER - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -m4_defun([_LT_COMPILER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -m4_defun([_LT_LINKER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* -])# _LT_LINKER_BOILERPLATE - -# _LT_REQUIRED_DARWIN_CHECKS -# ------------------------- -m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ - case $host_os in - rhapsody* | darwin*) - AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) - AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) - AC_CHECK_TOOL([LIPO], [lipo], [:]) - AC_CHECK_TOOL([OTOOL], [otool], [:]) - AC_CHECK_TOOL([OTOOL64], [otool64], [:]) - _LT_DECL([], [DSYMUTIL], [1], - [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) - _LT_DECL([], [NMEDIT], [1], - [Tool to change global to local symbols on Mac OS X]) - _LT_DECL([], [LIPO], [1], - [Tool to manipulate fat objects and archives on Mac OS X]) - _LT_DECL([], [OTOOL], [1], - [ldd/readelf like tool for Mach-O binaries on Mac OS X]) - _LT_DECL([], [OTOOL64], [1], - [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) - - AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], - [lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi]) - AC_CACHE_CHECK([for -exported_symbols_list linker flag], - [lt_cv_ld_exported_symbols_list], - [lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [lt_cv_ld_exported_symbols_list=yes], - [lt_cv_ld_exported_symbols_list=no]) - LDFLAGS="$save_LDFLAGS" - ]) - case $host_os in - rhapsody* | darwin1.[[012]]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[[012]]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac -]) - - -# _LT_DARWIN_LINKER_FEATURES -# -------------------------- -# Checks for linker and compiler features on darwin -m4_defun([_LT_DARWIN_LINKER_FEATURES], -[ - m4_require([_LT_REQUIRED_DARWIN_CHECKS]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_automatic, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(whole_archive_flag_spec, $1)='' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=echo - _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - m4_if([$1], [CXX], -[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then - _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" - fi -],[]) - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi -]) - -# _LT_SYS_MODULE_PATH_AIX -# ----------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -m4_defun([_LT_SYS_MODULE_PATH_AIX], -[m4_require([_LT_DECL_SED])dnl -AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_SYS_MODULE_PATH_AIX - - -# _LT_SHELL_INIT(ARG) -# ------------------- -m4_define([_LT_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_SHELL_INIT - - -# _LT_PROG_ECHO_BACKSLASH -# ----------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. -m4_defun([_LT_PROG_ECHO_BACKSLASH], -[_LT_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$lt_ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -ECHO=${lt_ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<_LT_EOF -[$]* -_LT_EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$lt_ECHO"; then - if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if { echo_test_string=`eval $cmd`; } 2>/dev/null && - { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null - then - break - fi - done - fi - - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : - else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$ECHO" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - ECHO='print -r' - elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - ECHO='printf %s\n' - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - ECHO="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - ECHO=echo - fi - fi - fi - fi - fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -lt_ECHO=$ECHO -if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(lt_ECHO) -]) -_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], - [An echo program that does not interpret backslashes]) -])# _LT_PROG_ECHO_BACKSLASH - - -# _LT_ENABLE_LOCK -# --------------- -m4_defun([_LT_ENABLE_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AS_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" -])# _LT_ENABLE_LOCK - - -# _LT_CMD_OLD_ARCHIVE -# ------------------- -m4_defun([_LT_CMD_OLD_ARCHIVE], -[AC_CHECK_TOOL(AR, ar, false) -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1]) - -AC_CHECK_TOOL(STRIP, strip, :) -test -z "$STRIP" && STRIP=: -_LT_DECL([], [STRIP], [1], [A symbol stripping program]) - -AC_CHECK_TOOL(RANLIB, ranlib, :) -test -z "$RANLIB" && RANLIB=: -_LT_DECL([], [RANLIB], [1], - [Commands used to install an old-style archive]) - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi -_LT_DECL([], [old_postinstall_cmds], [2]) -_LT_DECL([], [old_postuninstall_cmds], [2]) -_LT_TAGDECL([], [old_archive_cmds], [2], - [Commands used to build an old-style archive]) -])# _LT_CMD_OLD_ARCHIVE - - -# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([_LT_COMPILER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - fi - $RM conftest* -]) - -if test x"[$]$2" = xyes; then - m4_if([$5], , :, [$5]) -else - m4_if([$6], , :, [$6]) -fi -])# _LT_COMPILER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) - - -# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------- -# Check whether the given linker option works -AC_DEFUN([_LT_LINKER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - else - $2=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - m4_if([$4], , :, [$4]) -else - m4_if([$5], , :, [$5]) -fi -])# _LT_LINKER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) - - -# LT_CMD_MAX_LEN -#--------------- -AC_DEFUN([LT_CMD_MAX_LEN], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ - = "XX$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -max_cmd_len=$lt_cv_sys_max_cmd_len -_LT_DECL([], [max_cmd_len], [0], - [What is the maximum length of a command?]) -])# LT_CMD_MAX_LEN - -# Old name: -AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) - - -# _LT_HEADER_DLFCN -# ---------------- -m4_defun([_LT_HEADER_DLFCN], -[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl -])# _LT_HEADER_DLFCN - - -# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ---------------------------------------------------------------- -m4_defun([_LT_TRY_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -[#line __oline__ "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -}] -_LT_EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_dlunknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_TRY_DLOPEN_SELF - - -# LT_SYS_DLOPEN_SELF -# ------------------ -AC_DEFUN([LT_SYS_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -_LT_DECL([dlopen_support], [enable_dlopen], [0], - [Whether dlopen is supported]) -_LT_DECL([dlopen_self], [enable_dlopen_self], [0], - [Whether dlopen of programs is supported]) -_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], - [Whether dlopen of statically linked programs is supported]) -])# LT_SYS_DLOPEN_SELF - -# Old name: -AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) - - -# _LT_COMPILER_C_O([TAGNAME]) -# --------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler. -# This macro does not hard code the compiler like AC_PROG_CC_C_O. -m4_defun([_LT_COMPILER_C_O], -[m4_require([_LT_DECL_SED])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . 2>&AS_MESSAGE_LOG_FD - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* -]) -_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], - [Does compiler simultaneously support -c and -o options?]) -])# _LT_COMPILER_C_O - - -# _LT_COMPILER_FILE_LOCKS([TAGNAME]) -# ---------------------------------- -# Check to see if we can do hard links to lock some files if needed -m4_defun([_LT_COMPILER_FILE_LOCKS], -[m4_require([_LT_ENABLE_LOCK])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_COMPILER_C_O([$1]) - -hard_links="nottested" -if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) -])# _LT_COMPILER_FILE_LOCKS - - -# _LT_CHECK_OBJDIR -# ---------------- -m4_defun([_LT_CHECK_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -_LT_DECL([], [objdir], [0], - [The name of the directory that contains temporary libtool files])dnl -m4_pattern_allow([LT_OBJDIR])dnl -AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", - [Define to the sub-directory in which libtool stores uninstalled libraries.]) -])# _LT_CHECK_OBJDIR - - -# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) -# -------------------------------------- -# Check hardcoding attributes. -m4_defun([_LT_LINKER_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || - test -n "$_LT_TAGVAR(runpath_var, $1)" || - test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || - test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -_LT_TAGDECL([], [hardcode_action], [0], - [How to hardcode a shared library path into an executable]) -])# _LT_LINKER_HARDCODE_LIBPATH - - -# _LT_CMD_STRIPLIB -# ---------------- -m4_defun([_LT_CMD_STRIPLIB], -[m4_require([_LT_DECL_EGREP]) -striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) -_LT_DECL([], [striplib], [1]) -])# _LT_CMD_STRIPLIB - - -# _LT_SYS_DYNAMIC_LINKER([TAG]) -# ----------------------------- -# PORTME Fill in your ld.so characteristics -m4_defun([_LT_SYS_DYNAMIC_LINKER], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_OBJDUMP])dnl -m4_require([_LT_DECL_SED])dnl -AC_MSG_CHECKING([dynamic linker characteristics]) -m4_if([$1], - [], [ -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` - else - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[[lt_foo]]++; } - if (lt_freq[[lt_foo]] == 1) { print lt_foo; } -}'` - sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[[4-9]]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[[45]]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[[123]]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[[01]]* | freebsdelf3.[[01]]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ - freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix[[3-9]]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - -_LT_DECL([], [variables_saved_for_relink], [1], - [Variables whose values should be saved in libtool wrapper scripts and - restored at link time]) -_LT_DECL([], [need_lib_prefix], [0], - [Do we need the "lib" prefix for modules?]) -_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) -_LT_DECL([], [version_type], [0], [Library versioning type]) -_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) -_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) -_LT_DECL([], [shlibpath_overrides_runpath], [0], - [Is shlibpath searched before the hard-coded library search path?]) -_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) -_LT_DECL([], [library_names_spec], [1], - [[List of archive names. First name is the real one, the rest are links. - The last name is the one that the linker finds with -lNAME]]) -_LT_DECL([], [soname_spec], [1], - [[The coded name of the library, if different from the real name]]) -_LT_DECL([], [postinstall_cmds], [2], - [Command to use after installation of a shared archive]) -_LT_DECL([], [postuninstall_cmds], [2], - [Command to use after uninstallation of a shared archive]) -_LT_DECL([], [finish_cmds], [2], - [Commands used to finish a libtool library installation in a directory]) -_LT_DECL([], [finish_eval], [1], - [[As "finish_cmds", except a single script fragment to be evaled but - not shown]]) -_LT_DECL([], [hardcode_into_libs], [0], - [Whether we should hardcode library paths into libraries]) -_LT_DECL([], [sys_lib_search_path_spec], [2], - [Compile-time system search path for libraries]) -_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], - [Run-time system search path for libraries]) -])# _LT_SYS_DYNAMIC_LINKER - - -# _LT_PATH_TOOL_PREFIX(TOOL) -# -------------------------- -# find a file program which can recognize shared library -AC_DEFUN([_LT_PATH_TOOL_PREFIX], -[m4_require([_LT_DECL_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="m4_if([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -_LT_DECL([], [MAGIC_CMD], [0], - [Used to examine libraries when file_magic_cmd begins with "file"])dnl -])# _LT_PATH_TOOL_PREFIX - -# Old name: -AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) - - -# _LT_PATH_MAGIC -# -------------- -# find a file program which can recognize a shared library -m4_defun([_LT_PATH_MAGIC], -[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# _LT_PATH_MAGIC - - -# LT_PATH_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([LT_PATH_LD], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl - -AC_ARG_WITH([gnu-ld], - [AS_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])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 - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[[3-9]]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -_LT_DECL([], [deplibs_check_method], [1], - [Method to check whether dependent libraries are shared objects]) -_LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method == "file_magic"]) -])# _LT_CHECK_MAGIC_METHOD - - -# LT_PATH_NM -# ---------- -# find the pathname to a BSD- or MS-compatible name lister -AC_DEFUN([LT_PATH_NM], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi]) -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) - AC_SUBST([DUMPBIN]) - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm -AC_SUBST([NM]) -_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl - -AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], - [lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) - cat conftest.out >&AS_MESSAGE_LOG_FD - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest*]) -])# LT_PATH_NM - -# Old names: -AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) -AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_PROG_NM], []) -dnl AC_DEFUN([AC_PROG_NM], []) - - -# LT_LIB_M -# -------- -# check for math library -AC_DEFUN([LT_LIB_M], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -AC_SUBST([LIBM]) -])# LT_LIB_M - -# Old name: -AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_CHECK_LIBM], []) - - -# _LT_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------- -m4_defun([_LT_COMPILER_NO_RTTI], -[m4_require([_LT_TAG_COMPILER])dnl - -_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], - [Compiler flag to turn off builtin functions]) -])# _LT_COMPILER_NO_RTTI - - -# _LT_CMD_GLOBAL_SYMBOLS -# ---------------------- -m4_defun([_LT_CMD_GLOBAL_SYMBOLS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_PATH_NM])dnl -AC_REQUIRE([LT_PATH_LD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_TAG_COMPILER])dnl - -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris*) - symcode='[[BDRT]]' - ;; -sco3.2v5*) - symcode='[[DT]]' - ;; -sysv4.2uw2*) - symcode='[[DT]]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[[ABDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK ['"\ -" {last_section=section; section=\$ 3};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx]" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[[]] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi - -_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], - [Take the output of nm and produce a listing of raw symbols and C names]) -_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], - [Transform the output of nm in a proper C declaration]) -_LT_DECL([global_symbol_to_c_name_address], - [lt_cv_sys_global_symbol_to_c_name_address], [1], - [Transform the output of nm in a C name address pair]) -_LT_DECL([global_symbol_to_c_name_address_lib_prefix], - [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], - [Transform the output of nm in a C name address pair when lib prefix is needed]) -]) # _LT_CMD_GLOBAL_SYMBOLS - - -# _LT_COMPILER_PIC([TAGNAME]) -# --------------------------- -m4_defun([_LT_COMPILER_PIC], -[m4_require([_LT_TAG_COMPILER])dnl -_LT_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) -m4_if([$1], [CXX], [ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix[[4-9]]*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - KCC*) - # KAI C++ Compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - ecpc* ) - # old Intel C++ for x86_64 which still supported -KPIC. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - icpc* ) - # Intel C++, used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xlc* | xlC*) - # IBM XL 8.0 on PPC - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd* | netbsdelf*-gnu) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx*) - # Digital/Compaq C++ - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc*) - # Lucid - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - hpux9* | hpux10* | hpux11*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' - _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' - ;; - pgcc* | pgf77* | pgf90* | pgf95*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - ccc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xl*) - # IBM XL C 8.0/Fortran 10.1 on PPC - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' - ;; - esac - ;; - esac - ;; - - newsos6) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - rdos*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - solaris*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac - ;; - - sunos4*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - unicos*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" - ;; -esac -AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], - [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], - [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], - [Additional compiler flags for building library objects]) - -# -# Check to make sure the static flag actually works. -# -wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" -_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], - _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), - $lt_tmp_static_flag, - [], - [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) -_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], - [Compiler flag to prevent dynamic linking]) -])# _LT_COMPILER_PIC - - -# _LT_LINKER_SHLIBS([TAGNAME]) -# ---------------------------- -# See if the linker supports building shared libraries. -m4_defun([_LT_LINKER_SHLIBS], -[AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -m4_if([$1], [CXX], [ - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix[[4-9]]*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw* | cegcc*) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - ;; - linux* | k*bsd*-gnu) - _LT_TAGVAR(link_all_deplibs, $1)=no - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] -], [ - runpath_var= - _LT_TAGVAR(allow_undefined_flag, $1)= - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(archive_cmds, $1)= - _LT_TAGVAR(archive_expsym_cmds, $1)= - _LT_TAGVAR(compiler_needs_object, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(hardcode_automatic, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_TAGVAR(hardcode_libdir_separator, $1)= - _LT_TAGVAR(hardcode_minus_L, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(inherit_rpath, $1)=no - _LT_TAGVAR(link_all_deplibs, $1)=unknown - _LT_TAGVAR(module_cmds, $1)= - _LT_TAGVAR(module_expsym_cmds, $1)= - _LT_TAGVAR(old_archive_from_new_cmds, $1)= - _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_TAGVAR(thread_safe_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. -dnl Note also adjust exclude_expsyms for C++ above. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - linux* | k*bsd*-gnu) - _LT_TAGVAR(link_all_deplibs, $1)=no - ;; - esac - - _LT_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[[3-9]]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag= - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - _LT_TAGVAR(whole_archive_flag_spec, $1)= - tmp_sharedflag='--shared' ;; - xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - sunos4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - _LT_TAGVAR(link_all_deplibs, $1)=no - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - bsdi[[45]]*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE(int foo(void) {}, - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - ) - LDFLAGS="$save_LDFLAGS" - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - solaris*) - _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - fi - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' - ;; - esac - fi - fi -]) -AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) -test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld - -_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl -_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl -_LT_DECL([], [extract_expsyms_cmds], [2], - [The commands to extract the exported symbol list from a shared archive]) - -# -# Do we need to explicitly link libc? -# -case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac - -_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], - [Whether or not to add -lc for building shared libraries]) -_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], - [enable_shared_with_static_runtimes], [0], - [Whether or not to disallow shared libs when runtime libs are static]) -_LT_TAGDECL([], [export_dynamic_flag_spec], [1], - [Compiler flag to allow reflexive dlopens]) -_LT_TAGDECL([], [whole_archive_flag_spec], [1], - [Compiler flag to generate shared objects directly from archives]) -_LT_TAGDECL([], [compiler_needs_object], [1], - [Whether the compiler copes with passing no objects directly]) -_LT_TAGDECL([], [old_archive_from_new_cmds], [2], - [Create an old-style archive from a shared archive]) -_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], - [Create a temporary old-style archive to link instead of a shared archive]) -_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) -_LT_TAGDECL([], [archive_expsym_cmds], [2]) -_LT_TAGDECL([], [module_cmds], [2], - [Commands used to build a loadable module if different from building - a shared archive.]) -_LT_TAGDECL([], [module_expsym_cmds], [2]) -_LT_TAGDECL([], [with_gnu_ld], [1], - [Whether we are building with GNU ld or not]) -_LT_TAGDECL([], [allow_undefined_flag], [1], - [Flag that allows shared libraries with undefined symbols to be built]) -_LT_TAGDECL([], [no_undefined_flag], [1], - [Flag that enforces no undefined symbols]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], - [Flag to hardcode $libdir into a binary during linking. - This must work even if $libdir does not exist]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], - [[If ld is used when linking, flag to hardcode $libdir into a binary - during linking. This must work even if $libdir does not exist]]) -_LT_TAGDECL([], [hardcode_libdir_separator], [1], - [Whether we need a single "-rpath" flag with a separated argument]) -_LT_TAGDECL([], [hardcode_direct], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary]) -_LT_TAGDECL([], [hardcode_direct_absolute], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary and the resulting library dependency is - "absolute", i.e impossible to change by setting ${shlibpath_var} if the - library is relocated]) -_LT_TAGDECL([], [hardcode_minus_L], [0], - [Set to "yes" if using the -LDIR flag during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_shlibpath_var], [0], - [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_automatic], [0], - [Set to "yes" if building a shared library automatically hardcodes DIR - into the library and all subsequent libraries and executables linked - against it]) -_LT_TAGDECL([], [inherit_rpath], [0], - [Set to yes if linker adds runtime paths of dependent libraries - to runtime path list]) -_LT_TAGDECL([], [link_all_deplibs], [0], - [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [fix_srcfile_path], [1], - [Fix the shell variable $srcfile for the compiler]) -_LT_TAGDECL([], [always_export_symbols], [0], - [Set to "yes" if exported symbols are required]) -_LT_TAGDECL([], [export_symbols_cmds], [2], - [The commands to list exported symbols]) -_LT_TAGDECL([], [exclude_expsyms], [1], - [Symbols that should not be listed in the preloaded symbols]) -_LT_TAGDECL([], [include_expsyms], [1], - [Symbols that must always be exported]) -_LT_TAGDECL([], [prelink_cmds], [2], - [Commands necessary for linking programs (against libraries) with templates]) -_LT_TAGDECL([], [file_list_spec], [1], - [Specify filename containing input files]) -dnl FIXME: Not yet implemented -dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], -dnl [Compiler flag to generate thread safe objects]) -])# _LT_LINKER_SHLIBS - - -# _LT_LANG_C_CONFIG([TAG]) -# ------------------------ -# Ensure that the configuration variables for a C compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_C_CONFIG], -[m4_require([_LT_DECL_EGREP])dnl -lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - -_LT_TAG_COMPILER -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - LT_SYS_DLOPEN_SELF - _LT_CMD_STRIPLIB - - # Report which library types will actually be built - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_CONFIG($1) -fi -AC_LANG_POP -CC="$lt_save_CC" -])# _LT_LANG_C_CONFIG - - -# _LT_PROG_CXX -# ------------ -# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ -# compiler, we have our own version here. -m4_defun([_LT_PROG_CXX], -[ -pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) -AC_PROG_CXX -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -else - _lt_caught_CXX_error=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_CXX - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_CXX], []) - - -# _LT_LANG_CXX_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a C++ compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_CXX_CONFIG], -[AC_REQUIRE([_LT_PROG_CXX])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl - -AC_LANG_PUSH(C++) -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(compiler_needs_object, $1)=no -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_caught_CXX_error" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - else - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - fi - - if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - LT_PATH_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - - else - GXX=no - with_gnu_ld=no - wlarc= - fi - - # PORTME: fill in a description of your system's C++ link characteristics - AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) - _LT_TAGVAR(ld_shlibs, $1)=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GXX" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - freebsd[[12]]*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - freebsd-elf*) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - gnu*) - ;; - - hpux9*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - *) - if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' - fi - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) - _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' - _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ - $RANLIB $oldlib' - _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - *) # Version 6 will use weak symbols - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - xl*) - # IBM XL 8.0 on PPC, with GNU ld - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='echo' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - - *nto* | *qnx*) - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - openbsd2*) - # C++ shared libraries are fairly broken - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd=echo - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - case $host in - osf3*) - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - ;; - *) - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ - $RM $lib.exp' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - case $host in - osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(archive_cmds_need_lc,$1)=yes - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - - output_verbose_link_cmd='echo' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' - fi - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) - test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - - _LT_TAGVAR(GCC, $1)="$GXX" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - CC=$lt_save_CC - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test "$_lt_caught_CXX_error" != yes - -AC_LANG_POP -])# _LT_LANG_CXX_CONFIG - - -# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) -# --------------------------------- -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -m4_defun([_LT_SYS_HIDDEN_LIBDEPS], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -# Dependencies to place before and after the object being linked: -_LT_TAGVAR(predep_objects, $1)= -_LT_TAGVAR(postdep_objects, $1)= -_LT_TAGVAR(predeps, $1)= -_LT_TAGVAR(postdeps, $1)= -_LT_TAGVAR(compiler_lib_search_path, $1)= - -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF -int a; -void foo (void) { a = 0; } -_LT_EOF -], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF -], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer*4 a - a=0 - return - end -_LT_EOF -], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer a - a=0 - return - end -_LT_EOF -], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF -public class foo { - private int a; - public void bar (void) { - a = 0; - } -}; -_LT_EOF -]) -dnl Parse the compiler output and extract the necessary -dnl objects, libraries and library flags. -if AC_TRY_EVAL(ac_compile); then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" || - test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" - else - _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$_LT_TAGVAR(postdeps, $1)"; then - _LT_TAGVAR(postdeps, $1)="${prev}${p}" - else - _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$_LT_TAGVAR(predep_objects, $1)"; then - _LT_TAGVAR(predep_objects, $1)="$p" - else - _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" - fi - else - if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then - _LT_TAGVAR(postdep_objects, $1)="$p" - else - _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling $1 test program" -fi - -$RM -f confest.$objext - -# PORTME: override above test on systems where it is broken -m4_if([$1], [CXX], -[case $host_os in -interix[[3-9]]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - _LT_TAGVAR(predep_objects,$1)= - _LT_TAGVAR(postdep_objects,$1)= - _LT_TAGVAR(postdeps,$1)= - ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac -]) - -case " $_LT_TAGVAR(postdeps, $1) " in -*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; -esac - _LT_TAGVAR(compiler_lib_search_dirs, $1)= -if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then - _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` -fi -_LT_TAGDECL([], [compiler_lib_search_dirs], [1], - [The directories searched by this compiler when creating a shared library]) -_LT_TAGDECL([], [predep_objects], [1], - [Dependencies to place before and after the objects being linked to - create a shared library]) -_LT_TAGDECL([], [postdep_objects], [1]) -_LT_TAGDECL([], [predeps], [1]) -_LT_TAGDECL([], [postdeps], [1]) -_LT_TAGDECL([], [compiler_lib_search_path], [1], - [The library search path used internally by the compiler when linking - a shared library]) -])# _LT_SYS_HIDDEN_LIBDEPS - - -# _LT_PROG_F77 -# ------------ -# Since AC_PROG_F77 is broken, in that it returns the empty string -# if there is no fortran compiler, we have our own version here. -m4_defun([_LT_PROG_F77], -[ -pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) -AC_PROG_F77 -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_F77 - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_F77], []) - - -# _LT_LANG_F77_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a Fortran 77 compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_F77_CONFIG], -[AC_REQUIRE([_LT_PROG_F77])dnl -AC_LANG_PUSH(Fortran 77) - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the F77 compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_F77" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - CC=${F77-"f77"} - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - GCC=$G77 - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$G77" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" -fi # test "$_lt_disable_F77" != yes - -AC_LANG_POP -])# _LT_LANG_F77_CONFIG - - -# _LT_PROG_FC -# ----------- -# Since AC_PROG_FC is broken, in that it returns the empty string -# if there is no fortran compiler, we have our own version here. -m4_defun([_LT_PROG_FC], -[ -pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) -AC_PROG_FC -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi -popdef([AC_MSG_ERROR]) -])# _LT_PROG_FC - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([_LT_PROG_FC], []) - - -# _LT_LANG_FC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for a Fortran compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_FC_CONFIG], -[AC_REQUIRE([_LT_PROG_FC])dnl -AC_LANG_PUSH(Fortran) - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for fc test sources. -ac_ext=${ac_fc_srcext-f} - -# Object file extension for compiled fc test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the FC compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_FC" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - CC=${FC-"f95"} - compiler=$CC - GCC=$ac_cv_fc_compiler_gnu - - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" -fi # test "$_lt_disable_FC" != yes - -AC_LANG_POP -])# _LT_LANG_FC_CONFIG - - -# _LT_LANG_GCJ_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Java Compiler compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_GCJ_CONFIG], -[AC_REQUIRE([LT_PROG_GCJ])dnl -AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_GCC=$GCC -GCC=yes -CC=${GCJ-"gcj"} -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" -_LT_CC_BASENAME([$compiler]) - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds - -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC="$lt_save_CC" -])# _LT_LANG_GCJ_CONFIG - - -# _LT_LANG_RC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for the Windows resource compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_RC_CONFIG], -[AC_REQUIRE([LT_PROG_RC])dnl -AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_GCC=$GCC -GCC= -CC=${RC-"windres"} -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) -_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -if test -n "$compiler"; then - : - _LT_CONFIG($1) -fi - -GCC=$lt_save_GCC -AC_LANG_RESTORE -CC="$lt_save_CC" -])# _LT_LANG_RC_CONFIG - - -# LT_PROG_GCJ -# ----------- -AC_DEFUN([LT_PROG_GCJ], -[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], - [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], - [AC_CHECK_TOOL(GCJ, gcj,) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS)])])[]dnl -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_GCJ], []) - - -# LT_PROG_RC -# ---------- -AC_DEFUN([LT_PROG_RC], -[AC_CHECK_TOOL(RC, windres,) -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_RC], []) - - -# _LT_DECL_EGREP -# -------------- -# If we don't have a new enough Autoconf to choose the best grep -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_EGREP], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_REQUIRE([AC_PROG_FGREP])dnl -test -z "$GREP" && GREP=grep -_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) -_LT_DECL([], [EGREP], [1], [An ERE matcher]) -_LT_DECL([], [FGREP], [1], [A literal string matcher]) -dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too -AC_SUBST([GREP]) -]) - - -# _LT_DECL_OBJDUMP -# -------------- -# If we don't have a new enough Autoconf to choose the best objdump -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_OBJDUMP], -[AC_CHECK_TOOL(OBJDUMP, objdump, false) -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) -AC_SUBST([OBJDUMP]) -]) - - -# _LT_DECL_SED -# ------------ -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -m4_defun([_LT_DECL_SED], -[AC_PROG_SED -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" -_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) -_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], - [Sed that helps us avoid accidentally triggering echo(1) options like -n]) -])# _LT_DECL_SED - -m4_ifndef([AC_PROG_SED], [ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # - -m4_defun([AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -IFS=$as_save_IFS -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -]) -SED=$lt_cv_path_SED -AC_SUBST([SED]) -AC_MSG_RESULT([$SED]) -])#AC_PROG_SED -])#m4_ifndef - -# Old name: -AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_SED], []) - - -# _LT_CHECK_SHELL_FEATURES -# ------------------------ -# Find out whether the shell is Bourne or XSI compatible, -# or has some other useful features. -m4_defun([_LT_CHECK_SHELL_FEATURES], -[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -AC_MSG_RESULT([$xsi_shell]) -_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) - -AC_MSG_CHECKING([whether the shell understands "+="]) -lt_shell_append=no -( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -AC_MSG_RESULT([$lt_shell_append]) -_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi -_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac -_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl -_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl -])# _LT_CHECK_SHELL_FEATURES - - -# _LT_PROG_XSI_SHELLFNS -# --------------------- -# Bourne and XSI compatible variants of some useful shell functions. -m4_defun([_LT_PROG_XSI_SHELLFNS], -[case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $[*] )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} - -_LT_EOF - ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} - -dnl func_dirname_and_basename -dnl A portable version of this function is already defined in general.m4sh -dnl so there is no need for it here. - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; - esac -} - -# sed scripts: -my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[[^=]]*=//' - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` -} - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$[@]"` -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` -} - -_LT_EOF -esac - -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]+=\$[2]" -} -_LT_EOF - ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]=\$$[1]\$[2]" -} - -_LT_EOF - ;; - esac -]) - -# Helper functions for option handling. -*- Autoconf -*- -# -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 6 ltoptions.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) - - -# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) -# ------------------------------------------ -m4_define([_LT_MANGLE_OPTION], -[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) - - -# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) -# --------------------------------------- -# Set option OPTION-NAME for macro MACRO-NAME, and if there is a -# matching handler defined, dispatch to it. Other OPTION-NAMEs are -# saved as a flag. -m4_define([_LT_SET_OPTION], -[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl -m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), - _LT_MANGLE_DEFUN([$1], [$2]), - [m4_warning([Unknown $1 option `$2'])])[]dnl -]) - - -# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) -# ------------------------------------------------------------ -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -m4_define([_LT_IF_OPTION], -[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) - - -# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) -# ------------------------------------------------------- -# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME -# are set. -m4_define([_LT_UNLESS_OPTIONS], -[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), - [m4_define([$0_found])])])[]dnl -m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 -])[]dnl -]) - - -# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) -# ---------------------------------------- -# OPTION-LIST is a space-separated list of Libtool options associated -# with MACRO-NAME. If any OPTION has a matching handler declared with -# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about -# the unknown option and exit. -m4_defun([_LT_SET_OPTIONS], -[# Set options -m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [_LT_SET_OPTION([$1], _LT_Option)]) - -m4_if([$1],[LT_INIT],[ - dnl - dnl Simply set some default values (i.e off) if boolean options were not - dnl specified: - _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no - ]) - _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no - ]) - dnl - dnl If no reference was made to various pairs of opposing options, then - dnl we run the default mode handler for the pair. For example, if neither - dnl `shared' nor `disable-shared' was passed, we enable building of shared - dnl archives by default: - _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) - _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], - [_LT_ENABLE_FAST_INSTALL]) - ]) -])# _LT_SET_OPTIONS - - - -# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) -# ----------------------------------------- -m4_define([_LT_MANGLE_DEFUN], -[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) - - -# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) -# ----------------------------------------------- -m4_define([LT_OPTION_DEFINE], -[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl -])# LT_OPTION_DEFINE - - -# dlopen -# ------ -LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes -]) - -AU_DEFUN([AC_LIBTOOL_DLOPEN], -[_LT_SET_OPTION([LT_INIT], [dlopen]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `dlopen' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) - - -# win32-dll -# --------- -# Declare package support for building win32 dll's. -LT_OPTION_DEFINE([LT_INIT], [win32-dll], -[enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -esac - -test -z "$AS" && AS=as -_LT_DECL([], [AS], [0], [Assembler program])dnl - -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl - -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl -])# win32-dll - -AU_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -_LT_SET_OPTION([LT_INIT], [win32-dll]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `win32-dll' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) - - -# _LT_ENABLE_SHARED([DEFAULT]) -# ---------------------------- -# implement the --enable-shared flag, and supports the `shared' and -# `disable-shared' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_SHARED], -[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([shared], - [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) - - _LT_DECL([build_libtool_libs], [enable_shared], [0], - [Whether or not to build shared libraries]) -])# _LT_ENABLE_SHARED - -LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) -]) - -AC_DEFUN([AC_DISABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], [disable-shared]) -]) - -AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_SHARED], []) -dnl AC_DEFUN([AM_DISABLE_SHARED], []) - - - -# _LT_ENABLE_STATIC([DEFAULT]) -# ---------------------------- -# implement the --enable-static flag, and support the `static' and -# `disable-static' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_STATIC], -[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([static], - [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]_LT_ENABLE_STATIC_DEFAULT) - - _LT_DECL([build_old_libs], [enable_static], [0], - [Whether or not to build static libraries]) -])# _LT_ENABLE_STATIC - -LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) -]) - -AC_DEFUN([AC_DISABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], [disable-static]) -]) - -AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_STATIC], []) -dnl AC_DEFUN([AM_DISABLE_STATIC], []) - - - -# _LT_ENABLE_FAST_INSTALL([DEFAULT]) -# ---------------------------------- -# implement the --enable-fast-install flag, and support the `fast-install' -# and `disable-fast-install' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_FAST_INSTALL], -[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([fast-install], - [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) - -_LT_DECL([fast_install], [enable_fast_install], [0], - [Whether or not to optimize for fast installation])dnl -])# _LT_ENABLE_FAST_INSTALL - -LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) - -# Old names: -AU_DEFUN([AC_ENABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `fast-install' option into LT_INIT's first parameter.]) -]) - -AU_DEFUN([AC_DISABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `disable-fast-install' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) -dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) - - -# _LT_WITH_PIC([MODE]) -# -------------------- -# implement the --with-pic flag, and support the `pic-only' and `no-pic' -# LT_INIT options. -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -m4_define([_LT_WITH_PIC], -[AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) - -test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) - -_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl -])# _LT_WITH_PIC - -LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) - -# Old name: -AU_DEFUN([AC_LIBTOOL_PICMODE], -[_LT_SET_OPTION([LT_INIT], [pic-only]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `pic-only' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) - - -m4_define([_LTDL_MODE], []) -LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], - [m4_define([_LTDL_MODE], [nonrecursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [recursive], - [m4_define([_LTDL_MODE], [recursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [subproject], - [m4_define([_LTDL_MODE], [subproject])]) - -m4_define([_LTDL_TYPE], []) -LT_OPTION_DEFINE([LTDL_INIT], [installable], - [m4_define([_LTDL_TYPE], [installable])]) -LT_OPTION_DEFINE([LTDL_INIT], [convenience], - [m4_define([_LTDL_TYPE], [convenience])]) - -# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 6 ltsugar.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) - - -# lt_join(SEP, ARG1, [ARG2...]) -# ----------------------------- -# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their -# associated separator. -# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier -# versions in m4sugar had bugs. -m4_define([lt_join], -[m4_if([$#], [1], [], - [$#], [2], [[$2]], - [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) -m4_define([_lt_join], -[m4_if([$#$2], [2], [], - [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) - - -# lt_car(LIST) -# lt_cdr(LIST) -# ------------ -# Manipulate m4 lists. -# These macros are necessary as long as will still need to support -# Autoconf-2.59 which quotes differently. -m4_define([lt_car], [[$1]]) -m4_define([lt_cdr], -[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], - [$#], 1, [], - [m4_dquote(m4_shift($@))])]) -m4_define([lt_unquote], $1) - - -# lt_append(MACRO-NAME, STRING, [SEPARATOR]) -# ------------------------------------------ -# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. -# Note that neither SEPARATOR nor STRING are expanded; they are appended -# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). -# No SEPARATOR is output if MACRO-NAME was previously undefined (different -# than defined and empty). -# -# This macro is needed until we can rely on Autoconf 2.62, since earlier -# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. -m4_define([lt_append], -[m4_define([$1], - m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) - - - -# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) -# ---------------------------------------------------------- -# Produce a SEP delimited list of all paired combinations of elements of -# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list -# has the form PREFIXmINFIXSUFFIXn. -# Needed until we can rely on m4_combine added in Autoconf 2.62. -m4_define([lt_combine], -[m4_if(m4_eval([$# > 3]), [1], - [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl -[[m4_foreach([_Lt_prefix], [$2], - [m4_foreach([_Lt_suffix], - ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, - [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) - - -# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) -# ----------------------------------------------------------------------- -# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited -# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. -m4_define([lt_if_append_uniq], -[m4_ifdef([$1], - [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], - [lt_append([$1], [$2], [$3])$4], - [$5])], - [lt_append([$1], [$2], [$3])$4])]) - - -# lt_dict_add(DICT, KEY, VALUE) -# ----------------------------- -m4_define([lt_dict_add], -[m4_define([$1($2)], [$3])]) - - -# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) -# -------------------------------------------- -m4_define([lt_dict_add_subkey], -[m4_define([$1($2:$3)], [$4])]) - - -# lt_dict_fetch(DICT, KEY, [SUBKEY]) -# ---------------------------------- -m4_define([lt_dict_fetch], -[m4_ifval([$3], - m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), - m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) - - -# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) -# ----------------------------------------------------------------- -m4_define([lt_if_dict_fetch], -[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], - [$5], - [$6])]) - - -# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) -# -------------------------------------------------------------- -m4_define([lt_dict_filter], -[m4_if([$5], [], [], - [lt_join(m4_quote(m4_default([$4], [[, ]])), - lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), - [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl -]) - -# ltversion.m4 -- version numbers -*- Autoconf -*- -# -# Copyright (C) 2004 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# Generated from ltversion.in. - -# serial 3017 ltversion.m4 -# This file is part of GNU Libtool - -m4_define([LT_PACKAGE_VERSION], [2.2.6b]) -m4_define([LT_PACKAGE_REVISION], [1.3017]) - -AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.2.6b' -macro_revision='1.3017' -_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) -_LT_DECL(, macro_revision, 0) -]) - -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 4 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) - -# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -# (This private macro should not be called outside this file.) -AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.11' -dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to -dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.11.1], [], - [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl -]) - -# _AM_AUTOCONF_VERSION(VERSION) -# ----------------------------- -# aclocal traces this macro to find the Autoconf version. -# This is a private macro too. Using m4_define simplifies -# the logic in aclocal, which can simply ignore this definition. -m4_define([_AM_AUTOCONF_VERSION], []) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. -# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.11.1])dnl -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001, 2003, 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. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 -# 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. - -# serial 9 - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE])dnl -AC_SUBST([$1_FALSE])dnl -_AM_SUBST_NOTMAKE([$1_TRUE])dnl -_AM_SUBST_NOTMAKE([$1_FALSE])dnl -m4_define([_AM_COND_VALUE_$1], [$2])dnl -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([[conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]]) -fi])]) - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 -# 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. - -# serial 10 - -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], UPC, [depcc="$UPC" am_compiler_list=], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - am__universal=false - m4_case([$1], [CC], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac], - [CXX], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac]) - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH])dnl -_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 -# 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. - -#serial 5 - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[{ - # Autoconf 2.62 quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2008, 2009 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. - -# serial 16 - -# This macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.62])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl -dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, - [m4_fatal([AC_INIT should be called with package and version arguments])])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) -AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AM_PROG_MKDIR_P])dnl -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES(OBJC)], - [define([AC_PROG_OBJC], - defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl -]) -_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl -dnl The `parallel-tests' driver may need to know about EXEEXT, so add the -dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro -dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. -AC_CONFIG_COMMANDS_PRE(dnl -[m4_provide_if([_AM_COMPILER_EXEEXT], - [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl -]) - -dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not -dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further -dnl mangled by Autoconf and run in a shell conditional statement. -m4_define([_AC_COMPILER_EXEEXT], -m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) - - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_arg=$1 -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) - -# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi -AC_SUBST(install_sh)]) - -# Copyright (C) 2003, 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. - -# serial 2 - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005, 2009 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. - -# serial 4 - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# 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. - -# serial 6 - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005, 2008 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. - -# serial 4 - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# ------------------------------ -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) - -# _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 -# 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. - -# serial 5 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[[\\\"\#\$\&\'\`$am_lf]]*) - AC_MSG_ERROR([unsafe absolute working directory name]);; -esac -case $srcdir in - *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; -esac - -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - -# Copyright (C) 2001, 2003, 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. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor `install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Copyright (C) 2006, 2008 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. - -# serial 2 - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Public sister of _AM_SUBST_NOTMAKE. -AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004, 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. - -# serial 2 - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) -m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir - -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/apps/Makefile.am b/Src/Plugins/DSP/sc_serv3/GeoIP/apps/Makefile.am deleted file mode 100644 index 46cf501f..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/apps/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir)/libGeoIP \ - -Wall - -AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" -Wall - -DEPS = $(top_builddir)/libGeoIP/libGeoIP.la -LDADDS = $(top_builddir)/libGeoIP/libGeoIP.la - -bin_PROGRAMS = geoiplookup geoiplookup6 geoipupdate - -geoiplookup_SOURCES = geoiplookup.c -geoiplookup_LDFLAGS = -geoiplookup_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la -geoiplookup_LDADD = $(top_builddir)/libGeoIP/libGeoIP.la - -geoiplookup6_SOURCES = geoiplookup6.c -geoiplookup6_LDFLAGS = -geoiplookup6_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la -geoiplookup6_LDADD = $(top_builddir)/libGeoIP/libGeoIP.la - -geoipupdate_SOURCES = geoipupdate.c -geoipupdate_LDFLAGS = -geoipupdate_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la $(top_builddir)/libGeoIP/libGeoIPUpdate.la -geoipupdate_LDADD = $(top_builddir)/libGeoIP/libGeoIPUpdate.la $(top_builddir)/libGeoIP/libGeoIP.la -EXTRA_DIST = geoipupdate-pureperl.pl Makefile.vc diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/apps/Makefile.in b/Src/Plugins/DSP/sc_serv3/GeoIP/apps/Makefile.in deleted file mode 100644 index 934f6b6a..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/apps/Makefile.in +++ /dev/null @@ -1,544 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in 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. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -bin_PROGRAMS = geoiplookup$(EXEEXT) geoiplookup6$(EXEEXT) \ - geoipupdate$(EXEEXT) -subdir = apps -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -PROGRAMS = $(bin_PROGRAMS) -am_geoiplookup_OBJECTS = geoiplookup.$(OBJEXT) -geoiplookup_OBJECTS = $(am_geoiplookup_OBJECTS) -geoiplookup_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(geoiplookup_LDFLAGS) $(LDFLAGS) -o $@ -am_geoiplookup6_OBJECTS = geoiplookup6.$(OBJEXT) -geoiplookup6_OBJECTS = $(am_geoiplookup6_OBJECTS) -geoiplookup6_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(geoiplookup6_LDFLAGS) $(LDFLAGS) -o $@ -am_geoipupdate_OBJECTS = geoipupdate.$(OBJEXT) -geoipupdate_OBJECTS = $(am_geoipupdate_OBJECTS) -geoipupdate_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(geoipupdate_LDFLAGS) $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(geoiplookup_SOURCES) $(geoiplookup6_SOURCES) \ - $(geoipupdate_SOURCES) -DIST_SOURCES = $(geoiplookup_SOURCES) $(geoiplookup6_SOURCES) \ - $(geoipupdate_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -INCLUDES = \ - -I$(top_srcdir)/libGeoIP \ - -Wall - -AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" -Wall -DEPS = $(top_builddir)/libGeoIP/libGeoIP.la -LDADDS = $(top_builddir)/libGeoIP/libGeoIP.la -geoiplookup_SOURCES = geoiplookup.c -geoiplookup_LDFLAGS = -geoiplookup_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la -geoiplookup_LDADD = $(top_builddir)/libGeoIP/libGeoIP.la -geoiplookup6_SOURCES = geoiplookup6.c -geoiplookup6_LDFLAGS = -geoiplookup6_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la -geoiplookup6_LDADD = $(top_builddir)/libGeoIP/libGeoIP.la -geoipupdate_SOURCES = geoipupdate.c -geoipupdate_LDFLAGS = -geoipupdate_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la $(top_builddir)/libGeoIP/libGeoIPUpdate.la -geoipupdate_LDADD = $(top_builddir)/libGeoIP/libGeoIPUpdate.la $(top_builddir)/libGeoIP/libGeoIP.la -EXTRA_DIST = geoipupdate-pureperl.pl Makefile.vc -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu apps/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu apps/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p || test -f $$p1; \ - then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -geoiplookup$(EXEEXT): $(geoiplookup_OBJECTS) $(geoiplookup_DEPENDENCIES) - @rm -f geoiplookup$(EXEEXT) - $(geoiplookup_LINK) $(geoiplookup_OBJECTS) $(geoiplookup_LDADD) $(LIBS) -geoiplookup6$(EXEEXT): $(geoiplookup6_OBJECTS) $(geoiplookup6_DEPENDENCIES) - @rm -f geoiplookup6$(EXEEXT) - $(geoiplookup6_LINK) $(geoiplookup6_OBJECTS) $(geoiplookup6_LDADD) $(LIBS) -geoipupdate$(EXEEXT): $(geoipupdate_OBJECTS) $(geoipupdate_DEPENDENCIES) - @rm -f geoipupdate$(EXEEXT) - $(geoipupdate_LINK) $(geoipupdate_OBJECTS) $(geoipupdate_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geoiplookup.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geoiplookup6.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geoipupdate.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-binPROGRAMS - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool ctags distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-binPROGRAMS - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/apps/Makefile.vc b/Src/Plugins/DSP/sc_serv3/GeoIP/apps/Makefile.vc deleted file mode 100644 index 266a9319..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/apps/Makefile.vc +++ /dev/null @@ -1,25 +0,0 @@ -#NMAKE makefile for Windows developers. -#Produces a static library (GeoIP.lib). - -COMPILER=cl - -LINK = link -nologo - -CFLAGS=-DWIN32 -MD -nologo - -GEOIPINC = -I..\libGeoIP - -CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) - -GEOIPLIB = ..\libGeoIP\GeoIP.lib - -EXTRA_LIBS= advapi32.lib wsock32.lib - -AR=lib - -APPS: geoiplookup.exe - -geoiplookup.exe: geoiplookup.c - $(CC1) -c geoiplookup.c - $(LINK) geoiplookup.obj $(GEOIPLIB) - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/apps/geoiplookup.c b/Src/Plugins/DSP/sc_serv3/GeoIP/apps/geoiplookup.c deleted file mode 100644 index bd3c6fca..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/apps/geoiplookup.c +++ /dev/null @@ -1,401 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ -/* geoiplookup.c - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "GeoIP.h" -#include "GeoIPCity.h" -#include "GeoIP_internal.h" - -#if defined(_WIN32) -# ifndef uint32_t -typedef unsigned int uint32_t; -# endif -#endif - -void geoiplookup(GeoIP* gi,char *hostname,int i); - -void usage() { - fprintf(stderr,"Usage: geoiplookup [-d custom_dir] [-f custom_file] [-v] [-i] \n"); -} - -/* extra info used in _say_range_ip */ -int info_flag = 0; - -int main (int argc, char *argv[]) { - char * hostname = NULL; - char * db_info; - GeoIP * gi; - int i; - char *custom_directory = NULL; - char *custom_file = NULL; - int version_flag = 0; - - if (argc < 2) { - usage(); - exit(1); - } - i = 1; - while (i < argc) { - if (strcmp(argv[i],"-v") == 0) { - version_flag = 1; - } else if (strcmp(argv[i],"-i") == 0) { - info_flag = 1; - } else if (strcmp(argv[i],"-f") == 0) { - if ((i+1) < argc){ - i++; - custom_file = argv[i]; - } - } else if (strcmp(argv[i],"-d") == 0) { - if ((i+1) < argc){ - i++; - custom_directory = argv[i]; - } - } else { - hostname = argv[i]; - } - i++; - } - if (hostname == NULL) { - usage(); - exit(1); - } - - if (custom_directory != NULL) { - GeoIP_setup_custom_directory(custom_directory); - } - _GeoIP_setup_dbfilename(); - - if (custom_file != NULL) { - gi = GeoIP_open(custom_file, GEOIP_STANDARD); - - if (NULL == gi) { - printf("%s not available, skipping...\n", custom_file); - } else { - i = GeoIP_database_edition(gi); - if (version_flag == 1) { - db_info = GeoIP_database_info(gi); - printf("%s: %s\n",GeoIPDBDescription[i],db_info == NULL ? "": db_info ); - free(db_info); - } else { - geoiplookup(gi,hostname,i); - } - } - GeoIP_delete(gi); - } else { - /* iterate through different database types */ - for (i = 0; i < NUM_DB_TYPES; ++i) { - if (GeoIP_db_avail(i)) { - gi = GeoIP_open_type(i, GEOIP_STANDARD); - if (NULL == gi) { - printf("%s not available, skipping...\n", GeoIPDBDescription[i]); - } else { - if (version_flag == 1) { - db_info = GeoIP_database_info(gi); - printf("%s: %s\n",GeoIPDBDescription[i], db_info == NULL ? "" : db_info ); - free(db_info); - } else { - geoiplookup(gi,hostname,i); - } - } - GeoIP_delete(gi); - } - } - } - return 0; -} - -static const char * _mk_NA( const char * p ){ - return p ? p : "N/A"; -} - -static void _mk_conf_str( unsigned char val , char * to, int size){ - if ( ( val & 0x7f ) == 0x7f ){ - snprintf(to, 5, "N/A"); - return; - } - snprintf(to, 5, "%d", val); - return; -} - -static unsigned long -__addr_to_num(const char *addr) -{ - unsigned int c, octet, t; - unsigned long ipnum; - int i = 3; - - octet = ipnum = 0; - while ((c = *addr++)) { - if (c == '.') { - if (octet > 255) - return 0; - ipnum <<= 8; - ipnum += octet; - i--; - octet = 0; - } else { - t = octet; - octet <<= 3; - octet += t; - octet += t; - c -= '0'; - if (c > 9) - return 0; - octet += c; - } - } - if ((octet > 255) || (i != 0)) - return 0; - ipnum <<= 8; - return ipnum + octet; -} - - - -/* ptr must be a memory area with at least 16 bytes */ -static char *__num_to_addr_r (unsigned long ipnum, char * ptr) { - char *cur_str; - int octet[4]; - int num_chars_written, i; - - cur_str = ptr; - - for (i = 0; i<4; i++) { - octet[3 - i] = ipnum % 256; - ipnum >>= 8; - } - - for (i = 0; i<4; i++) { - num_chars_written = sprintf(cur_str, "%d", octet[i]); - cur_str += num_chars_written; - - if (i < 3) { - cur_str[0] = '.'; - cur_str++; - } - } - - return ptr; -} - -void _say_range_by_ip(GeoIP * gi, uint32_t ipnum ) { - unsigned long last_nm, mask, low, hi; - char ipaddr[16]; - char tmp[16]; - char ** range; - - if ( info_flag == 0 ) - return; /* noop unless extra information is requested */ - - range = GeoIP_range_by_ip( gi, __num_to_addr_r( ipnum, ipaddr ) ); - if ( range == NULL ) - return; - - printf ( " ipaddr: %s\n", ipaddr ); - - printf( " range_by_ip: %s - %s\n", range[0], range[1] ); - last_nm = GeoIP_last_netmask(gi); - mask = 0xffffffff << ( 32 - last_nm ); - low = ipnum & mask; - hi = low + ( 0xffffffff & ~mask ); - printf( " network: %s - %s ::%ld\n", - __num_to_addr_r( low, ipaddr ), - __num_to_addr_r( hi, tmp ), - last_nm - ); - printf( " ipnum: %u\n", ipnum ); - printf( " range_by_num: %lu - %lu\n", __addr_to_num(range[0]), __addr_to_num(range[1]) ); - printf( " network num: %lu - %lu ::%lu\n", low, hi, last_nm ); - - GeoIP_range_by_ip_delete(range); -} - -void -geoiplookup(GeoIP * gi, char *hostname, int i) -{ - const char *country_code; - const char *country_name; - const char *domain_name; - const char *asnum_name; - int netspeed; - int country_id; - GeoIPRegion *region; - GeoIPRecord *gir; - const char *org; - uint32_t ipnum; - - ipnum = _GeoIP_lookupaddress(hostname); - if (ipnum == 0) { - printf("%s: can't resolve hostname ( %s )\n", GeoIPDBDescription[i], hostname); - - } - else { - - if (GEOIP_DOMAIN_EDITION == i) { - domain_name = GeoIP_name_by_ipnum(gi, ipnum); - if (domain_name == NULL) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s\n", GeoIPDBDescription[i], domain_name); - _say_range_by_ip(gi, ipnum); - } - } - else if (GEOIP_LOCATIONA_EDITION == i || GEOIP_ACCURACYRADIUS_EDITION == i || GEOIP_ASNUM_EDITION == i || GEOIP_USERTYPE_EDITION == i || GEOIP_REGISTRAR_EDITION == i || GEOIP_NETSPEED_EDITION_REV1 == i ) { - asnum_name = GeoIP_name_by_ipnum(gi, ipnum); - if (asnum_name == NULL) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s\n", GeoIPDBDescription[i], asnum_name); - _say_range_by_ip(gi, ipnum); - } - } - else if (GEOIP_COUNTRY_EDITION == i) { - country_id = GeoIP_id_by_ipnum(gi, ipnum); - country_code = GeoIP_country_code[country_id]; - country_name = GeoIP_country_name[country_id]; - if (country_id == 0) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s, %s\n", GeoIPDBDescription[i], country_code, country_name); - _say_range_by_ip(gi, ipnum); - } - } - else if (GEOIP_REGION_EDITION_REV0 == i || GEOIP_REGION_EDITION_REV1 == i) { - region = GeoIP_region_by_ipnum(gi, ipnum); - if (NULL == region || region->country_code[0] == '\0' ) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s, %s\n", GeoIPDBDescription[i], region->country_code, region->region); - _say_range_by_ip(gi, ipnum); - GeoIPRegion_delete(region); - } - } - else if (GEOIP_CITY_EDITION_REV0 == i) { - gir = GeoIP_record_by_ipnum(gi, ipnum); - if (NULL == gir) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s, %s, %s, %s, %f, %f\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region), - _mk_NA(gir->city), _mk_NA(gir->postal_code), gir->latitude, gir->longitude); - _say_range_by_ip(gi, ipnum); - GeoIPRecord_delete(gir); - } - } - else if (GEOIP_CITY_EDITION_REV1 == i) { - gir = GeoIP_record_by_ipnum(gi, ipnum); - if (NULL == gir) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s, %s, %s, %s, %f, %f, %d, %d\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region), _mk_NA(gir->city), _mk_NA(gir->postal_code), - gir->latitude, gir->longitude, gir->metro_code, gir->area_code); - _say_range_by_ip(gi, ipnum); - GeoIPRecord_delete(gir); - } - } - else if (GEOIP_CITYCONFIDENCE_EDITION == i) { - gir = GeoIP_record_by_ipnum(gi, ipnum); - if (NULL == gir) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - char country_str[5], region_str[5], city_str[5], postal_str[5]; - _mk_conf_str(gir->country_conf, country_str, 5); - _mk_conf_str(gir->region_conf, region_str, 5); - _mk_conf_str(gir->city_conf, city_str, 5); - _mk_conf_str(gir->postal_conf, postal_str, 5); - - printf("%s: %s, %s, %s, %s, %f, %f, %d, %d, %s, %s, %s, %s\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region), _mk_NA(gir->city), _mk_NA(gir->postal_code), - gir->latitude, gir->longitude, gir->metro_code, gir->area_code, - country_str, region_str, city_str, postal_str - ); - _say_range_by_ip(gi, ipnum); - GeoIPRecord_delete(gir); - } - } - else if (GEOIP_CITYCONFIDENCEDIST_EDITION == i) { - gir = GeoIP_record_by_ipnum(gi, ipnum); - if (NULL == gir) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - char country_str[5], region_str[5], city_str[5], postal_str[5], accuracy_radius_str[5]; - _mk_conf_str(gir->country_conf, country_str, 5); - _mk_conf_str(gir->region_conf, region_str, 5); - _mk_conf_str(gir->city_conf, city_str, 5); - _mk_conf_str(gir->postal_conf, postal_str, 5); - if (gir->accuracy_radius != 1023){ - sprintf(accuracy_radius_str, "%d", gir->accuracy_radius ); -} else { - strcpy(accuracy_radius_str,"N/A");} - - printf("%s: %s, %s, %s, %s, %f, %f, %d, %d, %s, %s, %s, %s, %s\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region), _mk_NA(gir->city), _mk_NA(gir->postal_code), - gir->latitude, gir->longitude, gir->metro_code, gir->area_code, - country_str, region_str, city_str, postal_str, accuracy_radius_str - ); - _say_range_by_ip(gi, ipnum); - GeoIPRecord_delete(gir); - } - } - else if (GEOIP_ORG_EDITION == i || GEOIP_ISP_EDITION == i) { - org = GeoIP_org_by_ipnum(gi, ipnum); - if (org == NULL) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s\n", GeoIPDBDescription[i], org); - _say_range_by_ip(gi, ipnum); - } - } - else if (GEOIP_NETSPEED_EDITION == i) { - netspeed = GeoIP_id_by_ipnum(gi, ipnum); - if (netspeed == GEOIP_UNKNOWN_SPEED) { - printf("%s: Unknown\n", GeoIPDBDescription[i]); - } - else if (netspeed == GEOIP_DIALUP_SPEED) { - printf("%s: Dialup\n", GeoIPDBDescription[i]); - } - else if (netspeed == GEOIP_CABLEDSL_SPEED) { - printf("%s: Cable/DSL\n", GeoIPDBDescription[i]); - } - else if (netspeed == GEOIP_CORPORATE_SPEED) { - printf("%s: Corporate\n", GeoIPDBDescription[i]); - } - _say_range_by_ip(gi, ipnum); - } - else { - - /* - * Silent ignore IPv6 databases. Otherwise we get annoying - * messages whenever we have a mixed environment IPv4 and - * IPv6 - */ - - /* - * printf("Can not handle database type -- try geoiplookup6\n"); - */ - ; - } - } -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/apps/geoiplookup6.c b/Src/Plugins/DSP/sc_serv3/GeoIP/apps/geoiplookup6.c deleted file mode 100644 index dc0ff9ba..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/apps/geoiplookup6.c +++ /dev/null @@ -1,255 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ -/* geoiplookup.c - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -void geoiplookup(GeoIP* gi,char *hostname,int i); - -void usage() { - fprintf(stderr,"Usage: geoiplookup [-d custom_dir] [-f custom_file] [-v] \n"); -} - -int main (int argc, char *argv[]) { - char * hostname = NULL; - char * db_info; - GeoIP * gi; - int i; - char *custom_directory = NULL; - char *custom_file = NULL; - int version_flag = 0; - - if (argc < 2) { - usage(); - exit(1); - } - i = 1; - while (i < argc) { - if (strcmp(argv[i],"-v") == 0) { - version_flag = 1; - } else if (strcmp(argv[i],"-f") == 0) { - if ((i+1) < argc){ - i++; - custom_file = argv[i]; - } - } else if (strcmp(argv[i],"-d") == 0) { - if ((i+1) < argc){ - i++; - custom_directory = argv[i]; - } - } else { - hostname = argv[i]; - } - i++; - } - if (hostname == NULL) { - usage(); - exit(1); - } - - if (custom_directory != NULL) { - GeoIP_setup_custom_directory(custom_directory); - } - _GeoIP_setup_dbfilename(); - - if (custom_file != NULL) { - gi = GeoIP_open(custom_file, GEOIP_STANDARD); - if (NULL == gi) { - printf("%s not available, skipping...\n", custom_file); - } else { - i = GeoIP_database_edition(gi); - if (version_flag == 1) { - db_info = GeoIP_database_info(gi); - printf("%s: %s\n",GeoIPDBDescription[i],db_info == NULL ? "": db_info ); - free(db_info); - } else { - geoiplookup(gi,hostname,i); - } - } - GeoIP_delete(gi); - } else { - /* iterate through different database types */ - for (i = 0; i < NUM_DB_TYPES; ++i) { - if (GeoIP_db_avail(i)) { - gi = GeoIP_open_type(i, GEOIP_STANDARD); - if (NULL == gi) { - printf("%s not available, skipping...\n", GeoIPDBDescription[i]); - } else { - if (version_flag == 1) { - db_info = GeoIP_database_info(gi); - printf("%s: %s\n",GeoIPDBDescription[i],db_info); - free(db_info); - } else { - geoiplookup(gi,hostname,i); - } - } - GeoIP_delete(gi); - } - } - } - return 0; -} - -static const char * _mk_NA( const char * p ){ - return p ? p : "N/A"; -} - -void -geoiplookup(GeoIP * gi, char *hostname, int i) -{ - const char *country_code; - const char *country_name; - const char *domain_name; - const char *asnum_name; - int netspeed; - int country_id; - GeoIPRegion *region; - GeoIPRecord *gir; - const char *org; - - geoipv6_t ipnum; - ipnum = _GeoIP_lookupaddress_v6(hostname); - if (__GEOIP_V6_IS_NULL(ipnum)) { - printf("%s: can't resolve hostname ( %s )\n", GeoIPDBDescription[i], hostname); - - } - else { - - -#if 0 - if (GEOIP_DOMAIN_EDITION_V6 == i) { - domain_name = GeoIP_name_by_name_v6(gi, hostname); - if (domain_name == NULL) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s\n", GeoIPDBDescription[i], domain_name); - } - } -#endif - - - - if (GEOIP_LOCATIONA_EDITION_V6 == i || GEOIP_ASNUM_EDITION_V6 == i || GEOIP_USERTYPE_EDITION_V6 == i || GEOIP_REGISTRAR_EDITION_V6 == i || GEOIP_DOMAIN_EDITION_V6 == i || GEOIP_ORG_EDITION_V6 == i || GEOIP_ISP_EDITION_V6 == i || GEOIP_NETSPEED_EDITION_REV1_V6 == i ) { - asnum_name = GeoIP_name_by_ipnum_v6(gi, ipnum); - if (asnum_name == NULL) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s\n", GeoIPDBDescription[i], asnum_name); - // _say_range_by_ip(gi, ipnum); - } - } - - else if (GEOIP_CITY_EDITION_REV0_V6 == i) { - gir = GeoIP_record_by_name_v6(gi, hostname); - if (NULL == gir) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s, %s, %s, %s, %f, %f\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region), - _mk_NA(gir->city), _mk_NA(gir->postal_code), gir->latitude, gir->longitude); - } - } - else if (GEOIP_CITY_EDITION_REV1_V6 == i) { - gir = GeoIP_record_by_name_v6(gi, hostname); - if (NULL == gir) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s, %s, %s, %s, %f, %f, %d, %d\n", GeoIPDBDescription[i], gir->country_code, _mk_NA(gir->region), _mk_NA(gir->city), _mk_NA(gir->postal_code), - gir->latitude, gir->longitude, gir->metro_code, gir->area_code); - } - } - - else if (GEOIP_COUNTRY_EDITION_V6 == i) { - - country_id = GeoIP_id_by_ipnum_v6(gi, ipnum); - country_code = GeoIP_country_code[country_id]; - country_name = GeoIP_country_name[country_id]; - if (country_id == 0) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s, %s\n", GeoIPDBDescription[i], country_code, country_name); - } - } - } - -#if 0 - - else - if (GEOIP_REGION_EDITION_REV0 == i || GEOIP_REGION_EDITION_REV1 == i) { - region = GeoIP_region_by_name_v6(gi, hostname); - if (NULL == region) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s, %s\n", GeoIPDBDescription[i], region->country_code, region->region); - } - } - else if (GEOIP_CITY_EDITION_REV0 == i) { - gir = GeoIP_record_by_name(gi, hostname); - if (NULL == gir) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s, %s, %s, %s, %f, %f\n", GeoIPDBDescription[i], gir->country_code, gir->region, - gir->city, gir->postal_code, gir->latitude, gir->longitude); - } - } - else if (GEOIP_CITY_EDITION_REV1 == i) { - gir = GeoIP_record_by_name(gi, hostname); - if (NULL == gir) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s, %s, %s, %s, %f, %f, %d, %d\n", GeoIPDBDescription[i], gir->country_code, gir->region, gir->city, gir->postal_code, - gir->latitude, gir->longitude, gir->metro_code, gir->area_code); - } - } - else if (GEOIP_ORG_EDITION == i || GEOIP_ISP_EDITION == i) { - org = GeoIP_org_by_name_v6(gi, hostname); - if (org == NULL) { - printf("%s: IP Address not found\n", GeoIPDBDescription[i]); - } - else { - printf("%s: %s\n", GeoIPDBDescription[i], org); - } - } - else if (GEOIP_NETSPEED_EDITION == i) { - netspeed = GeoIP_id_by_name_v6(gi, hostname); - if (netspeed == GEOIP_UNKNOWN_SPEED) { - printf("%s: Unknown\n", GeoIPDBDescription[i]); - } - else if (netspeed == GEOIP_DIALUP_SPEED) { - printf("%s: Dialup\n", GeoIPDBDescription[i]); - } - else if (netspeed == GEOIP_CABLEDSL_SPEED) { - printf("%s: Cable/DSL\n", GeoIPDBDescription[i]); - } - else if (netspeed == GEOIP_CORPORATE_SPEED) { - printf("%s: Corporate\n", GeoIPDBDescription[i]); - } - - } -#endif - -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/apps/geoipupdate-pureperl.pl b/Src/Plugins/DSP/sc_serv3/GeoIP/apps/geoipupdate-pureperl.pl deleted file mode 100644 index a8f04bee..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/apps/geoipupdate-pureperl.pl +++ /dev/null @@ -1,260 +0,0 @@ -#!/usr/bin/perl - -=pod - -/* - * - * Copyright (C) 2008 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -=cut - -=pod - -pure perl version of geoipupdate. can handle anything, that - - GeoIP_update_database - GeoIP_update_database_general - -handle. It is a drop in replacement for geoipupdate, as opposide to geoipupdate is the -pp version able to handle proxy requests even with authentication and can be used with -https - -=cut - -use strict; -use warnings; - -our $VERSION = '0.07'; - -use 5.008; -use Data::Dumper; -use Digest::MD5; -use File::Spec; -use File::Basename; -use Getopt::Std; -use HTTP::Request::Common; -use LWP::UserAgent; -use PerlIO::gzip; -use URI; - -my $ua = LWP::UserAgent->new( agent => "pp_geoipupdate/$VERSION" ); -$ua->env_proxy; - -## --- for auth proxies use -## $ua->proxy(['http', 'ftp'] => 'http://username:password@proxy.myorg.com'); - -my $license_file = 'GeoIP.conf'; -my $update_host = 'updates.maxmind.com'; -my $proto = 'http'; -my %opts; - -if ( !getopts( 'hvf:d:', \%opts ) or $opts{h} ) { - print STDERR - "Usage: geoipupdate [-hv] [-f license_file] [-d custom directory]\n"; - exit @ARGV ? 1 : 0; -} - -my $rootdir = File::Spec->rootdir; -$opts{d} ||= File::Spec->catfile( $rootdir, qw/ usr local share GeoIP / ); -$opts{f} ||= - File::Spec->catfile( $rootdir, qw/ usr local etc /, $license_file ); - -die "dir $opts{d} does not exist or is not readable or is not a directory\n" - unless -d $opts{d}; -die "license_file $opts{f} does not exist, is not readable or is not a file\n" - unless -f $opts{f}; - -# -# --- parse license file -# -open my $fh, '<', $opts{f} - or die "Error opening GeoIP Configuration file $opts{f}\n"; -print "Opened License file $opts{f}\n" if $opts{v}; - -my ( $user_id, $license_key, @product_ids ); -{ - local $_; - - while (<$fh>) { - next if /^\s*#/; # skip comments - /^\s*UserId\s+(\d+)/ and $user_id = $1, next; - /^\s*LicenseKey\s+(\S{12})/ and $license_key = $1, next; - /^\s*ProductIds\s+(\d+(?:[a-zA-Z]{2,3})?(?:\s+\d+(?:[a-zA-Z]{2,3})?)*)/ - and @product_ids = split( /\s+/, $1 ), next; - - } -} - -if ( $opts{v} ) { - print "User id $user_id\n" if $user_id; - print "Read in license key $license_key\n"; - print "Product ids @product_ids\n"; -} - -if ($user_id) { - for my $product_id (@product_ids) { - - # update the databases using the user id string, - # the license key string and the product id for each database - eval { - GeoIP_update_database_general( $user_id, $license_key, - $product_id, $opts{v} ); - }; - my $err = $@; - die $err if $err and $err !~ /^No new updates available/i; - print $err; - } -} else { - - # Old format with just license key for MaxMind GeoIP Country database updates - # here for backwards compatibility - eval { GeoIP_update_database( $license_key, $opts{v} ); }; - my $err = $@; - die $err if $err and $err !~ /^No new updates available/i; - print $err; -} - -exit 0; - -sub GeoIP_update_database_general { - my ( $user_id, $license_key, $product_id, $verbose, $client_ipaddr ) = @_; - my $u = URI->new("$proto://$update_host/app/update_getfilename"); - $u->query_form( product_id => $product_id ); - - print 'Send request ' . $u->as_string, "\n" if ($verbose); - my $res = $ua->request( GET $u->as_string, Host => $update_host ); - die $res->status_line unless ( $res->is_success ); - # make sure to use only the filename for security reason - my $geoip_filename = File::Spec->catfile( $opts{d}, basename($res->content) ); - - # /* get MD5 of current GeoIP database file */ - my $old_md5 = _get_hexdigest($geoip_filename); - - print "MD5 sum of database $geoip_filename is $old_md5\n" if $verbose; - - unless ($client_ipaddr) { - print 'Send request ' . $u->as_string, "\n" if ($verbose); - - # /* get client ip address from MaxMind web page */ - $res = $ua->request( GET "$proto://$update_host/app/update_getipaddr", - Host => $update_host ); - die $res->status_line unless ( $res->is_success ); - $client_ipaddr = $res->content; - } - - print "client ip address: $client_ipaddr\n" if $verbose; - my $hex_digest2 = - Digest::MD5->new->add( $license_key, $client_ipaddr )->hexdigest; - print "md5sum of ip address and license key is $hex_digest2\n" if $verbose; - - my $mk_db_req_cref = sub { - - $u->path('/app/update_secure'); - $u->query_form( - db_md5 => shift, - challenge_md5 => $hex_digest2, - user_id => $user_id, - edition_id => $product_id - ); - print 'Send request ' . $u->as_string, "\n" if ($verbose); - return $ua->request( GET $u->as_string, Host => $update_host ); - }; - $res = $mk_db_req_cref->($old_md5); - die $res->status_line unless ( $res->is_success ); - - # print Dumper($res); - print "Downloading gzipped GeoIP Database...\n" if $verbose; - - _gunzip_and_replace( - $res->content, - $geoip_filename, - sub { - - # as sanity check request a update for the new downloaded file - # md5 of the new unpacked file - my $new_md5 = _get_hexdigest(shift); - return $mk_db_req_cref->($new_md5); - } - ); - print "Done\n" if $verbose; -} - -sub GeoIP_update_database { - my ( $license_key, $verbose ) = @_; - my $geoip_filename = File::Spec->catfile( $opts{d}, 'GeoIP.dat' ); - - # /* get MD5 of current GeoIP database file */ - my $hexdigest = _get_hexdigest($geoip_filename); - - print "MD5 sum of database $geoip_filename is $hexdigest\n" if $verbose; - - my $u = URI->new("$proto://$update_host/app/update"); - $u->query_form( license_key => $license_key, md5 => $hexdigest ); - - print 'Send request ' . $u->as_string, "\n" if ($verbose); - my $res = $ua->request( GET $u->as_string, Host => $update_host ); - die $res->status_line unless ( $res->is_success ); - print "Downloading gzipped GeoIP Database...\n" if $verbose; - _gunzip_and_replace( $res->content, $geoip_filename ); - print "Done\n" if $verbose; - -} - -# --- hexdigest of the file or 00000000000000000000000000000000 -sub _get_hexdigest { - my $md5 = '0' x 32; - if ( open my $fh, '<:raw', shift ) { - $md5 = Digest::MD5->new->addfile($fh)->hexdigest; - } - return $md5; -} - -sub _gunzip_and_replace { - my ( $content, $geoip_filename, $sanity_check_c ) = @_; - my $max_retry = 1; - - my $tmp_fname = $geoip_filename . '.test'; - - { - - # --- error if our content does not start with the gzip header - die $content || 'Not a gzip file' if substr( $content, 0, 2 ) ne "\x1f\x8b"; - - # --- uncompress the gzip data - { - local $_; - open my $gin, '<:gzip', \$content or die $!; - open my $gout, '>:raw', $tmp_fname or die $!; - print {$gout} $_ while (<$gin>); - } - - # --- sanity check - if ( defined $sanity_check_c ) { - die "Download failed" if $max_retry-- <= 0; - my $res = $sanity_check_c->($tmp_fname); - die $res->status_line unless ( $res->is_success ); - $content = $res->content; - - redo if ( $content !~ /^No new updates available/ ); - } - } - - # --- install GeoIP.dat.test -> GeoIP.dat - rename( $tmp_fname, $geoip_filename ) or die $!; -} - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/apps/geoipupdate.c b/Src/Plugins/DSP/sc_serv3/GeoIP/apps/geoipupdate.c deleted file mode 100644 index b3a553b2..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/apps/geoipupdate.c +++ /dev/null @@ -1,283 +0,0 @@ -/* geoipupdate.c - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "GeoIP.h" -#include "GeoIPUpdate.h" - -#include -#include -#include -#ifdef __linux__ -#include -#endif -#include - -#define PRODUCT_ID_TOKEN "ProductIds" -#define USER_ID_TOKEN "UserId" -#define LICENSE_KEY_TOKEN "LicenseKey" -#define LICENSE_KEY_LENGTH 12 - -const char *GeoIPConfFile = "GeoIP.conf"; - -void usage() { - fprintf(stderr,"Usage: geoipupdate [-hv] [-f license_file] [-d custom directory]\n"); -} - -void my_printf(char * str) { - printf("%s", str); -} - -void print_status (int err, char * license_file) { - if (err == GEOIP_NO_NEW_UPDATES) { - fprintf(stdout,"GeoIP Database up to date\n"); - } else if (err == GEOIP_LICENSE_KEY_INVALID_ERR) { - fprintf(stderr,"Invalid License Key in %s - Please visit http://www.maxmind.com/app/products for a subscription\n",license_file); - } else if (err == GEOIP_USER_ID_INVALID_ERR){ - fprintf(stderr,"Invalid UserID\n"); - } else if (err == GEOIP_PRODUCT_ID_INVALID_ERR){ - fprintf(stderr,"Invalid product ID or subscription expired\n"); - } else if (err < 0) { - fprintf(stderr,"Received Error %d (%s) when attempting to update GeoIP Database\n",err, GeoIP_get_error_message(err)); - } else { - fprintf(stdout,"Updated database\n"); - } -} - -int main (int argc, char *argv[]) { - int verbose = 0; - char * license_file = NULL; - FILE * license_fh; - int n = 40; - int line_index = 0; - unsigned char *lineptr = malloc(sizeof(char) * n); - char *a_license_key_str, *a_ptr; - char *the_license_key_str = ""; - char * the_reference_empty_license_key_str = the_license_key_str; - char *a_user_id_str = NULL; - /* the string that holds the user id */ - char *the_user_id_str = NULL; - /* the integer that holds the length of the string the_user_id_str */ - int the_user_id_strl = 0; - /* the integer that holds the alloc length of the string the_user_id_str */ - int the_user_id_stral = 0; - char *a_product_id_str = NULL; - char **the_product_id_str = NULL; - int *the_product_id_strl = NULL; - int *the_product_id_stral = NULL; - int num_product_ids = 0; - char * client_ipaddr = NULL; - char * custom_directory = NULL; - int c; - int err = 0; - int i; - - opterr = 0; - - while ((c = getopt (argc, argv, "hvf:d:")) != -1) - switch (c) { - case 'h': - usage(); - exit(0); - case 'v': - verbose = 1; - break; - case 'f': - license_file = optarg; - break; - case 'd': - custom_directory = optarg; - break; - case '?': - if (isprint (optopt)) - fprintf (stderr, "Unknown option `-%c'.\n", optopt); - else - fprintf (stderr, - "Unknown option character `\\x%x'.\n", - optopt); - usage(); - exit(1); - default: - abort(); - } - - if (custom_directory != NULL) { - GeoIP_setup_custom_directory(custom_directory); - } - if (license_file == NULL) { - license_file = malloc(sizeof(char) * (strlen(SYSCONFDIR)+strlen(GeoIPConfFile)+2)); - license_file[0] = '\0'; - strcat(license_file, SYSCONFDIR); - strcat(license_file, "/"); - strcat(license_file, GeoIPConfFile); - } - - license_fh = fopen(license_file,"r"); - if (license_fh == NULL) { - fprintf(stderr,"Error opening GeoIP Configuration file %s\n",license_file); - exit(1); - } - - if (verbose == 1) - printf("Opened License file %s\n", license_file); - - do { - c = fgetc(license_fh); - if (line_index >= n) { - n += 20; - lineptr = realloc(lineptr, n); - } - if (c == 10 || c == EOF) { - lineptr[line_index++] = '\0'; - line_index = 0; - if (lineptr[0] == '#') - continue; - /* get the product ids from the config file */ - a_product_id_str = strstr((char *)lineptr, PRODUCT_ID_TOKEN);//search for a product id token in the line - if (a_product_id_str != NULL) { - a_ptr = a_product_id_str; - /* set pos at the end of product id token */ - a_ptr += strlen(PRODUCT_ID_TOKEN) + 1; - while (a_ptr[0] == ' ') { - /* skip spaces */ - a_ptr++; - } - /* alloc the array of product ids */ - the_product_id_str = (char **) malloc((num_product_ids+1) * sizeof(char*)); /* array of strings */ - the_product_id_strl = (int *) malloc((num_product_ids+1) * sizeof(char*)); /* array of string lengths */ - the_product_id_stral = (int *) malloc((num_product_ids+1) * sizeof(char*)); /* array of string alloc lengths */ - while (a_ptr[0] != '\0') { - /* add new product id to the array of product ids */ - the_product_id_str[num_product_ids] = (char *) malloc(20); /* the string */ - the_product_id_strl[num_product_ids] = 0; /* the length of the string */ - the_product_id_stral[num_product_ids] = 20; /* the alloc length of the string */ - while ((a_ptr[0] != ' ') & (a_ptr[0] != '\0')) { - if (the_product_id_strl[num_product_ids] >= the_product_id_stral[num_product_ids]) { - /* if the length of the string is equal or more than - * alloc length of the string then realloc the string and - * increase the alloc length by 20 */ - the_product_id_stral[num_product_ids] = the_product_id_stral[num_product_ids] + 20; - the_product_id_str[num_product_ids] = (char *) realloc(the_product_id_str[num_product_ids],the_product_id_stral[num_product_ids]+4); - } - /* read the product id from the line in the config file */ - the_product_id_str[num_product_ids][the_product_id_strl[num_product_ids]] = a_ptr[0]; - the_product_id_strl[num_product_ids]++; - a_ptr++; - } - the_product_id_str[num_product_ids][the_product_id_strl[num_product_ids]] = 0; - while ((a_ptr[0] == ' ') & (a_ptr[0] != '\0')) { - a_ptr++;//skip spaces - } - /* new product id add, realloc the arrays */ - num_product_ids = num_product_ids + 1; - /* array of string */ - the_product_id_str = (char **) realloc(the_product_id_str,(num_product_ids+1) * sizeof(char*)); - /* array of string lengths */ - the_product_id_strl = (int *) realloc(the_product_id_strl,(num_product_ids+1) * sizeof(char*)); - /* array of string alloc lengths */ - the_product_id_stral = (int *) realloc(the_product_id_stral,(num_product_ids+1) * sizeof(char*)); - } - } - - /* get the user id from the config file */ - a_user_id_str = strstr((char *)lineptr, USER_ID_TOKEN); /* search for a user id token in the line */ - if (a_user_id_str != NULL) { - a_ptr = a_user_id_str; - /* set the position at the end of user id token */ - a_ptr += strlen(USER_ID_TOKEN) + 1; - while (a_ptr[0] == ' ') { - /* skip spaces */ - a_ptr++; - } - /* get the string that has the user id */ - the_user_id_stral = 20; - the_user_id_str = (char *)malloc(the_user_id_stral); - /* loop while the chars are numbers */ - while ((a_ptr[0] >= '0') & (a_ptr[0] <= '9')) { - the_user_id_str[the_user_id_strl++] = a_ptr[0]; - a_ptr++; - if (the_user_id_strl >= the_user_id_stral) { - /* if the length of user id string is greater or equal to - * the alloc length of user id string then - * add 20 to the alloc length and realloc the user id string */ - the_user_id_stral += 20; - the_user_id_str = realloc(the_user_id_str,the_user_id_stral); - } - } - the_user_id_str[the_user_id_strl] = 0; /* add NUL char */ - } - a_license_key_str = strstr((char *)lineptr, LICENSE_KEY_TOKEN); - if (a_license_key_str != NULL) { - a_ptr = a_license_key_str; - a_ptr += strlen(LICENSE_KEY_TOKEN) + 1; - while (a_ptr[0] == ' ') { - a_ptr++; - } - the_license_key_str = malloc(sizeof(char) * (LICENSE_KEY_LENGTH + 1)); - strncpy(the_license_key_str, a_ptr, LICENSE_KEY_LENGTH); - the_license_key_str[LICENSE_KEY_LENGTH] = '\0'; - } - } else { - lineptr[line_index++] = c; - } - } while (c != EOF); - - free(lineptr); - - fclose(license_fh); - - if (verbose == 1) { - printf("Read in license key %s\n", the_license_key_str); - printf("number of product ids %d \n",num_product_ids); - } - - if (the_user_id_str != NULL) { - /* update the databases using the user id string, the license key string and the product id for each database */ - client_ipaddr = NULL; - for (i = 0; i < num_product_ids; i++) { - err = GeoIP_update_database_general(the_user_id_str, the_license_key_str, the_product_id_str[i], verbose,&client_ipaddr, &my_printf); - print_status(err, license_file); - } - } else { - /* Old format with just license key for MaxMind GeoIP Country database updates - * here for backwards compatibility */ - err = GeoIP_update_database(the_license_key_str, verbose, &my_printf); - print_status(err, license_file); - } - - if (the_product_id_str != NULL) { - /* free the product ids */ - for (i = 0; i < num_product_ids; i++ ) { - free(the_product_id_str[i]); - } - free(the_product_id_str); - free(the_product_id_strl); - free(the_product_id_stral); - } - - if ( the_reference_empty_license_key_str != the_license_key_str ) - free(the_license_key_str); - - if (the_user_id_str) - free(the_user_id_str); - - if (client_ipaddr) { - free(client_ipaddr); - } - exit(err); -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/bootstrap b/Src/Plugins/DSP/sc_serv3/GeoIP/bootstrap deleted file mode 100644 index d3a651db..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/bootstrap +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/sh - -# disable dependency trackeing for OS X with multiply arch option's -# automake -i --gnu --add-missing - -aclocal \ -&& automake -i --gnu --add-missing \ -&& autoconf diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/conf/GeoIP.conf.default b/Src/Plugins/DSP/sc_serv3/GeoIP/conf/GeoIP.conf.default deleted file mode 100644 index 33f55265..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/conf/GeoIP.conf.default +++ /dev/null @@ -1,19 +0,0 @@ -# If you purchase a subscription to the GeoIP database, -# then you will obtain a license key which you can -# use to automatically obtain updates. -# for more details, please go to -# http://www.maxmind.com/app/products - -# see https://www.maxmind.com/app/license_key_login to obtain License Key, -# UserId, and available ProductIds - -# Enter your license key here -LicenseKey YOUR_LICENSE_KEY_HERE - -# Enter your User ID here -UserId YOUR_USER_ID_HERE - -# Enter the Product ID(s) of the database(s) you would like to update -# By default 106 (MaxMind GeoIP Country) is listed below -ProductIds 106 - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/conf/Makefile.am b/Src/Plugins/DSP/sc_serv3/GeoIP/conf/Makefile.am deleted file mode 100644 index c55ec18b..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/conf/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -dist_sysconf_DATA = GeoIP.conf.default - -DEFAULT_CONFIG_FILE = $(sysconfdir)/GeoIP.conf - -install-exec-hook: - @if test -f "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; then \ - echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; \ - else \ - echo "$(INSTALL_DATA) GeoIP.conf.default $(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \ - $(INSTALL_DATA) "$(srcdir)/GeoIP.conf.default" "$(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \ - fi - -uninstall-hook: - @if test -f "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; then \ - rm "$(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \ -fi diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/conf/Makefile.in b/Src/Plugins/DSP/sc_serv3/GeoIP/conf/Makefile.in deleted file mode 100644 index 2a4ad929..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/conf/Makefile.in +++ /dev/null @@ -1,414 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in 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. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = conf -DIST_COMMON = $(dist_sysconf_DATA) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -SOURCES = -DIST_SOURCES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__installdirs = "$(DESTDIR)$(sysconfdir)" -DATA = $(dist_sysconf_DATA) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -dist_sysconf_DATA = GeoIP.conf.default -DEFAULT_CONFIG_FILE = $(sysconfdir)/GeoIP.conf -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu conf/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu conf/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-dist_sysconfDATA: $(dist_sysconf_DATA) - @$(NORMAL_INSTALL) - test -z "$(sysconfdir)" || $(MKDIR_P) "$(DESTDIR)$(sysconfdir)" - @list='$(dist_sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(sysconfdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(sysconfdir)" || exit $$?; \ - done - -uninstall-dist_sysconfDATA: - @$(NORMAL_UNINSTALL) - @list='$(dist_sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(sysconfdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(sysconfdir)" && rm -f $$files -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(DATA) -installdirs: - for dir in "$(DESTDIR)$(sysconfdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-dist_sysconfDATA - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) install-exec-hook -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-dist_sysconfDATA - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) uninstall-hook -.MAKE: install-am install-exec-am install-strip uninstall-am - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dist_sysconfDATA \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-exec-hook install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-dist_sysconfDATA uninstall-hook - - -install-exec-hook: - @if test -f "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; then \ - echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; \ - else \ - echo "$(INSTALL_DATA) GeoIP.conf.default $(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \ - $(INSTALL_DATA) "$(srcdir)/GeoIP.conf.default" "$(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \ - fi - -uninstall-hook: - @if test -f "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; then \ - rm "$(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \ -fi - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/config.guess b/Src/Plugins/DSP/sc_serv3/GeoIP/config.guess deleted file mode 100644 index e3a2116a..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/config.guess +++ /dev/null @@ -1,1533 +0,0 @@ -#! /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, 2007, 2008, 2009 -# Free Software Foundation, Inc. - -timestamp='2009-06-10' - -# 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, 2006, 2007, 2008 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 ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - 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 ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[456]) - 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 -q __LP64__ - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - amd64) - echo x86_64-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 ;; - *: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 ;; - *:Interix*:[3456]*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T | authenticamd | genuineintel) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-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:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-gnu - else - echo ${UNAME_MACHINE}-unknown-linux-gnueabi - fi - exit ;; - avr32*: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:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | 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 -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-gnu - 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 ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-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" - ;; - 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(__SUNPRO_C) || defined(__SUNPRO_CC) - 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.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - 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 ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - 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: diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/config.sub b/Src/Plugins/DSP/sc_serv3/GeoIP/config.sub deleted file mode 100644 index eb0389a6..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/config.sub +++ /dev/null @@ -1,1693 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 -# Free Software Foundation, Inc. - -timestamp='2009-06-11' - -# 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, 2006, 2007, 2008 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* | \ - kopensolaris*-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 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - 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 | avr32 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nios | nios2 \ - | ns16k | ns32k \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k | z80) - 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-* | avr32-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | 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[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'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 - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - 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 - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) 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 - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - 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 - ;; - tile*) - basic_machine=tile-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -kopensolaris* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -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* | -toppers* | -drops*) - # 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 - ;; - -dicos*) - os=-dicos - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # 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 - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/configure b/Src/Plugins/DSP/sc_serv3/GeoIP/configure deleted file mode 100644 index 246e7563..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/configure +++ /dev/null @@ -1,13633 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for GeoIP 1.4.8. -# -# Report bugs to . -# -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 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 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 - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# 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 - - -# 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 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: support@maxmind.com about your system, including any -$0: error possibly output before this message. Then install -$0: a modern shell, or manually run the script under such a -$0: shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. -as_fn_error () -{ - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 - fi - $as_echo "$as_me: error: $1" >&2 - as_fn_exit $as_status -} # as_fn_error - -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 - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$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; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -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='mkdir -p "$as_dir"' -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'" - - - -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$lt_ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','` - ;; -esac - -ECHO=${lt_ECHO-echo} -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<_LT_EOF -$* -_LT_EOF - exit 0 -fi - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test -z "$lt_ECHO"; then - if test "X${echo_test_string+set}" != Xset; then - # find a string as large as possible, as long as the shell can cope with it - for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do - # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... - if { echo_test_string=`eval $cmd`; } 2>/dev/null && - { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null - then - break - fi - done - fi - - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : - else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$ECHO" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - ECHO='print -r' - elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - ECHO='printf %s\n' - if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && - echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - ECHO="$CONFIG_SHELL $0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - ECHO="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - ECHO=echo - fi - fi - fi - fi - fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -lt_ECHO=$ECHO -if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then - lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" -fi - - - - -test -n "$DJDIR" || 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= - -# Identity of this package. -PACKAGE_NAME='GeoIP' -PACKAGE_TARNAME='GeoIP' -PACKAGE_VERSION='1.4.8' -PACKAGE_STRING='GeoIP 1.4.8' -PACKAGE_BUGREPORT='support@maxmind.com' -PACKAGE_URL='' - -# 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_unique_file="libGeoIP/GeoIP.c" -ac_subst_vars='am__EXEEXT_FALSE -am__EXEEXT_TRUE -LTLIBOBJS -LIBOBJS -OTOOL64 -OTOOL -LIPO -NMEDIT -DSYMUTIL -lt_ECHO -RANLIB -AR -OBJDUMP -LN_S -NM -ac_ct_DUMPBIN -DUMPBIN -LD -FGREP -SED -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -LIBTOOL -GEOIP_VERSION_INFO -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -am__untar -am__tar -AMTAR -am__leading_dot -SET_MAKE -AWK -mkdir_p -MKDIR_P -INSTALL_STRIP_PROGRAM -STRIP -install_sh -MAKEINFO -AUTOHEADER -AUTOMAKE -AUTOCONF -ACLOCAL -VERSION -PACKAGE -CYGPATH_W -am__isrc -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_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_dependency_tracking -enable_shared -enable_static -with_pic -enable_fast_install -with_gnu_ld -enable_libtool_lock -' - 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_TARNAME}' -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_fn_error "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -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_fn_error "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --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_fn_error "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" - 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_fn_error "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information." - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $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_fn_error "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# 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_fn_error "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$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_fn_error "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" - 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 GeoIP 1.4.8 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/GeoIP] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names - -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 - case $ac_init_help in - short | recursive ) echo "Configuration of GeoIP 1.4.8:";; - esac - 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] - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pic try to use only PIC/non-PIC objects [default=use - both] - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - -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 (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -ac_status=$? -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 -GeoIP configure 1.4.8 -generated by GNU Autoconf 2.65 - -Copyright (C) 2009 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( cat <<\_ASBOX -## ---------------------------------- ## -## Report this to support@maxmind.com ## -## ---------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_header_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_func - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_type -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 GeoIP $as_me 1.4.8, which was -generated by GNU Autoconf 2.65. 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) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - 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 - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# 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:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; 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'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE -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 /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - 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. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$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:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* 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" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -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_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$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:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$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:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if 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 - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if 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 - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -eval as_val=\$$as_ac_Header - 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 - - - - ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = x""yes; then : - MINIX=yes -else - MINIX= -fi - - - if test "$MINIX" = yes; then - -$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h - - -$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h - - -$as_echo "#define _MINIX 1" >>confdefs.h - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 -$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if test "${ac_cv_safe_to_define___extensions__+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -# define __EXTENSIONS__ 1 - $ac_includes_default -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_safe_to_define___extensions__=yes -else - ac_cv_safe_to_define___extensions__=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 -$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } - test $ac_cv_safe_to_define___extensions__ = yes && - $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h - - $as_echo "#define _ALL_SOURCE 1" >>confdefs.h - - $as_echo "#define _GNU_SOURCE 1" >>confdefs.h - - $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h - - $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h - - - -am__api_version='1.11' - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - for ac_t in install-sh install.sh shtool; do - if test -f "$ac_dir/$ac_t"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/$ac_t -c" - break 2 - fi - done -done -if test -z "$ac_aux_dir"; then - as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# 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:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then : - $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:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -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:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[\\\"\#\$\&\'\`$am_lf]*) - as_fn_error "unsafe absolute working directory name" "$LINENO" 5;; -esac -case $srcdir in - *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; -esac - -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error "ls -t appears to fail. Make sure there is not a broken -alias in your environment" "$LINENO" 5 - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -if test x"${install_sh}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi - -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # 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_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if test "${ac_cv_path_mkdir+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done - done -IFS=$as_save_IFS - -fi - - test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P 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. - MKDIR_P="$ac_install_sh -d" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } - -mkdir_p="$MKDIR_P" -case $mkdir_p in - [\\/$]* | ?:[\\/]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AWK+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # 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_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - am__isrc=' -I$(srcdir)' - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='GeoIP' - VERSION='1.4.8' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - - - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - - - -GEOIP_VERSION_INFO=`echo $VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'` - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* 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" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -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 - -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac - - - -macro_version='2.2.6b' -macro_revision='1.3017' - - - - - - - - - - - - - -ltmain="$ac_aux_dir/ltmain.sh" - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if test "${ac_cv_build+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; -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 - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if test "${ac_cv_host+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; -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 - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if test "${ac_cv_path_SED+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - 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" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_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 -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_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 '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_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_SED_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error "no acceptable sed could be found in \$PATH" "$LINENO" 5 - fi -else - ac_cv_path_SED=$SED -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed - -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if test "${ac_cv_path_FGREP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_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 fgrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_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 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_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_FGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - as_fn_error "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_FGREP=$FGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -test -z "$GREP" && GREP=grep - - - - - - - - - - - - - - - - - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if test "${lt_cv_path_LD+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - 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 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if test "${lt_cv_path_NM+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$ac_tool_prefix"; then - for ac_prog in "dumpbin -symbols" "link -dump -symbols" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_DUMPBIN+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DUMPBIN"; then - ac_cv_prog_DUMPBIN="$DUMPBIN" # 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_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DUMPBIN=$ac_cv_prog_DUMPBIN -if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$DUMPBIN" && break - done -fi -if test -z "$DUMPBIN"; then - ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in "dumpbin -symbols" "link -dump -symbols" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DUMPBIN"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # 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_DUMPBIN="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN -if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_DUMPBIN" && break -done - - if test "x$ac_ct_DUMPBIN" = x; then - DUMPBIN=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DUMPBIN=$ac_ct_DUMPBIN - fi -fi - - - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if test "${lt_cv_nm_interface+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:5395: $ac_compile\"" >&5) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&5 - (eval echo "\"\$as_me:5398: $NM \\\"conftest.$ac_objext\\\"\"" >&5) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&5 - (eval echo "\"\$as_me:5401: output\"" >&5) - cat conftest.out >&5 - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - -# find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if test "${lt_cv_sys_max_cmd_len+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ - = "XX$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } -fi -max_cmd_len=$lt_cv_sys_max_cmd_len - - - - - - -: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 -$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 -$as_echo "$xsi_shell" >&6; } - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 -$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } -lt_shell_append=no -( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 -$as_echo "$lt_shell_append" >&6; } - - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi - - - - - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if test "${lt_cv_ld_reload_flag+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_reload_flag='-r' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - darwin*) - if test "$GCC" = yes; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OBJDUMP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # 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_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # 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_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if test "${lt_cv_deplibs_check_method+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix[4-9]*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_AR+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # 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_AR="${ac_tool_prefix}ar" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="ar" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -else - AR="$ac_cv_prog_AR" -fi - -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_STRIP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # 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_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -test -z "$STRIP" && STRIP=: - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_RANLIB+set}" = set; then : - $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then : - $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -test -z "$RANLIB" && RANLIB=: - - - - - - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[ABCDGISTW]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK '"\ -" {last_section=section; section=\$ 3};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } -fi - - - - - - - - - - - - - - - - - - - - - - -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : - enableval=$enable_libtool_lock; -fi - -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 6606 "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if test "${lt_cv_cc_needs_belf+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - 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 - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_cc_needs_belf=yes -else - lt_cv_cc_needs_belf=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext 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 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" - - - case $host_os in - rhapsody* | darwin*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. -set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_DSYMUTIL+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DSYMUTIL"; then - ac_cv_prog_DSYMUTIL="$DSYMUTIL" # 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_DSYMUTIL="${ac_tool_prefix}dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DSYMUTIL=$ac_cv_prog_DSYMUTIL -if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DSYMUTIL"; then - ac_ct_DSYMUTIL=$DSYMUTIL - # Extract the first word of "dsymutil", so it can be a program name with args. -set dummy dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DSYMUTIL"; then - ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # 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_DSYMUTIL="dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL -if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DSYMUTIL" = x; then - DSYMUTIL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DSYMUTIL=$ac_ct_DSYMUTIL - fi -else - DSYMUTIL="$ac_cv_prog_DSYMUTIL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. -set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_NMEDIT+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NMEDIT"; then - ac_cv_prog_NMEDIT="$NMEDIT" # 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_NMEDIT="${ac_tool_prefix}nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -NMEDIT=$ac_cv_prog_NMEDIT -if test -n "$NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -$as_echo "$NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_NMEDIT"; then - ac_ct_NMEDIT=$NMEDIT - # Extract the first word of "nmedit", so it can be a program name with args. -set dummy nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_NMEDIT"; then - ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # 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_NMEDIT="nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT -if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -$as_echo "$ac_ct_NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_NMEDIT" = x; then - NMEDIT=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - NMEDIT=$ac_ct_NMEDIT - fi -else - NMEDIT="$ac_cv_prog_NMEDIT" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. -set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_LIPO+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LIPO"; then - ac_cv_prog_LIPO="$LIPO" # 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_LIPO="${ac_tool_prefix}lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -LIPO=$ac_cv_prog_LIPO -if test -n "$LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -$as_echo "$LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_LIPO"; then - ac_ct_LIPO=$LIPO - # Extract the first word of "lipo", so it can be a program name with args. -set dummy lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_LIPO"; then - ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # 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_LIPO="lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO -if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -$as_echo "$ac_ct_LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_LIPO" = x; then - LIPO=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LIPO=$ac_ct_LIPO - fi -else - LIPO="$ac_cv_prog_LIPO" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OTOOL+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL"; then - ac_cv_prog_OTOOL="$OTOOL" # 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_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL=$ac_cv_prog_OTOOL -if test -n "$OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -$as_echo "$OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL"; then - ac_ct_OTOOL=$OTOOL - # Extract the first word of "otool", so it can be a program name with args. -set dummy otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL"; then - ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # 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_OTOOL="otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL -if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -$as_echo "$ac_ct_OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL" = x; then - OTOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL=$ac_ct_OTOOL - fi -else - OTOOL="$ac_cv_prog_OTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_OTOOL64+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL64"; then - ac_cv_prog_OTOOL64="$OTOOL64" # 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_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL64=$ac_cv_prog_OTOOL64 -if test -n "$OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -$as_echo "$OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL64"; then - ac_ct_OTOOL64=$OTOOL64 - # Extract the first word of "otool64", so it can be a program name with args. -set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL64"; then - ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # 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_OTOOL64="otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 -if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -$as_echo "$ac_ct_OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL64" = x; then - OTOOL64=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL64=$ac_ct_OTOOL64 - fi -else - OTOOL64="$ac_cv_prog_OTOOL64" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -$as_echo_n "checking for -single_module linker flag... " >&6; } -if test "${lt_cv_apple_cc_single_mod+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&5 - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -$as_echo "$lt_cv_apple_cc_single_mod" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if test "${lt_cv_ld_exported_symbols_list+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_ld_exported_symbols_list=yes -else - lt_cv_ld_exported_symbols_list=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[012]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac - -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF - -fi - -done - - - -# Set options - - - - enable_dlopen=no - - - enable_win32_dll=no - - - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi - - - - - - - - - - # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi - - - - - - - - - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : - withval=$with_pic; pic_mode="$withval" -else - pic_mode=default -fi - - -test -z "$pic_mode" && pic_mode=default - - - - - - - - # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi - - - - - - - - - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - - - - - - - - - - - - - - - - - - - - - - - - - -test -z "$LN_S" && LN_S="ln -s" - - - - - - - - - - - - - - -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if test "${lt_cv_objdir+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir - - - - - -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF - - - - - - - - - - - - - - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` - - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -# Use C for the default configuration in the libtool script - -lt_save_CC="$CC" -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 - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - -if test -n "$compiler"; then - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - lt_prog_compiler_no_builtin_flag=' -fno-builtin' - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7864: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:7868: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - - - - - - - lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } - - if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='--shared' - lt_prog_compiler_static='--static' - ;; - pgcc* | pgf77* | pgf90* | pgf95*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - xl*) - # IBM XL C 8.0/Fortran 10.1 on PPC - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-qpic' - lt_prog_compiler_static='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' - ;; - *Sun\ F*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; - esac - ;; - esac - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 -$as_echo "$lt_prog_compiler_pic" >&6; } - - - - - - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if test "${lt_cv_prog_compiler_pic_works+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8203: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:8207: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } - -if test x"$lt_cv_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi - - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if test "${lt_cv_prog_compiler_static_works+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works=yes - fi - else - lt_cv_prog_compiler_static_works=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -$as_echo "$lt_cv_prog_compiler_static_works" >&6; } - -if test x"$lt_cv_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8308: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:8312: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if test "${lt_cv_prog_compiler_c_o+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8363: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:8367: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - runpath_var= - allow_undefined_flag= - always_export_symbols=no - archive_cmds= - archive_expsym_cmds= - compiler_needs_object=no - enable_shared_with_static_runtimes=no - export_dynamic_flag_spec= - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - hardcode_automatic=no - hardcode_direct=no - hardcode_direct_absolute=no - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= - hardcode_libdir_separator= - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - inherit_rpath=no - link_all_deplibs=unknown - module_cmds= - module_expsym_cmds= - old_archive_from_new_cmds= - old_archive_from_expsyms_cmds= - thread_safe_flag_spec= - whole_archive_flag_spec= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - linux* | k*bsd*-gnu) - link_all_deplibs=no - ;; - esac - - ld_shlibs=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[3-9]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - - interix[3-9]*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag= - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - whole_archive_flag_spec= - tmp_sharedflag='--shared' ;; - xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld='-rpath $libdir' - archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - ld_shlibs=no - fi - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_direct_absolute=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - file_list_spec='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - link_all_deplibs=no - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - export_dynamic_flag_spec='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes - ;; - - darwin* | rhapsody*) - - - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='' - link_all_deplibs=yes - allow_undefined_flag="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=echo - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - - else - ld_shlibs=no - fi - - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo(void) {} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - inherit_rpath=yes - link_all_deplibs=yes - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - hardcode_shlibpath_var=no - hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - archive_cmds_need_lc='no' - hardcode_libdir_separator=: - ;; - - solaris*) - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='${wl}-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='${wl}-z,text' - allow_undefined_flag='${wl}-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-R,$libdir' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='${wl}-Blargedynsym' - ;; - esac - fi - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } -test "$ld_shlibs" = no && can_build_shared=no - -with_gnu_ld=$with_gnu_ld - - - - - - - - - - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - archive_cmds_need_lc=no - else - archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 -$as_echo "$archive_cmds_need_lc" >&6; } - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } - -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` - else - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[lt_foo]++; } - if (lt_freq[lt_foo] == 1) { print lt_foo; } -}'` - sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[4-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -interix[3-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # Some binutils ld are patched to set DT_RUNPATH - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - shlibpath_overrides_runpath=yes -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || - test -n "$runpath_var" || - test "X$hardcode_automatic" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } - -if test "$hardcode_action" = relink || - test "$inherit_rpath" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = x""yes; then : - lt_cv_dlopen="shl_load" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if test "${ac_cv_lib_dld_shl_load+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_shl_load=yes -else - ac_cv_lib_dld_shl_load=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = x""yes; then : - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -else - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = x""yes; then : - lt_cv_dlopen="dlopen" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if test "${ac_cv_lib_dl_dlopen+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if test "${ac_cv_lib_svld_dlopen+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_svld_dlopen=yes -else - ac_cv_lib_svld_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = x""yes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if test "${ac_cv_lib_dld_dld_link+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); -int -main () -{ -return dld_link (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_dld_link=yes -else - ac_cv_lib_dld_dld_link=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = x""yes; then : - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if test "${lt_cv_dlopen_self+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line 10747 "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if test "${lt_cv_dlopen_self_static+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line 10843 "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - - - - - - - - - - - - - - - - -striplib= -old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac -fi - - - - - - - - - - - - - # Report which library types will actually be built - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[4-9]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } - - - - -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - - - - - - - - - - - - - ac_config_commands="$ac_config_commands libtool" - - - - -# Only expand once: - - - -ac_fn_c_check_type "$LINENO" "byte" "ac_cv_type_byte" "$ac_includes_default" -if test "x$ac_cv_type_byte" = x""yes; then : - $as_echo "#define HAVE_BYTE_TYPEDEF 1" >>confdefs.h - -fi - -ac_fn_c_check_type "$LINENO" "ushort" "ac_cv_type_ushort" "$ac_includes_default" -if test "x$ac_cv_type_ushort" = x""yes; then : - $as_echo "#define HAVE_USHORT_TYPEDEF 1" >>confdefs.h - -fi - -ac_fn_c_check_type "$LINENO" "ulong" "ac_cv_type_ulong" "$ac_includes_default" -if test "x$ac_cv_type_ulong" = x""yes; then : - $as_echo "#define HAVE_ULONG_TYPEDEF 1" >>confdefs.h - -fi - -ac_fn_c_check_type "$LINENO" "u16" "ac_cv_type_u16" "$ac_includes_default" -if test "x$ac_cv_type_u16" = x""yes; then : - $as_echo "#define HAVE_U16_TYPEDEF 1" >>confdefs.h - -fi - -ac_fn_c_check_type "$LINENO" "u32" "ac_cv_type_u32" "$ac_includes_default" -if test "x$ac_cv_type_u32" = x""yes; then : - $as_echo "#define HAVE_U32_TYPEDEF 1" >>confdefs.h - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_bigendian=unknown - # See if we're dealing with a universal compiler. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - # Check for potential -arch flags. It is not universal unless - # there are at least two -arch flags with different values. - ac_arch= - ac_prev= - for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do - if test -n "$ac_prev"; then - case $ac_word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then - ac_arch=$ac_word - else - ac_cv_c_bigendian=universal - break - fi - ;; - esac - ac_prev= - elif test "x$ac_word" = "x-arch"; then - ac_prev=arch - fi - done -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ac_cv_c_bigendian = unknown; then - # See if sys/param.h defines the BYTE_ORDER macro. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ - && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ - && LITTLE_ENDIAN) - bogus endian macros - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) - bogus endian macros - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to _BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -#ifndef _BIG_ENDIAN - not big endian - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # Compile a test program. - if test "$cross_compiling" = yes; then : - # Try to guess by grepping values from an object file. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -short int ascii_mm[] = - { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = - { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; - int use_ascii (int i) { - return ascii_mm[i] + ascii_ii[i]; - } - short int ebcdic_ii[] = - { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = - { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; - int use_ebcdic (int i) { - return ebcdic_mm[i] + ebcdic_ii[i]; - } - extern int foo; - -int -main () -{ -return use_ascii (foo) == use_ebcdic (foo); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then - ac_cv_c_bigendian=yes - fi - if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi - fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_bigendian=no -else - ac_cv_c_bigendian=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } - case $ac_cv_c_bigendian in #( - yes) - $as_echo "#define BIG_ENDIAN_HOST 1" >>confdefs.h -;; #( - no) - $as_echo "#define LITTLE_ENDIAN_HOST 1" >>confdefs.h - ;; #( - universal) - -$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h - - ;; #( - *) - as_fn_error "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; - esac - - -for ac_header in stdint.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" -if test "x$ac_cv_header_stdint_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDINT_H 1 -_ACEOF - -fi - -done - -for ac_header in zlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" -if test "x$ac_cv_header_zlib_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ZLIB_H 1 -_ACEOF - -else - as_fn_error "Zlib header (zlib.h) not found. Tor requires zlib to build. You may need to install a zlib development package." "$LINENO" 5 -fi - -done - - -ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" -if test "x$ac_cv_func_gettimeofday" = x""yes; then : - $as_echo "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h - -fi - -ac_fn_c_check_func "$LINENO" "vasprintf" "ac_cv_func_vasprintf" -if test "x$ac_cv_func_vasprintf" = x""yes; then : - $as_echo "#define HAVE_VASPRINTF 1" >>confdefs.h - -fi - -ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf" -if test "x$ac_cv_func_vsnprintf" = x""yes; then : - $as_echo "#define HAVE_VSNPRINTF 1" >>confdefs.h - -fi - -ac_fn_c_check_func "$LINENO" "vsprintf" "ac_cv_func_vsprintf" -if test "x$ac_cv_func_vsprintf" = x""yes; then : - $as_echo "#define HAVE_VSPRINTF 1" >>confdefs.h - -fi - - -ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = x""yes; then : - $as_echo "#define HAVE_GETHOSTBYNAME 1" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 -$as_echo_n "checking for gethostbyname in -lnsl... " >&6; } -if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnsl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gethostbyname (); -int -main () -{ -return gethostbyname (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_nsl_gethostbyname=yes -else - ac_cv_lib_nsl_gethostbyname=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 -$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } -if test "x$ac_cv_lib_nsl_gethostbyname" = x""yes; then : - $as_echo "#define HAVE_GETHOSTBYNAME 1" >>confdefs.h - - LIBS="${LIBS} -lsocket -lnsl" -fi - -fi - - -ac_fn_c_check_func "$LINENO" "gethostbyname_r" "ac_cv_func_gethostbyname_r" -if test "x$ac_cv_func_gethostbyname_r" = x""yes; then : - - $as_echo "#define HAVE_GETHOSTBYNAME_R 1" >>confdefs.h - - # We look for the one that returns `int'. - # Hopefully this check is robust enough. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "int.*gethostbyname_r" >/dev/null 2>&1; then : - - $as_echo "#define GETHOSTBYNAME_R_RETURNS_INT 1" >>confdefs.h - -fi -rm -f conftest* - - -fi - - -ac_config_files="$ac_config_files Makefile GeoIP.spec libGeoIP/Makefile apps/Makefile conf/Makefile data/Makefile man/Makefile test/Makefile" - -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:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; 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:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - 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. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi - if test -n "$EXEEXT"; then - am__EXEEXT_TRUE= - am__EXEEXT_FALSE='#' -else - am__EXEEXT_TRUE='#' - am__EXEEXT_FALSE= -fi - - - -: ${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:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# 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} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - 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_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# 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 - - -# 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 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. -as_fn_error () -{ - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 - fi - $as_echo "$as_me: error: $1" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -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 - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -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 - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -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 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by GeoIP $as_me 1.4.8, which was -generated by GNU Autoconf 2.65. 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" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Configuration commands: -$config_commands - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -GeoIP config.status 1.4.8 -configured by $0, generated by GNU Autoconf 2.65, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2009 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' -MKDIR_P='$MKDIR_P' -AWK='$AWK' -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 ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append 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_fn_error "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append 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 -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`' -macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`' -enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`' -pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`' -host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`' -host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`' -host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`' -build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`' -build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`' -build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`' -SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`' -Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`' -GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`' -EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`' -FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`' -LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`' -NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`' -LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`' -ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`' -exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`' -lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`' -reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`' -AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`' -STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`' -RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' -CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`' -compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`' -GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' -objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`' -SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`' -ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`' -need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`' -LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`' -OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`' -libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' -module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`' -fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`' -need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`' -version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`' -runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`' -libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`' -soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`' -finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`' -old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`' -striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`' - -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# Quote evaled strings. -for var in SED \ -GREP \ -EGREP \ -FGREP \ -LD \ -NM \ -LN_S \ -lt_SP2NL \ -lt_NL2SP \ -reload_flag \ -OBJDUMP \ -deplibs_check_method \ -file_magic_cmd \ -AR \ -AR_FLAGS \ -STRIP \ -RANLIB \ -CC \ -CFLAGS \ -compiler \ -lt_cv_sys_global_symbol_pipe \ -lt_cv_sys_global_symbol_to_cdecl \ -lt_cv_sys_global_symbol_to_c_name_address \ -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -SHELL \ -ECHO \ -lt_prog_compiler_no_builtin_flag \ -lt_prog_compiler_wl \ -lt_prog_compiler_pic \ -lt_prog_compiler_static \ -lt_cv_prog_compiler_c_o \ -need_locks \ -DSYMUTIL \ -NMEDIT \ -LIPO \ -OTOOL \ -OTOOL64 \ -shrext_cmds \ -export_dynamic_flag_spec \ -whole_archive_flag_spec \ -compiler_needs_object \ -with_gnu_ld \ -allow_undefined_flag \ -no_undefined_flag \ -hardcode_libdir_flag_spec \ -hardcode_libdir_flag_spec_ld \ -hardcode_libdir_separator \ -fix_srcfile_path \ -exclude_expsyms \ -include_expsyms \ -file_list_spec \ -variables_saved_for_relink \ -libname_spec \ -library_names_spec \ -soname_spec \ -finish_eval \ -old_striplib \ -striplib; do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in reload_cmds \ -old_postinstall_cmds \ -old_postuninstall_cmds \ -old_archive_cmds \ -extract_expsyms_cmds \ -old_archive_from_new_cmds \ -old_archive_from_expsyms_cmds \ -archive_cmds \ -archive_expsym_cmds \ -module_cmds \ -module_expsym_cmds \ -export_symbols_cmds \ -prelink_cmds \ -postinstall_cmds \ -postuninstall_cmds \ -finish_cmds \ -sys_lib_search_path_spec \ -sys_lib_dlsearch_path_spec; do - case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Fix-up fallback echo if it was mangled by the above quoting rules. -case \$lt_ECHO in -*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\` - ;; -esac - -ac_aux_dir='$ac_aux_dir' -xsi_shell='$xsi_shell' -lt_shell_append='$lt_shell_append' - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - - - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile' - - - - -_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 - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "GeoIP.spec") CONFIG_FILES="$CONFIG_FILES GeoIP.spec" ;; - "libGeoIP/Makefile") CONFIG_FILES="$CONFIG_FILES libGeoIP/Makefile" ;; - "apps/Makefile") CONFIG_FILES="$CONFIG_FILES apps/Makefile" ;; - "conf/Makefile") CONFIG_FILES="$CONFIG_FILES conf/Makefile" ;; - "data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; - "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; - "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; - - *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - 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_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -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 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 - -# 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=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -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_fn_error "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# 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 :C $CONFIG_COMMANDS" -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_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[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_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $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:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; - 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"; as_fn_mkdir_p - 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 - ac_MKDIR_P=$MKDIR_P - case $MKDIR_P in - [\\/$]* | ?:[\\/]* ) ;; - */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; - 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:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - 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 -s&@MKDIR_P@&$ac_MKDIR_P&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" - case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; - esac \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 - ;; - - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Autoconf 2.62 quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} - ;; - "libtool":C) - - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008 Free Software Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - -# The names of the tagged configurations supported by this script. -available_tags="" - -# ### BEGIN LIBTOOL CONFIG - -# Which release of libtool.m4 was used? -macro_version=$macro_version -macro_revision=$macro_revision - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# What type of objects to build. -pic_mode=$pic_mode - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="\$SED -e 1s/^X//" - -# A grep program that handles long lines. -GREP=$lt_GREP - -# An ERE matcher. -EGREP=$lt_EGREP - -# A literal string matcher. -FGREP=$lt_FGREP - -# A BSD- or MS-compatible name lister. -NM=$lt_NM - -# Whether we need soft or hard links. -LN_S=$lt_LN_S - -# What is the maximum length of a command? -max_cmd_len=$max_cmd_len - -# Object file suffix (normally "o"). -objext=$ac_objext - -# Executable file suffix (normally ""). -exeext=$exeext - -# whether the shell understands "unset". -lt_unset=$lt_unset - -# turn spaces into newlines. -SP2NL=$lt_lt_SP2NL - -# turn newlines into spaces. -NL2SP=$lt_lt_NL2SP - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# An object symbol dumper. -OBJDUMP=$lt_OBJDUMP - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == "file_magic". -file_magic_cmd=$lt_file_magic_cmd - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A symbol stripping program. -STRIP=$lt_STRIP - -# Commands used to install an old-style archive. -RANLIB=$lt_RANLIB -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# A C compiler. -LTCC=$lt_CC - -# LTCC compiler flags. -LTCFLAGS=$lt_CFLAGS - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration. -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair. -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# Transform the output of nm in a C name address pair when lib prefix is needed. -global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that does not interpret backslashes. -ECHO=$lt_ECHO - -# Used to examine libraries when file_magic_cmd begins with "file". -MAGIC_CMD=$MAGIC_CMD - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Tool to manipulate archived DWARF debug symbol files on Mac OS X. -DSYMUTIL=$lt_DSYMUTIL - -# Tool to change global to local symbols on Mac OS X. -NMEDIT=$lt_NMEDIT - -# Tool to manipulate fat objects and archives on Mac OS X. -LIPO=$lt_LIPO - -# ldd/readelf like tool for Mach-O binaries on Mac OS X. -OTOOL=$lt_OTOOL - -# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. -OTOOL64=$lt_OTOOL64 - -# Old archive suffix (normally "a"). -libext=$libext - -# Shared library suffix (normally ".so"). -shrext_cmds=$lt_shrext_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at link time. -variables_saved_for_relink=$lt_variables_saved_for_relink - -# Do we need the "lib" prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Library versioning type. -version_type=$version_type - -# Shared library runtime path variable. -runpath_var=$runpath_var - -# Shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Command to use after installation of a shared archive. -postinstall_cmds=$lt_postinstall_cmds - -# Command to use after uninstallation of a shared archive. -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# As "finish_cmds", except a single script fragment to be evaled but -# not shown. -finish_eval=$lt_finish_eval - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Compile-time system search path for libraries. -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries. -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - - -# The linker used to build libraries. -LD=$lt_LD - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds - -# A language specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU compiler? -with_gcc=$GCC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# If ld is used when linking, flag to hardcode \$libdir into a binary -# during linking. This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - -ltmain="$ac_aux_dir/ltmain.sh" - - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $* )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} - -_LT_EOF - ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "X${3}" \ - | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; - esac -} - -# sed scripts: -my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[^=]*=//' - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` -} - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'` -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$@"` -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` -} - -_LT_EOF -esac - -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1+=\$2" -} -_LT_EOF - ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1=\$$1\$2" -} - -_LT_EOF - ;; - esac - - - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# 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 || as_fn_exit $? -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/configure.in b/Src/Plugins/DSP/sc_serv3/GeoIP/configure.in deleted file mode 100644 index 77309b18..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/configure.in +++ /dev/null @@ -1,50 +0,0 @@ -dnl AM_CONFIG_HEADER(config.h) - -AC_INIT([GeoIP], [1.4.8],[support@maxmind.com],[GeoIP]) -AC_GNU_SOURCE -AM_INIT_AUTOMAKE -AC_CONFIG_SRCDIR([libGeoIP/GeoIP.c]) -GEOIP_VERSION_INFO=`echo $VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'` -AC_SUBST(GEOIP_VERSION_INFO) - -AC_PROG_CC -AC_PROG_LIBTOOL - -AC_CHECK_TYPE(byte,[AC_DEFINE(HAVE_BYTE_TYPEDEF)],[]) -AC_CHECK_TYPE(ushort,[AC_DEFINE(HAVE_USHORT_TYPEDEF)],[]) -AC_CHECK_TYPE(ulong,[AC_DEFINE(HAVE_ULONG_TYPEDEF)],[]) -AC_CHECK_TYPE(u16,[AC_DEFINE(HAVE_U16_TYPEDEF)],[]) -AC_CHECK_TYPE(u32,[AC_DEFINE(HAVE_U32_TYPEDEF)],[]) - -AC_C_BIGENDIAN([AC_DEFINE(BIG_ENDIAN_HOST,1)],[AC_DEFINE(LITTLE_ENDIAN_HOST,1)]) - -AC_CHECK_HEADERS(stdint.h) -AC_CHECK_HEADERS(zlib.h, , AC_MSG_ERROR(Zlib header (zlib.h) not found. Tor requires zlib to build. You may need to install a zlib development package.)) - -AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY)) -AC_CHECK_FUNC(vasprintf, AC_DEFINE(HAVE_VASPRINTF)) -AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF)) -AC_CHECK_FUNC(vsprintf, AC_DEFINE(HAVE_VSPRINTF)) - -AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME), - AC_CHECK_LIB(nsl, gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME) - LIBS="${LIBS} -lsocket -lnsl")) - -AC_CHECK_FUNC(gethostbyname_r, [ - AC_DEFINE(HAVE_GETHOSTBYNAME_R) - # We look for the one that returns `int'. - # Hopefully this check is robust enough. - AC_EGREP_HEADER(int.*gethostbyname_r, netdb.h, [ - AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT)]) - ]) - -AC_OUTPUT([ -Makefile -GeoIP.spec -libGeoIP/Makefile -apps/Makefile -conf/Makefile -data/Makefile -man/Makefile -test/Makefile -]) diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/data/GeoIP.dat b/Src/Plugins/DSP/sc_serv3/GeoIP/data/GeoIP.dat deleted file mode 100644 index f92f5811..00000000 Binary files a/Src/Plugins/DSP/sc_serv3/GeoIP/data/GeoIP.dat and /dev/null differ diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/data/Makefile.am b/Src/Plugins/DSP/sc_serv3/GeoIP/data/Makefile.am deleted file mode 100644 index 5b7b9096..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/data/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -pkgdata_DATA = - -dist_pkgdata_DATA = GeoIP.dat - -DEFAULT_DB_FILE = $(pkgdatadir)/GeoIP.dat - -install-data-hook: - @if test -f "$(DESTDIR)$(DEFAULT_DB_FILE)" ; then \ - echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_DB_FILE)" ; \ - else \ - echo "$(INSTALL_DATA) GeoIP.dat $(DESTDIR)$(DEFAULT_DB_FILE)"; \ - $(INSTALL_DATA) "$(srcdir)/GeoIP.dat" "$(DESTDIR)$(DEFAULT_DB_FILE)"; \ - fi - -uninstall-hook: - @if test -f "$(DESTDIR)$(DEFAULT_DB_FILE)" ; then \ - rm "$(DESTDIR)$(DEFAULT_DB_FILE)"; \ -$(INSTALL_DATA) GeoIP.dat $(DESTDIR)$(DEFAULT_DB_FILE); \ - fi diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/data/Makefile.in b/Src/Plugins/DSP/sc_serv3/GeoIP/data/Makefile.in deleted file mode 100644 index 9d814220..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/data/Makefile.in +++ /dev/null @@ -1,437 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in 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. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = data -DIST_COMMON = $(dist_pkgdata_DATA) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -SOURCES = -DIST_SOURCES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__installdirs = "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(pkgdatadir)" -DATA = $(dist_pkgdata_DATA) $(pkgdata_DATA) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -pkgdata_DATA = -dist_pkgdata_DATA = GeoIP.dat -DEFAULT_DB_FILE = $(pkgdatadir)/GeoIP.dat -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu data/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu data/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-dist_pkgdataDATA: $(dist_pkgdata_DATA) - @$(NORMAL_INSTALL) - test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" - @list='$(dist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \ - done - -uninstall-dist_pkgdataDATA: - @$(NORMAL_UNINSTALL) - @list='$(dist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(pkgdatadir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(pkgdatadir)" && rm -f $$files -install-pkgdataDATA: $(pkgdata_DATA) - @$(NORMAL_INSTALL) - test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" - @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \ - done - -uninstall-pkgdataDATA: - @$(NORMAL_UNINSTALL) - @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(pkgdatadir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(pkgdatadir)" && rm -f $$files -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(DATA) -installdirs: - for dir in "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(pkgdatadir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-dist_pkgdataDATA install-pkgdataDATA - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) install-data-hook -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-dist_pkgdataDATA uninstall-pkgdataDATA - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) uninstall-hook -.MAKE: install-am install-data-am install-strip uninstall-am - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-data-hook \ - install-dist_pkgdataDATA install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-pkgdataDATA install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - uninstall uninstall-am uninstall-dist_pkgdataDATA \ - uninstall-hook uninstall-pkgdataDATA - - -install-data-hook: - @if test -f "$(DESTDIR)$(DEFAULT_DB_FILE)" ; then \ - echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_DB_FILE)" ; \ - else \ - echo "$(INSTALL_DATA) GeoIP.dat $(DESTDIR)$(DEFAULT_DB_FILE)"; \ - $(INSTALL_DATA) "$(srcdir)/GeoIP.dat" "$(DESTDIR)$(DEFAULT_DB_FILE)"; \ - fi - -uninstall-hook: - @if test -f "$(DESTDIR)$(DEFAULT_DB_FILE)" ; then \ - rm "$(DESTDIR)$(DEFAULT_DB_FILE)"; \ -$(INSTALL_DATA) GeoIP.dat $(DESTDIR)$(DEFAULT_DB_FILE); \ - fi - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/depcomp b/Src/Plugins/DSP/sc_serv3/GeoIP/depcomp deleted file mode 100644 index df8eea7e..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/depcomp +++ /dev/null @@ -1,630 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2009-04-28.21; # UTC - -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free -# Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 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, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by `PROGRAMS ARGS'. - object Object file output by `PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputing dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -cygpath_u="cygpath -u -f -" -if test "$depmode" = msvcmsys; then - # This is just like msvisualcpp but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u="sed s,\\\\\\\\,/,g" - depmode=msvisualcpp -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. -## Unfortunately, FreeBSD c89 acceptance of flags depends upon -## the command line argument order; so add the flags where they -## appear in depend2.am. Note that the slowdown incurred here -## affects only configure: in makefiles, %FASTDEP% shortcuts this. - for arg - do - case $arg in - -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; - *) set fnord "$@" "$arg" ;; - esac - shift # fnord - shift # $arg - done - "$@" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> "$depfile" - echo >> "$depfile" - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.u - tmpdepfile2=$base.u - tmpdepfile3=$dir.libs/$base.u - "$@" -Wc,-M - else - tmpdepfile1=$dir$base.u - tmpdepfile2=$dir$base.u - tmpdepfile3=$dir$base.u - "$@" -M - fi - stat=$? - - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp2) - # The "hp" stanza above does not work with aCC (C++) and HP's ia64 - # compilers, which have integrated preprocessors. The correct option - # to use with these is +Maked; it writes dependencies to a file named - # 'foo.d', which lands next to the object file, wherever that - # happens to be. - # Much of this is similar to the tru64 case; see comments there. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir.libs/$base.d - "$@" -Wc,+Maked - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - "$@" +Maked - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" - # Add `dependent.h:' lines. - sed -ne '2,${ - s/^ *// - s/ \\*$// - s/$/:/ - p - }' "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" "$tmpdepfile2" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mechanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no eat=no - for arg - do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - if test $eat = yes; then - eat=no - continue - fi - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -arch) - eat=yes ;; - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix=`echo "$object" | sed 's/^.*\././'` - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - IFS=" " - for arg - do - case "$arg" in - -o) - shift - ;; - $object) - shift - ;; - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E 2>/dev/null | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvcmsys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/geoip.ico b/Src/Plugins/DSP/sc_serv3/GeoIP/geoip.ico deleted file mode 100644 index ac13353b..00000000 Binary files a/Src/Plugins/DSP/sc_serv3/GeoIP/geoip.ico and /dev/null differ diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/get_ver.awk b/Src/Plugins/DSP/sc_serv3/GeoIP/get_ver.awk deleted file mode 100644 index 5e7abc08..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/get_ver.awk +++ /dev/null @@ -1,14 +0,0 @@ -# fetch version number from input file and write them to STDOUT -BEGIN { - while ((getline < ARGV[1]) > 0) { - if (match ($0, /^VERSION=/)) { - split($1, t, "="); - my_ver_str = t[2]; - split(my_ver_str, v, "."); - gsub("[^0-9].*$", "", v[3]); - my_ver = v[1] "," v[2] "," v[3]; - } - } - print "GEOIP_VERSION = " my_ver ""; - print "GEOIP_VERSION_STR = " my_ver_str ""; -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/install-sh b/Src/Plugins/DSP/sc_serv3/GeoIP/install-sh deleted file mode 100644 index 6781b987..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/install-sh +++ /dev/null @@ -1,520 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2009-04-28.21; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -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: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) dst_arg=$2 - shift;; - - -T) no_target_directory=true;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - trap '(exit $?); exit' 1 2 13 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dst_arg - # 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: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - -*) prefix='./';; - *) prefix='';; - esac - - eval "$initialize_posix_glob" - - oIFS=$IFS - IFS=/ - $posix_glob set -f - set fnord $dstdir - shift - $posix_glob set +f - IFS=$oIFS - - prefixes= - - for d - do - test -z "$d" && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIP.c b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIP.c deleted file mode 100644 index d4821c46..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIP.c +++ /dev/null @@ -1,1965 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ -/* GeoIP.c - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "GeoIP.h" - -static geoipv6_t IPV6_NULL; - -#if !defined(_WIN32) -#include -#include -#include -#endif /* !defined(_WIN32) */ - -#include -#include -#include -#include -#include -#include /* for fstat */ -#include /* for fstat */ - -#ifdef HAVE_GETTIMEOFDAY -#include /* for gettimeofday */ -#endif - -#ifdef HAVE_STDINT_H -#include /* For uint32_t */ -#endif - -#ifndef INADDR_NONE -#define INADDR_NONE -1 -#endif - -#define COUNTRY_BEGIN 16776960 -#define LARGE_COUNTRY_BEGIN 16515072 -#define STATE_BEGIN_REV0 16700000 -#define STATE_BEGIN_REV1 16000000 -#define STRUCTURE_INFO_MAX_SIZE 20 -#define DATABASE_INFO_MAX_SIZE 100 -#define MAX_ORG_RECORD_LENGTH 300 -#define US_OFFSET 1 -#define CANADA_OFFSET 677 -#define WORLD_OFFSET 1353 -#define FIPS_RANGE 360 - -#define CHECK_ERR(err, msg) { \ - if (err != Z_OK) { \ - /*fprintf(stderr, "%s error: %d\n", msg, err);*/ \ - exit(1); \ - } \ -} - -#ifdef _WIN32 -int pread(unsigned int fd, char *buf, size_t count, int offset) -{ - if (_lseek(fd, offset, SEEK_SET) != offset) { - return -1; - } - return read(fd, buf, (unsigned int)count); -} -#endif - -const char GeoIP_country_code[254][3] = { "--","AP","EU","AD","AE","AF","AG","AI","AL","AM","CW", - "AO","AQ","AR","AS","AT","AU","AW","AZ","BA","BB", - "BD","BE","BF","BG","BH","BI","BJ","BM","BN","BO", - "BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD", - "CF","CG","CH","CI","CK","CL","CM","CN","CO","CR", - "CU","CV","CX","CY","CZ","DE","DJ","DK","DM","DO", - "DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ", - "FK","FM","FO","FR","SX","GA","GB","GD","GE","GF", - "GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT", - "GU","GW","GY","HK","HM","HN","HR","HT","HU","ID", - "IE","IL","IN","IO","IQ","IR","IS","IT","JM","JO", - "JP","KE","KG","KH","KI","KM","KN","KP","KR","KW", - "KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT", - "LU","LV","LY","MA","MC","MD","MG","MH","MK","ML", - "MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV", - "MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI", - "NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF", - "PG","PH","PK","PL","PM","PN","PR","PS","PT","PW", - "PY","QA","RE","RO","RU","RW","SA","SB","SC","SD", - "SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO", - "SR","ST","SV","SY","SZ","TC","TD","TF","TG","TH", - "TJ","TK","TM","TN","TO","TL","TR","TT","TV","TW", - "TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE", - "VG","VI","VN","VU","WF","WS","YE","YT","RS","ZA", - "ZM","ME","ZW","A1","A2","O1","AX","GG","IM","JE", - "BL","MF", "BQ"}; - -static const unsigned num_GeoIP_countries = (unsigned)(sizeof(GeoIP_country_code)/sizeof(GeoIP_country_code[0])); - -const char GeoIP_country_code3[254][4] = { "--","AP","EU","AND","ARE","AFG","ATG","AIA","ALB","ARM","CUW", - "AGO","ATA","ARG","ASM","AUT","AUS","ABW","AZE","BIH","BRB", - "BGD","BEL","BFA","BGR","BHR","BDI","BEN","BMU","BRN","BOL", - "BRA","BHS","BTN","BVT","BWA","BLR","BLZ","CAN","CCK","COD", - "CAF","COG","CHE","CIV","COK","CHL","CMR","CHN","COL","CRI", - "CUB","CPV","CXR","CYP","CZE","DEU","DJI","DNK","DMA","DOM", - "DZA","ECU","EST","EGY","ESH","ERI","ESP","ETH","FIN","FJI", - "FLK","FSM","FRO","FRA","SXM","GAB","GBR","GRD","GEO","GUF", - "GHA","GIB","GRL","GMB","GIN","GLP","GNQ","GRC","SGS","GTM", - "GUM","GNB","GUY","HKG","HMD","HND","HRV","HTI","HUN","IDN", - "IRL","ISR","IND","IOT","IRQ","IRN","ISL","ITA","JAM","JOR", - "JPN","KEN","KGZ","KHM","KIR","COM","KNA","PRK","KOR","KWT", - "CYM","KAZ","LAO","LBN","LCA","LIE","LKA","LBR","LSO","LTU", - "LUX","LVA","LBY","MAR","MCO","MDA","MDG","MHL","MKD","MLI", - "MMR","MNG","MAC","MNP","MTQ","MRT","MSR","MLT","MUS","MDV", - "MWI","MEX","MYS","MOZ","NAM","NCL","NER","NFK","NGA","NIC", - "NLD","NOR","NPL","NRU","NIU","NZL","OMN","PAN","PER","PYF", - "PNG","PHL","PAK","POL","SPM","PCN","PRI","PSE","PRT","PLW", - "PRY","QAT","REU","ROU","RUS","RWA","SAU","SLB","SYC","SDN", - "SWE","SGP","SHN","SVN","SJM","SVK","SLE","SMR","SEN","SOM", - "SUR","STP","SLV","SYR","SWZ","TCA","TCD","ATF","TGO","THA", - "TJK","TKL","TKM","TUN","TON","TLS","TUR","TTO","TUV","TWN", - "TZA","UKR","UGA","UMI","USA","URY","UZB","VAT","VCT","VEN", - "VGB","VIR","VNM","VUT","WLF","WSM","YEM","MYT","SRB","ZAF", - "ZMB","MNE","ZWE","A1","A2","O1","ALA","GGY","IMN","JEY", - "BLM","MAF", "BES"}; - -const char * GeoIP_utf8_country_name[254] = {"N/A","Asia/Pacific Region","Europe","Andorra","United Arab Emirates","Afghanistan","Antigua and Barbuda","Anguilla","Albania","Armenia","Cura" "\xc3\xa7" "ao", - "Angola","Antarctica","Argentina","American Samoa","Austria","Australia","Aruba","Azerbaijan","Bosnia and Herzegovina","Barbados", - "Bangladesh","Belgium","Burkina Faso","Bulgaria","Bahrain","Burundi","Benin","Bermuda","Brunei Darussalam","Bolivia", - "Brazil","Bahamas","Bhutan","Bouvet Island","Botswana","Belarus","Belize","Canada","Cocos (Keeling) Islands","Congo, The Democratic Republic of the", - "Central African Republic","Congo","Switzerland","Cote D'Ivoire","Cook Islands","Chile","Cameroon","China","Colombia","Costa Rica", - "Cuba","Cape Verde","Christmas Island","Cyprus","Czech Republic","Germany","Djibouti","Denmark","Dominica","Dominican Republic", - "Algeria","Ecuador","Estonia","Egypt","Western Sahara","Eritrea","Spain","Ethiopia","Finland","Fiji", - "Falkland Islands (Malvinas)","Micronesia, Federated States of","Faroe Islands","France","Sint Maarten (Dutch part)","Gabon","United Kingdom","Grenada","Georgia","French Guiana", - "Ghana","Gibraltar","Greenland","Gambia","Guinea","Guadeloupe","Equatorial Guinea","Greece","South Georgia and the South Sandwich Islands","Guatemala", - "Guam","Guinea-Bissau","Guyana","Hong Kong","Heard Island and McDonald Islands","Honduras","Croatia","Haiti","Hungary","Indonesia", - "Ireland","Israel","India","British Indian Ocean Territory","Iraq","Iran, Islamic Republic of","Iceland","Italy","Jamaica","Jordan", - "Japan","Kenya","Kyrgyzstan","Cambodia","Kiribati","Comoros","Saint Kitts and Nevis","Korea, Democratic People's Republic of","Korea, Republic of","Kuwait", - "Cayman Islands","Kazakhstan","Lao People's Democratic Republic","Lebanon","Saint Lucia","Liechtenstein","Sri Lanka","Liberia","Lesotho","Lithuania", - "Luxembourg","Latvia","Libyan Arab Jamahiriya","Morocco","Monaco","Moldova, Republic of","Madagascar","Marshall Islands","Macedonia","Mali", - "Myanmar","Mongolia","Macau","Northern Mariana Islands","Martinique","Mauritania","Montserrat","Malta","Mauritius","Maldives", - "Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia","Niger","Norfolk Island","Nigeria","Nicaragua", - "Netherlands","Norway","Nepal","Nauru","Niue","New Zealand","Oman","Panama","Peru","French Polynesia", - "Papua New Guinea","Philippines","Pakistan","Poland","Saint Pierre and Miquelon","Pitcairn Islands","Puerto Rico","Palestinian Territory","Portugal","Palau", - "Paraguay","Qatar","Reunion","Romania","Russian Federation","Rwanda","Saudi Arabia","Solomon Islands","Seychelles","Sudan", - "Sweden","Singapore","Saint Helena","Slovenia","Svalbard and Jan Mayen","Slovakia","Sierra Leone","San Marino","Senegal","Somalia","Suriname", - "Sao Tome and Principe","El Salvador","Syrian Arab Republic","Swaziland","Turks and Caicos Islands","Chad","French Southern Territories","Togo","Thailand", - "Tajikistan","Tokelau","Turkmenistan","Tunisia","Tonga","Timor-Leste","Turkey","Trinidad and Tobago","Tuvalu","Taiwan", - "Tanzania, United Republic of","Ukraine","Uganda","United States Minor Outlying Islands","United States","Uruguay","Uzbekistan","Holy See (Vatican City State)","Saint Vincent and the Grenadines","Venezuela", - "Virgin Islands, British","Virgin Islands, U.S.","Vietnam","Vanuatu","Wallis and Futuna","Samoa","Yemen","Mayotte","Serbia","South Africa", - "Zambia","Montenegro","Zimbabwe","Anonymous Proxy","Satellite Provider","Other","Aland Islands","Guernsey","Isle of Man","Jersey", - "Saint Barthelemy","Saint Martin", "Bonaire, Saint Eustatius and Saba"}; - -const char * GeoIP_country_name[254] = {"N/A","Asia/Pacific Region","Europe","Andorra","United Arab Emirates","Afghanistan","Antigua and Barbuda","Anguilla","Albania","Armenia","Cura" "\xe7" "ao", - "Angola","Antarctica","Argentina","American Samoa","Austria","Australia","Aruba","Azerbaijan","Bosnia and Herzegovina","Barbados", - "Bangladesh","Belgium","Burkina Faso","Bulgaria","Bahrain","Burundi","Benin","Bermuda","Brunei Darussalam","Bolivia", - "Brazil","Bahamas","Bhutan","Bouvet Island","Botswana","Belarus","Belize","Canada","Cocos (Keeling) Islands","Congo, The Democratic Republic of the", - "Central African Republic","Congo","Switzerland","Cote D'Ivoire","Cook Islands","Chile","Cameroon","China","Colombia","Costa Rica", - "Cuba","Cape Verde","Christmas Island","Cyprus","Czech Republic","Germany","Djibouti","Denmark","Dominica","Dominican Republic", - "Algeria","Ecuador","Estonia","Egypt","Western Sahara","Eritrea","Spain","Ethiopia","Finland","Fiji", - "Falkland Islands (Malvinas)","Micronesia, Federated States of","Faroe Islands","France","Sint Maarten (Dutch part)","Gabon","United Kingdom","Grenada","Georgia","French Guiana", - "Ghana","Gibraltar","Greenland","Gambia","Guinea","Guadeloupe","Equatorial Guinea","Greece","South Georgia and the South Sandwich Islands","Guatemala", - "Guam","Guinea-Bissau","Guyana","Hong Kong","Heard Island and McDonald Islands","Honduras","Croatia","Haiti","Hungary","Indonesia", - "Ireland","Israel","India","British Indian Ocean Territory","Iraq","Iran, Islamic Republic of","Iceland","Italy","Jamaica","Jordan", - "Japan","Kenya","Kyrgyzstan","Cambodia","Kiribati","Comoros","Saint Kitts and Nevis","Korea, Democratic People's Republic of","Korea, Republic of","Kuwait", - "Cayman Islands","Kazakhstan","Lao People's Democratic Republic","Lebanon","Saint Lucia","Liechtenstein","Sri Lanka","Liberia","Lesotho","Lithuania", - "Luxembourg","Latvia","Libyan Arab Jamahiriya","Morocco","Monaco","Moldova, Republic of","Madagascar","Marshall Islands","Macedonia","Mali", - "Myanmar","Mongolia","Macau","Northern Mariana Islands","Martinique","Mauritania","Montserrat","Malta","Mauritius","Maldives", - "Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia","Niger","Norfolk Island","Nigeria","Nicaragua", - "Netherlands","Norway","Nepal","Nauru","Niue","New Zealand","Oman","Panama","Peru","French Polynesia", - "Papua New Guinea","Philippines","Pakistan","Poland","Saint Pierre and Miquelon","Pitcairn Islands","Puerto Rico","Palestinian Territory","Portugal","Palau", - "Paraguay","Qatar","Reunion","Romania","Russian Federation","Rwanda","Saudi Arabia","Solomon Islands","Seychelles","Sudan", - "Sweden","Singapore","Saint Helena","Slovenia","Svalbard and Jan Mayen","Slovakia","Sierra Leone","San Marino","Senegal","Somalia","Suriname", - "Sao Tome and Principe","El Salvador","Syrian Arab Republic","Swaziland","Turks and Caicos Islands","Chad","French Southern Territories","Togo","Thailand", - "Tajikistan","Tokelau","Turkmenistan","Tunisia","Tonga","Timor-Leste","Turkey","Trinidad and Tobago","Tuvalu","Taiwan", - "Tanzania, United Republic of","Ukraine","Uganda","United States Minor Outlying Islands","United States","Uruguay","Uzbekistan","Holy See (Vatican City State)","Saint Vincent and the Grenadines","Venezuela", - "Virgin Islands, British","Virgin Islands, U.S.","Vietnam","Vanuatu","Wallis and Futuna","Samoa","Yemen","Mayotte","Serbia","South Africa", - "Zambia","Montenegro","Zimbabwe","Anonymous Proxy","Satellite Provider","Other","Aland Islands","Guernsey","Isle of Man","Jersey", - "Saint Barthelemy","Saint Martin", "Bonaire, Saint Eustatius and Saba"}; - -/* Possible continent codes are AF, AS, EU, NA, OC, SA for Africa, Asia, Europe, North America, Oceania -and South America. */ - -const char GeoIP_country_continent[254][3] = { - "--", "AS","EU","EU","AS","AS","NA","NA","EU","AS","NA", - "AF","AN","SA","OC","EU","OC","NA","AS","EU","NA", - "AS","EU","AF","EU","AS","AF","AF","NA","AS","SA", - "SA","NA","AS","AN","AF","EU","NA","NA","AS","AF", - "AF","AF","EU","AF","OC","SA","AF","AS","SA","NA", - "NA","AF","AS","AS","EU","EU","AF","EU","NA","NA", - "AF","SA","EU","AF","AF","AF","EU","AF","EU","OC", - "SA","OC","EU","EU","NA","AF","EU","NA","AS","SA", - "AF","EU","NA","AF","AF","NA","AF","EU","AN","NA", - "OC","AF","SA","AS","AN","NA","EU","NA","EU","AS", - "EU","AS","AS","AS","AS","AS","EU","EU","NA","AS", - "AS","AF","AS","AS","OC","AF","NA","AS","AS","AS", - "NA","AS","AS","AS","NA","EU","AS","AF","AF","EU", - "EU","EU","AF","AF","EU","EU","AF","OC","EU","AF", - "AS","AS","AS","OC","NA","AF","NA","EU","AF","AS", - "AF","NA","AS","AF","AF","OC","AF","OC","AF","NA", - "EU","EU","AS","OC","OC","OC","AS","NA","SA","OC", - "OC","AS","AS","EU","NA","OC","NA","AS","EU","OC", - "SA","AS","AF","EU","EU","AF","AS","OC","AF","AF", - "EU","AS","AF","EU","EU","EU","AF","EU","AF","AF", - "SA","AF","NA","AS","AF","NA","AF","AN","AF","AS", - "AS","OC","AS","AF","OC","AS","EU","NA","OC","AS", - "AF","EU","AF","OC","NA","SA","AS","EU","NA","SA", - "NA","NA","AS","OC","OC","OC","AS","AF","EU","AF", - "AF","EU","AF","--","--","--","EU","EU","EU","EU", - "NA","NA","NA" -}; - -geoipv6_t _GeoIP_lookupaddress_v6 (const char *host); - -#if defined(_WIN32) -/* http://www.mail-archive.com/users@ipv6.org/msg02107.html */ -static const char * _GeoIP_inet_ntop(int af, const void *src, char *dst, socklen_t cnt) -{ - if (af == AF_INET) - { - struct sockaddr_in in; - memset(&in, 0, sizeof(in)); - in.sin_family = AF_INET; - memcpy(&in.sin_addr, src, sizeof(struct in_addr)); - getnameinfo((struct sockaddr *)&in, sizeof(struct -sockaddr_in), dst, cnt, NULL, 0, NI_NUMERICHOST); - return dst; - } - else if (af == AF_INET6) - { - struct sockaddr_in6 in; - memset(&in, 0, sizeof(in)); - in.sin6_family = AF_INET6; - memcpy(&in.sin6_addr, src, sizeof(struct in_addr6)); - getnameinfo((struct sockaddr *)&in, sizeof(struct -sockaddr_in6), dst, cnt, NULL, 0, NI_NUMERICHOST); - return dst; - } - return NULL; -} - -static int _GeoIP_inet_pton(int af, const char *src, void *dst) -{ - struct addrinfo hints, *res, *ressave; - - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = af; - - if (getaddrinfo(src, NULL, &hints, &res) != 0) - { - //fprintf(stderr, "Couldn't resolve host %s\n", src); - return -1; - } - - ressave = res; - - while (res) - { - memcpy(dst, res->ai_addr, res->ai_addrlen); - res = res->ai_next; - } - - freeaddrinfo(ressave); - return 0; -} -#else -static int _GeoIP_inet_pton(int af, const char *src, void *dst) { - return inet_pton(af, src, dst); -} -static const char * _GeoIP_inet_ntop(int af, const void *src, char *dst, socklen_t cnt) { - return inet_ntop(af, src, dst, cnt); -} - -#endif /* defined(_WIN32) */ - - -int __GEOIP_V6_IS_NULL(geoipv6_t v6) { - int i; - for (i=0;i<16;i++) { - if (v6.s6_addr[i]) - return 0; - } - return 1; -} - -void __GEOIP_PREPARE_TEREDO(geoipv6_t* v6){ - int i; - if ((v6->s6_addr[0]) != 0x20) return; - if ((v6->s6_addr[1]) != 0x01) return; - if ((v6->s6_addr[2]) != 0x00) return; - if ((v6->s6_addr[3]) != 0x00) return; - - for ( i = 0; i< 12; i++) - v6->s6_addr[i] = 0; - for ( ; i < 16; i++) - v6->s6_addr[i]^=0xff; -} - -const char * GeoIPDBDescription[NUM_DB_TYPES] = { - NULL, - "GeoIP Country Edition", - "GeoIP City Edition, Rev 1", - "GeoIP Region Edition, Rev 1", - "GeoIP ISP Edition", - "GeoIP Organization Edition", - "GeoIP City Edition, Rev 0", - "GeoIP Region Edition, Rev 0", - "GeoIP Proxy Edition", - "GeoIP ASNum Edition", - "GeoIP Netspeed Edition", - "GeoIP Domain Name Edition", - "GeoIP Country V6 Edition", - "GeoIP LocationID ASCII Edition", - "GeoIP Accuracy Radius Edition", - "GeoIP City with Confidence Edition", - "GeoIP City with Confidence and Accuracy Edition", - "GeoIP Large Country Edition", - "GeoIP Large Country V6 Edition", - NULL, - "GeoIP CCM Edition", - "GeoIP ASNum V6 Edition", - "GeoIP ISP V6 Edition", - "GeoIP Organization V6 Edition", - "GeoIP Domain Name V6 Edition", - "GeoIP LocationID ASCII V6 Edition", - "GeoIP Registrar Edition", - "GeoIP Registrar V6 Edition", - "GeoIP UserType Edition", - "GeoIP UserType V6 Edition", - "GeoIP City Edition V6, Rev 1", - "GeoIP City Edition V6, Rev 0", - "GeoIP Netspeed Edition, Rev 1", - "GeoIP Netspeed Edition V6, Rev1" -}; - -char * custom_directory = NULL; - -void GeoIP_setup_custom_directory (char * dir) { - custom_directory = dir; -} - -char *_GeoIP_full_path_to(const char *file_name) { - size_t len; - char *path = malloc(sizeof(char) * 1024); - - /*if (custom_directory == NULL){ -#if !defined(_WIN32) - memset(path, 0, sizeof(char) * 1024); - snprintf(path, sizeof(char) * 1024 - 1, "%s/%s", GEOIPDATADIR, file_name); -#else - char buf[MAX_PATH], *p, *q = NULL; - memset(buf, 0, sizeof(buf)); - len = GetModuleFileNameA(GetModuleHandle(NULL), buf, sizeof(buf) - 1); - for (p = buf + len; p > buf; p--) - if (*p == '\\') - { - if (!q) - q = p; - else - *p = '/'; - } - *q = 0; - memset(path, 0, sizeof(char) * 1024); - snprintf(path, sizeof(char) * 1024 - 1, "%s/%s", buf, file_name); -#endif - } else*/ { - len = strlen(custom_directory); - if (custom_directory[len-1] != '/') { - snprintf(path, sizeof(char) * 1024 - 1, "%s/%s",custom_directory, file_name); - } else { - snprintf(path, sizeof(char) * 1024 - 1, "%s%s", custom_directory, file_name); - } - } - return path; -} - -char ** GeoIPDBFileName = NULL; - -void _GeoIP_setup_dbfilename() { - if (NULL == GeoIPDBFileName) { - GeoIPDBFileName = malloc(sizeof(char *) * NUM_DB_TYPES); - memset(GeoIPDBFileName, 0, sizeof(char *) * NUM_DB_TYPES); - - GeoIPDBFileName[GEOIP_COUNTRY_EDITION] = _GeoIP_full_path_to("GeoIP.dat"); - GeoIPDBFileName[GEOIP_REGION_EDITION_REV0] = _GeoIP_full_path_to("GeoIPRegion.dat"); - GeoIPDBFileName[GEOIP_REGION_EDITION_REV1] = _GeoIP_full_path_to("GeoIPRegion.dat"); - GeoIPDBFileName[GEOIP_CITY_EDITION_REV0] = _GeoIP_full_path_to("GeoIPCity.dat"); - GeoIPDBFileName[GEOIP_CITY_EDITION_REV1] = _GeoIP_full_path_to("GeoIPCity.dat"); - GeoIPDBFileName[GEOIP_ISP_EDITION] = _GeoIP_full_path_to("GeoIPISP.dat"); - GeoIPDBFileName[GEOIP_ORG_EDITION] = _GeoIP_full_path_to("GeoIPOrg.dat"); - GeoIPDBFileName[GEOIP_PROXY_EDITION] = _GeoIP_full_path_to("GeoIPProxy.dat"); - GeoIPDBFileName[GEOIP_ASNUM_EDITION] = _GeoIP_full_path_to("GeoIPASNum.dat"); - GeoIPDBFileName[GEOIP_NETSPEED_EDITION] = _GeoIP_full_path_to("GeoIPNetSpeed.dat"); - GeoIPDBFileName[GEOIP_DOMAIN_EDITION] = _GeoIP_full_path_to("GeoIPDomain.dat"); - GeoIPDBFileName[GEOIP_COUNTRY_EDITION_V6] = _GeoIP_full_path_to("GeoIPv6.dat"); - GeoIPDBFileName[GEOIP_LOCATIONA_EDITION] = _GeoIP_full_path_to("GeoIPLocA.dat"); - GeoIPDBFileName[GEOIP_ACCURACYRADIUS_EDITION] = _GeoIP_full_path_to("GeoIPDistance.dat"); - GeoIPDBFileName[GEOIP_CITYCONFIDENCE_EDITION] = _GeoIP_full_path_to("GeoIPCityConfidence.dat"); - GeoIPDBFileName[GEOIP_CITYCONFIDENCEDIST_EDITION] = _GeoIP_full_path_to("GeoIPCityConfidenceDist.dat"); - GeoIPDBFileName[GEOIP_LARGE_COUNTRY_EDITION] = _GeoIP_full_path_to("GeoIP.dat"); - GeoIPDBFileName[GEOIP_LARGE_COUNTRY_EDITION_V6] = _GeoIP_full_path_to("GeoIPv6.dat"); - GeoIPDBFileName[GEOIP_ASNUM_EDITION_V6] = _GeoIP_full_path_to("GeoIPASNumv6.dat"); - GeoIPDBFileName[GEOIP_ISP_EDITION_V6] = _GeoIP_full_path_to("GeoIPISPv6.dat"); - GeoIPDBFileName[GEOIP_ORG_EDITION_V6] = _GeoIP_full_path_to("GeoIPOrgv6.dat"); - GeoIPDBFileName[GEOIP_DOMAIN_EDITION_V6] = _GeoIP_full_path_to("GeoIPDomainv6.dat"); - GeoIPDBFileName[GEOIP_LOCATIONA_EDITION_V6] = _GeoIP_full_path_to("GeoIPLocAv6.dat"); - GeoIPDBFileName[GEOIP_REGISTRAR_EDITION] = _GeoIP_full_path_to("GeoIPRegistrar.dat"); - GeoIPDBFileName[GEOIP_REGISTRAR_EDITION_V6] = _GeoIP_full_path_to("GeoIPRegistrarv6.dat"); - GeoIPDBFileName[GEOIP_USERTYPE_EDITION] = _GeoIP_full_path_to("GeoIPUserType.dat"); - GeoIPDBFileName[GEOIP_USERTYPE_EDITION_V6] = _GeoIP_full_path_to("GeoIPUserTypev6.dat"); - GeoIPDBFileName[GEOIP_CITY_EDITION_REV0_V6] = _GeoIP_full_path_to("GeoIPCityv6.dat"); - GeoIPDBFileName[GEOIP_CITY_EDITION_REV1_V6] = _GeoIP_full_path_to("GeoIPCityv6.dat"); - GeoIPDBFileName[GEOIP_NETSPEED_EDITION_REV1] = _GeoIP_full_path_to("GeoIPNetspeedCell.dat"); - GeoIPDBFileName[GEOIP_NETSPEED_EDITION_REV1_V6] = _GeoIP_full_path_to("GeoIPNetseedCellv6.dat"); - } -} - -static -int _file_exists(const char *file_name) { - struct stat file_stat; - return( (stat(file_name, &file_stat) == 0) ? 1:0); -} - -char * _GeoIP_iso_8859_1__utf8(const char * iso) { - signed char c; - char k; - char * p; - char * t = (char *)iso; - int len = 0; - while ( ( c = *t++) ){ - if ( c < 0 ) - len++; - } - len += (int)(t - iso); - t = p = malloc( len ); - - if ( p ){ - while ( ( c = *iso++ ) ) { - if (c < 0 ) { - k = 0xc2; - if (c >= -64 ) - k++; - *t++ = k; - c &= ~0x40; - } - *t++ = c; - } - *t++ = 0x00; - } - return p; -} - -int GeoIP_is_private_ipnum_v4( unsigned long ipnum ){ -return ((ipnum >= 167772160U && ipnum <= 184549375U) - || (ipnum >= 2851995648U && ipnum <= 2852061183U) - || (ipnum >= 2886729728U && ipnum <= 2887778303U) - || (ipnum >= 3232235520U && ipnum <= 3232301055U) - || (ipnum >= 2130706432U && ipnum <= 2147483647U))? 1 : 0; -} - -int GeoIP_is_private_v4( const char * addr ){ - unsigned long ipnum = GeoIP_addr_to_num(addr); - return GeoIP_is_private_ipnum_v4(ipnum); -} - -int GeoIP_db_avail(int type) { - const char * filePath; - if (type < 0 || type >= NUM_DB_TYPES) { - return 0; - } - _GeoIP_setup_dbfilename(); - filePath = GeoIPDBFileName[type]; - if (NULL == filePath) { - return 0; - } - return _file_exists(filePath); -} - -static -void _setup_segments(GeoIP * gi) { - int i, j, segment_record_length; - unsigned char delim[3]; - unsigned char buf[LARGE_SEGMENT_RECORD_LENGTH]; - ssize_t silence; - int fno = fileno(gi->GeoIPDatabase); - - gi->databaseSegments = NULL; - - /* default to GeoIP Country Edition */ - gi->databaseType = GEOIP_COUNTRY_EDITION; - gi->record_length = STANDARD_RECORD_LENGTH; - lseek(fno, -3l, SEEK_END); - for (i = 0; i < STRUCTURE_INFO_MAX_SIZE; i++) { - silence = read(fno, delim, 3); - if (delim[0] == 255 && delim[1] == 255 && delim[2] == 255) { - silence = read(fno, &gi->databaseType, 1 ); - if (gi->databaseType >= 106) { - /* backwards compatibility with databases from April 2003 and earlier */ - gi->databaseType -= 105; - } - - if (gi->databaseType == GEOIP_REGION_EDITION_REV0) { - /* Region Edition, pre June 2003 */ - gi->databaseSegments = malloc(sizeof(int)); - gi->databaseSegments[0] = STATE_BEGIN_REV0; - } else if (gi->databaseType == GEOIP_REGION_EDITION_REV1) { - /* Region Edition, post June 2003 */ - gi->databaseSegments = malloc(sizeof(int)); - gi->databaseSegments[0] = STATE_BEGIN_REV1; - } else if (gi->databaseType == GEOIP_CITY_EDITION_REV0 || - gi->databaseType == GEOIP_CITY_EDITION_REV1 || - gi->databaseType == GEOIP_ORG_EDITION || - gi->databaseType == GEOIP_ORG_EDITION_V6 || - gi->databaseType == GEOIP_DOMAIN_EDITION || - gi->databaseType == GEOIP_DOMAIN_EDITION_V6 || - gi->databaseType == GEOIP_ISP_EDITION || - gi->databaseType == GEOIP_ISP_EDITION_V6 || - gi->databaseType == GEOIP_REGISTRAR_EDITION || - gi->databaseType == GEOIP_REGISTRAR_EDITION_V6 || - gi->databaseType == GEOIP_USERTYPE_EDITION || - gi->databaseType == GEOIP_USERTYPE_EDITION_V6 || - gi->databaseType == GEOIP_ASNUM_EDITION || - gi->databaseType == GEOIP_ASNUM_EDITION_V6 || - gi->databaseType == GEOIP_NETSPEED_EDITION_REV1 || - gi->databaseType == GEOIP_NETSPEED_EDITION_REV1_V6 || - gi->databaseType == GEOIP_LOCATIONA_EDITION || - gi->databaseType == GEOIP_ACCURACYRADIUS_EDITION || - gi->databaseType == GEOIP_CITYCONFIDENCE_EDITION || - gi->databaseType == GEOIP_CITYCONFIDENCEDIST_EDITION || - gi->databaseType == GEOIP_CITY_EDITION_REV0_V6 || - gi->databaseType == GEOIP_CITY_EDITION_REV1_V6 - - ) { - /* City/Org Editions have two segments, read offset of second segment */ - gi->databaseSegments = malloc(sizeof(int)); - gi->databaseSegments[0] = 0; - - segment_record_length = gi->databaseType == GEOIP_CITYCONFIDENCEDIST_EDITION ? LARGE_SEGMENT_RECORD_LENGTH : SEGMENT_RECORD_LENGTH; - - silence = read(fno, buf, segment_record_length ); - for (j = 0; j < segment_record_length; j++) { - gi->databaseSegments[0] += (buf[j] << (j * 8)); - } - - /* the record_length must be correct from here on */ - if (gi->databaseType == GEOIP_ORG_EDITION || - gi->databaseType == GEOIP_ORG_EDITION_V6 || - gi->databaseType == GEOIP_DOMAIN_EDITION || - gi->databaseType == GEOIP_DOMAIN_EDITION_V6 || - gi->databaseType == GEOIP_ISP_EDITION || - gi->databaseType == GEOIP_ISP_EDITION_V6 || - gi->databaseType == GEOIP_CITYCONFIDENCEDIST_EDITION - ) - gi->record_length = ORG_RECORD_LENGTH; - - if ( gi->databaseType == GEOIP_CITYCONFIDENCE_EDITION - || gi->databaseType == GEOIP_CITYCONFIDENCEDIST_EDITION - ) { - silence = pread(fileno(gi->GeoIPDatabase), buf, gi->record_length, gi->databaseSegments[0] * 2 * gi->record_length); - gi->dyn_seg_size = 0; - for (j = 0; j < gi->record_length; j++) { - gi->dyn_seg_size += (buf[j] << (j * 8)); - } - } - - } - break; - } else { - lseek(fno, -4l, SEEK_CUR); - } - } - if (gi->databaseType == GEOIP_COUNTRY_EDITION || - gi->databaseType == GEOIP_PROXY_EDITION || - gi->databaseType == GEOIP_NETSPEED_EDITION || - gi->databaseType == GEOIP_COUNTRY_EDITION_V6 ) { - gi->databaseSegments = malloc(sizeof(int)); - gi->databaseSegments[0] = COUNTRY_BEGIN; - } - else if ( gi->databaseType == GEOIP_LARGE_COUNTRY_EDITION || - gi->databaseType == GEOIP_LARGE_COUNTRY_EDITION_V6 ) { - gi->databaseSegments = malloc(sizeof(int)); - gi->databaseSegments[0] = LARGE_COUNTRY_BEGIN; - } - -} - -static -int _check_mtime(GeoIP *gi) { - struct stat buf; - -#if !defined(_WIN32) - struct timeval t; -#else /* !defined(_WIN32) */ - FILETIME ft; - ULONGLONG t; -#endif /* !defined(_WIN32) */ - - if (gi->flags & GEOIP_CHECK_CACHE) { - -#if !defined(_WIN32) - /* stat only has second granularity, so don't - * call it more than once a second */ - gettimeofday(&t, NULL); - if (t.tv_sec == gi->last_mtime_check){ - return 0; - } - gi->last_mtime_check = t.tv_sec; - -#else /* !defined(_WIN32) */ - - /* stat only has second granularity, so don't - call it more than once a second */ - GetSystemTimeAsFileTime(&ft); - t = FILETIME_TO_USEC(ft) / 1000 / 1000; - if (t == gi->last_mtime_check){ - return 0; - } - gi->last_mtime_check = t; - -#endif /* !defined(_WIN32) */ - - if (stat(gi->file_path, &buf) != -1) { - /* make sure that the database file is at least 60 - * seconds untouched. Otherwise we might load the - * database only partly and crash - */ - if (buf.st_mtime != gi->mtime && ( buf.st_mtime + 60 < gi->last_mtime_check ) ) { - /* GeoIP Database file updated */ - if (gi->flags & (GEOIP_MEMORY_CACHE | GEOIP_MMAP_CACHE)) { - if ( gi->flags & GEOIP_MMAP_CACHE) { -#if !defined(_WIN32) - /* MMAP is only avail on UNIX */ - munmap(gi->cache, gi->size); - gi->cache = NULL; -#endif - } else { - /* reload database into memory cache */ - if ((gi->cache = (unsigned char*) realloc(gi->cache, buf.st_size)) == NULL) { - //fprintf(stderr,"Out of memory when reloading %s\n",gi->file_path); - return -1; - } - } - } - /* refresh filehandle */ - fclose(gi->GeoIPDatabase); - gi->GeoIPDatabase = fopen(gi->file_path,"rb"); - if (gi->GeoIPDatabase == NULL) { - //fprintf(stderr,"Error Opening file %s when reloading\n",gi->file_path); - return -1; - } - gi->mtime = buf.st_mtime; - gi->size = buf.st_size; - - if ( gi->flags & GEOIP_MMAP_CACHE) { -#if defined(_WIN32) - //fprintf(stderr, "GEOIP_MMAP_CACHE is not supported on WIN32\n"); - gi->cache = 0; - return -1; -#else - gi->cache = mmap(NULL, buf.st_size, PROT_READ, MAP_PRIVATE, fileno(gi->GeoIPDatabase), 0); - if ( gi->cache == MAP_FAILED ) { - - //fprintf(stderr,"Error remapping file %s when reloading\n",gi->file_path); - - gi->cache = NULL; - return -1; - } -#endif - } else if ( gi->flags & GEOIP_MEMORY_CACHE ) { - if (pread(fileno(gi->GeoIPDatabase), gi->cache, buf.st_size, 0) != (ssize_t) buf.st_size) { - //fprintf(stderr,"Error reading file %s when reloading\n",gi->file_path); - return -1; - } - } - - if (gi->databaseSegments != NULL) { - free(gi->databaseSegments); - gi->databaseSegments = NULL; - } - _setup_segments(gi); - if (gi->databaseSegments == NULL) { - //fprintf(stderr, "Error reading file %s -- corrupt\n", gi->file_path); - return -1; - } - if (gi->flags & GEOIP_INDEX_CACHE) { - gi->index_cache = (unsigned char *) realloc(gi->index_cache, sizeof(unsigned char) * ((gi->databaseSegments[0] * (long)gi->record_length * 2))); - if (gi->index_cache != NULL) { - if (pread(fileno(gi->GeoIPDatabase), gi->index_cache, - gi->databaseSegments[0] * (long)gi->record_length * 2, 0 ) != (ssize_t) (gi->databaseSegments[0]*(long)gi->record_length * 2)) { - //fprintf(stderr,"Error reading file %s where reloading\n",gi->file_path); - return -1; - } - } - } - } - } - } - return 0; -} - -#define ADDR_STR_LEN (8 * 4 + 7 + 1) -unsigned int _GeoIP_seek_record_v6 (GeoIP *gi, geoipv6_t ipnum) { - int depth; - char paddr[ADDR_STR_LEN]; - unsigned int x; - unsigned char stack_buffer[2 * MAX_RECORD_LENGTH]; - const unsigned char *buf = (gi->cache == NULL) ? stack_buffer : NULL; - unsigned int offset = 0; - - const unsigned char * p; - int j; - ssize_t silence; - int fno = fileno(gi->GeoIPDatabase); - _check_mtime(gi); - if ( GeoIP_teredo(gi) ) - __GEOIP_PREPARE_TEREDO(&ipnum); - for (depth = 127; depth >= 0; depth--) { - if (gi->cache == NULL && gi->index_cache == NULL) { - /* read from disk */ - silence = pread(fno, stack_buffer,gi->record_length * 2, (long)gi->record_length * 2 * offset ); - } else if (gi->index_cache == NULL) { - /* simply point to record in memory */ - buf = gi->cache + (long)gi->record_length * 2 *offset; - } else { - buf = gi->index_cache + (long)gi->record_length * 2 * offset; - } - - if (GEOIP_CHKBIT_V6(depth, ipnum.s6_addr )) { - /* Take the right-hand branch */ - if ( gi->record_length == 3 ) { - /* Most common case is completely unrolled and uses constants. */ - x = (buf[3*1 + 0] << (0*8)) - + (buf[3*1 + 1] << (1*8)) - + (buf[3*1 + 2] << (2*8)); - - } else { - /* General case */ - j = gi->record_length; - p = &buf[2*j]; - x = 0; - do { - x <<= 8; - x += *(--p); - } while ( --j ); - } - - } else { - /* Take the left-hand branch */ - if ( gi->record_length == 3 ) { - /* Most common case is completely unrolled and uses constants. */ - x = (buf[3*0 + 0] << (0*8)) - + (buf[3*0 + 1] << (1*8)) - + (buf[3*0 + 2] << (2*8)); - } else { - /* General case */ - j = gi->record_length; - p = &buf[1*j]; - x = 0; - do { - x <<= 8; - x += *(--p); - } while ( --j ); - } - } - - if (x >= gi->databaseSegments[0]) { - gi->netmask = 128 - depth; - return x; - } - offset = x; - } - - /* shouldn't reach here */ - _GeoIP_inet_ntop(AF_INET6, &ipnum.s6_addr[0], paddr, ADDR_STR_LEN); - //fprintf(stderr,"Error Traversing Database for ipnum = %s - Perhaps database is corrupt?\n", paddr); - return 0; -} - -geoipv6_t -_GeoIP_addr_to_num_v6(const char *addr) -{ - geoipv6_t ipnum; - if ( 1 == _GeoIP_inet_pton(AF_INET6, addr, &ipnum.s6_addr[0] ) ) - return ipnum; - return IPV6_NULL; -} - -unsigned int _GeoIP_seek_record (GeoIP *gi, unsigned long ipnum) { - int depth; - unsigned int x; - unsigned char stack_buffer[2 * MAX_RECORD_LENGTH]; - const unsigned char *buf = (gi->cache == NULL) ? stack_buffer : NULL; - unsigned int offset = 0; - ssize_t silence; - - const unsigned char * p; - int j; - int fno = fileno(gi->GeoIPDatabase); - _check_mtime(gi); - for (depth = 31; depth >= 0; depth--) { - if (gi->cache == NULL && gi->index_cache == NULL) { - /* read from disk */ - silence = pread(fno, stack_buffer, gi->record_length * 2, gi->record_length * 2 * offset); - } else if (gi->index_cache == NULL) { - /* simply point to record in memory */ - buf = gi->cache + (long)gi->record_length * 2 *offset; - } else { - buf = gi->index_cache + (long)gi->record_length * 2 * offset; - } - - if (ipnum & (1 << depth)) { - /* Take the right-hand branch */ - if ( gi->record_length == 3 ) { - /* Most common case is completely unrolled and uses constants. */ - x = (buf[3*1 + 0] << (0*8)) - + (buf[3*1 + 1] << (1*8)) - + (buf[3*1 + 2] << (2*8)); - - } else { - /* General case */ - j = gi->record_length; - p = &buf[2*j]; - x = 0; - do { - x <<= 8; - x += *(--p); - } while ( --j ); - } - - } else { - /* Take the left-hand branch */ - if ( gi->record_length == 3 ) { - /* Most common case is completely unrolled and uses constants. */ - x = (buf[3*0 + 0] << (0*8)) - + (buf[3*0 + 1] << (1*8)) - + (buf[3*0 + 2] << (2*8)); - } else { - /* General case */ - j = gi->record_length; - p = &buf[1*j]; - x = 0; - do { - x <<= 8; - x += *(--p); - } while ( --j ); - } - } - - if (x >= gi->databaseSegments[0]) { - gi->netmask = 32 - depth; - return x; - } - offset = x; - } - /* shouldn't reach here */ - //fprintf(stderr,"Error Traversing Database for ipnum = %lu - Perhaps database is corrupt?\n",ipnum); - return 0; -} - -unsigned long -GeoIP_addr_to_num(const char *addr) -{ - unsigned int c, octet, t; - unsigned long ipnum; - int i = 3; - - octet = ipnum = 0; - while ((c = *addr++)) { - if (c == '.') { - if (octet > 255) - return 0; - ipnum <<= 8; - ipnum += octet; - i--; - octet = 0; - } else { - t = octet; - octet <<= 3; - octet += t; - octet += t; - c -= '0'; - if (c > 9) - return 0; - octet += c; - } - } - if ((octet > 255) || (i != 0)) - return 0; - ipnum <<= 8; - return ipnum + octet; -} - -GeoIP* GeoIP_open_type (int type, int flags) { - GeoIP * gi; - const char * filePath; - if (type < 0 || type >= NUM_DB_TYPES) { - printf("Invalid database type %d\n", type); - return NULL; - } - _GeoIP_setup_dbfilename(); - filePath = GeoIPDBFileName[type]; - if (filePath == NULL) { - printf("Invalid database type %d\n", type); - return NULL; - } - gi = GeoIP_open (filePath, flags); - return gi; -} - -GeoIP* GeoIP_new (int flags) { - GeoIP * gi; - _GeoIP_setup_dbfilename(); - gi = GeoIP_open (GeoIPDBFileName[GEOIP_COUNTRY_EDITION], flags); - return gi; -} - -GeoIP* GeoIP_open (const char * filename, int flags) { - struct stat buf; - GeoIP * gi; - size_t len; - - gi = (GeoIP *)malloc(sizeof(GeoIP)); - if (gi == NULL) - return NULL; - len = sizeof(char) * (strlen(filename)+1); - gi->file_path = malloc(len); - if (gi->file_path == NULL) { - free(gi); - return NULL; - } - strncpy(gi->file_path, filename, len); - gi->GeoIPDatabase = fopen(filename,"rb"); - if (gi->GeoIPDatabase == NULL) { - //fprintf(stderr,"Error Opening file %s\n",filename); - free(gi->file_path); - free(gi); - return NULL; - } else { - if (flags & (GEOIP_MEMORY_CACHE | GEOIP_MMAP_CACHE) ) { - if (fstat(fileno(gi->GeoIPDatabase), &buf) == -1) { - //fprintf(stderr,"Error stating file %s\n",filename); - free(gi->file_path); - free(gi); - return NULL; - } - gi->mtime = buf.st_mtime; - gi->size = buf.st_size; - - /* MMAP added my Peter Shipley */ - if ( flags & GEOIP_MMAP_CACHE ) { -#if !defined(_WIN32) - gi->cache = mmap(NULL, buf.st_size, PROT_READ, MAP_PRIVATE, fileno(gi->GeoIPDatabase), 0); - if ( gi->cache == MAP_FAILED ) { - fprintf(stderr,"Error mmaping file %s\n",filename); - free(gi->file_path); - free(gi); - return NULL; - } -#endif - } else { - gi->cache = (unsigned char *) malloc(sizeof(unsigned char) * buf.st_size); - - if (gi->cache != NULL) { - if (pread(fileno(gi->GeoIPDatabase),gi->cache, buf.st_size, 0) != (ssize_t) buf.st_size) { - //fprintf(stderr,"Error reading file %s\n",filename); - free(gi->cache); - free(gi->file_path); - free(gi); - return NULL; - } - } - } - } else { - if (flags & GEOIP_CHECK_CACHE) { - if (fstat(fileno(gi->GeoIPDatabase), &buf) == -1) { - //fprintf(stderr,"Error stating file %s\n",filename); - free(gi->file_path); - free(gi); - return NULL; - } - gi->mtime = buf.st_mtime; - } - gi->cache = NULL; - } - gi->flags = flags; - gi->charset = GEOIP_CHARSET_ISO_8859_1; - gi->ext_flags = 1U << GEOIP_TEREDO_BIT; - _setup_segments(gi); - if (flags & GEOIP_INDEX_CACHE) { - gi->index_cache = (unsigned char *) malloc(sizeof(unsigned char) * ((gi->databaseSegments[0] * (long)gi->record_length * 2))); - if (gi->index_cache != NULL) { - if (pread(fileno(gi->GeoIPDatabase),gi->index_cache, gi->databaseSegments[0] * (long)gi->record_length * 2, 0) != (size_t) (gi->databaseSegments[0]*(long)gi->record_length * 2)) { - //fprintf(stderr,"Error reading file %s\n",filename); - free(gi->databaseSegments); - free(gi->index_cache); - free(gi); - return NULL; - } - } - } else { - gi->index_cache = NULL; - } - return gi; - } -} - -void GeoIP_delete (GeoIP *gi) { - if (gi == NULL ) - return; - if (gi->GeoIPDatabase != NULL) - fclose(gi->GeoIPDatabase); - if (gi->cache != NULL) { - if ( gi->flags & GEOIP_MMAP_CACHE ) { -#if !defined(_WIN32) - munmap(gi->cache, gi->size); -#endif - } else { - free(gi->cache); - } - gi->cache = NULL; - } - if (gi->index_cache != NULL) - free(gi->index_cache); - if (gi->file_path != NULL) - free(gi->file_path); - if (gi->databaseSegments != NULL) - free(gi->databaseSegments); - free(gi); -} - -const char *GeoIP_country_code_by_name_v6 (GeoIP* gi, const char *name) { - int country_id; - country_id = GeoIP_id_by_name_v6(gi, name); - return (country_id > 0) ? GeoIP_country_code[country_id] : NULL; -} - -const char *GeoIP_country_code_by_name (GeoIP* gi, const char *name) { - int country_id; - country_id = GeoIP_id_by_name(gi, name); - return (country_id > 0) ? GeoIP_country_code[country_id] : NULL; -} - -const char *GeoIP_country_code3_by_name_v6 (GeoIP* gi, const char *name) { - int country_id; - country_id = GeoIP_id_by_name_v6(gi, name); - return (country_id > 0) ? GeoIP_country_code3[country_id] : NULL; -} - -const char *GeoIP_country_code3_by_name (GeoIP* gi, const char *name) { - int country_id; - country_id = GeoIP_id_by_name(gi, name); - return (country_id > 0) ? GeoIP_country_code3[country_id] : NULL; -} - -const char *GeoIP_country_name_by_name_v6 (GeoIP* gi, const char *name) { - int country_id; - country_id = GeoIP_id_by_name_v6(gi, name); - return GeoIP_country_name_by_id(gi, country_id ); -} - -const char *GeoIP_country_name_by_name (GeoIP* gi, const char *name) { - int country_id; - country_id = GeoIP_id_by_name(gi, name); - return GeoIP_country_name_by_id(gi, country_id ); -} - -unsigned long _GeoIP_lookupaddress (const char *host) { - unsigned long addr = inet_addr(host); - struct hostent phe2; - struct hostent * phe = &phe2; - char *buf = NULL; -#ifdef HAVE_GETHOSTBYNAME_R - int buflength = 16384; - int herr = 0; -#endif - int result = 0; -#ifdef HAVE_GETHOSTBYNAME_R - buf = malloc(buflength); -#endif - if (addr == INADDR_NONE) { -#ifdef HAVE_GETHOSTBYNAME_R - while (1) { - /* we use gethostbyname_r here because it is thread-safe and gethostbyname is not */ -#ifdef GETHOSTBYNAME_R_RETURNS_INT - result = gethostbyname_r(host,&phe2,buf,buflength,&phe,&herr); -#else - phe = gethostbyname_r(host,&phe2,buf,buflength,&herr); -#endif - if (herr != ERANGE) - break; - if (result == 0) - break; - /* double the buffer if the buffer is too small */ - buflength = buflength * 2; - buf = realloc(buf,buflength); - } -#else - /* Some systems do not support gethostbyname_r, such as Mac OS X */ - phe = gethostbyname(host); -#endif - if (!phe || result != 0) { - free(buf); - return 0; - } -#if !defined(_WIN32) - addr = *((in_addr_t *) phe->h_addr_list[0]); -#else - addr = ((IN_ADDR *) phe->h_addr_list[0])->S_un.S_addr; -#endif - } -#ifdef HAVE_GETHOSTBYNAME_R - free(buf); -#endif - return ntohl(addr); -} - -geoipv6_t -_GeoIP_lookupaddress_v6(const char *host) -{ - geoipv6_t ipnum; - int gaierr; - struct addrinfo hints, *aifirst; - - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_INET6; - /* hints.ai_flags = AI_V4MAPPED; */ - hints.ai_socktype = SOCK_STREAM; - - if ((gaierr = getaddrinfo(host, NULL, &hints, &aifirst)) != 0) { - /* fprintf(stderr, "Err: %s (%d %s)\n", host, gaierr, gai_strerror(gaierr)); */ - return IPV6_NULL; - } - memcpy(ipnum.s6_addr, ((struct sockaddr_in6 *) aifirst->ai_addr)->sin6_addr.s6_addr, sizeof(geoipv6_t)); - freeaddrinfo(aifirst); - /* inet_pton(AF_INET6, host, ipnum.s6_addr); */ - - return ipnum; -} - -int GeoIP_id_by_name (GeoIP* gi, const char *name) { - unsigned long ipnum; - int ret; - if (name == NULL) { - return 0; - } - if (gi->databaseType != GEOIP_LARGE_COUNTRY_EDITION && gi->databaseType != GEOIP_COUNTRY_EDITION && gi->databaseType != GEOIP_PROXY_EDITION && gi->databaseType != GEOIP_NETSPEED_EDITION) { - printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_COUNTRY_EDITION]); - return 0; - } - if (!(ipnum = _GeoIP_lookupaddress(name))) - return 0; - ret = _GeoIP_seek_record(gi, ipnum) - gi->databaseSegments[0]; - return ret; - -} - -int GeoIP_id_by_name_v6 (GeoIP* gi, const char *name) { - geoipv6_t ipnum; - int ret; - if (name == NULL) { - return 0; - } - if (gi->databaseType != GEOIP_LARGE_COUNTRY_EDITION_V6 && gi->databaseType != GEOIP_COUNTRY_EDITION_V6) { - printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_COUNTRY_EDITION_V6]); - return 0; - } - ipnum = _GeoIP_lookupaddress_v6(name); - if (__GEOIP_V6_IS_NULL(ipnum)) - return 0; - - ret = _GeoIP_seek_record_v6(gi, ipnum) - gi->databaseSegments[0]; - return ret; -} - -const char *GeoIP_country_code_by_addr_v6 (GeoIP* gi, const char *addr) { - int country_id; - country_id = GeoIP_id_by_addr_v6(gi, addr); - return (country_id > 0) ? GeoIP_country_code[country_id] : NULL; -} - -const char *GeoIP_country_code_by_addr (GeoIP* gi, const char *addr) { - int country_id; - country_id = GeoIP_id_by_addr(gi, addr); - return (country_id > 0) ? GeoIP_country_code[country_id] : NULL; -} - -const char *GeoIP_country_code3_by_addr_v6 (GeoIP* gi, const char *addr) { - int country_id; - country_id = GeoIP_id_by_addr_v6(gi, addr); - return (country_id > 0) ? GeoIP_country_code3[country_id] : NULL; -} - -const char *GeoIP_country_code3_by_addr (GeoIP* gi, const char *addr) { - int country_id; - country_id = GeoIP_id_by_addr(gi, addr); - return (country_id > 0) ? GeoIP_country_code3[country_id] : NULL; -} - -const char *GeoIP_country_name_by_addr_v6 (GeoIP* gi, const char *addr) { - int country_id; - country_id = GeoIP_id_by_addr_v6(gi, addr); - return GeoIP_country_name_by_id(gi, country_id ); -} - -const char *GeoIP_country_name_by_addr (GeoIP* gi, const char *addr) { - int country_id; - country_id = GeoIP_id_by_addr(gi, addr); - return GeoIP_country_name_by_id(gi, country_id ); -} - -const char *GeoIP_country_name_by_ipnum (GeoIP* gi, unsigned long ipnum) { - int country_id; - country_id = GeoIP_id_by_ipnum(gi, ipnum); - return GeoIP_country_name_by_id(gi, country_id ); -} - -const char *GeoIP_country_name_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum) { - int country_id; - country_id = GeoIP_id_by_ipnum_v6(gi, ipnum); - return GeoIP_country_name_by_id(gi, country_id ); -} - -const char *GeoIP_country_code_by_ipnum (GeoIP* gi, unsigned long ipnum) { - int country_id; - country_id = GeoIP_id_by_ipnum(gi, ipnum); - return (country_id > 0) ? GeoIP_country_code[country_id] : NULL; -} - -const char *GeoIP_country_code_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum) { - int country_id; - country_id = GeoIP_id_by_ipnum_v6(gi, ipnum); - return (country_id > 0) ? GeoIP_country_code[country_id] : NULL; -} - -const char *GeoIP_country_code3_by_ipnum (GeoIP* gi, unsigned long ipnum) { - int country_id; - country_id = GeoIP_id_by_ipnum(gi, ipnum); - return (country_id > 0) ? GeoIP_country_code3[country_id] : NULL; -} - -const char *GeoIP_country_code3_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum) { - int country_id; - country_id = GeoIP_id_by_ipnum_v6(gi, ipnum); - return (country_id > 0) ? GeoIP_country_code3[country_id] : NULL; -} - -int GeoIP_country_id_by_addr_v6 (GeoIP* gi, const char *addr) { - return GeoIP_id_by_addr_v6(gi, addr); -} - -int GeoIP_country_id_by_addr (GeoIP* gi, const char *addr) { - return GeoIP_id_by_addr(gi, addr); -} - -int GeoIP_country_id_by_name_v6 (GeoIP* gi, const char *host) { - return GeoIP_id_by_name_v6(gi, host); -} - -int GeoIP_country_id_by_name (GeoIP* gi, const char *host) { - return GeoIP_id_by_name(gi, host); -} - -int GeoIP_id_by_addr_v6 (GeoIP* gi, const char *addr) { - geoipv6_t ipnum; - int ret; - if (addr == NULL) { - return 0; - } - if (gi->databaseType != GEOIP_COUNTRY_EDITION_V6 - && gi->databaseType != GEOIP_LARGE_COUNTRY_EDITION_V6) { - printf("Invalid database type %s, expected %s\n", - GeoIPDBDescription[(int)gi->databaseType], - GeoIPDBDescription[GEOIP_COUNTRY_EDITION_V6]); - return 0; - } - ipnum = _GeoIP_addr_to_num_v6(addr); - ret = _GeoIP_seek_record_v6(gi, ipnum) - gi->databaseSegments[0]; - return ret; -} - -int GeoIP_id_by_addr (GeoIP* gi, const char *addr) { - unsigned long ipnum; - int ret; - if (addr == NULL) { - return 0; - } - if (gi->databaseType != GEOIP_COUNTRY_EDITION && - gi->databaseType != GEOIP_LARGE_COUNTRY_EDITION && - gi->databaseType != GEOIP_PROXY_EDITION && - gi->databaseType != GEOIP_NETSPEED_EDITION) { - printf("Invalid database type %s, expected %s\n", - GeoIPDBDescription[(int)gi->databaseType], - GeoIPDBDescription[GEOIP_COUNTRY_EDITION]); - return 0; - } - ipnum = GeoIP_addr_to_num(addr); - ret = _GeoIP_seek_record(gi, ipnum) - gi->databaseSegments[0]; - return ret; -} - -int GeoIP_id_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum) { - int ret; -/* if (ipnum == 0) { - return 0; - } -*/ - if (gi->databaseType != GEOIP_COUNTRY_EDITION_V6 - && gi->databaseType != GEOIP_LARGE_COUNTRY_EDITION_V6) { - printf("Invalid database type %s, expected %s\n", - GeoIPDBDescription[(int)gi->databaseType], - GeoIPDBDescription[GEOIP_COUNTRY_EDITION_V6]); - return 0; - } - ret = _GeoIP_seek_record_v6(gi, ipnum) - gi->databaseSegments[0]; - return ret; -} - - - -int GeoIP_id_by_ipnum (GeoIP* gi, unsigned long ipnum) { - int ret; - if (ipnum == 0) { - return 0; - } - if (gi->databaseType != GEOIP_COUNTRY_EDITION && - gi->databaseType != GEOIP_LARGE_COUNTRY_EDITION && - gi->databaseType != GEOIP_PROXY_EDITION && - gi->databaseType != GEOIP_NETSPEED_EDITION) { - printf("Invalid database type %s, expected %s\n", - GeoIPDBDescription[(int)gi->databaseType], - GeoIPDBDescription[GEOIP_COUNTRY_EDITION]); - return 0; - } - ret = _GeoIP_seek_record(gi, ipnum) - gi->databaseSegments[0]; - return ret; -} - -char *GeoIP_database_info (GeoIP* gi) { - int i; - unsigned char buf[3]; - char *retval; - int hasStructureInfo = 0; - ssize_t silence; - int fno = fileno(gi->GeoIPDatabase); - - if(gi == NULL) - return NULL; - - _check_mtime(gi); - lseek(fno, -3l, SEEK_END); - - /* first get past the database structure information */ - for (i = 0; i < STRUCTURE_INFO_MAX_SIZE; i++) { - silence = read(fno, buf, 3 ); - if (buf[0] == 255 && buf[1] == 255 && buf[2] == 255) { - hasStructureInfo = 1; - break; - } - lseek(fno, -4l, SEEK_CUR); - } - if (hasStructureInfo == 1) { - lseek(fno, -6l, SEEK_CUR); - } else { - /* no structure info, must be pre Sep 2002 database, go back to end */ - lseek(fno, -3l, SEEK_END); - } - - for (i = 0; i < DATABASE_INFO_MAX_SIZE; i++) { - silence = read(fno, buf, 3 ); - if (buf[0] == 0 && buf[1] == 0 && buf[2] == 0) { - retval = malloc(sizeof(char) * (i+1)); - if (retval == NULL) { - return NULL; - } - silence = read(fno, retval, i); - retval[i] = '\0'; - return retval; - } - lseek(fno, -4l, SEEK_CUR); - } - return NULL; -} - -/* GeoIP Region Edition functions */ - -void GeoIP_assign_region_by_inetaddr(GeoIP* gi, unsigned long inetaddr, GeoIPRegion *region) { - unsigned int seek_region; - - /* This also writes in the terminating NULs (if you decide to - * keep them) and clear any fields that are not set. */ - memset(region, 0, sizeof(GeoIPRegion)); - - seek_region = _GeoIP_seek_record(gi, ntohl(inetaddr)); - - if (gi->databaseType == GEOIP_REGION_EDITION_REV0) { - /* Region Edition, pre June 2003 */ - seek_region -= STATE_BEGIN_REV0; - if (seek_region >= 1000) { - region->country_code[0] = 'U'; - region->country_code[1] = 'S'; - region->region[0] = (char) ((seek_region - 1000)/26 + 65); - region->region[1] = (char) ((seek_region - 1000)%26 + 65); - } else { - memcpy(region->country_code, GeoIP_country_code[seek_region], 2); - } - } else if (gi->databaseType == GEOIP_REGION_EDITION_REV1) { - /* Region Edition, post June 2003 */ - seek_region -= STATE_BEGIN_REV1; - if (seek_region < US_OFFSET) { - /* Unknown */ - /* we don't need to do anything here b/c we memset region to 0 */ - } else if (seek_region < CANADA_OFFSET) { - /* USA State */ - region->country_code[0] = 'U'; - region->country_code[1] = 'S'; - region->region[0] = (char) ((seek_region - US_OFFSET)/26 + 65); - region->region[1] = (char) ((seek_region - US_OFFSET)%26 + 65); - } else if (seek_region < WORLD_OFFSET) { - /* Canada Province */ - region->country_code[0] = 'C'; - region->country_code[1] = 'A'; - region->region[0] = (char) ((seek_region - CANADA_OFFSET)/26 + 65); - region->region[1] = (char) ((seek_region - CANADA_OFFSET)%26 + 65); - } else { - /* Not US or Canada */ - memcpy(region->country_code, GeoIP_country_code[(seek_region - WORLD_OFFSET) / FIPS_RANGE], 2); - } - } -} - -void GeoIP_assign_region_by_inetaddr_v6(GeoIP* gi, geoipv6_t inetaddr, GeoIPRegion *region) { - unsigned int seek_region; - - /* This also writes in the terminating NULs (if you decide to - * keep them) and clear any fields that are not set. */ - memset(region, 0, sizeof(GeoIPRegion)); - - seek_region = _GeoIP_seek_record_v6(gi, inetaddr); - - if (gi->databaseType == GEOIP_REGION_EDITION_REV0) { - /* Region Edition, pre June 2003 */ - seek_region -= STATE_BEGIN_REV0; - if (seek_region >= 1000) { - region->country_code[0] = 'U'; - region->country_code[1] = 'S'; - region->region[0] = (char) ((seek_region - 1000)/26 + 65); - region->region[1] = (char) ((seek_region - 1000)%26 + 65); - } else { - memcpy(region->country_code, GeoIP_country_code[seek_region], 2); - } - } else if (gi->databaseType == GEOIP_REGION_EDITION_REV1) { - /* Region Edition, post June 2003 */ - seek_region -= STATE_BEGIN_REV1; - if (seek_region < US_OFFSET) { - /* Unknown */ - /* we don't need to do anything here b/c we memset region to 0 */ - } else if (seek_region < CANADA_OFFSET) { - /* USA State */ - region->country_code[0] = 'U'; - region->country_code[1] = 'S'; - region->region[0] = (char) ((seek_region - US_OFFSET)/26 + 65); - region->region[1] = (char) ((seek_region - US_OFFSET)%26 + 65); - } else if (seek_region < WORLD_OFFSET) { - /* Canada Province */ - region->country_code[0] = 'C'; - region->country_code[1] = 'A'; - region->region[0] = (char) ((seek_region - CANADA_OFFSET)/26 + 65); - region->region[1] = (char) ((seek_region - CANADA_OFFSET)%26 + 65); - } else { - /* Not US or Canada */ - memcpy(region->country_code, GeoIP_country_code[(seek_region - WORLD_OFFSET) / FIPS_RANGE], 2); - } - } -} - -static -GeoIPRegion * _get_region(GeoIP* gi, unsigned long ipnum) { - GeoIPRegion * region; - - region = malloc(sizeof(GeoIPRegion)); - if (region) { - GeoIP_assign_region_by_inetaddr(gi, htonl(ipnum), region); - } - return region; -} - -static -GeoIPRegion * _get_region_v6(GeoIP* gi, geoipv6_t ipnum) { - GeoIPRegion * region; - - region = malloc(sizeof(GeoIPRegion)); - if (region) { - GeoIP_assign_region_by_inetaddr_v6(gi, ipnum, region); - } - return region; -} - -GeoIPRegion * GeoIP_region_by_addr (GeoIP* gi, const char *addr) { - unsigned long ipnum; - if (addr == NULL) { - return 0; - } - if (gi->databaseType != GEOIP_REGION_EDITION_REV0 && - gi->databaseType != GEOIP_REGION_EDITION_REV1) { - printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_REGION_EDITION_REV1]); - return 0; - } - ipnum = GeoIP_addr_to_num(addr); - return _get_region(gi, ipnum); -} - -GeoIPRegion * GeoIP_region_by_addr_v6 (GeoIP* gi, const char *addr) { - geoipv6_t ipnum; - if (addr == NULL) { - return 0; - } - if (gi->databaseType != GEOIP_REGION_EDITION_REV0 && - gi->databaseType != GEOIP_REGION_EDITION_REV1) { - printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_REGION_EDITION_REV1]); - return 0; - } - ipnum = _GeoIP_addr_to_num_v6(addr); - return _get_region_v6(gi, ipnum); -} - -GeoIPRegion * GeoIP_region_by_name (GeoIP* gi, const char *name) { - unsigned long ipnum; - if (name == NULL) { - return 0; - } - if (gi->databaseType != GEOIP_REGION_EDITION_REV0 && - gi->databaseType != GEOIP_REGION_EDITION_REV1) { - printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_REGION_EDITION_REV1]); - return 0; - } - if (!(ipnum = _GeoIP_lookupaddress(name))) - return 0; - return _get_region(gi, ipnum); -} - -GeoIPRegion * GeoIP_region_by_name_v6 (GeoIP* gi, const char *name) { - geoipv6_t ipnum; - if (name == NULL) { - return 0; - } - if (gi->databaseType != GEOIP_REGION_EDITION_REV0 && - gi->databaseType != GEOIP_REGION_EDITION_REV1) { - printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_REGION_EDITION_REV1]); - return 0; - } - - ipnum = _GeoIP_lookupaddress_v6(name); - if (__GEOIP_V6_IS_NULL(ipnum)) - return 0; - return _get_region_v6(gi, ipnum); -} - -GeoIPRegion * GeoIP_region_by_ipnum (GeoIP* gi, unsigned long ipnum) { - if (gi->databaseType != GEOIP_REGION_EDITION_REV0 && - gi->databaseType != GEOIP_REGION_EDITION_REV1) { - printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_REGION_EDITION_REV1]); - return 0; - } - return _get_region(gi, ipnum); -} - -GeoIPRegion * GeoIP_region_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum) { - if (gi->databaseType != GEOIP_REGION_EDITION_REV0 && - gi->databaseType != GEOIP_REGION_EDITION_REV1) { - printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_REGION_EDITION_REV1]); - return 0; - } - return _get_region_v6(gi, ipnum); -} - -void GeoIPRegion_delete (GeoIPRegion *gir) { - free(gir); -} - -/* GeoIP Organization, ISP and AS Number Edition private method */ -static -char *_get_name (GeoIP* gi, unsigned long ipnum) { - int seek_org; - char buf[MAX_ORG_RECORD_LENGTH]; - char * org_buf, * buf_pointer; - int record_pointer; - size_t len; - ssize_t silence; - - if (gi->databaseType != GEOIP_ORG_EDITION && - gi->databaseType != GEOIP_ISP_EDITION && - gi->databaseType != GEOIP_DOMAIN_EDITION && - gi->databaseType != GEOIP_ASNUM_EDITION && - gi->databaseType != GEOIP_NETSPEED_EDITION_REV1 && - gi->databaseType != GEOIP_USERTYPE_EDITION && - gi->databaseType != GEOIP_REGISTRAR_EDITION && - gi->databaseType != GEOIP_LOCATIONA_EDITION - ) { - printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_ORG_EDITION]); - return NULL; - } - - seek_org = _GeoIP_seek_record(gi, ipnum); - if (seek_org == gi->databaseSegments[0]) - return NULL; - - record_pointer = seek_org + (2 * gi->record_length - 1) * gi->databaseSegments[0]; - - if (gi->cache == NULL) { - silence = pread(fileno(gi->GeoIPDatabase), buf, MAX_ORG_RECORD_LENGTH, record_pointer); - if ( gi->charset == GEOIP_CHARSET_UTF8 ) { - org_buf = _GeoIP_iso_8859_1__utf8( (const char * ) buf ); - } else { - len = sizeof(char) * (strlen(buf)+1); - org_buf = malloc(len); - strncpy(org_buf, buf, len); - } - } else { - buf_pointer = (char *)(gi->cache + (long)record_pointer); - if ( gi->charset == GEOIP_CHARSET_UTF8 ) { - org_buf = _GeoIP_iso_8859_1__utf8( (const char * ) buf_pointer ); - } else { - len = sizeof(char) * (strlen(buf_pointer)+1); - org_buf = malloc(len); - strncpy(org_buf, buf_pointer, len); - } - } - return org_buf; -} - -char *_get_name_v6 (GeoIP* gi, geoipv6_t ipnum) { - int seek_org; - char buf[MAX_ORG_RECORD_LENGTH]; - char * org_buf, * buf_pointer; - int record_pointer; - size_t len; - ssize_t silence; - - if ( - gi->databaseType != GEOIP_ORG_EDITION_V6 && - gi->databaseType != GEOIP_ISP_EDITION_V6 && - gi->databaseType != GEOIP_DOMAIN_EDITION_V6 && - gi->databaseType != GEOIP_ASNUM_EDITION_V6 && - gi->databaseType != GEOIP_NETSPEED_EDITION_REV1_V6 && - gi->databaseType != GEOIP_USERTYPE_EDITION_V6 && - gi->databaseType != GEOIP_REGISTRAR_EDITION_V6 && - gi->databaseType != GEOIP_LOCATIONA_EDITION - ) { - printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int)gi->databaseType], GeoIPDBDescription[GEOIP_ORG_EDITION]); - return NULL; - } - - seek_org = _GeoIP_seek_record_v6(gi, ipnum); - if (seek_org == gi->databaseSegments[0]) - return NULL; - - record_pointer = seek_org + (2 * gi->record_length - 1) * gi->databaseSegments[0]; - - if (gi->cache == NULL) { - silence = pread(fileno(gi->GeoIPDatabase), buf, MAX_ORG_RECORD_LENGTH, record_pointer); - if ( gi->charset == GEOIP_CHARSET_UTF8 ) { - org_buf = _GeoIP_iso_8859_1__utf8( (const char * ) buf ); - } else { - len = sizeof(char) * (strlen(buf)+1); - org_buf = malloc(len); - strncpy(org_buf, buf, len); - } - } else { - buf_pointer = (char *)(gi->cache + (long)record_pointer); - if ( gi->charset == GEOIP_CHARSET_UTF8 ) { - org_buf = _GeoIP_iso_8859_1__utf8( (const char * ) buf_pointer ); - } else { - len = sizeof(char) * (strlen(buf_pointer)+1); - org_buf = malloc(len); - strncpy(org_buf, buf_pointer, len); - } - } - return org_buf; -} - -char * GeoIP_num_to_addr (unsigned long ipnum) { - char *ret_str; - char *cur_str; - int octet[4]; - int num_chars_written, i; - - ret_str = malloc(sizeof(char) * 16); - cur_str = ret_str; - - for (i = 0; i<4; i++) { - octet[3 - i] = ipnum % 256; - ipnum >>= 8; - } - - for (i = 0; i<4; i++) { - num_chars_written = sprintf(cur_str, "%d", octet[i]); - cur_str += num_chars_written; - - if (i < 3) { - cur_str[0] = '.'; - cur_str++; - } - } - - return ret_str; -} - -char **GeoIP_range_by_ip (GeoIP* gi, const char *addr) { - unsigned long ipnum; - unsigned long left_seek; - unsigned long right_seek; - unsigned long mask; - int orig_netmask; - int target_value; - char **ret; - - if (addr == NULL) { - return 0; - } - - ret = malloc(sizeof(char *) * 2); - - ipnum = GeoIP_addr_to_num(addr); - target_value = _GeoIP_seek_record(gi, ipnum); - orig_netmask = GeoIP_last_netmask(gi); - mask = 0xffffffff << ( 32 - orig_netmask ); - left_seek = ipnum & mask; - right_seek = left_seek + ( 0xffffffff & ~mask ); - - while (left_seek != 0 - && target_value == _GeoIP_seek_record(gi, left_seek - 1) ) { - - /* Go to beginning of netblock defined by netmask */ - mask = 0xffffffff << ( 32 - GeoIP_last_netmask(gi) ); - left_seek = ( left_seek - 1 ) & mask; - } - ret[0] = GeoIP_num_to_addr(left_seek); - - while (right_seek != 0xffffffff - && target_value == _GeoIP_seek_record(gi, right_seek + 1) ) { - - /* Go to end of netblock defined by netmask */ - mask = 0xffffffff << ( 32 - GeoIP_last_netmask(gi) ); - right_seek = ( right_seek + 1 ) & mask; - right_seek += 0xffffffff & ~mask; - } - ret[1] = GeoIP_num_to_addr(right_seek); - - gi->netmask = orig_netmask; - - return ret; -} - -void GeoIP_range_by_ip_delete( char ** ptr ){ - if ( ptr ){ - if ( ptr[0] ) - free(ptr[0]); - if ( ptr[1] ) - free(ptr[1]); - free(ptr); - } -} - -char *GeoIP_name_by_ipnum (GeoIP* gi, unsigned long ipnum) { - return _get_name(gi,ipnum); -} - -char *GeoIP_name_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum) { - return _get_name_v6(gi,ipnum); -} - -char *GeoIP_name_by_addr (GeoIP* gi, const char *addr) { - unsigned long ipnum; - if (addr == NULL) { - return 0; - } - ipnum = GeoIP_addr_to_num(addr); - return _get_name(gi, ipnum); -} - -char *GeoIP_name_by_addr_v6 (GeoIP* gi, const char *addr) { - geoipv6_t ipnum; - if (addr == NULL) { - return 0; - } - ipnum = _GeoIP_addr_to_num_v6(addr); - return _get_name_v6(gi, ipnum); -} - -char *GeoIP_name_by_name (GeoIP* gi, const char *name) { - unsigned long ipnum; - if (name == NULL) { - return 0; - } - if (!(ipnum = _GeoIP_lookupaddress(name))) - return 0; - return _get_name(gi, ipnum); -} - -char *GeoIP_name_by_name_v6 (GeoIP* gi, const char *name) { - geoipv6_t ipnum; - if (name == NULL) { - return 0; - } - ipnum = _GeoIP_lookupaddress_v6(name); - if (__GEOIP_V6_IS_NULL(ipnum)) - return 0; - return _get_name_v6(gi, ipnum); -} - -char *GeoIP_org_by_ipnum (GeoIP* gi, unsigned long ipnum) { - return GeoIP_name_by_ipnum(gi, ipnum); -} - -char *GeoIP_org_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum) { - return GeoIP_name_by_ipnum_v6(gi, ipnum); -} - -char *GeoIP_org_by_addr (GeoIP* gi, const char *addr) { - return GeoIP_name_by_addr(gi, addr); -} - -char *GeoIP_org_by_addr_v6 (GeoIP* gi, const char *addr) { - return GeoIP_name_by_addr_v6(gi, addr); -} - -char *GeoIP_org_by_name (GeoIP* gi, const char *name) { - return GeoIP_name_by_name(gi, name); -} - -char *GeoIP_org_by_name_v6 (GeoIP* gi, const char *name) { - return GeoIP_name_by_name_v6(gi, name); -} - -unsigned char GeoIP_database_edition (GeoIP* gi) { - return gi->databaseType; -} - -int GeoIP_enable_teredo(GeoIP* gi, int true_false){ - unsigned int mask = ( 1U << GEOIP_TEREDO_BIT ); - int b = ( gi->ext_flags & mask ) ? 1 : 0; - gi->ext_flags &= ~mask ; - if ( true_false ) - gi->ext_flags |= true_false; - return b; -} - -int GeoIP_teredo ( GeoIP* gi ){ - unsigned int mask = ( 1U << GEOIP_TEREDO_BIT ); - return ( gi->ext_flags & mask ) ? 1 : 0; -} - -int GeoIP_charset( GeoIP* gi){ - return gi->charset; -} - -int GeoIP_set_charset( GeoIP* gi, int charset ){ - int old_charset = gi->charset; - gi->charset = charset; - return old_charset; -} - -int GeoIP_last_netmask (GeoIP* gi) { - return gi->netmask; -} - - -/** return two letter country code */ -const char* GeoIP_code_by_id(int id) -{ - if (id < 0 || id >= (int) num_GeoIP_countries) - return NULL; - - return GeoIP_country_code[id]; -} - -/** return three letter country code */ -const char* GeoIP_code3_by_id(int id) -{ - if (id < 0 || id >= (int) num_GeoIP_countries) - return NULL; - - return GeoIP_country_code3[id]; -} - - -/** return full name of country in utf8 or iso-8859-1 */ -const char* GeoIP_country_name_by_id(GeoIP * gi, int id) -{ - /* return NULL also even for index 0 for backward compatibility */ - if (id <= 0 || id >= (int) num_GeoIP_countries) - return NULL; - return ((gi->charset == GEOIP_CHARSET_UTF8) - ? GeoIP_utf8_country_name[id] - : GeoIP_country_name[id]); -} - -/** return full name of country in iso-8859-1 */ -const char* GeoIP_name_by_id(int id) -{ - if (id < 0 || id >= (int) num_GeoIP_countries) - return NULL; - - return GeoIP_country_name[id]; -} - -/** return continent of country */ -const char* GeoIP_continent_by_id(int id) -{ - if (id < 0 || id >= (int) num_GeoIP_countries) - return NULL; - - return GeoIP_country_continent[id]; -} - -/** return id by country code **/ -int GeoIP_id_by_code(const char *country) -{ - unsigned i; - - for ( i = 0; i < num_GeoIP_countries; ++i) - { - if (strcmp(country, GeoIP_country_code[i]) == 0) - return i; - } - - return 0; -} - -unsigned GeoIP_num_countries(void) -{ - return num_GeoIP_countries; -} - -/*const char * GeoIP_lib_version(void) -{ - return PACKAGE_VERSION; -}*/ - -int GeoIP_cleanup(void) -{ - int i, result = 0; - if (GeoIPDBFileName) { - - for (i = 0; i < NUM_DB_TYPES; i++) { - if (GeoIPDBFileName[i]) free(GeoIPDBFileName[i]); - } - - free(GeoIPDBFileName); - GeoIPDBFileName = NULL; - result = 1; - } - - return result; -} - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIP.h b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIP.h deleted file mode 100644 index c1a2a470..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIP.h +++ /dev/null @@ -1,315 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ -/* GeoIP.h - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef GEOIP_H -#define GEOIP_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#if !defined(_WIN32) -#include -#include -#include -#else /* !defined(_WIN32) */ -#include -#include -#include -#include -#define snprintf _snprintf -#define FILETIME_TO_USEC(ft) (((unsigned __int64) ft.dwHighDateTime << 32 | ft.dwLowDateTime) / 10) -#endif /* !defined(_WIN32) */ - -#include -#include -#include -#include /* for fstat */ -#include /* for fstat */ - -#define SEGMENT_RECORD_LENGTH 3 -#define LARGE_SEGMENT_RECORD_LENGTH 4 -#define STANDARD_RECORD_LENGTH 3 -#define ORG_RECORD_LENGTH 4 -#define MAX_RECORD_LENGTH 4 -#define NUM_DB_TYPES (33+1) - -// TODO -#ifdef _WIN32 -#include -#include -#define ssize_t int -static int pread(unsigned int fd, char *buf, size_t count, int offset); -#endif - -/* 128 bit address in network order */ -typedef struct in6_addr geoipv6_t; - -#define GEOIP_CHKBIT_V6(bit,ptr) (ptr[((127UL - bit) >> 3)] & (1UL << (~(127 - bit) & 7))) - -typedef struct GeoIPTag { - FILE *GeoIPDatabase; - char *file_path; - unsigned char *cache; - unsigned char *index_cache; - unsigned int *databaseSegments; - char databaseType; - time_t mtime; - int flags; - off_t size; - char record_length; - int charset; /* 0 iso-8859-1 1 utf8 */ - int record_iter; /* used in GeoIP_next_record */ - int netmask; /* netmask of last lookup - set using depth in _GeoIP_seek_record */ - time_t last_mtime_check; - off_t dyn_seg_size; /* currently only used by the cityconfidence database */ - unsigned int ext_flags; /* bit 0 teredo support enabled */ -} GeoIP; - - -typedef enum { - GEOIP_TEREDO_BIT = 0 -} GeoIPExtFlags; - -typedef enum { - GEOIP_CHARSET_ISO_8859_1 = 0, - GEOIP_CHARSET_UTF8 = 1 -} GeoIPCharset; - -typedef struct GeoIPRegionTag { - char country_code[3]; - char region[3]; -} GeoIPRegion; - -typedef enum { - GEOIP_STANDARD = 0, - GEOIP_MEMORY_CACHE = 1, - GEOIP_CHECK_CACHE = 2, - GEOIP_INDEX_CACHE = 4, - GEOIP_MMAP_CACHE = 8, -} GeoIPOptions; - -typedef enum { - GEOIP_COUNTRY_EDITION = 1, - GEOIP_REGION_EDITION_REV0 = 7, - GEOIP_CITY_EDITION_REV0 = 6, - GEOIP_ORG_EDITION = 5, - GEOIP_ISP_EDITION = 4, - GEOIP_CITY_EDITION_REV1 = 2, - GEOIP_REGION_EDITION_REV1 = 3, - GEOIP_PROXY_EDITION = 8, - GEOIP_ASNUM_EDITION = 9, - GEOIP_NETSPEED_EDITION = 10, - GEOIP_DOMAIN_EDITION = 11, - GEOIP_COUNTRY_EDITION_V6 = 12, - GEOIP_LOCATIONA_EDITION = 13, - GEOIP_ACCURACYRADIUS_EDITION = 14, - GEOIP_CITYCONFIDENCE_EDITION = 15, - GEOIP_CITYCONFIDENCEDIST_EDITION = 16, - GEOIP_LARGE_COUNTRY_EDITION = 17, - GEOIP_LARGE_COUNTRY_EDITION_V6 = 18, - GEOIP_CITYCONFIDENCEDIST_ISP_ORG_EDITION = 19, /* unsued, but gaps are not allowed */ - GEOIP_CCM_COUNTRY_EDITION =20, /* unsued, but gaps are not allowed */ - GEOIP_ASNUM_EDITION_V6 = 21, - GEOIP_ISP_EDITION_V6 = 22, - GEOIP_ORG_EDITION_V6 = 23, - GEOIP_DOMAIN_EDITION_V6 = 24, - GEOIP_LOCATIONA_EDITION_V6 = 25, - GEOIP_REGISTRAR_EDITION = 26, - GEOIP_REGISTRAR_EDITION_V6 = 27, - GEOIP_USERTYPE_EDITION = 28, - GEOIP_USERTYPE_EDITION_V6 = 29, - GEOIP_CITY_EDITION_REV1_V6 = 30, - GEOIP_CITY_EDITION_REV0_V6 = 31, - GEOIP_NETSPEED_EDITION_REV1 = 32, - GEOIP_NETSPEED_EDITION_REV1_V6 = 33 -} GeoIPDBTypes; - -typedef enum { - GEOIP_ANON_PROXY = 1, - GEOIP_HTTP_X_FORWARDED_FOR_PROXY = 2, - GEOIP_HTTP_CLIENT_IP_PROXY = 3, -} GeoIPProxyTypes; - -typedef enum { - GEOIP_UNKNOWN_SPEED = 0, - GEOIP_DIALUP_SPEED = 1, - GEOIP_CABLEDSL_SPEED = 2, - GEOIP_CORPORATE_SPEED = 3, -} GeoIPNetspeedValues; - -extern char **GeoIPDBFileName; -extern const char * GeoIPDBDescription[NUM_DB_TYPES]; -extern const char *GeoIPCountryDBFileName; -extern const char *GeoIPRegionDBFileName; -extern const char *GeoIPCityDBFileName; -extern const char *GeoIPOrgDBFileName; -extern const char *GeoIPISPDBFileName; -extern const char *GeoIPLocationADBFileName; -extern const char *GeoIPAccuracyRadiusFileName; -extern const char *GeoIPCityConfidenceFileName; - -/* Warning: do not use those arrays as doing so may break your - * program with newer GeoIP versions */ -extern const char GeoIP_country_code[254][3]; -extern const char GeoIP_country_code3[254][4]; -extern const char * GeoIP_country_name[254]; -extern const char * GeoIP_utf8_country_name[254]; -extern const char GeoIP_country_continent[254][3]; - -#ifdef DLL -#define GEOIP_API __declspec(dllexport) -#else -#define GEOIP_API -#endif /* DLL */ - -GEOIP_API void GeoIP_setup_custom_directory(char *dir); -GEOIP_API GeoIP* GeoIP_open_type (int type, int flags); -GEOIP_API GeoIP* GeoIP_new(int flags); -GEOIP_API GeoIP* GeoIP_open(const char * filename, int flags); -GEOIP_API int GeoIP_db_avail(int type); -GEOIP_API void GeoIP_delete(GeoIP* gi); -GEOIP_API const char *GeoIP_country_code_by_addr (GeoIP* gi, const char *addr); -GEOIP_API const char *GeoIP_country_code_by_name (GeoIP* gi, const char *host); -GEOIP_API const char *GeoIP_country_code3_by_addr (GeoIP* gi, const char *addr); -GEOIP_API const char *GeoIP_country_code3_by_name (GeoIP* gi, const char *host); -GEOIP_API const char *GeoIP_country_name_by_addr (GeoIP* gi, const char *addr); -GEOIP_API const char *GeoIP_country_name_by_name (GeoIP* gi, const char *host); -GEOIP_API const char *GeoIP_country_name_by_ipnum (GeoIP* gi, unsigned long ipnum); -GEOIP_API const char *GeoIP_country_code_by_ipnum (GeoIP* gi, unsigned long ipnum); -GEOIP_API const char *GeoIP_country_code3_by_ipnum (GeoIP* gi, unsigned long ipnum); - -/* */ -GEOIP_API const char *GeoIP_country_name_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); -GEOIP_API const char *GeoIP_country_code_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); -GEOIP_API const char *GeoIP_country_code3_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); - -GEOIP_API const char *GeoIP_country_code_by_addr_v6 (GeoIP* gi, const char *addr); -GEOIP_API const char *GeoIP_country_code_by_name_v6 (GeoIP* gi, const char *host); -GEOIP_API const char *GeoIP_country_code3_by_addr_v6 (GeoIP* gi, const char *addr); -GEOIP_API const char *GeoIP_country_code3_by_name_v6 (GeoIP* gi, const char *host); -GEOIP_API const char *GeoIP_country_name_by_addr_v6 (GeoIP* gi, const char *addr); -GEOIP_API const char *GeoIP_country_name_by_name_v6 (GeoIP* gi, const char *host); - -/* Deprecated - for backwards compatibility only */ -GEOIP_API int GeoIP_country_id_by_addr (GeoIP* gi, const char *addr); -GEOIP_API int GeoIP_country_id_by_name (GeoIP* gi, const char *host); -GEOIP_API char *GeoIP_org_by_addr (GeoIP* gi, const char *addr); -GEOIP_API char *GeoIP_org_by_name (GeoIP* gi, const char *host); -GEOIP_API char *GeoIP_org_by_ipnum (GeoIP* gi, unsigned long ipnum); - -GEOIP_API char *GeoIP_org_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); -GEOIP_API char *GeoIP_org_by_addr_v6 (GeoIP* gi, const char *addr); -GEOIP_API char *GeoIP_org_by_name_v6 (GeoIP* gi, const char *name); - -/* End deprecated */ - -GEOIP_API int GeoIP_id_by_addr (GeoIP* gi, const char *addr); -GEOIP_API int GeoIP_id_by_name (GeoIP* gi, const char *host); -GEOIP_API int GeoIP_id_by_ipnum (GeoIP* gi, unsigned long ipnum); - -GEOIP_API int GeoIP_id_by_addr_v6 (GeoIP* gi, const char *addr); -GEOIP_API int GeoIP_id_by_name_v6 (GeoIP* gi, const char *host); -GEOIP_API int GeoIP_id_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); - -GEOIP_API GeoIPRegion * GeoIP_region_by_addr (GeoIP* gi, const char *addr); -GEOIP_API GeoIPRegion * GeoIP_region_by_name (GeoIP* gi, const char *host); -GEOIP_API GeoIPRegion * GeoIP_region_by_ipnum (GeoIP *gi, unsigned long ipnum); - -GEOIP_API GeoIPRegion * GeoIP_region_by_addr_v6 (GeoIP* gi, const char *addr); -GEOIP_API GeoIPRegion * GeoIP_region_by_name_v6 (GeoIP* gi, const char *host); -GEOIP_API GeoIPRegion * GeoIP_region_by_ipnum_v6 (GeoIP *gi, geoipv6_t ipnum); - -/* Warning - don't call this after GeoIP_assign_region_by_inetaddr calls */ -GEOIP_API void GeoIPRegion_delete (GeoIPRegion *gir); - -GEOIP_API void GeoIP_assign_region_by_inetaddr(GeoIP* gi, unsigned long inetaddr, GeoIPRegion *gir); - -GEOIP_API void GeoIP_assign_region_by_inetaddr_v6(GeoIP* gi, geoipv6_t inetaddr, GeoIPRegion *gir); - -/* Used to query GeoIP Organization, ISP and AS Number databases */ -GEOIP_API char *GeoIP_name_by_ipnum (GeoIP* gi, unsigned long ipnum); -GEOIP_API char *GeoIP_name_by_addr (GeoIP* gi, const char *addr); -GEOIP_API char *GeoIP_name_by_name (GeoIP* gi, const char *host); - -GEOIP_API char *GeoIP_name_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); -GEOIP_API char *GeoIP_name_by_addr_v6 (GeoIP* gi, const char *addr); -GEOIP_API char *GeoIP_name_by_name_v6 (GeoIP* gi, const char *name); - -/** return two letter country code */ -GEOIP_API const char* GeoIP_code_by_id(int id); - -/** return three letter country code */ -GEOIP_API const char* GeoIP_code3_by_id(int id); - -/** return full name of country in utf8 or iso-8859-1 */ -GEOIP_API const char* GeoIP_country_name_by_id(GeoIP* gi, int id); - -/** return full name of country */ -GEOIP_API const char* GeoIP_name_by_id(int id); - -/** return continent of country */ -GEOIP_API const char* GeoIP_continent_by_id(int id); - -/** return id by country code **/ -GEOIP_API int GeoIP_id_by_code(const char *country); - -/** return return number of known countries */ -GEOIP_API unsigned GeoIP_num_countries(void); - -GEOIP_API char *GeoIP_database_info (GeoIP* gi); -GEOIP_API unsigned char GeoIP_database_edition (GeoIP* gi); - -GEOIP_API int GeoIP_charset (GeoIP* gi); -GEOIP_API int GeoIP_set_charset (GeoIP* gi, int charset); -GEOIP_API int GeoIP_enable_teredo (GeoIP* gi, int true_false ); -GEOIP_API int GeoIP_teredo (GeoIP* gi ); - -GEOIP_API int GeoIP_last_netmask (GeoIP* gi); -GEOIP_API char **GeoIP_range_by_ip (GeoIP* gi, const char *addr); -GEOIP_API void GeoIP_range_by_ip_delete(char **ptr); - -/* Convert region code to region name */ -GEOIP_API const char * GeoIP_region_name_by_code(const char *country_code, const char *region_code); - -/* Get timezone from country and region code */ -GEOIP_API const char * GeoIP_time_zone_by_country_and_region(const char *country_code, const char *region_code); - -/* some v4 helper functions as of 1.4.7 exported to the public API */ -GEOIP_API unsigned long GeoIP_addr_to_num(const char *addr); -GEOIP_API char * GeoIP_num_to_addr(unsigned long ipnum); - -/* Internal function -- convert iso to utf8; return a malloced utf8 string. */ -char * _GeoIP_iso_8859_1__utf8(const char * iso); - -/* Cleans up memory used to hold file name paths. Returns 1 if successful; otherwise 0. - * */ -GEOIP_API int GeoIP_cleanup(void); - -/* Returns the library version in use. Helpful if your loading dynamically. */ -GEOIP_API const char * GeoIP_lib_version(void); - -# -#ifdef __cplusplus -} -#endif - -#endif /* GEOIP_H */ diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIPCity.c b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIPCity.c deleted file mode 100644 index 8503fcb2..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIPCity.c +++ /dev/null @@ -1,393 +0,0 @@ - -/* - * GeoIPCity.c - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#if !defined(_WIN32) -#include -#include -#include /* For ntohl */ -#else -#include -#include -#endif -#include /* For uint32_t */ -#ifdef HAVE_STDINT_H -#include /* For uint32_t */ -#endif - -static -const int FULL_RECORD_LENGTH = 50; - -static const int CITYCONFIDENCE_FIXED_RECORD = 4; -static const int CITYCONFIDENCEDIST_FIXED_RECORD = 6; - - -static -GeoIPRecord * -_extract_record(GeoIP * gi, unsigned int seek_record, int *next_record_ptr) -{ - int record_pointer; - unsigned char *record_buf = NULL; - unsigned char *begin_record_buf = NULL; - GeoIPRecord *record; - int str_length = 0; - int j; - double latitude = 0, longitude = 0; - int metroarea_combo = 0; - int bytes_read = 0; - if (seek_record == gi->databaseSegments[0]) - return NULL; - - record = malloc(sizeof(GeoIPRecord)); - memset(record, 0, sizeof(GeoIPRecord)); - record->charset = gi->charset; - - if (gi->databaseType == GEOIP_CITYCONFIDENCE_EDITION - || gi->databaseType == GEOIP_CITYCONFIDENCEDIST_EDITION) { - - int fixed_rec_size = gi->record_length + - ((gi->databaseType == GEOIP_CITYCONFIDENCE_EDITION) - ? CITYCONFIDENCE_FIXED_RECORD - : CITYCONFIDENCEDIST_FIXED_RECORD); - - //allocate max rec size, even for CITYCONFIDENCE_FIXED_RECORD - //+4 is the max_record_length - // TODO - unsigned char tmp_fixed_record[6/*CITYCONFIDENCEDIST_FIXED_RECORD*/ + 4]; - int dseg = gi->databaseSegments[0] * gi->record_length * 2 + gi->record_length; -// int aligned_dseg = dseg ; - - int offset = seek_record - gi->databaseSegments[0] - 1; /* -1 b/c zero is not - * found. but the array - * start with 0 */ - record_pointer = offset * fixed_rec_size + dseg + gi->dyn_seg_size; - if (gi->cache == NULL) { - - /* read from disk */ - bytes_read = pread(fileno(gi->GeoIPDatabase), tmp_fixed_record, fixed_rec_size, record_pointer); - - if (bytes_read != fixed_rec_size) - return NULL; - - record->country_conf = tmp_fixed_record[0]; - record->region_conf = tmp_fixed_record[1]; - record->city_conf = tmp_fixed_record[2]; - record->postal_conf = tmp_fixed_record[3]; - - record->accuracy_radius = - gi->databaseType == GEOIP_CITYCONFIDENCEDIST_EDITION - ? ((tmp_fixed_record[4] + (tmp_fixed_record[5] << 8)) & 0x3ff) : 0x3ff; - - int t = fixed_rec_size - gi->record_length; - - record_pointer = dseg + tmp_fixed_record[t] + - (tmp_fixed_record[t + 1] << 8) + (tmp_fixed_record[t + 2] << 16) ; - - if (gi->record_length == 4) - record_pointer += (tmp_fixed_record[t + 3] << 24); - - begin_record_buf = record_buf = malloc(sizeof(char) * FULL_RECORD_LENGTH); - - bytes_read = pread(fileno(gi->GeoIPDatabase), record_buf, FULL_RECORD_LENGTH, record_pointer); - - if (bytes_read == 0) { - /* eof or other error */ - free(begin_record_buf); - free(record); - return NULL; - } - - } - else { - record_buf = gi->cache + (long) record_pointer; - - record->country_conf = record_buf[0]; - record->region_conf = record_buf[1]; - record->city_conf = record_buf[2]; - record->postal_conf = record_buf[3]; - - record->accuracy_radius = - gi->databaseType == GEOIP_CITYCONFIDENCEDIST_EDITION - ? ((record_buf[4] + (record_buf[5] << 8)) & 0x3ff) : 0x3ff; - - int t = fixed_rec_size - gi->record_length; - - record_pointer = dseg + record_buf[t] + - (record_buf[t + 1] << 8) + (record_buf[t + 2] << 16) ; - - if (gi->record_length == 4) - record_pointer += (record_buf[t + 3] << 24); - - record_buf = gi->cache + (long) record_pointer; - } - - } /* other city records */ - else { - - record->country_conf = GEOIP_UNKNOWN_CONF; - record->region_conf = GEOIP_UNKNOWN_CONF; - record->city_conf = GEOIP_UNKNOWN_CONF; - record->postal_conf = GEOIP_UNKNOWN_CONF; - record->accuracy_radius = GEOIP_UNKNOWN_ACCURACY_RADIUS; - - record_pointer = seek_record + (2 * gi->record_length - 1) * gi->databaseSegments[0]; - - if (gi->cache == NULL) { - begin_record_buf = record_buf = malloc(sizeof(char) * FULL_RECORD_LENGTH); - bytes_read = pread(fileno(gi->GeoIPDatabase), record_buf, FULL_RECORD_LENGTH, record_pointer); - if (bytes_read == 0) { - /* eof or other error */ - free(begin_record_buf); - free(record); - return NULL; - } - } - else { - record_buf = gi->cache + (long) record_pointer; - } - } - - /* get country */ - record->continent_code = (char *) GeoIP_country_continent[record_buf[0]]; - record->country_code = (char *) GeoIP_country_code[record_buf[0]]; - record->country_code3 = (char *) GeoIP_country_code3[record_buf[0]]; - record->country_name = (char *) GeoIP_country_name_by_id(gi, record_buf[0]); - record_buf++; - - /* get region */ - while (record_buf[str_length] != '\0') - str_length++; - if (str_length > 0) { - record->region = malloc(str_length + 1); - strncpy(record->region, (char *) record_buf, str_length + 1); - } - record_buf += str_length + 1; - str_length = 0; - - /* get city */ - while (record_buf[str_length] != '\0') - str_length++; - if (str_length > 0) { - if (gi->charset == GEOIP_CHARSET_UTF8) { - record->city = _GeoIP_iso_8859_1__utf8((const char *) record_buf); - } - else { - record->city = malloc(str_length + 1); - strncpy(record->city, (const char *) record_buf, str_length + 1); - } - } - record_buf += (str_length + 1); - str_length = 0; - - /* get postal code */ - while (record_buf[str_length] != '\0') - str_length++; - if (str_length > 0) { - record->postal_code = malloc(str_length + 1); - strncpy(record->postal_code, (char *) record_buf, str_length + 1); - } - record_buf += (str_length + 1); - - /* get latitude */ - for (j = 0; j < 3; ++j) - latitude += (record_buf[j] << (j * 8)); - record->latitude = latitude / 10000 - 180; - record_buf += 3; - - /* get longitude */ - for (j = 0; j < 3; ++j) - longitude += (record_buf[j] << (j * 8)); - record->longitude = longitude / 10000 - 180; - - /* - * get area code and metro code for post April 2002 databases and for US - * locations - */ - if (GEOIP_CITY_EDITION_REV1 == gi->databaseType - || GEOIP_CITYCONFIDENCE_EDITION == gi->databaseType) { - if (!strcmp(record->country_code, "US")) { - record_buf += 3; - for (j = 0; j < 3; ++j) - metroarea_combo += (record_buf[j] << (j * 8)); - record->metro_code = metroarea_combo / 1000; - record->area_code = metroarea_combo % 1000; - } - } - - if (gi->cache == NULL) - free(begin_record_buf); - - /* Used for GeoIP_next_record */ - if (next_record_ptr != NULL) - *next_record_ptr = seek_record + record_buf - begin_record_buf + 3; - - return record; -} - -static -GeoIPRecord * -_get_record(GeoIP * gi, unsigned long ipnum) -{ - unsigned int seek_record; - if (gi->databaseType != GEOIP_CITY_EDITION_REV0 - && gi->databaseType != GEOIP_CITY_EDITION_REV1 - && gi->databaseType != GEOIP_CITYCONFIDENCE_EDITION - && gi->databaseType != GEOIP_CITYCONFIDENCEDIST_EDITION) { - printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int) gi->databaseType], GeoIPDBDescription[GEOIP_CITY_EDITION_REV1]); - return 0; - } - - seek_record = _GeoIP_seek_record(gi, ipnum); - return _extract_record(gi, seek_record, NULL); -} - -static -GeoIPRecord * -_get_record_v6(GeoIP * gi, geoipv6_t ipnum) -{ - unsigned int seek_record; - if (gi->databaseType != GEOIP_CITY_EDITION_REV0_V6 && - gi->databaseType != GEOIP_CITY_EDITION_REV1_V6) { - printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int) gi->databaseType], GeoIPDBDescription[GEOIP_CITY_EDITION_REV1_V6]); - return 0; - } - - seek_record = _GeoIP_seek_record_v6(gi, ipnum); - return _extract_record(gi, seek_record, NULL); -} - - - -GeoIPRecord * -GeoIP_record_by_ipnum(GeoIP * gi, unsigned long ipnum) -{ - return _get_record(gi, ipnum); -} - -GeoIPRecord * -GeoIP_record_by_ipnum_v6(GeoIP * gi, geoipv6_t ipnum) -{ - return _get_record_v6(gi, ipnum); -} - -GeoIPRecord * -GeoIP_record_by_addr(GeoIP * gi, const char *addr) -{ - unsigned long ipnum; - if (addr == NULL) { - return 0; - } - ipnum = GeoIP_addr_to_num(addr); - return _get_record(gi, ipnum); -} - -GeoIPRecord * -GeoIP_record_by_addr_v6(GeoIP * gi, const char *addr) -{ - geoipv6_t ipnum; - if (addr == NULL) { - return 0; - } - ipnum = _GeoIP_addr_to_num_v6(addr); - return _get_record_v6(gi, ipnum); -} - -GeoIPRecord * -GeoIP_record_by_name(GeoIP * gi, const char *name) -{ - unsigned long ipnum; - if (name == NULL) { - return 0; - } - ipnum = _GeoIP_lookupaddress(name); - return _get_record(gi, ipnum); -} - -GeoIPRecord * -GeoIP_record_by_name_v6(GeoIP * gi, const char *name) -{ - geoipv6_t ipnum; - if (name == NULL) { - return 0; - } - ipnum = _GeoIP_lookupaddress_v6(name); - return _get_record_v6(gi, ipnum); -} - -int -GeoIP_record_id_by_addr(GeoIP * gi, const char *addr) -{ - unsigned long ipnum; - if (gi->databaseType != GEOIP_CITY_EDITION_REV0 && - gi->databaseType != GEOIP_CITY_EDITION_REV1) { - printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int) gi->databaseType], GeoIPDBDescription[GEOIP_CITY_EDITION_REV1]); - return 0; - } - if (addr == NULL) { - return 0; - } - ipnum = GeoIP_addr_to_num(addr); - return _GeoIP_seek_record(gi, ipnum); -} - -int -GeoIP_record_id_by_addr_v6(GeoIP * gi, const char *addr) -{ - geoipv6_t ipnum; - if (gi->databaseType != GEOIP_CITY_EDITION_REV0_V6 && - gi->databaseType != GEOIP_CITY_EDITION_REV1_V6) { - printf("Invalid database type %s, expected %s\n", GeoIPDBDescription[(int) gi->databaseType], GeoIPDBDescription[GEOIP_CITY_EDITION_REV1]); - return 0; - } - if (addr == NULL) { - return 0; - } - ipnum = _GeoIP_addr_to_num_v6(addr); - return _GeoIP_seek_record_v6(gi, ipnum); -} - -int -GeoIP_init_record_iter(GeoIP * gi) -{ - return gi->databaseSegments[0] + 1; -} - -int -GeoIP_next_record(GeoIP * gi, GeoIPRecord ** gir, int *record_iter) -{ - if (gi->cache != NULL) { - printf("GeoIP_next_record not supported in memory cache mode\n"); - return 1; - } - *gir = _extract_record(gi, *record_iter, record_iter); - return 0; -} - -void -GeoIPRecord_delete(GeoIPRecord * gir) -{ - free(gir->region); - free(gir->city); - free(gir->postal_code); - free(gir); -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIPCity.h b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIPCity.h deleted file mode 100644 index f6f8fc80..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIPCity.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ -/* GeoIPCity.h - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef GEOIPCITY_H -#define GEOIPCITY_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define GEOIP_UNKNOWN_CONF ( 0x7f ) -#define GEOIP_UNKNOWN_ACCURACY_RADIUS ( 0x3ff ) - -typedef struct GeoIPRecordTag { - char *country_code; - char *country_code3; - char *country_name; - char *region; - char *city; - char *postal_code; - float latitude; - float longitude; - union { - int metro_code; /* metro_code is a alias for dma_code */ - int dma_code; - }; - int area_code; - int charset; - char *continent_code; - /* confidence factor for Country/Region/City/Postal */ - unsigned char country_conf, region_conf, city_conf, postal_conf; - int accuracy_radius; -} GeoIPRecord; - -GeoIPRecord * GeoIP_record_by_ipnum (GeoIP* gi, unsigned long ipnum); -GeoIPRecord * GeoIP_record_by_addr (GeoIP* gi, const char *addr); -GeoIPRecord * GeoIP_record_by_name (GeoIP* gi, const char *host); - -GeoIPRecord * GeoIP_record_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum); -GeoIPRecord * GeoIP_record_by_addr_v6 (GeoIP* gi, const char *addr); -GeoIPRecord * GeoIP_record_by_name_v6 (GeoIP* gi, const char *host); - -int GeoIP_record_id_by_addr (GeoIP* gi, const char *addr); -int GeoIP_record_id_by_addr_v6 (GeoIP* gi, const char *addr); - -int GeoIP_init_record_iter (GeoIP* gi); -/* returns 0 on success, 1 on failure */ -int GeoIP_next_record (GeoIP* gi, GeoIPRecord **gir, int *record_iter); - -void GeoIPRecord_delete (GeoIPRecord *gir); - -/* NULL on failure otherwise a malloced string in utf8 */ -/* char * GeoIP_iso_8859_1__utf8(const char *); */ - -#ifdef __cplusplus -} -#endif - -#endif /* GEOIPCITY_H */ diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIPUpdate.c b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIPUpdate.c deleted file mode 100644 index 008c9d93..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIPUpdate.c +++ /dev/null @@ -1,975 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ -/* GeoIPUpdate.c - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "GeoIPCity.h" -#include "GeoIP.h" -#include "GeoIPUpdate.h" -#include "GeoIP_internal.h" - -#include "global.h" -#include "md5.h" -#include -#if !defined(_WIN32) -#include -#include -#include -#include -#else -#include -//#include -#include -#endif -#include -#include -#include -//#include - - -#define BLOCK_SIZE 1024 - -/* Update DB Host & HTTP GET Request formats: - * ------------------------------------------ - * GET must support an optional HTTP Proxy. - */ -const char *GeoIPUpdateHost = "updates.maxmind.com"; -/* This is the direct, or proxy port number. */ -static int GeoIPHTTPPort = 80; -/* License-only format (OLD) */ -const char *GeoIPHTTPRequest = "GET %s%s/app/update?license_key=%s&md5=%s HTTP/1.0\nHost: updates.maxmind.com\n\n"; -/* General DB Types formats */ -const char *GeoIPHTTPRequestFilename = "GET %s%s/app/update_getfilename?product_id=%s HTTP/1.0\nHost: %s\n\n"; -const char *GeoIPHTTPRequestClientIP = "GET %s%s/app/update_getipaddr HTTP/1.0\nHost: %s\n\n"; -const char *GeoIPHTTPRequestMD5 = "GET %s%s/app/update_secure?db_md5=%s&challenge_md5=%s&user_id=%s&edition_id=%s HTTP/1.0\nHost: updates.maxmind.com\n\n"; - -/* messages */ -const char *NoCurrentDB = "%s can't be opened, proceeding to download database\n"; -const char *MD5Info = "MD5 Digest of installed database is %s\n"; -const char *SavingGzip = "Saving gzip file to %s ... "; -const char *WritingFile = "Writing uncompressed data to %s ..."; - -const char * GeoIP_get_error_message(int i) { - switch (i) { - case GEOIP_NO_NEW_UPDATES: - return "no new updates"; - case GEOIP_SUCCESS: - return "Success"; - case GEOIP_LICENSE_KEY_INVALID_ERR: - return "License Key Invalid"; - case GEOIP_DNS_ERR: - return "Unable to resolve hostname"; - case GEOIP_NON_IPV4_ERR: - return "Non - IPv4 address"; - case GEOIP_SOCKET_OPEN_ERR: - return "Error opening socket"; - case GEOIP_CONNECTION_ERR: - return "Unable to connect"; - case GEOIP_GZIP_IO_ERR: - return "Unable to write GeoIP.dat.gz file"; - case GEOIP_TEST_IO_ERR: - return "Unable to write GeoIP.dat.test file"; - case GEOIP_GZIP_READ_ERR: - return "Unable to read gzip data"; - case GEOIP_OUT_OF_MEMORY_ERR: - return "Out of memory error"; - case GEOIP_SOCKET_READ_ERR: - return "Error reading from socket, see errno"; - case GEOIP_SANITY_OPEN_ERR: - return "Sanity check GeoIP_open error"; - case GEOIP_SANITY_INFO_FAIL: - return "Sanity check database_info string failed"; - case GEOIP_SANITY_LOOKUP_FAIL: - return "Sanity check ip address lookup failed"; - case GEOIP_RENAME_ERR: - return "Rename error while installing db, check errno"; - case GEOIP_USER_ID_INVALID_ERR: - return "Invalid userID"; - case GEOIP_PRODUCT_ID_INVALID_ERR: - return "Invalid product ID or subscription expired"; - case GEOIP_INVALID_SERVER_RESPONSE: - return "Server returned something unexpected"; - default: - return "no error"; - } -} -int GeoIP_fprintf(int (*f)(FILE *, char *),FILE *fp, const char *str, ...) { - va_list ap; - int rc; - char * f_str; - int silence; - - if ( f == NULL ) - return 0; - va_start(ap, str); -#if defined(HAVE_VASPRINTF) - silence = vasprintf(&f_str, str, ap); -#elif defined (HAVE_VSNPRINTF) - f_str = malloc(4096); - if ( f_str ) - silence = vsnprintf(f_str, 4096, str, ap); -#else - f_str = malloc(4096); - if ( f_str ) - silence = vsprintf(f_str, str, ap); -#endif - va_end(ap); - if ( f_str == NULL ) - return -1; - rc = (*f)(fp, f_str); - free(f_str); - return(rc); -} - -void GeoIP_printf(void (*f)(char *), const char *str,...) { - va_list params; - char * f_str; - int silence; - if (f == NULL) - return; - va_start(params, str); -#if defined(HAVE_VASPRINTF) - silence = vasprintf(&f_str, str, params); -#elif defined (HAVE_VSNPRINTF) - f_str = malloc(4096); - if ( f_str ) - silence = vsnprintf(f_str, 4096, str, params); -#else - f_str = malloc(4096); - if ( f_str ) - silence = vsprintf(f_str, str, params); -#endif - va_end(params); - if ( f_str == NULL ) - return; - (*f)(f_str); - free(f_str); -} - -/* Support HTTP Proxy Host - * -------------------------------------------------- - * Use typical OS support for the optional HTTP Proxy. - * - * Proxy adds http://{real-hostname} to URI format strings: - * sprintf("GET %s%s/ HTTP/1.0\r\n",GeoIPProxyHTTP,GeoIPProxiedHost, ...); - */ - -/* The Protocol is usually "" OR "http://" with a proxy. */ -static char *GeoIPProxyHTTP = ""; -/* GeoIP Hostname where proxy forwards requests. */ -static char *GeoIPProxiedHost = ""; - -/* Read http_proxy env. variable & parse it. - * ----------------------------------------- - * Allow only these formats: - * "http://server.com", "http://server.com:8080" - * OR - * "server.com", "server.com:8080" - * - * A "user:password@" part will break this. - */ -short int parse_http_proxy(char **proxy_host, int *port) { - char * http_proxy; - char * port_value; - - if ((http_proxy = getenv("http_proxy"))) { - - if (! strncmp("http://", http_proxy, 7)) http_proxy += 7; - - *proxy_host = strdup(http_proxy); - if ( *proxy_host == NULL ) - return 0; /* let the other functions deal with the memory error */ - - if ((port_value = strchr(*proxy_host, ':'))) { - *port_value++ = '\0'; - *port = atoi(port_value); - } - else { - *port = 80; - } - return(1); - } - else { - return(0); - } -} - -/* Get the GeoIP host or the current HTTP Proxy host. */ -struct hostent *GeoIP_get_host_or_proxy (void) { - char * hostname = (char *) GeoIPUpdateHost; - char * proxy_host; - int proxy_port; - - /* Set Proxy from OS: Unix/Linux */ - if (parse_http_proxy(&proxy_host,&proxy_port)) { - hostname = proxy_host; - GeoIPProxyHTTP = "http://"; - GeoIPProxiedHost = (char *) GeoIPUpdateHost; - GeoIPHTTPPort = proxy_port; - } - - /* Resolve DNS host entry. */ - return(gethostbyname(hostname)); -} - -short int GeoIP_update_database (char * license_key, int verbose, void (*f)( char * )) { - struct hostent *hostlist; - int sock; - char * buf; - struct sockaddr_in sa; - int offset = 0, err; - char * request_uri; - char * compr; - unsigned long comprLen; - FILE *comp_fh, *cur_db_fh, *gi_fh; - gzFile gz_fh; - char * file_path_gz, * file_path_test; - MD5_CONTEXT context; - unsigned char buffer[1024], digest[16]; - char hex_digest[33] = "00000000000000000000000000000000\0"; - unsigned int i; - GeoIP * gi; - char * db_info; - char block[BLOCK_SIZE]; - int block_size = BLOCK_SIZE; - size_t len; - size_t written; - _GeoIP_setup_dbfilename(); - - /* get MD5 of current GeoIP database file */ - if ((cur_db_fh = fopen (GeoIPDBFileName[GEOIP_COUNTRY_EDITION], "rb")) == NULL) { - GeoIP_printf(f,"%s%s", NoCurrentDB, GeoIPDBFileName[GEOIP_COUNTRY_EDITION]); - } else { - md5_init(&context); - while ((len = fread (buffer, 1, 1024, cur_db_fh)) > 0) - md5_write (&context, buffer, len); - md5_final (&context); - memcpy(digest,context.buf,16); - fclose (cur_db_fh); - for (i = 0; i < 16; i++) { - // "%02x" will write 3 chars - snprintf (&hex_digest[2*i], 3, "%02x", digest[i]); - } - GeoIP_printf(f, MD5Info, hex_digest); - } - - hostlist = GeoIP_get_host_or_proxy(); - - if (hostlist == NULL) - return GEOIP_DNS_ERR; - - if (hostlist->h_addrtype != AF_INET) - return GEOIP_NON_IPV4_ERR; - - if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - return GEOIP_SOCKET_OPEN_ERR; - } - - memset(&sa, 0, sizeof(struct sockaddr_in)); - sa.sin_port = htons(GeoIPHTTPPort); - memcpy(&sa.sin_addr, hostlist->h_addr_list[0], hostlist->h_length); - sa.sin_family = AF_INET; - - if (verbose == 1){ - GeoIP_printf(f,"Connecting to MaxMind GeoIP Update server\n"); - GeoIP_printf(f, "via Host or Proxy Server: %s:%d\n", hostlist->h_name, GeoIPHTTPPort); - } - - /* Download gzip file */ - if (connect(sock, (struct sockaddr *)&sa, sizeof(struct sockaddr))< 0) - return GEOIP_CONNECTION_ERR; - - request_uri = malloc(sizeof(char) * (strlen(license_key) + strlen(GeoIPHTTPRequest) - + strlen(GeoIPProxyHTTP) + strlen(GeoIPProxiedHost) + 36 + 1)); - if (request_uri == NULL) - return GEOIP_OUT_OF_MEMORY_ERR; - sprintf(request_uri,GeoIPHTTPRequest,GeoIPProxyHTTP,GeoIPProxiedHost,license_key, hex_digest); - send(sock, request_uri, strlen(request_uri),0); - free(request_uri); - - buf = malloc(sizeof(char) * block_size + 1); - if (buf == NULL) - return GEOIP_OUT_OF_MEMORY_ERR; - - if (verbose == 1) - GeoIP_printf(f,"Downloading gzipped GeoIP Database...\n"); - - for (;;) { - int amt; - amt = recv(sock, &buf[offset], block_size,0); - if (amt == 0) { - break; - } else if (amt == -1) { - free(buf); - return GEOIP_SOCKET_READ_ERR; - } - offset += amt; - buf = realloc(buf, offset+block_size + 1); - if (buf == NULL) - return GEOIP_OUT_OF_MEMORY_ERR; - } - - buf[offset]=0; - compr = strstr(buf, "\r\n\r\n"); - if ( compr == NULL ) { - free(buf); - return GEOIP_INVALID_SERVER_RESPONSE; - } - /* skip searchstr "\r\n\r\n" */ - compr += 4; - comprLen = offset + buf - compr; - - if (strstr(compr, "License Key Invalid") != NULL) { - if (verbose == 1) - GeoIP_printf(f,"Failed\n"); - free(buf); - return GEOIP_LICENSE_KEY_INVALID_ERR; - } else if (strstr(compr, "Invalid product ID or subscription expired") != NULL){ - free(buf); - return GEOIP_PRODUCT_ID_INVALID_ERR; - } else if (strstr(compr, "No new updates available") != NULL) { - free(buf); - return GEOIP_NO_NEW_UPDATES; - } - - if (verbose == 1) - GeoIP_printf(f,"Done\n"); - - /* save gzip file */ - file_path_gz = malloc(sizeof(char) * (strlen(GeoIPDBFileName[GEOIP_COUNTRY_EDITION]) + 4)); - if (file_path_gz == NULL) - return GEOIP_OUT_OF_MEMORY_ERR; - strcpy(file_path_gz,GeoIPDBFileName[GEOIP_COUNTRY_EDITION]); - strcat(file_path_gz,".gz"); - if (verbose == 1) { - GeoIP_printf(f, SavingGzip, file_path_gz); - } - comp_fh = fopen(file_path_gz, "wb"); - - if(comp_fh == NULL) { - free(file_path_gz); - free(buf); - return GEOIP_GZIP_IO_ERR; - } - - written = fwrite(compr, 1, comprLen, comp_fh); - fclose(comp_fh); - free(buf); - - if ( written != comprLen ) - return GEOIP_GZIP_IO_ERR; - - if (verbose == 1) - GeoIP_printf(f,"Done\n"); - - if (verbose == 1) - GeoIP_printf(f,"Uncompressing gzip file ... "); - - /* uncompress gzip file */ - gz_fh = gzopen(file_path_gz, "rb"); - file_path_test = malloc(sizeof(char) * (strlen(GeoIPDBFileName[GEOIP_COUNTRY_EDITION]) + 6)); - if (file_path_test == NULL) - return GEOIP_OUT_OF_MEMORY_ERR; - strcpy(file_path_test,GeoIPDBFileName[GEOIP_COUNTRY_EDITION]); - strcat(file_path_test,".test"); - gi_fh = fopen(file_path_test, "wb"); - - if(gi_fh == NULL) { - free(file_path_test); - return GEOIP_TEST_IO_ERR; - } - for (;;) { - int amt; - amt = gzread(gz_fh, block, block_size); - if (amt == -1) { - free(file_path_test); - fclose(gi_fh); - gzclose(gz_fh); - return GEOIP_GZIP_READ_ERR; - } - if (amt == 0) { - break; - } - if ( fwrite(block,1,amt,gi_fh) != amt ){ - free(file_path_test); - fclose(gi_fh); - gzclose(gz_fh); - return GEOIP_GZIP_READ_ERR; - } - } - gzclose(gz_fh); - unlink(file_path_gz); - free(file_path_gz); - fclose(gi_fh); - - if (verbose == 1) - GeoIP_printf(f,"Done\n"); - - if (verbose == 1) { - GeoIP_printf(f, WritingFile, GeoIPDBFileName[GEOIP_COUNTRY_EDITION]); - } - - /* sanity check */ - gi = GeoIP_open(file_path_test, GEOIP_STANDARD); - - if (verbose == 1) - GeoIP_printf(f,"Performing santity checks ... "); - - if (gi == NULL) { - GeoIP_printf(f,"Error opening sanity check database\n"); - return GEOIP_SANITY_OPEN_ERR; - } - - /* this checks to make sure the files is complete, since info is at the end */ - /* dependent on future databases having MaxMind in info */ - if (verbose == 1) - GeoIP_printf(f,"database_info "); - db_info = GeoIP_database_info(gi); - if (db_info == NULL) { - GeoIP_delete(gi); - if (verbose == 1) - GeoIP_printf(f,"FAIL\n"); - return GEOIP_SANITY_INFO_FAIL; - } - if (strstr(db_info, "MaxMind") == NULL) { - free(db_info); - GeoIP_delete(gi); - if (verbose == 1) - GeoIP_printf(f,"FAIL\n"); - return GEOIP_SANITY_INFO_FAIL; - } - free(db_info); - if (verbose == 1) - GeoIP_printf(f,"PASS "); - - /* this performs an IP lookup test of a US IP address */ - if (verbose == 1) - GeoIP_printf(f,"lookup "); - if (strcmp(GeoIP_country_code_by_addr(gi,"24.24.24.24"), "US") != 0) { - GeoIP_delete(gi); - if (verbose == 1) - GeoIP_printf(f,"FAIL\n"); - return GEOIP_SANITY_LOOKUP_FAIL; - } - GeoIP_delete(gi); - if (verbose == 1) - GeoIP_printf(f,"PASS\n"); - - /* install GeoIP.dat.test -> GeoIP.dat */ - err = rename(file_path_test, GeoIPDBFileName[GEOIP_COUNTRY_EDITION]); - if (err != 0) { - GeoIP_printf(f,"GeoIP Install error while renaming file\n"); - return GEOIP_RENAME_ERR; - } - - if (verbose == 1) - GeoIP_printf(f,"Done\n"); - - return 0; -} - -short int GeoIP_update_database_general (char * user_id,char * license_key,char *data_base_type, int verbose,char ** client_ipaddr, void (*f)( char *)) { - struct hostent *hostlist; - int sock; - char * buf; - struct sockaddr_in sa; - int offset = 0, err; - char * request_uri; - char * compr; - unsigned long comprLen; - FILE *comp_fh, *cur_db_fh, *gi_fh; - gzFile gz_fh; - char * file_path_gz, * file_path_test; - MD5_CONTEXT context; - MD5_CONTEXT context2; - unsigned char buffer[1024], digest[16] ,digest2[16]; - char hex_digest[33] = "0000000000000000000000000000000\0"; - char hex_digest2[33] = "0000000000000000000000000000000\0"; - unsigned int i; - char *f_str; - GeoIP * gi; - char * db_info; - char *ipaddress; - char *geoipfilename; - char *tmpstr; - int dbtype; - int lookupresult = 1; - char block[BLOCK_SIZE]; - int block_size = BLOCK_SIZE; - size_t len; - size_t request_uri_len; - size_t size; - - hostlist = GeoIP_get_host_or_proxy(); - - if (hostlist == NULL) - return GEOIP_DNS_ERR; - - if (hostlist->h_addrtype != AF_INET) - return GEOIP_NON_IPV4_ERR; - if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - return GEOIP_SOCKET_OPEN_ERR; - } - - memset(&sa, 0, sizeof(struct sockaddr_in)); - sa.sin_port = htons(GeoIPHTTPPort); - memcpy(&sa.sin_addr, hostlist->h_addr_list[0], hostlist->h_length); - sa.sin_family = AF_INET; - - if (verbose == 1) { - GeoIP_printf(f,"Connecting to MaxMind GeoIP server\n"); - GeoIP_printf(f, "via Host or Proxy Server: %s:%d\n", hostlist->h_name, GeoIPHTTPPort); - } - - if (connect(sock, (struct sockaddr *)&sa, sizeof(struct sockaddr))< 0) - return GEOIP_CONNECTION_ERR; - request_uri = malloc(sizeof(char) * (strlen(GeoIPHTTPRequestFilename) - + strlen(GeoIPProxyHTTP) + strlen(GeoIPProxiedHost) - + strlen(data_base_type) + strlen(GeoIPUpdateHost) + 1)); - if (request_uri == NULL) - return GEOIP_OUT_OF_MEMORY_ERR; - - /* get the file name from a web page using the product id */ - sprintf(request_uri,GeoIPHTTPRequestFilename,GeoIPProxyHTTP,GeoIPProxiedHost,data_base_type,GeoIPUpdateHost); - if (verbose == 1) { - GeoIP_printf(f, "sending request %s \n",request_uri); - } - send(sock, request_uri, strlen(request_uri),0); /* send the request */ - free(request_uri); - buf = malloc(sizeof(char) * (block_size+4)); - if (buf == NULL) - return GEOIP_OUT_OF_MEMORY_ERR; - offset = 0; - for (;;){ - int amt; - amt = recv(sock, &buf[offset], block_size,0); - if (amt == 0){ - break; - } else if (amt == -1) { - free(buf); - return GEOIP_SOCKET_READ_ERR; - } - offset += amt; - buf = realloc(buf, offset + block_size + 4); - } - buf[offset] = 0; - offset = 0; - tmpstr = strstr(buf, "\r\n\r\n"); - if ( tmpstr == NULL ) { - free(buf); - return GEOIP_INVALID_SERVER_RESPONSE; - } - /* skip searchstr "\r\n\r\n" */ - tmpstr += 4; - if (tmpstr[0] == '.' || strchr(tmpstr, '/') != NULL || strchr(tmpstr, '\\') != NULL) { - free(buf); - return GEOIP_INVALID_SERVER_RESPONSE; - } - geoipfilename = _GeoIP_full_path_to(tmpstr); - free(buf); - - /* print the database product id and the database filename */ - if (verbose == 1){ - GeoIP_printf(f, "database product id %s database file name %s \n",data_base_type,geoipfilename); - } - _GeoIP_setup_dbfilename(); - - /* get MD5 of current GeoIP database file */ - if ((cur_db_fh = fopen (geoipfilename, "rb")) == NULL) { - GeoIP_printf(f, NoCurrentDB, geoipfilename); - } else { - md5_init(&context); - while ((len = fread (buffer, 1, 1024, cur_db_fh)) > 0) - md5_write (&context, buffer, len); - md5_final (&context); - memcpy(digest,context.buf,16); - fclose (cur_db_fh); - for (i = 0; i < 16; i++) - sprintf (&hex_digest[2*i], "%02x", digest[i]); - GeoIP_printf(f, MD5Info, hex_digest ); - } - if (verbose == 1) { - GeoIP_printf(f,"MD5 sum of database %s is %s \n",geoipfilename,hex_digest); - } - if (client_ipaddr[0] == NULL) { - /* We haven't gotten our IP address yet, so let's request it */ - if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - free(geoipfilename); - return GEOIP_SOCKET_OPEN_ERR; - } - - memset(&sa, 0, sizeof(struct sockaddr_in)); - sa.sin_port = htons(GeoIPHTTPPort); - memcpy(&sa.sin_addr, hostlist->h_addr_list[0], hostlist->h_length); - sa.sin_family = AF_INET; - - if (verbose == 1) - GeoIP_printf(f,"Connecting to MaxMind GeoIP Update server\n"); - - /* Download gzip file */ - if (connect(sock, (struct sockaddr *)&sa, sizeof(struct sockaddr))< 0) { - free(geoipfilename); - return GEOIP_CONNECTION_ERR; - } - request_uri = malloc(sizeof(char) * (strlen(GeoIPHTTPRequestClientIP) - + strlen(GeoIPProxyHTTP) - + strlen(GeoIPProxiedHost) - + strlen(GeoIPUpdateHost) + 1 )); - if (request_uri == NULL) { - free(geoipfilename); - return GEOIP_OUT_OF_MEMORY_ERR; - } - - /* get client ip address from MaxMind web page */ - sprintf(request_uri,GeoIPHTTPRequestClientIP,GeoIPProxyHTTP,GeoIPProxiedHost,GeoIPUpdateHost); - send(sock, request_uri, strlen(request_uri),0); /* send the request */ - if (verbose == 1) { - GeoIP_printf(f, "sending request %s", request_uri); - } - free(request_uri); - buf = malloc(sizeof(char) * (block_size+1)); - if (buf == NULL) { - free(geoipfilename); - return GEOIP_OUT_OF_MEMORY_ERR; - } - offset = 0; - - for (;;){ - int amt; - amt = recv(sock, &buf[offset], block_size,0); - if (amt == 0) { - break; - } else if (amt == -1) { - free(buf); - return GEOIP_SOCKET_READ_ERR; - } - offset += amt; - buf = realloc(buf, offset+block_size+1); - } - - buf[offset] = 0; - offset = 0; - ipaddress = strstr(buf, "\r\n\r\n") + 4; /* get the ip address */ - ipaddress = malloc(strlen(strstr(buf, "\r\n\r\n") + 4)+5); - strcpy(ipaddress,strstr(buf, "\r\n\r\n") + 4); - client_ipaddr[0] = ipaddress; - if (verbose == 1) { - GeoIP_printf(f, "client ip address: %s\n",ipaddress); - } - free(buf); - close(sock); - } - - ipaddress = client_ipaddr[0]; - - /* make a md5 sum of ip address and license_key and store it in hex_digest2 */ - md5_init(&context2); - md5_write (&context2, (byte *)license_key, 12);//add license key to the md5 sum - md5_write (&context2, (byte *)ipaddress, strlen(ipaddress));//add ip address to the md5 sum - md5_final (&context2); - memcpy(digest2,context2.buf,16); - for (i = 0; i < 16; i++) - snprintf (&hex_digest2[2*i], 3, "%02x", digest2[i]);// change the digest to a hex digest - if (verbose == 1) { - GeoIP_printf(f, "md5sum of ip address and license key is %s \n",hex_digest2); - } - - /* send the request using the user id,product id, - * md5 sum of the prev database and - * the md5 sum of the license_key and ip address */ - if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - return GEOIP_SOCKET_OPEN_ERR; - } - memset(&sa, 0, sizeof(struct sockaddr_in)); - sa.sin_port = htons(GeoIPHTTPPort); - memcpy(&sa.sin_addr, hostlist->h_addr_list[0], hostlist->h_length); - sa.sin_family = AF_INET; - if (connect(sock, (struct sockaddr *)&sa, sizeof(struct sockaddr))< 0) - return GEOIP_CONNECTION_ERR; - request_uri_len = sizeof(char) * 2036; - request_uri = malloc(request_uri_len); - if (request_uri == NULL) - return GEOIP_OUT_OF_MEMORY_ERR; - snprintf(request_uri, request_uri_len, GeoIPHTTPRequestMD5,GeoIPProxyHTTP,GeoIPProxiedHost,hex_digest,hex_digest2,user_id,data_base_type); - send(sock, request_uri, strlen(request_uri),0); - if (verbose == 1) { - GeoIP_printf(f, "sending request %s\n",request_uri); - } - - free(request_uri); - - offset = 0; - buf = malloc(sizeof(char) * block_size); - if (buf == NULL) - return GEOIP_OUT_OF_MEMORY_ERR; - - if (verbose == 1) - GeoIP_printf(f,"Downloading gzipped GeoIP Database...\n"); - - for (;;) { - int amt; - amt = recv(sock, &buf[offset], block_size,0); - - if (amt == 0) { - break; - } else if (amt == -1) { - free(buf); - return GEOIP_SOCKET_READ_ERR; - } - offset += amt; - buf = realloc(buf, offset+block_size); - if (buf == NULL) - return GEOIP_OUT_OF_MEMORY_ERR; - } - - compr = strstr(buf, "\r\n\r\n") + 4; - comprLen = offset + buf - compr; - - if (strstr(compr, "License Key Invalid") != NULL) { - if (verbose == 1) - GeoIP_printf(f,"Failed\n"); - free(buf); - return GEOIP_LICENSE_KEY_INVALID_ERR; - } else if (strstr(compr, "No new updates available") != NULL) { - free(buf); - GeoIP_printf(f, "%s is up to date, no updates required\n", geoipfilename); - return GEOIP_NO_NEW_UPDATES; - } else if (strstr(compr, "Invalid UserId") != NULL){ - free(buf); - return GEOIP_USER_ID_INVALID_ERR; - } else if (strstr(compr, "Invalid product ID or subscription expired") != NULL){ - free(buf); - return GEOIP_PRODUCT_ID_INVALID_ERR; - } - - if (verbose == 1) - GeoIP_printf(f,"Done\n"); - - GeoIP_printf(f, "Updating %s\n", geoipfilename); - - /* save gzip file */ - file_path_gz = malloc(sizeof(char) * (strlen(geoipfilename) + 4)); - - if (file_path_gz == NULL) - return GEOIP_OUT_OF_MEMORY_ERR; - strcpy(file_path_gz,geoipfilename); - strcat(file_path_gz,".gz"); - if (verbose == 1) { - GeoIP_printf(f, SavingGzip, file_path_gz ); - } - comp_fh = fopen(file_path_gz, "wb"); - - if(comp_fh == NULL) { - free(file_path_gz); - free(buf); - return GEOIP_GZIP_IO_ERR; - } - - size = fwrite(compr, 1, comprLen, comp_fh); - fclose(comp_fh); - free(buf); - if ( size != comprLen ) { - return GEOIP_GZIP_IO_ERR; - } - - if (verbose == 1) { - GeoIP_printf(f, "download data to a gz file named %s \n",file_path_gz); - GeoIP_printf(f,"Done\n"); - GeoIP_printf(f,"Uncompressing gzip file ... "); - } - - file_path_test = malloc(sizeof(char) * (strlen(GeoIPDBFileName[GEOIP_COUNTRY_EDITION]) + 6)); - if (file_path_test == NULL) { - free(file_path_gz); - return GEOIP_OUT_OF_MEMORY_ERR; - } - strcpy(file_path_test,GeoIPDBFileName[GEOIP_COUNTRY_EDITION]); - strcat(file_path_test,".test"); - gi_fh = fopen(file_path_test, "wb"); - if(gi_fh == NULL) { - free(file_path_test); - free(file_path_gz); - return GEOIP_TEST_IO_ERR; - } - /* uncompress gzip file */ - offset = 0; - gz_fh = gzopen(file_path_gz, "rb"); - for (;;) { - int amt; - amt = gzread(gz_fh, block, block_size); - if (amt == -1) { - free(file_path_gz); - free(file_path_test); - gzclose(gz_fh); - fclose(gi_fh); - return GEOIP_GZIP_READ_ERR; - } - if (amt == 0) { - break; - } - if ( amt != fwrite(block,1,amt,gi_fh) ){ - return GEOIP_GZIP_IO_ERR; - } - } - gzclose(gz_fh); - unlink(file_path_gz); - free(file_path_gz); - fclose(gi_fh); - - if (verbose == 1) - GeoIP_printf(f,"Done\n"); - - if (verbose == 1) { - len = strlen(WritingFile) + strlen(geoipfilename) - 1; - f_str = malloc(len); - snprintf(f_str,len,WritingFile,geoipfilename); - free(f_str); - } - - /* sanity check */ - gi = GeoIP_open(file_path_test, GEOIP_STANDARD); - - if (verbose == 1) - GeoIP_printf(f,"Performing santity checks ... "); - - if (gi == NULL) { - GeoIP_printf(f,"Error opening sanity check database\n"); - return GEOIP_SANITY_OPEN_ERR; - } - - - /* get the database type */ - dbtype = GeoIP_database_edition(gi); - if (verbose == 1) { - GeoIP_printf(f, "Database type is %d\n",dbtype); - } - - /* this checks to make sure the files is complete, since info is at the end - dependent on future databases having MaxMind in info (ISP and Organization databases currently don't have info string */ - - if ((dbtype != GEOIP_ISP_EDITION)&& - (dbtype != GEOIP_ORG_EDITION)) { - if (verbose == 1) - GeoIP_printf(f,"database_info "); - db_info = GeoIP_database_info(gi); - if (db_info == NULL) { - GeoIP_delete(gi); - if (verbose == 1) - GeoIP_printf(f,"FAIL null\n"); - return GEOIP_SANITY_INFO_FAIL; - } - if (strstr(db_info, "MaxMind") == NULL) { - free(db_info); - GeoIP_delete(gi); - if (verbose == 1) - GeoIP_printf(f,"FAIL maxmind\n"); - return GEOIP_SANITY_INFO_FAIL; - } - free(db_info); - if (verbose == 1) - GeoIP_printf(f,"PASS "); - } - - /* this performs an IP lookup test of a US IP address */ - if (verbose == 1) - GeoIP_printf(f,"lookup "); - if (dbtype == GEOIP_NETSPEED_EDITION) { - int netspeed = GeoIP_id_by_name(gi,"24.24.24.24"); - lookupresult = 0; - if (netspeed == GEOIP_CABLEDSL_SPEED){ - lookupresult = 1; - } - } - if (dbtype == GEOIP_COUNTRY_EDITION) { - /* if data base type is country then call the function - * named GeoIP_country_code_by_addr */ - lookupresult = 1; - if (strcmp(GeoIP_country_code_by_addr(gi,"24.24.24.24"), "US") != 0) { - lookupresult = 0; - } - if (verbose == 1) { - GeoIP_printf(f,"testing GEOIP_COUNTRY_EDITION\n"); - } - } - if (dbtype == GEOIP_REGION_EDITION_REV1) { - /* if data base type is region then call the function - * named GeoIP_region_by_addr */ - GeoIPRegion *r = GeoIP_region_by_addr(gi,"24.24.24.24"); - lookupresult = 0; - if (r != NULL) { - lookupresult = 1; - free(r); - } - if (verbose == 1) { - GeoIP_printf(f,"testing GEOIP_REGION_EDITION\n"); - } - } - if (dbtype == GEOIP_CITY_EDITION_REV1) { - /* if data base type is city then call the function - * named GeoIP_record_by_addr */ - GeoIPRecord *r = GeoIP_record_by_addr(gi,"24.24.24.24"); - lookupresult = 0; - if (r != NULL) { - lookupresult = 1; - free(r); - } - if (verbose == 1) { - GeoIP_printf(f,"testing GEOIP_CITY_EDITION\n"); - } - } - if ((dbtype == GEOIP_ISP_EDITION)|| - (dbtype == GEOIP_ORG_EDITION)) { - /* if data base type is isp or org then call the function - * named GeoIP_org_by_addr */ - GeoIPRecord *r = (GeoIPRecord*)GeoIP_org_by_addr(gi,"24.24.24.24"); - lookupresult = 0; - if (r != NULL) { - lookupresult = 1; - free(r); - } - if (verbose == 1) { - if (dbtype == GEOIP_ISP_EDITION) { - GeoIP_printf(f,"testing GEOIP_ISP_EDITION\n"); - } - if (dbtype == GEOIP_ORG_EDITION) { - GeoIP_printf(f,"testing GEOIP_ORG_EDITION\n"); - } - } - } - if (lookupresult == 0) { - GeoIP_delete(gi); - if (verbose == 1) - GeoIP_printf(f,"FAIL\n"); - return GEOIP_SANITY_LOOKUP_FAIL; - } - GeoIP_delete(gi); - if (verbose == 1) - GeoIP_printf(f,"PASS\n"); - - /* install GeoIP.dat.test -> GeoIP.dat */ - err = rename(file_path_test, geoipfilename); - if (err != 0) { - GeoIP_printf(f,"GeoIP Install error while renaming file\n"); - return GEOIP_RENAME_ERR; - } - - if (verbose == 1) - GeoIP_printf(f,"Done\n"); - free(geoipfilename); - return 0; -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIPUpdate.h b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIPUpdate.h deleted file mode 100644 index 7e6bbe18..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIPUpdate.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ -/* GeoIP.h - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef GEOIPUPDATE_H -#define GEOIPUPDATE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -typedef enum { - GEOIP_NO_NEW_UPDATES = 1, /* Database up-to-date, no action taken */ - GEOIP_SUCCESS = 0, /* Success */ - GEOIP_LICENSE_KEY_INVALID_ERR = -1, /* License Key Invalid */ - GEOIP_DNS_ERR = -11, /* Unable to resolve hostname */ - GEOIP_NON_IPV4_ERR = -12, /* Non - IPv4 address */ - GEOIP_SOCKET_OPEN_ERR = -13, /* Error opening socket */ - GEOIP_CONNECTION_ERR = -14, /* Unable to connect */ - GEOIP_GZIP_IO_ERR = -15, /* Unable to write GeoIP.dat.gz file */ - GEOIP_TEST_IO_ERR = -16, /* Unable to write GeoIP.dat.test file */ - GEOIP_GZIP_READ_ERR = -17, /* Unable to read gzip data */ - GEOIP_OUT_OF_MEMORY_ERR = -18, /* Out of memory error */ - GEOIP_SOCKET_READ_ERR = -19, /* Error reading from socket, see errno */ - GEOIP_SANITY_OPEN_ERR = -20, /* Sanity check GeoIP_open error */ - GEOIP_SANITY_INFO_FAIL = -21, /* Sanity check database_info string failed */ - GEOIP_SANITY_LOOKUP_FAIL = -22, /* Sanity check ip address lookup failed */ - GEOIP_RENAME_ERR = -23, /* Rename error while installing db, check errno */ - GEOIP_USER_ID_INVALID_ERR = -24, /* Invalid userID */ - GEOIP_PRODUCT_ID_INVALID_ERR = -25, /* Invalid product ID or subscription expired */ - GEOIP_INVALID_SERVER_RESPONSE = -26 /* Server returned invalid response */ -} GeoIPUpdateCode; - -const char * GeoIP_get_error_message(int i); - -/* Original Update Function, just for MaxMind GeoIP Country database */ - short int GeoIP_update_database (char * license_key, int verbose, void (*f)( char *)); - -/* More generalized update function that works more databases */ - short int GeoIP_update_database_general (char * user_id, char * license_key,char * data_base_type, int verbose,char ** client_ipaddr, void (*f)( char *)); - - /* experimental export */ - int GeoIP_fprintf(int (*f)(FILE *, char *),FILE *fp, const char *fmt, ...); - void GeoIP_printf(void (*f)(char *), const char *fmt, ...); - -#ifdef __cplusplus -} -#endif - -#endif /* GEOIPUPDATE_H */ diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIP_internal.h b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIP_internal.h deleted file mode 100644 index c19870fa..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/GeoIP_internal.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef GEOIP_INTERNAL_H -#define GEOIP_INTERNAL_H - -#include "GeoIP.h" - -GEOIP_API unsigned int _GeoIP_seek_record (GeoIP *gi, unsigned long ipnum); - -GEOIP_API unsigned int _GeoIP_seek_record_v6 (GeoIP *gi, geoipv6_t ipnum); -GEOIP_API geoipv6_t _GeoIP_addr_to_num_v6 (const char *addr); - -GEOIP_API unsigned long _GeoIP_lookupaddress (const char *host); -GEOIP_API geoipv6_t _GeoIP_lookupaddress_v6 (const char *host); -GEOIP_API int __GEOIP_V6_IS_NULL(geoipv6_t v6); - -GEOIP_API void _GeoIP_setup_dbfilename(); -GEOIP_API char *_GeoIP_full_path_to(const char *file_name); - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/Makefile.am b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/Makefile.am deleted file mode 100644 index 5fa0a903..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -lib_LTLIBRARIES = libGeoIP.la libGeoIPUpdate.la - -EXTRA_DIST = Makefile.vc md5.h global.h types.h GeoIP_internal.h - -AM_CPPFLAGS = -DGEOIPDATADIR=\"$(pkgdatadir)\" -Wall - -libGeoIP_la_SOURCES = GeoIP.c GeoIPCity.c regionName.c timeZone.c -include_HEADERS = GeoIP.h GeoIPCity.h GeoIPUpdate.h - -libGeoIPUpdate_la_SOURCES = GeoIPUpdate.c md5.c - -libGeoIP_la_LDFLAGS = -version-info @GEOIP_VERSION_INFO@ - -libGeoIPUpdate_la_LIBADD = -lz libGeoIP.la - -GeoIP.lo GeoIP.o: GeoIP.c GeoIP.h - -GeoIPCity.lo GeoIPCity.o: GeoIPCity.c GeoIP.h - -GeoIPUpdate.lo GeoIPUpdate.o: GeoIPUpdate.c GeoIPCity.h GeoIP.h - -regionName.lo regionName.o: regionName.c - -md5.lo md5.o: md5.c - -timeZone.lo timeZone.o: timeZone.c - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/Makefile.in b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/Makefile.in deleted file mode 100644 index 5cb5c9f1..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/Makefile.in +++ /dev/null @@ -1,567 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in 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. - -@SET_MAKE@ - - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = libGeoIP -DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" -LTLIBRARIES = $(lib_LTLIBRARIES) -libGeoIP_la_LIBADD = -am_libGeoIP_la_OBJECTS = GeoIP.lo GeoIPCity.lo regionName.lo \ - timeZone.lo -libGeoIP_la_OBJECTS = $(am_libGeoIP_la_OBJECTS) -libGeoIP_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(libGeoIP_la_LDFLAGS) $(LDFLAGS) -o $@ -libGeoIPUpdate_la_DEPENDENCIES = libGeoIP.la -am_libGeoIPUpdate_la_OBJECTS = GeoIPUpdate.lo md5.lo -libGeoIPUpdate_la_OBJECTS = $(am_libGeoIPUpdate_la_OBJECTS) -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(libGeoIP_la_SOURCES) $(libGeoIPUpdate_la_SOURCES) -DIST_SOURCES = $(libGeoIP_la_SOURCES) $(libGeoIPUpdate_la_SOURCES) -HEADERS = $(include_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -lib_LTLIBRARIES = libGeoIP.la libGeoIPUpdate.la -EXTRA_DIST = Makefile.vc md5.h global.h types.h GeoIP_internal.h -AM_CPPFLAGS = -DGEOIPDATADIR=\"$(pkgdatadir)\" -Wall -libGeoIP_la_SOURCES = GeoIP.c GeoIPCity.c regionName.c timeZone.c -include_HEADERS = GeoIP.h GeoIPCity.h GeoIPUpdate.h -libGeoIPUpdate_la_SOURCES = GeoIPUpdate.c md5.c -libGeoIP_la_LDFLAGS = -version-info @GEOIP_VERSION_INFO@ -libGeoIPUpdate_la_LIBADD = -lz libGeoIP.la -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libGeoIP/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu libGeoIP/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ - } - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libGeoIP.la: $(libGeoIP_la_OBJECTS) $(libGeoIP_la_DEPENDENCIES) - $(libGeoIP_la_LINK) -rpath $(libdir) $(libGeoIP_la_OBJECTS) $(libGeoIP_la_LIBADD) $(LIBS) -libGeoIPUpdate.la: $(libGeoIPUpdate_la_OBJECTS) $(libGeoIPUpdate_la_DEPENDENCIES) - $(LINK) -rpath $(libdir) $(libGeoIPUpdate_la_OBJECTS) $(libGeoIPUpdate_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeoIP.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeoIPCity.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GeoIPUpdate.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regionName.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timeZone.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-includeHEADERS: $(include_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" - @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ - $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ - done - -uninstall-includeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(includedir)" && rm -f $$files - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-includeHEADERS - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-libLTLIBRARIES - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-includeHEADERS install-info \ - install-info-am install-libLTLIBRARIES install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-includeHEADERS \ - uninstall-libLTLIBRARIES - - -GeoIP.lo GeoIP.o: GeoIP.c GeoIP.h - -GeoIPCity.lo GeoIPCity.o: GeoIPCity.c GeoIP.h - -GeoIPUpdate.lo GeoIPUpdate.o: GeoIPUpdate.c GeoIPCity.h GeoIP.h - -regionName.lo regionName.o: regionName.c - -md5.lo md5.o: md5.c - -timeZone.lo timeZone.o: timeZone.c - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/Makefile.vc b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/Makefile.vc deleted file mode 100644 index 2a167319..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/Makefile.vc +++ /dev/null @@ -1,34 +0,0 @@ -#NMAKE makefile for Windows developers. -#Produces a static library (GeoIP.lib). - -COMPILER=cl - -CFLAGS=-DWIN32 -MD -nologo - -GEOIPINC = -I..\libGeoIP - -CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) -DGEOIPDATADIR=\"$(GEOIPDATADIR)\" - -OBJS=GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj - -EXTRA_LIBS= advapi32.lib wsock32.lib - -AR=lib - -GeoIP.lib: GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj - $(AR) -nologo $(OBJS) $(EXTRA_LIBS) /OUT:GeoIP.lib - -GeoIP.obj: GeoIP.c - $(CC1) -c GeoIP.c $(GEOIPINC) - -GeoIPCity.obj: GeoIPCity.c - $(CC1) -c GeoIPCity.c $(GEOIPINC) - -regionName.obj: regionName.c - $(CC1) -c regionName.c $(GEOIPINC) - -md5.obj: md5.c - $(CC1) -c md5.c $(GEOIPINC) - -timeZone.obj: timeZone.c - $(CC1) -c timeZone.c $(GEOIPINC) diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/global.h b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/global.h deleted file mode 100644 index 22c5684b..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/global.h +++ /dev/null @@ -1,32 +0,0 @@ -/* GLOBAL.H - RSAREF types and constants - */ - -/* PROTOTYPES should be set to one if and only if the compiler supports - function argument prototyping. -The following makes PROTOTYPES default to 0 if it has not already - - been defined with C compiler flags. - */ -#ifndef PROTOTYPES -#define PROTOTYPES 0 -#endif - -/* POINTER defines a generic pointer type */ -typedef unsigned char *POINTER; - -/* UINT2 defines a two byte word */ -typedef unsigned short int UINT2; - -/* UINT4 defines a four byte word */ -typedef unsigned long int UINT4; - -/* PROTO_LIST is defined depending on how PROTOTYPES is defined above. -If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it - returns an empty list. - */ -#if PROTOTYPES -#define PROTO_LIST(list) list -#else -#define PROTO_LIST(list) () -#endif - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/md5.c b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/md5.c deleted file mode 100644 index 4b0c237f..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/md5.c +++ /dev/null @@ -1,326 +0,0 @@ -/* md5.c - MD5 Message-Digest Algorithm - * Copyright (C) 1995, 1996, 1998, 1999, - * 2000, 2001 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * According to the definition of MD5 in RFC 1321 from April 1992. - * NOTE: This is *not* the same file as the one from glibc. - */ -/* Written by Ulrich Drepper , 1995. */ -/* Heavily modified for GnuPG by */ - -#include -#include -#include -#include - -#include "types.h" - -#ifdef WORDS_BIGENDIAN -#define BIG_ENDIAN_HOST -#endif - -//#define DIM(v) (sizeof(v)/sizeof((v)[0])) -#define wipememory2(_ptr,_set,_len) do { volatile char *_vptr=(volatile char *)(_ptr); size_t _vlen=(_len); while(_vlen) { *_vptr=(_set); _vptr++; _vlen--; } } while(0) -#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len) -#define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) ) - -typedef struct { - u32 A,B,C,D; /* chaining variables */ - u32 nblocks; - byte buf[64]; - int count; -} MD5_CONTEXT; - - -void -md5_init( MD5_CONTEXT *ctx ) -{ - ctx->A = 0x67452301; - ctx->B = 0xefcdab89; - ctx->C = 0x98badcfe; - ctx->D = 0x10325476; - - ctx->nblocks = 0; - ctx->count = 0; -} - - - - -/* These are the four functions used in the four steps of the MD5 algorithm - and defined in the RFC 1321. The first function is a little bit optimized - (as found in Colin Plumbs public domain implementation). */ -/* #define FF(b, c, d) ((b & c) | (~b & d)) */ -#define FF(b, c, d) (d ^ (b & (c ^ d))) -#define FG(b, c, d) FF (d, b, c) -#define FH(b, c, d) (b ^ c ^ d) -#define FI(b, c, d) (c ^ (b | ~d)) - -static void -burn_stack (int bytes) -{ - char buf[128]; - - wipememory(buf,sizeof buf); - bytes -= sizeof buf; - if (bytes > 0) - burn_stack (bytes); -} - - - -/**************** - * transform n*64 bytes - */ -static void -/*transform( MD5_CONTEXT *ctx, const void *buffer, size_t len )*/ -transform( MD5_CONTEXT *ctx, byte *data ) -{ - u32 correct_words[16]; - u32 A = ctx->A; - u32 B = ctx->B; - u32 C = ctx->C; - u32 D = ctx->D; - u32 *cwp = correct_words; - -#ifdef BIG_ENDIAN_HOST - { int i; - byte *p2, *p1; - for(i=0, p1=data, p2=(byte*)correct_words; i < 16; i++, p2 += 4 ) { - p2[3] = *p1++; - p2[2] = *p1++; - p2[1] = *p1++; - p2[0] = *p1++; - } - } -#else - memcpy( correct_words, data, 64 ); -#endif - - -#define OP(a, b, c, d, s, T) \ - do \ - { \ - a += FF (b, c, d) + (*cwp++) + T; \ - a = rol(a, s); \ - a += b; \ - } \ - while (0) - - /* Before we start, one word about the strange constants. - They are defined in RFC 1321 as - - T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 - */ - - /* Round 1. */ - OP (A, B, C, D, 7, 0xd76aa478); - OP (D, A, B, C, 12, 0xe8c7b756); - OP (C, D, A, B, 17, 0x242070db); - OP (B, C, D, A, 22, 0xc1bdceee); - OP (A, B, C, D, 7, 0xf57c0faf); - OP (D, A, B, C, 12, 0x4787c62a); - OP (C, D, A, B, 17, 0xa8304613); - OP (B, C, D, A, 22, 0xfd469501); - OP (A, B, C, D, 7, 0x698098d8); - OP (D, A, B, C, 12, 0x8b44f7af); - OP (C, D, A, B, 17, 0xffff5bb1); - OP (B, C, D, A, 22, 0x895cd7be); - OP (A, B, C, D, 7, 0x6b901122); - OP (D, A, B, C, 12, 0xfd987193); - OP (C, D, A, B, 17, 0xa679438e); - OP (B, C, D, A, 22, 0x49b40821); - -#undef OP -#define OP(f, a, b, c, d, k, s, T) \ - do \ - { \ -a += f (b, c, d) + correct_words[k] + T; \ -a = rol(a, s); \ -a += b; \ - } \ - while (0) - - /* Round 2. */ - OP (FG, A, B, C, D, 1, 5, 0xf61e2562); - OP (FG, D, A, B, C, 6, 9, 0xc040b340); - OP (FG, C, D, A, B, 11, 14, 0x265e5a51); - OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); - OP (FG, A, B, C, D, 5, 5, 0xd62f105d); - OP (FG, D, A, B, C, 10, 9, 0x02441453); - OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); - OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); - OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); - OP (FG, D, A, B, C, 14, 9, 0xc33707d6); - OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); - OP (FG, B, C, D, A, 8, 20, 0x455a14ed); - OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); - OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); - OP (FG, C, D, A, B, 7, 14, 0x676f02d9); - OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); - - /* Round 3. */ - OP (FH, A, B, C, D, 5, 4, 0xfffa3942); - OP (FH, D, A, B, C, 8, 11, 0x8771f681); - OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); - OP (FH, B, C, D, A, 14, 23, 0xfde5380c); - OP (FH, A, B, C, D, 1, 4, 0xa4beea44); - OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); - OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); - OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); - OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); - OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); - OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); - OP (FH, B, C, D, A, 6, 23, 0x04881d05); - OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); - OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); - OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); - OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); - - /* Round 4. */ - OP (FI, A, B, C, D, 0, 6, 0xf4292244); - OP (FI, D, A, B, C, 7, 10, 0x432aff97); - OP (FI, C, D, A, B, 14, 15, 0xab9423a7); - OP (FI, B, C, D, A, 5, 21, 0xfc93a039); - OP (FI, A, B, C, D, 12, 6, 0x655b59c3); - OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); - OP (FI, C, D, A, B, 10, 15, 0xffeff47d); - OP (FI, B, C, D, A, 1, 21, 0x85845dd1); - OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); - OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); - OP (FI, C, D, A, B, 6, 15, 0xa3014314); - OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); - OP (FI, A, B, C, D, 4, 6, 0xf7537e82); - OP (FI, D, A, B, C, 11, 10, 0xbd3af235); - OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); - OP (FI, B, C, D, A, 9, 21, 0xeb86d391); - - /* Put checksum in context given as argument. */ - ctx->A += A; - ctx->B += B; - ctx->C += C; - ctx->D += D; -} - - - -/* The routine updates the message-digest context to - * account for the presence of each of the characters inBuf[0..inLen-1] - * in the message whose digest is being computed. - */ -void -md5_write( MD5_CONTEXT *hd, byte *inbuf, size_t inlen) -{ - if( hd->count == 64 ) { /* flush the buffer */ - transform( hd, hd->buf ); - burn_stack (80+6*sizeof(void*)); - hd->count = 0; - hd->nblocks++; - } - if( !inbuf ) - return; - if( hd->count ) { - for( ; inlen && hd->count < 64; inlen-- ) - hd->buf[hd->count++] = *inbuf++; - md5_write( hd, NULL, 0 ); - if( !inlen ) - return; - } - - while( inlen >= 64 ) { - transform( hd, inbuf ); - hd->count = 0; - hd->nblocks++; - inlen -= 64; - inbuf += 64; - } - burn_stack (80+6*sizeof(void*)); - for( ; inlen && hd->count < 64; inlen-- ) - hd->buf[hd->count++] = *inbuf++; -} -/* The routine final terminates the message-digest computation and - * ends with the desired message digest in mdContext->digest[0...15]. - * The handle is prepared for a new MD5 cycle. - * Returns 16 bytes representing the digest. - */ - -void -md5_final( MD5_CONTEXT *hd ) -{ - u32 t, msb, lsb; - byte *p; - - md5_write(hd, NULL, 0); /* flush */; - - t = hd->nblocks; - /* multiply by 64 to make a byte count */ - lsb = t << 6; - msb = t >> 26; - /* add the count */ - t = lsb; - if( (lsb += hd->count) < t ) - msb++; - /* multiply by 8 to make a bit count */ - t = lsb; - lsb <<= 3; - msb <<= 3; - msb |= t >> 29; - - if( hd->count < 56 ) { /* enough room */ - hd->buf[hd->count++] = 0x80; /* pad */ - while( hd->count < 56 ) - hd->buf[hd->count++] = 0; /* pad */ - } - else { /* need one extra block */ - hd->buf[hd->count++] = 0x80; /* pad character */ - while( hd->count < 64 ) - hd->buf[hd->count++] = 0; - md5_write(hd, NULL, 0); /* flush */; - memset(hd->buf, 0, 56 ); /* fill next block with zeroes */ - } - /* append the 64 bit count */ - hd->buf[56] = lsb ; - hd->buf[57] = lsb >> 8; - hd->buf[58] = lsb >> 16; - hd->buf[59] = lsb >> 24; - hd->buf[60] = msb ; - hd->buf[61] = msb >> 8; - hd->buf[62] = msb >> 16; - hd->buf[63] = msb >> 24; - transform( hd, hd->buf ); - burn_stack (80+6*sizeof(void*)); - - p = hd->buf; -#ifdef BIG_ENDIAN_HOST -#define X(a) do { *p++ = hd-> a ; *p++ = hd-> a >> 8; \ - *p++ = hd-> a >> 16; *p++ = hd-> a >> 24; } while(0) -#else /* little endian */ -#define X(a) do { *(u32*)p = hd-> a ; p += 4; } while(0) -#endif - X(A); - X(B); - X(C); - X(D); -#undef X - -} - -static byte * -md5_read( MD5_CONTEXT *hd ) -{ - return hd->buf; -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/md5.h b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/md5.h deleted file mode 100644 index e1607be9..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/md5.h +++ /dev/null @@ -1,40 +0,0 @@ -/* MD5.H - header file for MD5C.C - */ - -/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All -rights reserved. - -License to copy and use this software is granted provided that it -is identified as the "RSA Data Security, Inc. MD5 Message-Digest -Algorithm" in all material mentioning or referencing this software -or this function. - -License is also granted to make and use derivative works provided -that such works are identified as "derived from the RSA Data -Security, Inc. MD5 Message-Digest Algorithm" in all material -mentioning or referencing the derived work. - -RSA Data Security, Inc. makes no representations concerning either -the merchantability of this software or the suitability of this -software for any particular purpose. It is provided "as is" -without express or implied warranty of any kind. - -These notices must be retained in any copies of any part of this -documentation and/or software. - */ - -/* MD5 context. */ - -#include "types.h" - -typedef struct { - u32 A,B,C,D; /* chaining variables */ - u32 nblocks; - byte buf[64]; - int count; -} MD5_CONTEXT; - -void md5_init( MD5_CONTEXT *ctx ); -void md5_write( MD5_CONTEXT *hd, byte *inbuf, size_t inlen); -void md5_final( MD5_CONTEXT *hd ); - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/regionName.c b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/regionName.c deleted file mode 100644 index 4f90f386..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/regionName.c +++ /dev/null @@ -1,12780 +0,0 @@ -#include -#include - -const char * GeoIP_region_name_by_code(const char * country_code,const char * region_code) { - const char * name = NULL; - int region_code2 = -1; - if (region_code == NULL) { return NULL; } - - if ( ((region_code[0] >= 48) && (region_code[0] < (48 + 10))) - && ((region_code[1] >= 48) && (region_code[1] < (48 + 10))) - ) { - - /* only numbers, that shorten the large switch statements */ - region_code2 = (region_code[0] - 48) * 10 + region_code[1] - 48; - } - - else if ( ( ((region_code[0] >= 65) && (region_code[0] < (65 + 26))) - || ((region_code[0] >= 48) && (region_code[0] < (48 + 10)))) - && ( ((region_code[1] >= 65) && (region_code[1] < (65 + 26))) - || ((region_code[1] >= 48) && (region_code[1] < (48 + 10)))) - ) { - - region_code2 = (region_code[0] - 48) * (65 + 26 - 48) + region_code[1] - 48 + 100; - } - - if (region_code2 == -1) {return NULL;} - - if (strcmp(country_code,"CA") == 0) { - switch (region_code2) { - case 849: - name = "Alberta"; - break; - case 893: - name = "British Columbia"; - break; - case 1365: - name = "Manitoba"; - break; - case 1408: - name = "New Brunswick"; - break; - case 1418: - name = "Newfoundland"; - break; - case 1425: - name = "Nova Scotia"; - break; - case 1427: - name = "Nunavut"; - break; - case 1463: - name = "Ontario"; - break; - case 1497: - name = "Prince Edward Island"; - break; - case 1538: - name = "Quebec"; - break; - case 1632: - name = "Saskatchewan"; - break; - case 1426: - name = "Northwest Territories"; - break; - case 1899: - name = "Yukon Territory"; - break; - } - } - if (strcmp(country_code,"US") == 0) { - switch (region_code2) { - case 848: - name = "Armed Forces Americas"; - break; - case 852: - name = "Armed Forces Europe, Middle East, & Canada"; - break; - case 858: - name = "Alaska"; - break; - case 859: - name = "Alabama"; - break; - case 863: - name = "Armed Forces Pacific"; - break; - case 865: - name = "Arkansas"; - break; - case 866: - name = "American Samoa"; - break; - case 873: - name = "Arizona"; - break; - case 934: - name = "California"; - break; - case 948: - name = "Colorado"; - break; - case 953: - name = "Connecticut"; - break; - case 979: - name = "District of Columbia"; - break; - case 981: - name = "Delaware"; - break; - case 1074: - name = "Florida"; - break; - case 1075: - name = "Federated States of Micronesia"; - break; - case 1106: - name = "Georgia"; - break; - case 1126: - name = "Guam"; - break; - case 1157: - name = "Hawaii"; - break; - case 1192: - name = "Iowa"; - break; - case 1195: - name = "Idaho"; - break; - case 1203: - name = "Illinois"; - break; - case 1205: - name = "Indiana"; - break; - case 1296: - name = "Kansas"; - break; - case 1302: - name = "Kentucky"; - break; - case 1321: - name = "Louisiana"; - break; - case 1364: - name = "Massachusetts"; - break; - case 1367: - name = "Maryland"; - break; - case 1368: - name = "Maine"; - break; - case 1371: - name = "Marshall Islands"; - break; - case 1372: - name = "Michigan"; - break; - case 1377: - name = "Minnesota"; - break; - case 1378: - name = "Missouri"; - break; - case 1379: - name = "Northern Mariana Islands"; - break; - case 1382: - name = "Mississippi"; - break; - case 1383: - name = "Montana"; - break; - case 1409: - name = "North Carolina"; - break; - case 1410: - name = "North Dakota"; - break; - case 1411: - name = "Nebraska"; - break; - case 1414: - name = "New Hampshire"; - break; - case 1416: - name = "New Jersey"; - break; - case 1419: - name = "New Mexico"; - break; - case 1428: - name = "Nevada"; - break; - case 1431: - name = "New York"; - break; - case 1457: - name = "Ohio"; - break; - case 1460: - name = "Oklahoma"; - break; - case 1467: - name = "Oregon"; - break; - case 1493: - name = "Pennsylvania"; - break; - case 1510: - name = "Puerto Rico"; - break; - case 1515: - name = "Palau"; - break; - case 1587: - name = "Rhode Island"; - break; - case 1624: - name = "South Carolina"; - break; - case 1625: - name = "South Dakota"; - break; - case 1678: - name = "Tennessee"; - break; - case 1688: - name = "Texas"; - break; - case 1727: - name = "Utah"; - break; - case 1751: - name = "Virginia"; - break; - case 1759: - name = "Virgin Islands"; - break; - case 1770: - name = "Vermont"; - break; - case 1794: - name = "Washington"; - break; - case 1815: - name = "West Virginia"; - break; - case 1802: - name = "Wisconsin"; - break; - case 1818: - name = "Wyoming"; - break; - } - } - if (strcmp(country_code,"AD") == 0) { - switch (region_code2) { - case 2: - name = "Canillo"; - break; - case 3: - name = "Encamp"; - break; - case 4: - name = "La Massana"; - break; - case 5: - name = "Ordino"; - break; - case 6: - name = "Sant Julia de Loria"; - break; - case 7: - name = "Andorra la Vella"; - break; - case 8: - name = "Escaldes-Engordany"; - break; - } - } - if (strcmp(country_code,"AE") == 0) { - switch (region_code2) { - case 1: - name = "Abu Dhabi"; - break; - case 2: - name = "Ajman"; - break; - case 3: - name = "Dubai"; - break; - case 4: - name = "Fujairah"; - break; - case 5: - name = "Ras Al Khaimah"; - break; - case 6: - name = "Sharjah"; - break; - case 7: - name = "Umm Al Quwain"; - break; - } - } - if (strcmp(country_code,"AF") == 0) { - switch (region_code2) { - case 1: - name = "Badakhshan"; - break; - case 2: - name = "Badghis"; - break; - case 3: - name = "Baghlan"; - break; - case 5: - name = "Bamian"; - break; - case 6: - name = "Farah"; - break; - case 7: - name = "Faryab"; - break; - case 8: - name = "Ghazni"; - break; - case 9: - name = "Ghowr"; - break; - case 10: - name = "Helmand"; - break; - case 11: - name = "Herat"; - break; - case 13: - name = "Kabol"; - break; - case 14: - name = "Kapisa"; - break; - case 17: - name = "Lowgar"; - break; - case 18: - name = "Nangarhar"; - break; - case 19: - name = "Nimruz"; - break; - case 23: - name = "Kandahar"; - break; - case 24: - name = "Kondoz"; - break; - case 26: - name = "Takhar"; - break; - case 27: - name = "Vardak"; - break; - case 28: - name = "Zabol"; - break; - case 29: - name = "Paktika"; - break; - case 30: - name = "Balkh"; - break; - case 31: - name = "Jowzjan"; - break; - case 32: - name = "Samangan"; - break; - case 33: - name = "Sar-e Pol"; - break; - case 34: - name = "Konar"; - break; - case 35: - name = "Laghman"; - break; - case 36: - name = "Paktia"; - break; - case 37: - name = "Khowst"; - break; - case 38: - name = "Nurestan"; - break; - case 39: - name = "Oruzgan"; - break; - case 40: - name = "Parvan"; - break; - case 41: - name = "Daykondi"; - break; - case 42: - name = "Panjshir"; - break; - } - } - if (strcmp(country_code,"AG") == 0) { - switch (region_code2) { - case 1: - name = "Barbuda"; - break; - case 3: - name = "Saint George"; - break; - case 4: - name = "Saint John"; - break; - case 5: - name = "Saint Mary"; - break; - case 6: - name = "Saint Paul"; - break; - case 7: - name = "Saint Peter"; - break; - case 8: - name = "Saint Philip"; - break; - case 9: - name = "Redonda"; - break; - } - } - if (strcmp(country_code,"AL") == 0) { - switch (region_code2) { - case 40: - name = "Berat"; - break; - case 41: - name = "Diber"; - break; - case 42: - name = "Durres"; - break; - case 43: - name = "Elbasan"; - break; - case 44: - name = "Fier"; - break; - case 45: - name = "Gjirokaster"; - break; - case 46: - name = "Korce"; - break; - case 47: - name = "Kukes"; - break; - case 48: - name = "Lezhe"; - break; - case 49: - name = "Shkoder"; - break; - case 50: - name = "Tirane"; - break; - case 51: - name = "Vlore"; - break; - } - } - if (strcmp(country_code,"AM") == 0) { - switch (region_code2) { - case 1: - name = "Aragatsotn"; - break; - case 2: - name = "Ararat"; - break; - case 3: - name = "Armavir"; - break; - case 4: - name = "Geghark'unik'"; - break; - case 5: - name = "Kotayk'"; - break; - case 6: - name = "Lorri"; - break; - case 7: - name = "Shirak"; - break; - case 8: - name = "Syunik'"; - break; - case 9: - name = "Tavush"; - break; - case 10: - name = "Vayots' Dzor"; - break; - case 11: - name = "Yerevan"; - break; - } - } - if (strcmp(country_code,"AO") == 0) { - switch (region_code2) { - case 1: - name = "Benguela"; - break; - case 2: - name = "Bie"; - break; - case 3: - name = "Cabinda"; - break; - case 4: - name = "Cuando Cubango"; - break; - case 5: - name = "Cuanza Norte"; - break; - case 6: - name = "Cuanza Sul"; - break; - case 7: - name = "Cunene"; - break; - case 8: - name = "Huambo"; - break; - case 9: - name = "Huila"; - break; - case 12: - name = "Malanje"; - break; - case 13: - name = "Namibe"; - break; - case 14: - name = "Moxico"; - break; - case 15: - name = "Uige"; - break; - case 16: - name = "Zaire"; - break; - case 17: - name = "Lunda Norte"; - break; - case 18: - name = "Lunda Sul"; - break; - case 19: - name = "Bengo"; - break; - case 20: - name = "Luanda"; - break; - } - } - if (strcmp(country_code,"AR") == 0) { - switch (region_code2) { - case 1: - name = "Buenos Aires"; - break; - case 2: - name = "Catamarca"; - break; - case 3: - name = "Chaco"; - break; - case 4: - name = "Chubut"; - break; - case 5: - name = "Cordoba"; - break; - case 6: - name = "Corrientes"; - break; - case 7: - name = "Distrito Federal"; - break; - case 8: - name = "Entre Rios"; - break; - case 9: - name = "Formosa"; - break; - case 10: - name = "Jujuy"; - break; - case 11: - name = "La Pampa"; - break; - case 12: - name = "La Rioja"; - break; - case 13: - name = "Mendoza"; - break; - case 14: - name = "Misiones"; - break; - case 15: - name = "Neuquen"; - break; - case 16: - name = "Rio Negro"; - break; - case 17: - name = "Salta"; - break; - case 18: - name = "San Juan"; - break; - case 19: - name = "San Luis"; - break; - case 20: - name = "Santa Cruz"; - break; - case 21: - name = "Santa Fe"; - break; - case 22: - name = "Santiago del Estero"; - break; - case 23: - name = "Tierra del Fuego"; - break; - case 24: - name = "Tucuman"; - break; - } - } - if (strcmp(country_code,"AT") == 0) { - switch (region_code2) { - case 1: - name = "Burgenland"; - break; - case 2: - name = "Karnten"; - break; - case 3: - name = "Niederosterreich"; - break; - case 4: - name = "Oberosterreich"; - break; - case 5: - name = "Salzburg"; - break; - case 6: - name = "Steiermark"; - break; - case 7: - name = "Tirol"; - break; - case 8: - name = "Vorarlberg"; - break; - case 9: - name = "Wien"; - break; - } - } - if (strcmp(country_code,"AU") == 0) { - switch (region_code2) { - case 1: - name = "Australian Capital Territory"; - break; - case 2: - name = "New South Wales"; - break; - case 3: - name = "Northern Territory"; - break; - case 4: - name = "Queensland"; - break; - case 5: - name = "South Australia"; - break; - case 6: - name = "Tasmania"; - break; - case 7: - name = "Victoria"; - break; - case 8: - name = "Western Australia"; - break; - } - } - if (strcmp(country_code,"AZ") == 0) { - switch (region_code2) { - case 1: - name = "Abseron"; - break; - case 2: - name = "Agcabadi"; - break; - case 3: - name = "Agdam"; - break; - case 4: - name = "Agdas"; - break; - case 5: - name = "Agstafa"; - break; - case 6: - name = "Agsu"; - break; - case 7: - name = "Ali Bayramli"; - break; - case 8: - name = "Astara"; - break; - case 9: - name = "Baki"; - break; - case 10: - name = "Balakan"; - break; - case 11: - name = "Barda"; - break; - case 12: - name = "Beylaqan"; - break; - case 13: - name = "Bilasuvar"; - break; - case 14: - name = "Cabrayil"; - break; - case 15: - name = "Calilabad"; - break; - case 16: - name = "Daskasan"; - break; - case 17: - name = "Davaci"; - break; - case 18: - name = "Fuzuli"; - break; - case 19: - name = "Gadabay"; - break; - case 20: - name = "Ganca"; - break; - case 21: - name = "Goranboy"; - break; - case 22: - name = "Goycay"; - break; - case 23: - name = "Haciqabul"; - break; - case 24: - name = "Imisli"; - break; - case 25: - name = "Ismayilli"; - break; - case 26: - name = "Kalbacar"; - break; - case 27: - name = "Kurdamir"; - break; - case 28: - name = "Lacin"; - break; - case 29: - name = "Lankaran"; - break; - case 30: - name = "Lankaran"; - break; - case 31: - name = "Lerik"; - break; - case 32: - name = "Masalli"; - break; - case 33: - name = "Mingacevir"; - break; - case 34: - name = "Naftalan"; - break; - case 35: - name = "Naxcivan"; - break; - case 36: - name = "Neftcala"; - break; - case 37: - name = "Oguz"; - break; - case 38: - name = "Qabala"; - break; - case 39: - name = "Qax"; - break; - case 40: - name = "Qazax"; - break; - case 41: - name = "Qobustan"; - break; - case 42: - name = "Quba"; - break; - case 43: - name = "Qubadli"; - break; - case 44: - name = "Qusar"; - break; - case 45: - name = "Saatli"; - break; - case 46: - name = "Sabirabad"; - break; - case 47: - name = "Saki"; - break; - case 48: - name = "Saki"; - break; - case 49: - name = "Salyan"; - break; - case 50: - name = "Samaxi"; - break; - case 51: - name = "Samkir"; - break; - case 52: - name = "Samux"; - break; - case 53: - name = "Siyazan"; - break; - case 54: - name = "Sumqayit"; - break; - case 55: - name = "Susa"; - break; - case 56: - name = "Susa"; - break; - case 57: - name = "Tartar"; - break; - case 58: - name = "Tovuz"; - break; - case 59: - name = "Ucar"; - break; - case 60: - name = "Xacmaz"; - break; - case 61: - name = "Xankandi"; - break; - case 62: - name = "Xanlar"; - break; - case 63: - name = "Xizi"; - break; - case 64: - name = "Xocali"; - break; - case 65: - name = "Xocavand"; - break; - case 66: - name = "Yardimli"; - break; - case 67: - name = "Yevlax"; - break; - case 68: - name = "Yevlax"; - break; - case 69: - name = "Zangilan"; - break; - case 70: - name = "Zaqatala"; - break; - case 71: - name = "Zardab"; - break; - } - } - if (strcmp(country_code,"BA") == 0) { - switch (region_code2) { - case 1: - name = "Federation of Bosnia and Herzegovina"; - break; - case 2: - name = "Republika Srpska"; - break; - } - } - if (strcmp(country_code,"BB") == 0) { - switch (region_code2) { - case 1: - name = "Christ Church"; - break; - case 2: - name = "Saint Andrew"; - break; - case 3: - name = "Saint George"; - break; - case 4: - name = "Saint James"; - break; - case 5: - name = "Saint John"; - break; - case 6: - name = "Saint Joseph"; - break; - case 7: - name = "Saint Lucy"; - break; - case 8: - name = "Saint Michael"; - break; - case 9: - name = "Saint Peter"; - break; - case 10: - name = "Saint Philip"; - break; - case 11: - name = "Saint Thomas"; - break; - } - } - if (strcmp(country_code,"BD") == 0) { - switch (region_code2) { - case 81: - name = "Dhaka"; - break; - case 82: - name = "Khulna"; - break; - case 83: - name = "Rajshahi"; - break; - case 84: - name = "Chittagong"; - break; - case 85: - name = "Barisal"; - break; - case 86: - name = "Sylhet"; - break; - } - } - if (strcmp(country_code,"BE") == 0) { - switch (region_code2) { - case 1: - name = "Antwerpen"; - break; - case 3: - name = "Hainaut"; - break; - case 4: - name = "Liege"; - break; - case 5: - name = "Limburg"; - break; - case 6: - name = "Luxembourg"; - break; - case 7: - name = "Namur"; - break; - case 8: - name = "Oost-Vlaanderen"; - break; - case 9: - name = "West-Vlaanderen"; - break; - case 10: - name = "Brabant Wallon"; - break; - case 11: - name = "Brussels Hoofdstedelijk Gewest"; - break; - case 12: - name = "Vlaams-Brabant"; - break; - } - } - if (strcmp(country_code,"BF") == 0) { - switch (region_code2) { - case 15: - name = "Bam"; - break; - case 19: - name = "Boulkiemde"; - break; - case 20: - name = "Ganzourgou"; - break; - case 21: - name = "Gnagna"; - break; - case 28: - name = "Kouritenga"; - break; - case 33: - name = "Oudalan"; - break; - case 34: - name = "Passore"; - break; - case 36: - name = "Sanguie"; - break; - case 40: - name = "Soum"; - break; - case 42: - name = "Tapoa"; - break; - case 44: - name = "Zoundweogo"; - break; - case 45: - name = "Bale"; - break; - case 46: - name = "Banwa"; - break; - case 47: - name = "Bazega"; - break; - case 48: - name = "Bougouriba"; - break; - case 49: - name = "Boulgou"; - break; - case 50: - name = "Gourma"; - break; - case 51: - name = "Houet"; - break; - case 52: - name = "Ioba"; - break; - case 53: - name = "Kadiogo"; - break; - case 54: - name = "Kenedougou"; - break; - case 55: - name = "Komoe"; - break; - case 56: - name = "Komondjari"; - break; - case 57: - name = "Kompienga"; - break; - case 58: - name = "Kossi"; - break; - case 59: - name = "Koulpelogo"; - break; - case 60: - name = "Kourweogo"; - break; - case 61: - name = "Leraba"; - break; - case 62: - name = "Loroum"; - break; - case 63: - name = "Mouhoun"; - break; - case 64: - name = "Namentenga"; - break; - case 65: - name = "Naouri"; - break; - case 66: - name = "Nayala"; - break; - case 67: - name = "Noumbiel"; - break; - case 68: - name = "Oubritenga"; - break; - case 69: - name = "Poni"; - break; - case 70: - name = "Sanmatenga"; - break; - case 71: - name = "Seno"; - break; - case 72: - name = "Sissili"; - break; - case 73: - name = "Sourou"; - break; - case 74: - name = "Tuy"; - break; - case 75: - name = "Yagha"; - break; - case 76: - name = "Yatenga"; - break; - case 77: - name = "Ziro"; - break; - case 78: - name = "Zondoma"; - break; - } - } - if (strcmp(country_code,"BG") == 0) { - switch (region_code2) { - case 33: - name = "Mikhaylovgrad"; - break; - case 38: - name = "Blagoevgrad"; - break; - case 39: - name = "Burgas"; - break; - case 40: - name = "Dobrich"; - break; - case 41: - name = "Gabrovo"; - break; - case 42: - name = "Grad Sofiya"; - break; - case 43: - name = "Khaskovo"; - break; - case 44: - name = "Kurdzhali"; - break; - case 45: - name = "Kyustendil"; - break; - case 46: - name = "Lovech"; - break; - case 47: - name = "Montana"; - break; - case 48: - name = "Pazardzhik"; - break; - case 49: - name = "Pernik"; - break; - case 50: - name = "Pleven"; - break; - case 51: - name = "Plovdiv"; - break; - case 52: - name = "Razgrad"; - break; - case 53: - name = "Ruse"; - break; - case 54: - name = "Shumen"; - break; - case 55: - name = "Silistra"; - break; - case 56: - name = "Sliven"; - break; - case 57: - name = "Smolyan"; - break; - case 58: - name = "Sofiya"; - break; - case 59: - name = "Stara Zagora"; - break; - case 60: - name = "Turgovishte"; - break; - case 61: - name = "Varna"; - break; - case 62: - name = "Veliko Turnovo"; - break; - case 63: - name = "Vidin"; - break; - case 64: - name = "Vratsa"; - break; - case 65: - name = "Yambol"; - break; - } - } - if (strcmp(country_code,"BH") == 0) { - switch (region_code2) { - case 1: - name = "Al Hadd"; - break; - case 2: - name = "Al Manamah"; - break; - case 5: - name = "Jidd Hafs"; - break; - case 6: - name = "Sitrah"; - break; - case 8: - name = "Al Mintaqah al Gharbiyah"; - break; - case 9: - name = "Mintaqat Juzur Hawar"; - break; - case 10: - name = "Al Mintaqah ash Shamaliyah"; - break; - case 11: - name = "Al Mintaqah al Wusta"; - break; - case 12: - name = "Madinat"; - break; - case 13: - name = "Ar Rifa"; - break; - case 14: - name = "Madinat Hamad"; - break; - case 15: - name = "Al Muharraq"; - break; - case 16: - name = "Al Asimah"; - break; - case 17: - name = "Al Janubiyah"; - break; - case 18: - name = "Ash Shamaliyah"; - break; - case 19: - name = "Al Wusta"; - break; - } - } - if (strcmp(country_code,"BI") == 0) { - switch (region_code2) { - case 2: - name = "Bujumbura"; - break; - case 9: - name = "Bubanza"; - break; - case 10: - name = "Bururi"; - break; - case 11: - name = "Cankuzo"; - break; - case 12: - name = "Cibitoke"; - break; - case 13: - name = "Gitega"; - break; - case 14: - name = "Karuzi"; - break; - case 15: - name = "Kayanza"; - break; - case 16: - name = "Kirundo"; - break; - case 17: - name = "Makamba"; - break; - case 18: - name = "Muyinga"; - break; - case 19: - name = "Ngozi"; - break; - case 20: - name = "Rutana"; - break; - case 21: - name = "Ruyigi"; - break; - case 22: - name = "Muramvya"; - break; - case 23: - name = "Mwaro"; - break; - } - } - if (strcmp(country_code,"BJ") == 0) { - switch (region_code2) { - case 7: - name = "Alibori"; - break; - case 8: - name = "Atakora"; - break; - case 9: - name = "Atlanyique"; - break; - case 10: - name = "Borgou"; - break; - case 11: - name = "Collines"; - break; - case 12: - name = "Kouffo"; - break; - case 13: - name = "Donga"; - break; - case 14: - name = "Littoral"; - break; - case 15: - name = "Mono"; - break; - case 16: - name = "Oueme"; - break; - case 17: - name = "Plateau"; - break; - case 18: - name = "Zou"; - break; - } - } - if (strcmp(country_code,"BM") == 0) { - switch (region_code2) { - case 1: - name = "Devonshire"; - break; - case 2: - name = "Hamilton"; - break; - case 3: - name = "Hamilton"; - break; - case 4: - name = "Paget"; - break; - case 5: - name = "Pembroke"; - break; - case 6: - name = "Saint George"; - break; - case 7: - name = "Saint George's"; - break; - case 8: - name = "Sandys"; - break; - case 9: - name = "Smiths"; - break; - case 10: - name = "Southampton"; - break; - case 11: - name = "Warwick"; - break; - } - } - if (strcmp(country_code,"BN") == 0) { - switch (region_code2) { - case 7: - name = "Alibori"; - break; - case 8: - name = "Belait"; - break; - case 9: - name = "Brunei and Muara"; - break; - case 10: - name = "Temburong"; - break; - case 11: - name = "Collines"; - break; - case 12: - name = "Kouffo"; - break; - case 13: - name = "Donga"; - break; - case 14: - name = "Littoral"; - break; - case 15: - name = "Tutong"; - break; - case 16: - name = "Oueme"; - break; - case 17: - name = "Plateau"; - break; - case 18: - name = "Zou"; - break; - } - } - if (strcmp(country_code,"BO") == 0) { - switch (region_code2) { - case 1: - name = "Chuquisaca"; - break; - case 2: - name = "Cochabamba"; - break; - case 3: - name = "El Beni"; - break; - case 4: - name = "La Paz"; - break; - case 5: - name = "Oruro"; - break; - case 6: - name = "Pando"; - break; - case 7: - name = "Potosi"; - break; - case 8: - name = "Santa Cruz"; - break; - case 9: - name = "Tarija"; - break; - } - } - if (strcmp(country_code,"BR") == 0) { - switch (region_code2) { - case 1: - name = "Acre"; - break; - case 2: - name = "Alagoas"; - break; - case 3: - name = "Amapa"; - break; - case 4: - name = "Amazonas"; - break; - case 5: - name = "Bahia"; - break; - case 6: - name = "Ceara"; - break; - case 7: - name = "Distrito Federal"; - break; - case 8: - name = "Espirito Santo"; - break; - case 11: - name = "Mato Grosso do Sul"; - break; - case 13: - name = "Maranhao"; - break; - case 14: - name = "Mato Grosso"; - break; - case 15: - name = "Minas Gerais"; - break; - case 16: - name = "Para"; - break; - case 17: - name = "Paraiba"; - break; - case 18: - name = "Parana"; - break; - case 20: - name = "Piaui"; - break; - case 21: - name = "Rio de Janeiro"; - break; - case 22: - name = "Rio Grande do Norte"; - break; - case 23: - name = "Rio Grande do Sul"; - break; - case 24: - name = "Rondonia"; - break; - case 25: - name = "Roraima"; - break; - case 26: - name = "Santa Catarina"; - break; - case 27: - name = "Sao Paulo"; - break; - case 28: - name = "Sergipe"; - break; - case 29: - name = "Goias"; - break; - case 30: - name = "Pernambuco"; - break; - case 31: - name = "Tocantins"; - break; - } - } - if (strcmp(country_code,"BS") == 0) { - switch (region_code2) { - case 5: - name = "Bimini"; - break; - case 6: - name = "Cat Island"; - break; - case 10: - name = "Exuma"; - break; - case 13: - name = "Inagua"; - break; - case 15: - name = "Long Island"; - break; - case 16: - name = "Mayaguana"; - break; - case 18: - name = "Ragged Island"; - break; - case 22: - name = "Harbour Island"; - break; - case 23: - name = "New Providence"; - break; - case 24: - name = "Acklins and Crooked Islands"; - break; - case 25: - name = "Freeport"; - break; - case 26: - name = "Fresh Creek"; - break; - case 27: - name = "Governor's Harbour"; - break; - case 28: - name = "Green Turtle Cay"; - break; - case 29: - name = "High Rock"; - break; - case 30: - name = "Kemps Bay"; - break; - case 31: - name = "Marsh Harbour"; - break; - case 32: - name = "Nichollstown and Berry Islands"; - break; - case 33: - name = "Rock Sound"; - break; - case 34: - name = "Sandy Point"; - break; - case 35: - name = "San Salvador and Rum Cay"; - break; - } - } - if (strcmp(country_code,"BT") == 0) { - switch (region_code2) { - case 5: - name = "Bumthang"; - break; - case 6: - name = "Chhukha"; - break; - case 7: - name = "Chirang"; - break; - case 8: - name = "Daga"; - break; - case 9: - name = "Geylegphug"; - break; - case 10: - name = "Ha"; - break; - case 11: - name = "Lhuntshi"; - break; - case 12: - name = "Mongar"; - break; - case 13: - name = "Paro"; - break; - case 14: - name = "Pemagatsel"; - break; - case 15: - name = "Punakha"; - break; - case 16: - name = "Samchi"; - break; - case 17: - name = "Samdrup"; - break; - case 18: - name = "Shemgang"; - break; - case 19: - name = "Tashigang"; - break; - case 20: - name = "Thimphu"; - break; - case 21: - name = "Tongsa"; - break; - case 22: - name = "Wangdi Phodrang"; - break; - } - } - if (strcmp(country_code,"BW") == 0) { - switch (region_code2) { - case 1: - name = "Central"; - break; - case 3: - name = "Ghanzi"; - break; - case 4: - name = "Kgalagadi"; - break; - case 5: - name = "Kgatleng"; - break; - case 6: - name = "Kweneng"; - break; - case 8: - name = "North-East"; - break; - case 9: - name = "South-East"; - break; - case 10: - name = "Southern"; - break; - case 11: - name = "North-West"; - break; - } - } - if (strcmp(country_code,"BY") == 0) { - switch (region_code2) { - case 1: - name = "Brestskaya Voblasts'"; - break; - case 2: - name = "Homyel'skaya Voblasts'"; - break; - case 3: - name = "Hrodzyenskaya Voblasts'"; - break; - case 4: - name = "Minsk"; - break; - case 5: - name = "Minskaya Voblasts'"; - break; - case 6: - name = "Mahilyowskaya Voblasts'"; - break; - case 7: - name = "Vitsyebskaya Voblasts'"; - break; - } - } - if (strcmp(country_code,"BZ") == 0) { - switch (region_code2) { - case 1: - name = "Belize"; - break; - case 2: - name = "Cayo"; - break; - case 3: - name = "Corozal"; - break; - case 4: - name = "Orange Walk"; - break; - case 5: - name = "Stann Creek"; - break; - case 6: - name = "Toledo"; - break; - } - } - if (strcmp(country_code,"CD") == 0) { - switch (region_code2) { - case 1: - name = "Bandundu"; - break; - case 2: - name = "Equateur"; - break; - case 4: - name = "Kasai-Oriental"; - break; - case 5: - name = "Katanga"; - break; - case 6: - name = "Kinshasa"; - break; - case 8: - name = "Bas-Congo"; - break; - case 9: - name = "Orientale"; - break; - case 10: - name = "Maniema"; - break; - case 11: - name = "Nord-Kivu"; - break; - case 12: - name = "Sud-Kivu"; - break; - } - } - if (strcmp(country_code,"CF") == 0) { - switch (region_code2) { - case 1: - name = "Bamingui-Bangoran"; - break; - case 2: - name = "Basse-Kotto"; - break; - case 3: - name = "Haute-Kotto"; - break; - case 4: - name = "Mambere-Kadei"; - break; - case 5: - name = "Haut-Mbomou"; - break; - case 6: - name = "Kemo"; - break; - case 7: - name = "Lobaye"; - break; - case 8: - name = "Mbomou"; - break; - case 9: - name = "Nana-Mambere"; - break; - case 11: - name = "Ouaka"; - break; - case 12: - name = "Ouham"; - break; - case 13: - name = "Ouham-Pende"; - break; - case 14: - name = "Cuvette-Ouest"; - break; - case 15: - name = "Nana-Grebizi"; - break; - case 16: - name = "Sangha-Mbaere"; - break; - case 17: - name = "Ombella-Mpoko"; - break; - case 18: - name = "Bangui"; - break; - } - } - if (strcmp(country_code,"CG") == 0) { - switch (region_code2) { - case 1: - name = "Bouenza"; - break; - case 4: - name = "Kouilou"; - break; - case 5: - name = "Lekoumou"; - break; - case 6: - name = "Likouala"; - break; - case 7: - name = "Niari"; - break; - case 8: - name = "Plateaux"; - break; - case 10: - name = "Sangha"; - break; - case 11: - name = "Pool"; - break; - case 12: - name = "Brazzaville"; - break; - case 13: - name = "Cuvette"; - break; - case 14: - name = "Cuvette-Ouest"; - break; - } - } - if (strcmp(country_code,"CH") == 0) { - switch (region_code2) { - case 1: - name = "Aargau"; - break; - case 2: - name = "Ausser-Rhoden"; - break; - case 3: - name = "Basel-Landschaft"; - break; - case 4: - name = "Basel-Stadt"; - break; - case 5: - name = "Bern"; - break; - case 6: - name = "Fribourg"; - break; - case 7: - name = "Geneve"; - break; - case 8: - name = "Glarus"; - break; - case 9: - name = "Graubunden"; - break; - case 10: - name = "Inner-Rhoden"; - break; - case 11: - name = "Luzern"; - break; - case 12: - name = "Neuchatel"; - break; - case 13: - name = "Nidwalden"; - break; - case 14: - name = "Obwalden"; - break; - case 15: - name = "Sankt Gallen"; - break; - case 16: - name = "Schaffhausen"; - break; - case 17: - name = "Schwyz"; - break; - case 18: - name = "Solothurn"; - break; - case 19: - name = "Thurgau"; - break; - case 20: - name = "Ticino"; - break; - case 21: - name = "Uri"; - break; - case 22: - name = "Valais"; - break; - case 23: - name = "Vaud"; - break; - case 24: - name = "Zug"; - break; - case 25: - name = "Zurich"; - break; - case 26: - name = "Jura"; - break; - } - } - if (strcmp(country_code,"CI") == 0) { - switch (region_code2) { - case 74: - name = "Agneby"; - break; - case 75: - name = "Bafing"; - break; - case 76: - name = "Bas-Sassandra"; - break; - case 77: - name = "Denguele"; - break; - case 78: - name = "Dix-Huit Montagnes"; - break; - case 79: - name = "Fromager"; - break; - case 80: - name = "Haut-Sassandra"; - break; - case 81: - name = "Lacs"; - break; - case 82: - name = "Lagunes"; - break; - case 83: - name = "Marahoue"; - break; - case 84: - name = "Moyen-Cavally"; - break; - case 85: - name = "Moyen-Comoe"; - break; - case 86: - name = "N'zi-Comoe"; - break; - case 87: - name = "Savanes"; - break; - case 88: - name = "Sud-Bandama"; - break; - case 89: - name = "Sud-Comoe"; - break; - case 90: - name = "Vallee du Bandama"; - break; - case 91: - name = "Worodougou"; - break; - case 92: - name = "Zanzan"; - break; - } - } - if (strcmp(country_code,"CL") == 0) { - switch (region_code2) { - case 1: - name = "Valparaiso"; - break; - case 2: - name = "Aisen del General Carlos Ibanez del Campo"; - break; - case 3: - name = "Antofagasta"; - break; - case 4: - name = "Araucania"; - break; - case 5: - name = "Atacama"; - break; - case 6: - name = "Bio-Bio"; - break; - case 7: - name = "Coquimbo"; - break; - case 8: - name = "Libertador General Bernardo O'Higgins"; - break; - case 9: - name = "Los Lagos"; - break; - case 10: - name = "Magallanes y de la Antartica Chilena"; - break; - case 11: - name = "Maule"; - break; - case 12: - name = "Region Metropolitana"; - break; - case 13: - name = "Tarapaca"; - break; - case 14: - name = "Los Lagos"; - break; - case 15: - name = "Tarapaca"; - break; - case 16: - name = "Arica y Parinacota"; - break; - case 17: - name = "Los Rios"; - break; - } - } - if (strcmp(country_code,"CM") == 0) { - switch (region_code2) { - case 4: - name = "Est"; - break; - case 5: - name = "Littoral"; - break; - case 7: - name = "Nord-Ouest"; - break; - case 8: - name = "Ouest"; - break; - case 9: - name = "Sud-Ouest"; - break; - case 10: - name = "Adamaoua"; - break; - case 11: - name = "Centre"; - break; - case 12: - name = "Extreme-Nord"; - break; - case 13: - name = "Nord"; - break; - case 14: - name = "Sud"; - break; - } - } - if (strcmp(country_code,"CN") == 0) { - switch (region_code2) { - case 1: - name = "Anhui"; - break; - case 2: - name = "Zhejiang"; - break; - case 3: - name = "Jiangxi"; - break; - case 4: - name = "Jiangsu"; - break; - case 5: - name = "Jilin"; - break; - case 6: - name = "Qinghai"; - break; - case 7: - name = "Fujian"; - break; - case 8: - name = "Heilongjiang"; - break; - case 9: - name = "Henan"; - break; - case 10: - name = "Hebei"; - break; - case 11: - name = "Hunan"; - break; - case 12: - name = "Hubei"; - break; - case 13: - name = "Xinjiang"; - break; - case 14: - name = "Xizang"; - break; - case 15: - name = "Gansu"; - break; - case 16: - name = "Guangxi"; - break; - case 18: - name = "Guizhou"; - break; - case 19: - name = "Liaoning"; - break; - case 20: - name = "Nei Mongol"; - break; - case 21: - name = "Ningxia"; - break; - case 22: - name = "Beijing"; - break; - case 23: - name = "Shanghai"; - break; - case 24: - name = "Shanxi"; - break; - case 25: - name = "Shandong"; - break; - case 26: - name = "Shaanxi"; - break; - case 28: - name = "Tianjin"; - break; - case 29: - name = "Yunnan"; - break; - case 30: - name = "Guangdong"; - break; - case 31: - name = "Hainan"; - break; - case 32: - name = "Sichuan"; - break; - case 33: - name = "Chongqing"; - break; - } - } - if (strcmp(country_code,"CO") == 0) { - switch (region_code2) { - case 1: - name = "Amazonas"; - break; - case 2: - name = "Antioquia"; - break; - case 3: - name = "Arauca"; - break; - case 4: - name = "Atlantico"; - break; - case 5: - name = "Bolivar Department"; - break; - case 6: - name = "Boyaca Department"; - break; - case 7: - name = "Caldas Department"; - break; - case 8: - name = "Caqueta"; - break; - case 9: - name = "Cauca"; - break; - case 10: - name = "Cesar"; - break; - case 11: - name = "Choco"; - break; - case 12: - name = "Cordoba"; - break; - case 14: - name = "Guaviare"; - break; - case 15: - name = "Guainia"; - break; - case 16: - name = "Huila"; - break; - case 17: - name = "La Guajira"; - break; - case 18: - name = "Magdalena Department"; - break; - case 19: - name = "Meta"; - break; - case 20: - name = "Narino"; - break; - case 21: - name = "Norte de Santander"; - break; - case 22: - name = "Putumayo"; - break; - case 23: - name = "Quindio"; - break; - case 24: - name = "Risaralda"; - break; - case 25: - name = "San Andres y Providencia"; - break; - case 26: - name = "Santander"; - break; - case 27: - name = "Sucre"; - break; - case 28: - name = "Tolima"; - break; - case 29: - name = "Valle del Cauca"; - break; - case 30: - name = "Vaupes"; - break; - case 31: - name = "Vichada"; - break; - case 32: - name = "Casanare"; - break; - case 33: - name = "Cundinamarca"; - break; - case 34: - name = "Distrito Especial"; - break; - case 35: - name = "Bolivar"; - break; - case 36: - name = "Boyaca"; - break; - case 37: - name = "Caldas"; - break; - case 38: - name = "Magdalena"; - break; - } - } - if (strcmp(country_code,"CR") == 0) { - switch (region_code2) { - case 1: - name = "Alajuela"; - break; - case 2: - name = "Cartago"; - break; - case 3: - name = "Guanacaste"; - break; - case 4: - name = "Heredia"; - break; - case 6: - name = "Limon"; - break; - case 7: - name = "Puntarenas"; - break; - case 8: - name = "San Jose"; - break; - } - } - if (strcmp(country_code,"CU") == 0) { - switch (region_code2) { - case 1: - name = "Pinar del Rio"; - break; - case 2: - name = "Ciudad de la Habana"; - break; - case 3: - name = "Matanzas"; - break; - case 4: - name = "Isla de la Juventud"; - break; - case 5: - name = "Camaguey"; - break; - case 7: - name = "Ciego de Avila"; - break; - case 8: - name = "Cienfuegos"; - break; - case 9: - name = "Granma"; - break; - case 10: - name = "Guantanamo"; - break; - case 11: - name = "La Habana"; - break; - case 12: - name = "Holguin"; - break; - case 13: - name = "Las Tunas"; - break; - case 14: - name = "Sancti Spiritus"; - break; - case 15: - name = "Santiago de Cuba"; - break; - case 16: - name = "Villa Clara"; - break; - } - } - if (strcmp(country_code,"CV") == 0) { - switch (region_code2) { - case 1: - name = "Boa Vista"; - break; - case 2: - name = "Brava"; - break; - case 4: - name = "Maio"; - break; - case 5: - name = "Paul"; - break; - case 7: - name = "Ribeira Grande"; - break; - case 8: - name = "Sal"; - break; - case 10: - name = "Sao Nicolau"; - break; - case 11: - name = "Sao Vicente"; - break; - case 13: - name = "Mosteiros"; - break; - case 14: - name = "Praia"; - break; - case 15: - name = "Santa Catarina"; - break; - case 16: - name = "Santa Cruz"; - break; - case 17: - name = "Sao Domingos"; - break; - case 18: - name = "Sao Filipe"; - break; - case 19: - name = "Sao Miguel"; - break; - case 20: - name = "Tarrafal"; - break; - } - } - if (strcmp(country_code,"CY") == 0) { - switch (region_code2) { - case 1: - name = "Famagusta"; - break; - case 2: - name = "Kyrenia"; - break; - case 3: - name = "Larnaca"; - break; - case 4: - name = "Nicosia"; - break; - case 5: - name = "Limassol"; - break; - case 6: - name = "Paphos"; - break; - } - } - if (strcmp(country_code,"CZ") == 0) { - switch (region_code2) { - case 52: - name = "Hlavni mesto Praha"; - break; - case 78: - name = "Jihomoravsky kraj"; - break; - case 79: - name = "Jihocesky kraj"; - break; - case 80: - name = "Vysocina"; - break; - case 81: - name = "Karlovarsky kraj"; - break; - case 82: - name = "Kralovehradecky kraj"; - break; - case 83: - name = "Liberecky kraj"; - break; - case 84: - name = "Olomoucky kraj"; - break; - case 85: - name = "Moravskoslezsky kraj"; - break; - case 86: - name = "Pardubicky kraj"; - break; - case 87: - name = "Plzensky kraj"; - break; - case 88: - name = "Stredocesky kraj"; - break; - case 89: - name = "Ustecky kraj"; - break; - case 90: - name = "Zlinsky kraj"; - break; - } - } - if (strcmp(country_code,"DE") == 0) { - switch (region_code2) { - case 1: - name = "Baden-Wurttemberg"; - break; - case 2: - name = "Bayern"; - break; - case 3: - name = "Bremen"; - break; - case 4: - name = "Hamburg"; - break; - case 5: - name = "Hessen"; - break; - case 6: - name = "Niedersachsen"; - break; - case 7: - name = "Nordrhein-Westfalen"; - break; - case 8: - name = "Rheinland-Pfalz"; - break; - case 9: - name = "Saarland"; - break; - case 10: - name = "Schleswig-Holstein"; - break; - case 11: - name = "Brandenburg"; - break; - case 12: - name = "Mecklenburg-Vorpommern"; - break; - case 13: - name = "Sachsen"; - break; - case 14: - name = "Sachsen-Anhalt"; - break; - case 15: - name = "Thuringen"; - break; - case 16: - name = "Berlin"; - break; - } - } - if (strcmp(country_code,"DJ") == 0) { - switch (region_code2) { - case 1: - name = "Ali Sabieh"; - break; - case 4: - name = "Obock"; - break; - case 5: - name = "Tadjoura"; - break; - case 6: - name = "Dikhil"; - break; - case 7: - name = "Djibouti"; - break; - case 8: - name = "Arta"; - break; - } - } - if (strcmp(country_code,"DK") == 0) { - switch (region_code2) { - case 17: - name = "Hovedstaden"; - break; - case 18: - name = "Midtjylland"; - break; - case 19: - name = "Nordjylland"; - break; - case 20: - name = "Sjelland"; - break; - case 21: - name = "Syddanmark"; - break; - } - } - if (strcmp(country_code,"DM") == 0) { - switch (region_code2) { - case 2: - name = "Saint Andrew"; - break; - case 3: - name = "Saint David"; - break; - case 4: - name = "Saint George"; - break; - case 5: - name = "Saint John"; - break; - case 6: - name = "Saint Joseph"; - break; - case 7: - name = "Saint Luke"; - break; - case 8: - name = "Saint Mark"; - break; - case 9: - name = "Saint Patrick"; - break; - case 10: - name = "Saint Paul"; - break; - case 11: - name = "Saint Peter"; - break; - } - } - if (strcmp(country_code,"DO") == 0) { - switch (region_code2) { - case 1: - name = "Azua"; - break; - case 2: - name = "Baoruco"; - break; - case 3: - name = "Barahona"; - break; - case 4: - name = "Dajabon"; - break; - case 5: - name = "Distrito Nacional"; - break; - case 6: - name = "Duarte"; - break; - case 8: - name = "Espaillat"; - break; - case 9: - name = "Independencia"; - break; - case 10: - name = "La Altagracia"; - break; - case 11: - name = "Elias Pina"; - break; - case 12: - name = "La Romana"; - break; - case 14: - name = "Maria Trinidad Sanchez"; - break; - case 15: - name = "Monte Cristi"; - break; - case 16: - name = "Pedernales"; - break; - case 17: - name = "Peravia"; - break; - case 18: - name = "Puerto Plata"; - break; - case 19: - name = "Salcedo"; - break; - case 20: - name = "Samana"; - break; - case 21: - name = "Sanchez Ramirez"; - break; - case 23: - name = "San Juan"; - break; - case 24: - name = "San Pedro De Macoris"; - break; - case 25: - name = "Santiago"; - break; - case 26: - name = "Santiago Rodriguez"; - break; - case 27: - name = "Valverde"; - break; - case 28: - name = "El Seibo"; - break; - case 29: - name = "Hato Mayor"; - break; - case 30: - name = "La Vega"; - break; - case 31: - name = "Monsenor Nouel"; - break; - case 32: - name = "Monte Plata"; - break; - case 33: - name = "San Cristobal"; - break; - case 34: - name = "Distrito Nacional"; - break; - case 35: - name = "Peravia"; - break; - case 36: - name = "San Jose de Ocoa"; - break; - case 37: - name = "Santo Domingo"; - break; - } - } - if (strcmp(country_code,"DZ") == 0) { - switch (region_code2) { - case 1: - name = "Alger"; - break; - case 3: - name = "Batna"; - break; - case 4: - name = "Constantine"; - break; - case 6: - name = "Medea"; - break; - case 7: - name = "Mostaganem"; - break; - case 9: - name = "Oran"; - break; - case 10: - name = "Saida"; - break; - case 12: - name = "Setif"; - break; - case 13: - name = "Tiaret"; - break; - case 14: - name = "Tizi Ouzou"; - break; - case 15: - name = "Tlemcen"; - break; - case 18: - name = "Bejaia"; - break; - case 19: - name = "Biskra"; - break; - case 20: - name = "Blida"; - break; - case 21: - name = "Bouira"; - break; - case 22: - name = "Djelfa"; - break; - case 23: - name = "Guelma"; - break; - case 24: - name = "Jijel"; - break; - case 25: - name = "Laghouat"; - break; - case 26: - name = "Mascara"; - break; - case 27: - name = "M'sila"; - break; - case 29: - name = "Oum el Bouaghi"; - break; - case 30: - name = "Sidi Bel Abbes"; - break; - case 31: - name = "Skikda"; - break; - case 33: - name = "Tebessa"; - break; - case 34: - name = "Adrar"; - break; - case 35: - name = "Ain Defla"; - break; - case 36: - name = "Ain Temouchent"; - break; - case 37: - name = "Annaba"; - break; - case 38: - name = "Bechar"; - break; - case 39: - name = "Bordj Bou Arreridj"; - break; - case 40: - name = "Boumerdes"; - break; - case 41: - name = "Chlef"; - break; - case 42: - name = "El Bayadh"; - break; - case 43: - name = "El Oued"; - break; - case 44: - name = "El Tarf"; - break; - case 45: - name = "Ghardaia"; - break; - case 46: - name = "Illizi"; - break; - case 47: - name = "Khenchela"; - break; - case 48: - name = "Mila"; - break; - case 49: - name = "Naama"; - break; - case 50: - name = "Ouargla"; - break; - case 51: - name = "Relizane"; - break; - case 52: - name = "Souk Ahras"; - break; - case 53: - name = "Tamanghasset"; - break; - case 54: - name = "Tindouf"; - break; - case 55: - name = "Tipaza"; - break; - case 56: - name = "Tissemsilt"; - break; - } - } - if (strcmp(country_code,"EC") == 0) { - switch (region_code2) { - case 1: - name = "Galapagos"; - break; - case 2: - name = "Azuay"; - break; - case 3: - name = "Bolivar"; - break; - case 4: - name = "Canar"; - break; - case 5: - name = "Carchi"; - break; - case 6: - name = "Chimborazo"; - break; - case 7: - name = "Cotopaxi"; - break; - case 8: - name = "El Oro"; - break; - case 9: - name = "Esmeraldas"; - break; - case 10: - name = "Guayas"; - break; - case 11: - name = "Imbabura"; - break; - case 12: - name = "Loja"; - break; - case 13: - name = "Los Rios"; - break; - case 14: - name = "Manabi"; - break; - case 15: - name = "Morona-Santiago"; - break; - case 17: - name = "Pastaza"; - break; - case 18: - name = "Pichincha"; - break; - case 19: - name = "Tungurahua"; - break; - case 20: - name = "Zamora-Chinchipe"; - break; - case 22: - name = "Sucumbios"; - break; - case 23: - name = "Napo"; - break; - case 24: - name = "Orellana"; - break; - } - } - if (strcmp(country_code,"EE") == 0) { - switch (region_code2) { - case 1: - name = "Harjumaa"; - break; - case 2: - name = "Hiiumaa"; - break; - case 3: - name = "Ida-Virumaa"; - break; - case 4: - name = "Jarvamaa"; - break; - case 5: - name = "Jogevamaa"; - break; - case 6: - name = "Kohtla-Jarve"; - break; - case 7: - name = "Laanemaa"; - break; - case 8: - name = "Laane-Virumaa"; - break; - case 9: - name = "Narva"; - break; - case 10: - name = "Parnu"; - break; - case 11: - name = "Parnumaa"; - break; - case 12: - name = "Polvamaa"; - break; - case 13: - name = "Raplamaa"; - break; - case 14: - name = "Saaremaa"; - break; - case 15: - name = "Sillamae"; - break; - case 16: - name = "Tallinn"; - break; - case 17: - name = "Tartu"; - break; - case 18: - name = "Tartumaa"; - break; - case 19: - name = "Valgamaa"; - break; - case 20: - name = "Viljandimaa"; - break; - case 21: - name = "Vorumaa"; - break; - } - } - if (strcmp(country_code,"EG") == 0) { - switch (region_code2) { - case 1: - name = "Ad Daqahliyah"; - break; - case 2: - name = "Al Bahr al Ahmar"; - break; - case 3: - name = "Al Buhayrah"; - break; - case 4: - name = "Al Fayyum"; - break; - case 5: - name = "Al Gharbiyah"; - break; - case 6: - name = "Al Iskandariyah"; - break; - case 7: - name = "Al Isma'iliyah"; - break; - case 8: - name = "Al Jizah"; - break; - case 9: - name = "Al Minufiyah"; - break; - case 10: - name = "Al Minya"; - break; - case 11: - name = "Al Qahirah"; - break; - case 12: - name = "Al Qalyubiyah"; - break; - case 13: - name = "Al Wadi al Jadid"; - break; - case 14: - name = "Ash Sharqiyah"; - break; - case 15: - name = "As Suways"; - break; - case 16: - name = "Aswan"; - break; - case 17: - name = "Asyut"; - break; - case 18: - name = "Bani Suwayf"; - break; - case 19: - name = "Bur Sa'id"; - break; - case 20: - name = "Dumyat"; - break; - case 21: - name = "Kafr ash Shaykh"; - break; - case 22: - name = "Matruh"; - break; - case 23: - name = "Qina"; - break; - case 24: - name = "Suhaj"; - break; - case 26: - name = "Janub Sina'"; - break; - case 27: - name = "Shamal Sina'"; - break; - } - } - if (strcmp(country_code,"ER") == 0) { - switch (region_code2) { - case 1: - name = "Anseba"; - break; - case 2: - name = "Debub"; - break; - case 3: - name = "Debubawi K'eyih Bahri"; - break; - case 4: - name = "Gash Barka"; - break; - case 5: - name = "Ma'akel"; - break; - case 6: - name = "Semenawi K'eyih Bahri"; - break; - } - } - if (strcmp(country_code,"ES") == 0) { - switch (region_code2) { - case 7: - name = "Islas Baleares"; - break; - case 27: - name = "La Rioja"; - break; - case 29: - name = "Madrid"; - break; - case 31: - name = "Murcia"; - break; - case 32: - name = "Navarra"; - break; - case 34: - name = "Asturias"; - break; - case 39: - name = "Cantabria"; - break; - case 51: - name = "Andalucia"; - break; - case 52: - name = "Aragon"; - break; - case 53: - name = "Canarias"; - break; - case 54: - name = "Castilla-La Mancha"; - break; - case 55: - name = "Castilla y Leon"; - break; - case 56: - name = "Catalonia"; - break; - case 57: - name = "Extremadura"; - break; - case 58: - name = "Galicia"; - break; - case 59: - name = "Pais Vasco"; - break; - case 60: - name = "Comunidad Valenciana"; - break; - } - } - if (strcmp(country_code,"ET") == 0) { - switch (region_code2) { - case 44: - name = "Adis Abeba"; - break; - case 45: - name = "Afar"; - break; - case 46: - name = "Amara"; - break; - case 47: - name = "Binshangul Gumuz"; - break; - case 48: - name = "Dire Dawa"; - break; - case 49: - name = "Gambela Hizboch"; - break; - case 50: - name = "Hareri Hizb"; - break; - case 51: - name = "Oromiya"; - break; - case 52: - name = "Sumale"; - break; - case 53: - name = "Tigray"; - break; - case 54: - name = "YeDebub Biheroch Bihereseboch na Hizboch"; - break; - } - } - if (strcmp(country_code,"FI") == 0) { - switch (region_code2) { - case 1: - name = "Aland"; - break; - case 6: - name = "Lapland"; - break; - case 8: - name = "Oulu"; - break; - case 13: - name = "Southern Finland"; - break; - case 14: - name = "Eastern Finland"; - break; - case 15: - name = "Western Finland"; - break; - } - } - if (strcmp(country_code,"FJ") == 0) { - switch (region_code2) { - case 1: - name = "Central"; - break; - case 2: - name = "Eastern"; - break; - case 3: - name = "Northern"; - break; - case 4: - name = "Rotuma"; - break; - case 5: - name = "Western"; - break; - } - } - if (strcmp(country_code,"FM") == 0) { - switch (region_code2) { - case 1: - name = "Kosrae"; - break; - case 2: - name = "Pohnpei"; - break; - case 3: - name = "Chuuk"; - break; - case 4: - name = "Yap"; - break; - } - } - if (strcmp(country_code,"FR") == 0) { - switch (region_code2) { - case 97: - name = "Aquitaine"; - break; - case 98: - name = "Auvergne"; - break; - case 99: - name = "Basse-Normandie"; - break; - case 832: - name = "Bourgogne"; - break; - case 833: - name = "Bretagne"; - break; - case 834: - name = "Centre"; - break; - case 835: - name = "Champagne-Ardenne"; - break; - case 836: - name = "Corse"; - break; - case 837: - name = "Franche-Comte"; - break; - case 838: - name = "Haute-Normandie"; - break; - case 839: - name = "Ile-de-France"; - break; - case 840: - name = "Languedoc-Roussillon"; - break; - case 875: - name = "Limousin"; - break; - case 876: - name = "Lorraine"; - break; - case 877: - name = "Midi-Pyrenees"; - break; - case 878: - name = "Nord-Pas-de-Calais"; - break; - case 879: - name = "Pays de la Loire"; - break; - case 880: - name = "Picardie"; - break; - case 881: - name = "Poitou-Charentes"; - break; - case 882: - name = "Provence-Alpes-Cote d'Azur"; - break; - case 883: - name = "Rhone-Alpes"; - break; - case 918: - name = "Alsace"; - break; - } - } - if (strcmp(country_code,"GA") == 0) { - switch (region_code2) { - case 1: - name = "Estuaire"; - break; - case 2: - name = "Haut-Ogooue"; - break; - case 3: - name = "Moyen-Ogooue"; - break; - case 4: - name = "Ngounie"; - break; - case 5: - name = "Nyanga"; - break; - case 6: - name = "Ogooue-Ivindo"; - break; - case 7: - name = "Ogooue-Lolo"; - break; - case 8: - name = "Ogooue-Maritime"; - break; - case 9: - name = "Woleu-Ntem"; - break; - } - } - if (strcmp(country_code,"GB") == 0) { - switch (region_code2) { - case 832: - name = "Barking and Dagenham"; - break; - case 833: - name = "Barnet"; - break; - case 834: - name = "Barnsley"; - break; - case 835: - name = "Bath and North East Somerset"; - break; - case 836: - name = "Bedfordshire"; - break; - case 837: - name = "Bexley"; - break; - case 838: - name = "Birmingham"; - break; - case 839: - name = "Blackburn with Darwen"; - break; - case 840: - name = "Blackpool"; - break; - case 875: - name = "Bolton"; - break; - case 876: - name = "Bournemouth"; - break; - case 877: - name = "Bracknell Forest"; - break; - case 878: - name = "Bradford"; - break; - case 879: - name = "Brent"; - break; - case 880: - name = "Brighton and Hove"; - break; - case 881: - name = "Bristol, City of"; - break; - case 882: - name = "Bromley"; - break; - case 883: - name = "Buckinghamshire"; - break; - case 918: - name = "Bury"; - break; - case 919: - name = "Calderdale"; - break; - case 920: - name = "Cambridgeshire"; - break; - case 921: - name = "Camden"; - break; - case 922: - name = "Cheshire"; - break; - case 923: - name = "Cornwall"; - break; - case 924: - name = "Coventry"; - break; - case 925: - name = "Croydon"; - break; - case 926: - name = "Cumbria"; - break; - case 961: - name = "Darlington"; - break; - case 962: - name = "Derby"; - break; - case 963: - name = "Derbyshire"; - break; - case 964: - name = "Devon"; - break; - case 965: - name = "Doncaster"; - break; - case 966: - name = "Dorset"; - break; - case 967: - name = "Dudley"; - break; - case 968: - name = "Durham"; - break; - case 969: - name = "Ealing"; - break; - case 1004: - name = "East Riding of Yorkshire"; - break; - case 1005: - name = "East Sussex"; - break; - case 1006: - name = "Enfield"; - break; - case 1007: - name = "Essex"; - break; - case 1008: - name = "Gateshead"; - break; - case 1009: - name = "Gloucestershire"; - break; - case 1010: - name = "Greenwich"; - break; - case 1011: - name = "Hackney"; - break; - case 1012: - name = "Halton"; - break; - case 1047: - name = "Hammersmith and Fulham"; - break; - case 1048: - name = "Hampshire"; - break; - case 1049: - name = "Haringey"; - break; - case 1050: - name = "Harrow"; - break; - case 1051: - name = "Hartlepool"; - break; - case 1052: - name = "Havering"; - break; - case 1053: - name = "Herefordshire"; - break; - case 1054: - name = "Hertford"; - break; - case 1055: - name = "Hillingdon"; - break; - case 1090: - name = "Hounslow"; - break; - case 1091: - name = "Isle of Wight"; - break; - case 1092: - name = "Islington"; - break; - case 1093: - name = "Kensington and Chelsea"; - break; - case 1094: - name = "Kent"; - break; - case 1095: - name = "Kingston upon Hull, City of"; - break; - case 1096: - name = "Kingston upon Thames"; - break; - case 1097: - name = "Kirklees"; - break; - case 1098: - name = "Knowsley"; - break; - case 1133: - name = "Lambeth"; - break; - case 1134: - name = "Lancashire"; - break; - case 1135: - name = "Leeds"; - break; - case 1136: - name = "Leicester"; - break; - case 1137: - name = "Leicestershire"; - break; - case 1138: - name = "Lewisham"; - break; - case 1139: - name = "Lincolnshire"; - break; - case 1140: - name = "Liverpool"; - break; - case 1141: - name = "London, City of"; - break; - case 1176: - name = "Luton"; - break; - case 1177: - name = "Manchester"; - break; - case 1178: - name = "Medway"; - break; - case 1179: - name = "Merton"; - break; - case 1180: - name = "Middlesbrough"; - break; - case 1181: - name = "Milton Keynes"; - break; - case 1182: - name = "Newcastle upon Tyne"; - break; - case 1183: - name = "Newham"; - break; - case 1184: - name = "Norfolk"; - break; - case 1219: - name = "Northamptonshire"; - break; - case 1220: - name = "North East Lincolnshire"; - break; - case 1221: - name = "North Lincolnshire"; - break; - case 1222: - name = "North Somerset"; - break; - case 1223: - name = "North Tyneside"; - break; - case 1224: - name = "Northumberland"; - break; - case 1225: - name = "North Yorkshire"; - break; - case 1226: - name = "Nottingham"; - break; - case 1227: - name = "Nottinghamshire"; - break; - case 1262: - name = "Oldham"; - break; - case 1263: - name = "Oxfordshire"; - break; - case 1264: - name = "Peterborough"; - break; - case 1265: - name = "Plymouth"; - break; - case 1266: - name = "Poole"; - break; - case 1267: - name = "Portsmouth"; - break; - case 1268: - name = "Reading"; - break; - case 1269: - name = "Redbridge"; - break; - case 1270: - name = "Redcar and Cleveland"; - break; - case 1305: - name = "Richmond upon Thames"; - break; - case 1306: - name = "Rochdale"; - break; - case 1307: - name = "Rotherham"; - break; - case 1308: - name = "Rutland"; - break; - case 1309: - name = "Salford"; - break; - case 1310: - name = "Shropshire"; - break; - case 1311: - name = "Sandwell"; - break; - case 1312: - name = "Sefton"; - break; - case 1313: - name = "Sheffield"; - break; - case 1348: - name = "Slough"; - break; - case 1349: - name = "Solihull"; - break; - case 1350: - name = "Somerset"; - break; - case 1351: - name = "Southampton"; - break; - case 1352: - name = "Southend-on-Sea"; - break; - case 1353: - name = "South Gloucestershire"; - break; - case 1354: - name = "South Tyneside"; - break; - case 1355: - name = "Southwark"; - break; - case 1356: - name = "Staffordshire"; - break; - case 1391: - name = "St. Helens"; - break; - case 1392: - name = "Stockport"; - break; - case 1393: - name = "Stockton-on-Tees"; - break; - case 1394: - name = "Stoke-on-Trent"; - break; - case 1395: - name = "Suffolk"; - break; - case 1396: - name = "Sunderland"; - break; - case 1397: - name = "Surrey"; - break; - case 1398: - name = "Sutton"; - break; - case 1399: - name = "Swindon"; - break; - case 1434: - name = "Tameside"; - break; - case 1435: - name = "Telford and Wrekin"; - break; - case 1436: - name = "Thurrock"; - break; - case 1437: - name = "Torbay"; - break; - case 1438: - name = "Tower Hamlets"; - break; - case 1439: - name = "Trafford"; - break; - case 1440: - name = "Wakefield"; - break; - case 1441: - name = "Walsall"; - break; - case 1442: - name = "Waltham Forest"; - break; - case 1477: - name = "Wandsworth"; - break; - case 1478: - name = "Warrington"; - break; - case 1479: - name = "Warwickshire"; - break; - case 1480: - name = "West Berkshire"; - break; - case 1481: - name = "Westminster"; - break; - case 1482: - name = "West Sussex"; - break; - case 1483: - name = "Wigan"; - break; - case 1484: - name = "Wiltshire"; - break; - case 1485: - name = "Windsor and Maidenhead"; - break; - case 1520: - name = "Wirral"; - break; - case 1521: - name = "Wokingham"; - break; - case 1522: - name = "Wolverhampton"; - break; - case 1523: - name = "Worcestershire"; - break; - case 1524: - name = "York"; - break; - case 1525: - name = "Antrim"; - break; - case 1526: - name = "Ards"; - break; - case 1527: - name = "Armagh"; - break; - case 1528: - name = "Ballymena"; - break; - case 1563: - name = "Ballymoney"; - break; - case 1564: - name = "Banbridge"; - break; - case 1565: - name = "Belfast"; - break; - case 1566: - name = "Carrickfergus"; - break; - case 1567: - name = "Castlereagh"; - break; - case 1568: - name = "Coleraine"; - break; - case 1569: - name = "Cookstown"; - break; - case 1570: - name = "Craigavon"; - break; - case 1571: - name = "Down"; - break; - case 1606: - name = "Dungannon"; - break; - case 1607: - name = "Fermanagh"; - break; - case 1608: - name = "Larne"; - break; - case 1609: - name = "Limavady"; - break; - case 1610: - name = "Lisburn"; - break; - case 1611: - name = "Derry"; - break; - case 1612: - name = "Magherafelt"; - break; - case 1613: - name = "Moyle"; - break; - case 1614: - name = "Newry and Mourne"; - break; - case 1649: - name = "Newtownabbey"; - break; - case 1650: - name = "North Down"; - break; - case 1651: - name = "Omagh"; - break; - case 1652: - name = "Strabane"; - break; - case 1653: - name = "Aberdeen City"; - break; - case 1654: - name = "Aberdeenshire"; - break; - case 1655: - name = "Angus"; - break; - case 1656: - name = "Argyll and Bute"; - break; - case 1657: - name = "Scottish Borders, The"; - break; - case 1692: - name = "Clackmannanshire"; - break; - case 1693: - name = "Dumfries and Galloway"; - break; - case 1694: - name = "Dundee City"; - break; - case 1695: - name = "East Ayrshire"; - break; - case 1696: - name = "East Dunbartonshire"; - break; - case 1697: - name = "East Lothian"; - break; - case 1698: - name = "East Renfrewshire"; - break; - case 1699: - name = "Edinburgh, City of"; - break; - case 1700: - name = "Falkirk"; - break; - case 1735: - name = "Fife"; - break; - case 1736: - name = "Glasgow City"; - break; - case 1737: - name = "Highland"; - break; - case 1738: - name = "Inverclyde"; - break; - case 1739: - name = "Midlothian"; - break; - case 1740: - name = "Moray"; - break; - case 1741: - name = "North Ayrshire"; - break; - case 1742: - name = "North Lanarkshire"; - break; - case 1743: - name = "Orkney"; - break; - case 1778: - name = "Perth and Kinross"; - break; - case 1779: - name = "Renfrewshire"; - break; - case 1780: - name = "Shetland Islands"; - break; - case 1781: - name = "South Ayrshire"; - break; - case 1782: - name = "South Lanarkshire"; - break; - case 1783: - name = "Stirling"; - break; - case 1784: - name = "West Dunbartonshire"; - break; - case 1785: - name = "Eilean Siar"; - break; - case 1786: - name = "West Lothian"; - break; - case 1821: - name = "Isle of Anglesey"; - break; - case 1822: - name = "Blaenau Gwent"; - break; - case 1823: - name = "Bridgend"; - break; - case 1824: - name = "Caerphilly"; - break; - case 1825: - name = "Cardiff"; - break; - case 1826: - name = "Ceredigion"; - break; - case 1827: - name = "Carmarthenshire"; - break; - case 1828: - name = "Conwy"; - break; - case 1829: - name = "Denbighshire"; - break; - case 1864: - name = "Flintshire"; - break; - case 1865: - name = "Gwynedd"; - break; - case 1866: - name = "Merthyr Tydfil"; - break; - case 1867: - name = "Monmouthshire"; - break; - case 1868: - name = "Neath Port Talbot"; - break; - case 1869: - name = "Newport"; - break; - case 1870: - name = "Pembrokeshire"; - break; - case 1871: - name = "Powys"; - break; - case 1872: - name = "Rhondda Cynon Taff"; - break; - case 1907: - name = "Swansea"; - break; - case 1908: - name = "Torfaen"; - break; - case 1909: - name = "Vale of Glamorgan, The"; - break; - case 1910: - name = "Wrexham"; - break; - } - } - if (strcmp(country_code,"GD") == 0) { - switch (region_code2) { - case 1: - name = "Saint Andrew"; - break; - case 2: - name = "Saint David"; - break; - case 3: - name = "Saint George"; - break; - case 4: - name = "Saint John"; - break; - case 5: - name = "Saint Mark"; - break; - case 6: - name = "Saint Patrick"; - break; - } - } - if (strcmp(country_code,"GE") == 0) { - switch (region_code2) { - case 1: - name = "Abashis Raioni"; - break; - case 2: - name = "Abkhazia"; - break; - case 3: - name = "Adigenis Raioni"; - break; - case 4: - name = "Ajaria"; - break; - case 5: - name = "Akhalgoris Raioni"; - break; - case 6: - name = "Akhalk'alak'is Raioni"; - break; - case 7: - name = "Akhalts'ikhis Raioni"; - break; - case 8: - name = "Akhmetis Raioni"; - break; - case 9: - name = "Ambrolauris Raioni"; - break; - case 10: - name = "Aspindzis Raioni"; - break; - case 11: - name = "Baghdat'is Raioni"; - break; - case 12: - name = "Bolnisis Raioni"; - break; - case 13: - name = "Borjomis Raioni"; - break; - case 14: - name = "Chiat'ura"; - break; - case 15: - name = "Ch'khorotsqus Raioni"; - break; - case 16: - name = "Ch'okhatauris Raioni"; - break; - case 17: - name = "Dedop'listsqaros Raioni"; - break; - case 18: - name = "Dmanisis Raioni"; - break; - case 19: - name = "Dushet'is Raioni"; - break; - case 20: - name = "Gardabanis Raioni"; - break; - case 21: - name = "Gori"; - break; - case 22: - name = "Goris Raioni"; - break; - case 23: - name = "Gurjaanis Raioni"; - break; - case 24: - name = "Javis Raioni"; - break; - case 25: - name = "K'arelis Raioni"; - break; - case 26: - name = "Kaspis Raioni"; - break; - case 27: - name = "Kharagaulis Raioni"; - break; - case 28: - name = "Khashuris Raioni"; - break; - case 29: - name = "Khobis Raioni"; - break; - case 30: - name = "Khonis Raioni"; - break; - case 31: - name = "K'ut'aisi"; - break; - case 32: - name = "Lagodekhis Raioni"; - break; - case 33: - name = "Lanch'khut'is Raioni"; - break; - case 34: - name = "Lentekhis Raioni"; - break; - case 35: - name = "Marneulis Raioni"; - break; - case 36: - name = "Martvilis Raioni"; - break; - case 37: - name = "Mestiis Raioni"; - break; - case 38: - name = "Mts'khet'is Raioni"; - break; - case 39: - name = "Ninotsmindis Raioni"; - break; - case 40: - name = "Onis Raioni"; - break; - case 41: - name = "Ozurget'is Raioni"; - break; - case 42: - name = "P'ot'i"; - break; - case 43: - name = "Qazbegis Raioni"; - break; - case 44: - name = "Qvarlis Raioni"; - break; - case 45: - name = "Rust'avi"; - break; - case 46: - name = "Sach'kheris Raioni"; - break; - case 47: - name = "Sagarejos Raioni"; - break; - case 48: - name = "Samtrediis Raioni"; - break; - case 49: - name = "Senakis Raioni"; - break; - case 50: - name = "Sighnaghis Raioni"; - break; - case 51: - name = "T'bilisi"; - break; - case 52: - name = "T'elavis Raioni"; - break; - case 53: - name = "T'erjolis Raioni"; - break; - case 54: - name = "T'et'ritsqaros Raioni"; - break; - case 55: - name = "T'ianet'is Raioni"; - break; - case 56: - name = "Tqibuli"; - break; - case 57: - name = "Ts'ageris Raioni"; - break; - case 58: - name = "Tsalenjikhis Raioni"; - break; - case 59: - name = "Tsalkis Raioni"; - break; - case 60: - name = "Tsqaltubo"; - break; - case 61: - name = "Vanis Raioni"; - break; - case 62: - name = "Zestap'onis Raioni"; - break; - case 63: - name = "Zugdidi"; - break; - case 64: - name = "Zugdidis Raioni"; - break; - } - } - if (strcmp(country_code,"GH") == 0) { - switch (region_code2) { - case 1: - name = "Greater Accra"; - break; - case 2: - name = "Ashanti"; - break; - case 3: - name = "Brong-Ahafo"; - break; - case 4: - name = "Central"; - break; - case 5: - name = "Eastern"; - break; - case 6: - name = "Northern"; - break; - case 8: - name = "Volta"; - break; - case 9: - name = "Western"; - break; - case 10: - name = "Upper East"; - break; - case 11: - name = "Upper West"; - break; - } - } - if (strcmp(country_code,"GL") == 0) { - switch (region_code2) { - case 1: - name = "Nordgronland"; - break; - case 2: - name = "Ostgronland"; - break; - case 3: - name = "Vestgronland"; - break; - } - } - if (strcmp(country_code,"GM") == 0) { - switch (region_code2) { - case 1: - name = "Banjul"; - break; - case 2: - name = "Lower River"; - break; - case 3: - name = "Central River"; - break; - case 4: - name = "Upper River"; - break; - case 5: - name = "Western"; - break; - case 7: - name = "North Bank"; - break; - } - } - if (strcmp(country_code,"GN") == 0) { - switch (region_code2) { - case 1: - name = "Beyla"; - break; - case 2: - name = "Boffa"; - break; - case 3: - name = "Boke"; - break; - case 4: - name = "Conakry"; - break; - case 5: - name = "Dabola"; - break; - case 6: - name = "Dalaba"; - break; - case 7: - name = "Dinguiraye"; - break; - case 9: - name = "Faranah"; - break; - case 10: - name = "Forecariah"; - break; - case 11: - name = "Fria"; - break; - case 12: - name = "Gaoual"; - break; - case 13: - name = "Gueckedou"; - break; - case 15: - name = "Kerouane"; - break; - case 16: - name = "Kindia"; - break; - case 17: - name = "Kissidougou"; - break; - case 18: - name = "Koundara"; - break; - case 19: - name = "Kouroussa"; - break; - case 21: - name = "Macenta"; - break; - case 22: - name = "Mali"; - break; - case 23: - name = "Mamou"; - break; - case 25: - name = "Pita"; - break; - case 27: - name = "Telimele"; - break; - case 28: - name = "Tougue"; - break; - case 29: - name = "Yomou"; - break; - case 30: - name = "Coyah"; - break; - case 31: - name = "Dubreka"; - break; - case 32: - name = "Kankan"; - break; - case 33: - name = "Koubia"; - break; - case 34: - name = "Labe"; - break; - case 35: - name = "Lelouma"; - break; - case 36: - name = "Lola"; - break; - case 37: - name = "Mandiana"; - break; - case 38: - name = "Nzerekore"; - break; - case 39: - name = "Siguiri"; - break; - } - } - if (strcmp(country_code,"GQ") == 0) { - switch (region_code2) { - case 3: - name = "Annobon"; - break; - case 4: - name = "Bioko Norte"; - break; - case 5: - name = "Bioko Sur"; - break; - case 6: - name = "Centro Sur"; - break; - case 7: - name = "Kie-Ntem"; - break; - case 8: - name = "Litoral"; - break; - case 9: - name = "Wele-Nzas"; - break; - } - } - if (strcmp(country_code,"GR") == 0) { - switch (region_code2) { - case 1: - name = "Evros"; - break; - case 2: - name = "Rodhopi"; - break; - case 3: - name = "Xanthi"; - break; - case 4: - name = "Drama"; - break; - case 5: - name = "Serrai"; - break; - case 6: - name = "Kilkis"; - break; - case 7: - name = "Pella"; - break; - case 8: - name = "Florina"; - break; - case 9: - name = "Kastoria"; - break; - case 10: - name = "Grevena"; - break; - case 11: - name = "Kozani"; - break; - case 12: - name = "Imathia"; - break; - case 13: - name = "Thessaloniki"; - break; - case 14: - name = "Kavala"; - break; - case 15: - name = "Khalkidhiki"; - break; - case 16: - name = "Pieria"; - break; - case 17: - name = "Ioannina"; - break; - case 18: - name = "Thesprotia"; - break; - case 19: - name = "Preveza"; - break; - case 20: - name = "Arta"; - break; - case 21: - name = "Larisa"; - break; - case 22: - name = "Trikala"; - break; - case 23: - name = "Kardhitsa"; - break; - case 24: - name = "Magnisia"; - break; - case 25: - name = "Kerkira"; - break; - case 26: - name = "Levkas"; - break; - case 27: - name = "Kefallinia"; - break; - case 28: - name = "Zakinthos"; - break; - case 29: - name = "Fthiotis"; - break; - case 30: - name = "Evritania"; - break; - case 31: - name = "Aitolia kai Akarnania"; - break; - case 32: - name = "Fokis"; - break; - case 33: - name = "Voiotia"; - break; - case 34: - name = "Evvoia"; - break; - case 35: - name = "Attiki"; - break; - case 36: - name = "Argolis"; - break; - case 37: - name = "Korinthia"; - break; - case 38: - name = "Akhaia"; - break; - case 39: - name = "Ilia"; - break; - case 40: - name = "Messinia"; - break; - case 41: - name = "Arkadhia"; - break; - case 42: - name = "Lakonia"; - break; - case 43: - name = "Khania"; - break; - case 44: - name = "Rethimni"; - break; - case 45: - name = "Iraklion"; - break; - case 46: - name = "Lasithi"; - break; - case 47: - name = "Dhodhekanisos"; - break; - case 48: - name = "Samos"; - break; - case 49: - name = "Kikladhes"; - break; - case 50: - name = "Khios"; - break; - case 51: - name = "Lesvos"; - break; - } - } - if (strcmp(country_code,"GT") == 0) { - switch (region_code2) { - case 1: - name = "Alta Verapaz"; - break; - case 2: - name = "Baja Verapaz"; - break; - case 3: - name = "Chimaltenango"; - break; - case 4: - name = "Chiquimula"; - break; - case 5: - name = "El Progreso"; - break; - case 6: - name = "Escuintla"; - break; - case 7: - name = "Guatemala"; - break; - case 8: - name = "Huehuetenango"; - break; - case 9: - name = "Izabal"; - break; - case 10: - name = "Jalapa"; - break; - case 11: - name = "Jutiapa"; - break; - case 12: - name = "Peten"; - break; - case 13: - name = "Quetzaltenango"; - break; - case 14: - name = "Quiche"; - break; - case 15: - name = "Retalhuleu"; - break; - case 16: - name = "Sacatepequez"; - break; - case 17: - name = "San Marcos"; - break; - case 18: - name = "Santa Rosa"; - break; - case 19: - name = "Solola"; - break; - case 20: - name = "Suchitepequez"; - break; - case 21: - name = "Totonicapan"; - break; - case 22: - name = "Zacapa"; - break; - } - } - if (strcmp(country_code,"GW") == 0) { - switch (region_code2) { - case 1: - name = "Bafata"; - break; - case 2: - name = "Quinara"; - break; - case 4: - name = "Oio"; - break; - case 5: - name = "Bolama"; - break; - case 6: - name = "Cacheu"; - break; - case 7: - name = "Tombali"; - break; - case 10: - name = "Gabu"; - break; - case 11: - name = "Bissau"; - break; - case 12: - name = "Biombo"; - break; - } - } - if (strcmp(country_code,"GY") == 0) { - switch (region_code2) { - case 10: - name = "Barima-Waini"; - break; - case 11: - name = "Cuyuni-Mazaruni"; - break; - case 12: - name = "Demerara-Mahaica"; - break; - case 13: - name = "East Berbice-Corentyne"; - break; - case 14: - name = "Essequibo Islands-West Demerara"; - break; - case 15: - name = "Mahaica-Berbice"; - break; - case 16: - name = "Pomeroon-Supenaam"; - break; - case 17: - name = "Potaro-Siparuni"; - break; - case 18: - name = "Upper Demerara-Berbice"; - break; - case 19: - name = "Upper Takutu-Upper Essequibo"; - break; - } - } - if (strcmp(country_code,"HN") == 0) { - switch (region_code2) { - case 1: - name = "Atlantida"; - break; - case 2: - name = "Choluteca"; - break; - case 3: - name = "Colon"; - break; - case 4: - name = "Comayagua"; - break; - case 5: - name = "Copan"; - break; - case 6: - name = "Cortes"; - break; - case 7: - name = "El Paraiso"; - break; - case 8: - name = "Francisco Morazan"; - break; - case 9: - name = "Gracias a Dios"; - break; - case 10: - name = "Intibuca"; - break; - case 11: - name = "Islas de la Bahia"; - break; - case 12: - name = "La Paz"; - break; - case 13: - name = "Lempira"; - break; - case 14: - name = "Ocotepeque"; - break; - case 15: - name = "Olancho"; - break; - case 16: - name = "Santa Barbara"; - break; - case 17: - name = "Valle"; - break; - case 18: - name = "Yoro"; - break; - } - } - if (strcmp(country_code,"HR") == 0) { - switch (region_code2) { - case 1: - name = "Bjelovarsko-Bilogorska"; - break; - case 2: - name = "Brodsko-Posavska"; - break; - case 3: - name = "Dubrovacko-Neretvanska"; - break; - case 4: - name = "Istarska"; - break; - case 5: - name = "Karlovacka"; - break; - case 6: - name = "Koprivnicko-Krizevacka"; - break; - case 7: - name = "Krapinsko-Zagorska"; - break; - case 8: - name = "Licko-Senjska"; - break; - case 9: - name = "Medimurska"; - break; - case 10: - name = "Osjecko-Baranjska"; - break; - case 11: - name = "Pozesko-Slavonska"; - break; - case 12: - name = "Primorsko-Goranska"; - break; - case 13: - name = "Sibensko-Kninska"; - break; - case 14: - name = "Sisacko-Moslavacka"; - break; - case 15: - name = "Splitsko-Dalmatinska"; - break; - case 16: - name = "Varazdinska"; - break; - case 17: - name = "Viroviticko-Podravska"; - break; - case 18: - name = "Vukovarsko-Srijemska"; - break; - case 19: - name = "Zadarska"; - break; - case 20: - name = "Zagrebacka"; - break; - case 21: - name = "Grad Zagreb"; - break; - } - } - if (strcmp(country_code,"HT") == 0) { - switch (region_code2) { - case 3: - name = "Nord-Ouest"; - break; - case 6: - name = "Artibonite"; - break; - case 7: - name = "Centre"; - break; - case 9: - name = "Nord"; - break; - case 10: - name = "Nord-Est"; - break; - case 11: - name = "Ouest"; - break; - case 12: - name = "Sud"; - break; - case 13: - name = "Sud-Est"; - break; - case 14: - name = "Grand' Anse"; - break; - case 15: - name = "Nippes"; - break; - } - } - if (strcmp(country_code,"HU") == 0) { - switch (region_code2) { - case 1: - name = "Bacs-Kiskun"; - break; - case 2: - name = "Baranya"; - break; - case 3: - name = "Bekes"; - break; - case 4: - name = "Borsod-Abauj-Zemplen"; - break; - case 5: - name = "Budapest"; - break; - case 6: - name = "Csongrad"; - break; - case 7: - name = "Debrecen"; - break; - case 8: - name = "Fejer"; - break; - case 9: - name = "Gyor-Moson-Sopron"; - break; - case 10: - name = "Hajdu-Bihar"; - break; - case 11: - name = "Heves"; - break; - case 12: - name = "Komarom-Esztergom"; - break; - case 13: - name = "Miskolc"; - break; - case 14: - name = "Nograd"; - break; - case 15: - name = "Pecs"; - break; - case 16: - name = "Pest"; - break; - case 17: - name = "Somogy"; - break; - case 18: - name = "Szabolcs-Szatmar-Bereg"; - break; - case 19: - name = "Szeged"; - break; - case 20: - name = "Jasz-Nagykun-Szolnok"; - break; - case 21: - name = "Tolna"; - break; - case 22: - name = "Vas"; - break; - case 23: - name = "Veszprem"; - break; - case 24: - name = "Zala"; - break; - case 25: - name = "Gyor"; - break; - case 26: - name = "Bekescsaba"; - break; - case 27: - name = "Dunaujvaros"; - break; - case 28: - name = "Eger"; - break; - case 29: - name = "Hodmezovasarhely"; - break; - case 30: - name = "Kaposvar"; - break; - case 31: - name = "Kecskemet"; - break; - case 32: - name = "Nagykanizsa"; - break; - case 33: - name = "Nyiregyhaza"; - break; - case 34: - name = "Sopron"; - break; - case 35: - name = "Szekesfehervar"; - break; - case 36: - name = "Szolnok"; - break; - case 37: - name = "Szombathely"; - break; - case 38: - name = "Tatabanya"; - break; - case 39: - name = "Veszprem"; - break; - case 40: - name = "Zalaegerszeg"; - break; - case 41: - name = "Salgotarjan"; - break; - case 42: - name = "Szekszard"; - break; - case 43: - name = "Erd"; - break; - } - } - if (strcmp(country_code,"ID") == 0) { - switch (region_code2) { - case 1: - name = "Aceh"; - break; - case 2: - name = "Bali"; - break; - case 3: - name = "Bengkulu"; - break; - case 4: - name = "Jakarta Raya"; - break; - case 5: - name = "Jambi"; - break; - case 6: - name = "Jawa Barat"; - break; - case 7: - name = "Jawa Tengah"; - break; - case 8: - name = "Jawa Timur"; - break; - case 9: - name = "Papua"; - break; - case 10: - name = "Yogyakarta"; - break; - case 11: - name = "Kalimantan Barat"; - break; - case 12: - name = "Kalimantan Selatan"; - break; - case 13: - name = "Kalimantan Tengah"; - break; - case 14: - name = "Kalimantan Timur"; - break; - case 15: - name = "Lampung"; - break; - case 16: - name = "Maluku"; - break; - case 17: - name = "Nusa Tenggara Barat"; - break; - case 18: - name = "Nusa Tenggara Timur"; - break; - case 19: - name = "Riau"; - break; - case 20: - name = "Sulawesi Selatan"; - break; - case 21: - name = "Sulawesi Tengah"; - break; - case 22: - name = "Sulawesi Tenggara"; - break; - case 23: - name = "Sulawesi Utara"; - break; - case 24: - name = "Sumatera Barat"; - break; - case 25: - name = "Sumatera Selatan"; - break; - case 26: - name = "Sumatera Utara"; - break; - case 28: - name = "Maluku"; - break; - case 29: - name = "Maluku Utara"; - break; - case 30: - name = "Jawa Barat"; - break; - case 31: - name = "Sulawesi Utara"; - break; - case 32: - name = "Sumatera Selatan"; - break; - case 33: - name = "Banten"; - break; - case 34: - name = "Gorontalo"; - break; - case 35: - name = "Kepulauan Bangka Belitung"; - break; - case 36: - name = "Papua"; - break; - case 37: - name = "Riau"; - break; - case 38: - name = "Sulawesi Selatan"; - break; - case 39: - name = "Irian Jaya Barat"; - break; - case 40: - name = "Kepulauan Riau"; - break; - case 41: - name = "Sulawesi Barat"; - break; - } - } - if (strcmp(country_code,"IE") == 0) { - switch (region_code2) { - case 1: - name = "Carlow"; - break; - case 2: - name = "Cavan"; - break; - case 3: - name = "Clare"; - break; - case 4: - name = "Cork"; - break; - case 6: - name = "Donegal"; - break; - case 7: - name = "Dublin"; - break; - case 10: - name = "Galway"; - break; - case 11: - name = "Kerry"; - break; - case 12: - name = "Kildare"; - break; - case 13: - name = "Kilkenny"; - break; - case 14: - name = "Leitrim"; - break; - case 15: - name = "Laois"; - break; - case 16: - name = "Limerick"; - break; - case 18: - name = "Longford"; - break; - case 19: - name = "Louth"; - break; - case 20: - name = "Mayo"; - break; - case 21: - name = "Meath"; - break; - case 22: - name = "Monaghan"; - break; - case 23: - name = "Offaly"; - break; - case 24: - name = "Roscommon"; - break; - case 25: - name = "Sligo"; - break; - case 26: - name = "Tipperary"; - break; - case 27: - name = "Waterford"; - break; - case 29: - name = "Westmeath"; - break; - case 30: - name = "Wexford"; - break; - case 31: - name = "Wicklow"; - break; - } - } - if (strcmp(country_code,"IL") == 0) { - switch (region_code2) { - case 1: - name = "HaDarom"; - break; - case 2: - name = "HaMerkaz"; - break; - case 3: - name = "HaZafon"; - break; - case 4: - name = "Hefa"; - break; - case 5: - name = "Tel Aviv"; - break; - case 6: - name = "Yerushalayim"; - break; - } - } - if (strcmp(country_code,"IN") == 0) { - switch (region_code2) { - case 1: - name = "Andaman and Nicobar Islands"; - break; - case 2: - name = "Andhra Pradesh"; - break; - case 3: - name = "Assam"; - break; - case 5: - name = "Chandigarh"; - break; - case 6: - name = "Dadra and Nagar Haveli"; - break; - case 7: - name = "Delhi"; - break; - case 9: - name = "Gujarat"; - break; - case 10: - name = "Haryana"; - break; - case 11: - name = "Himachal Pradesh"; - break; - case 12: - name = "Jammu and Kashmir"; - break; - case 13: - name = "Kerala"; - break; - case 14: - name = "Lakshadweep"; - break; - case 16: - name = "Maharashtra"; - break; - case 17: - name = "Manipur"; - break; - case 18: - name = "Meghalaya"; - break; - case 19: - name = "Karnataka"; - break; - case 20: - name = "Nagaland"; - break; - case 21: - name = "Orissa"; - break; - case 22: - name = "Puducherry"; - break; - case 23: - name = "Punjab"; - break; - case 24: - name = "Rajasthan"; - break; - case 25: - name = "Tamil Nadu"; - break; - case 26: - name = "Tripura"; - break; - case 28: - name = "West Bengal"; - break; - case 29: - name = "Sikkim"; - break; - case 30: - name = "Arunachal Pradesh"; - break; - case 31: - name = "Mizoram"; - break; - case 32: - name = "Daman and Diu"; - break; - case 33: - name = "Goa"; - break; - case 34: - name = "Bihar"; - break; - case 35: - name = "Madhya Pradesh"; - break; - case 36: - name = "Uttar Pradesh"; - break; - case 37: - name = "Chhattisgarh"; - break; - case 38: - name = "Jharkhand"; - break; - case 39: - name = "Uttarakhand"; - break; - } - } - if (strcmp(country_code,"IQ") == 0) { - switch (region_code2) { - case 1: - name = "Al Anbar"; - break; - case 2: - name = "Al Basrah"; - break; - case 3: - name = "Al Muthanna"; - break; - case 4: - name = "Al Qadisiyah"; - break; - case 5: - name = "As Sulaymaniyah"; - break; - case 6: - name = "Babil"; - break; - case 7: - name = "Baghdad"; - break; - case 8: - name = "Dahuk"; - break; - case 9: - name = "Dhi Qar"; - break; - case 10: - name = "Diyala"; - break; - case 11: - name = "Arbil"; - break; - case 12: - name = "Karbala'"; - break; - case 13: - name = "At Ta'mim"; - break; - case 14: - name = "Maysan"; - break; - case 15: - name = "Ninawa"; - break; - case 16: - name = "Wasit"; - break; - case 17: - name = "An Najaf"; - break; - case 18: - name = "Salah ad Din"; - break; - } - } - if (strcmp(country_code,"IR") == 0) { - switch (region_code2) { - case 1: - name = "Azarbayjan-e Bakhtari"; - break; - case 3: - name = "Chahar Mahall va Bakhtiari"; - break; - case 4: - name = "Sistan va Baluchestan"; - break; - case 5: - name = "Kohkiluyeh va Buyer Ahmadi"; - break; - case 7: - name = "Fars"; - break; - case 8: - name = "Gilan"; - break; - case 9: - name = "Hamadan"; - break; - case 10: - name = "Ilam"; - break; - case 11: - name = "Hormozgan"; - break; - case 12: - name = "Kerman"; - break; - case 13: - name = "Bakhtaran"; - break; - case 15: - name = "Khuzestan"; - break; - case 16: - name = "Kordestan"; - break; - case 17: - name = "Mazandaran"; - break; - case 18: - name = "Semnan Province"; - break; - case 19: - name = "Markazi"; - break; - case 21: - name = "Zanjan"; - break; - case 22: - name = "Bushehr"; - break; - case 23: - name = "Lorestan"; - break; - case 24: - name = "Markazi"; - break; - case 25: - name = "Semnan"; - break; - case 26: - name = "Tehran"; - break; - case 27: - name = "Zanjan"; - break; - case 28: - name = "Esfahan"; - break; - case 29: - name = "Kerman"; - break; - case 30: - name = "Khorasan"; - break; - case 31: - name = "Yazd"; - break; - case 32: - name = "Ardabil"; - break; - case 33: - name = "East Azarbaijan"; - break; - case 34: - name = "Markazi"; - break; - case 35: - name = "Mazandaran"; - break; - case 36: - name = "Zanjan"; - break; - case 37: - name = "Golestan"; - break; - case 38: - name = "Qazvin"; - break; - case 39: - name = "Qom"; - break; - case 40: - name = "Yazd"; - break; - case 41: - name = "Khorasan-e Janubi"; - break; - case 42: - name = "Khorasan-e Razavi"; - break; - case 43: - name = "Khorasan-e Shemali"; - break; - } - } - if (strcmp(country_code,"IS") == 0) { - switch (region_code2) { - case 3: - name = "Arnessysla"; - break; - case 5: - name = "Austur-Hunavatnssysla"; - break; - case 6: - name = "Austur-Skaftafellssysla"; - break; - case 7: - name = "Borgarfjardarsysla"; - break; - case 9: - name = "Eyjafjardarsysla"; - break; - case 10: - name = "Gullbringusysla"; - break; - case 15: - name = "Kjosarsysla"; - break; - case 17: - name = "Myrasysla"; - break; - case 20: - name = "Nordur-Mulasysla"; - break; - case 21: - name = "Nordur-Tingeyjarsysla"; - break; - case 23: - name = "Rangarvallasysla"; - break; - case 28: - name = "Skagafjardarsysla"; - break; - case 29: - name = "Snafellsnes- og Hnappadalssysla"; - break; - case 30: - name = "Strandasysla"; - break; - case 31: - name = "Sudur-Mulasysla"; - break; - case 32: - name = "Sudur-Tingeyjarsysla"; - break; - case 34: - name = "Vestur-Bardastrandarsysla"; - break; - case 35: - name = "Vestur-Hunavatnssysla"; - break; - case 36: - name = "Vestur-Isafjardarsysla"; - break; - case 37: - name = "Vestur-Skaftafellssysla"; - break; - case 40: - name = "Norourland Eystra"; - break; - case 41: - name = "Norourland Vestra"; - break; - case 42: - name = "Suourland"; - break; - case 43: - name = "Suournes"; - break; - case 44: - name = "Vestfiroir"; - break; - case 45: - name = "Vesturland"; - break; - } - } - if (strcmp(country_code,"IT") == 0) { - switch (region_code2) { - case 1: - name = "Abruzzi"; - break; - case 2: - name = "Basilicata"; - break; - case 3: - name = "Calabria"; - break; - case 4: - name = "Campania"; - break; - case 5: - name = "Emilia-Romagna"; - break; - case 6: - name = "Friuli-Venezia Giulia"; - break; - case 7: - name = "Lazio"; - break; - case 8: - name = "Liguria"; - break; - case 9: - name = "Lombardia"; - break; - case 10: - name = "Marche"; - break; - case 11: - name = "Molise"; - break; - case 12: - name = "Piemonte"; - break; - case 13: - name = "Puglia"; - break; - case 14: - name = "Sardegna"; - break; - case 15: - name = "Sicilia"; - break; - case 16: - name = "Toscana"; - break; - case 17: - name = "Trentino-Alto Adige"; - break; - case 18: - name = "Umbria"; - break; - case 19: - name = "Valle d'Aosta"; - break; - case 20: - name = "Veneto"; - break; - } - } - if (strcmp(country_code,"JM") == 0) { - switch (region_code2) { - case 1: - name = "Clarendon"; - break; - case 2: - name = "Hanover"; - break; - case 4: - name = "Manchester"; - break; - case 7: - name = "Portland"; - break; - case 8: - name = "Saint Andrew"; - break; - case 9: - name = "Saint Ann"; - break; - case 10: - name = "Saint Catherine"; - break; - case 11: - name = "Saint Elizabeth"; - break; - case 12: - name = "Saint James"; - break; - case 13: - name = "Saint Mary"; - break; - case 14: - name = "Saint Thomas"; - break; - case 15: - name = "Trelawny"; - break; - case 16: - name = "Westmoreland"; - break; - case 17: - name = "Kingston"; - break; - } - } - if (strcmp(country_code,"JO") == 0) { - switch (region_code2) { - case 2: - name = "Al Balqa'"; - break; - case 7: - name = "Ma"; - break; - case 9: - name = "Al Karak"; - break; - case 10: - name = "Al Mafraq"; - break; - case 11: - name = "Amman Governorate"; - break; - case 12: - name = "At Tafilah"; - break; - case 13: - name = "Az Zarqa"; - break; - case 14: - name = "Irbid"; - break; - case 16: - name = "Amman"; - break; - } - } - if (strcmp(country_code,"JP") == 0) { - switch (region_code2) { - case 1: - name = "Aichi"; - break; - case 2: - name = "Akita"; - break; - case 3: - name = "Aomori"; - break; - case 4: - name = "Chiba"; - break; - case 5: - name = "Ehime"; - break; - case 6: - name = "Fukui"; - break; - case 7: - name = "Fukuoka"; - break; - case 8: - name = "Fukushima"; - break; - case 9: - name = "Gifu"; - break; - case 10: - name = "Gumma"; - break; - case 11: - name = "Hiroshima"; - break; - case 12: - name = "Hokkaido"; - break; - case 13: - name = "Hyogo"; - break; - case 14: - name = "Ibaraki"; - break; - case 15: - name = "Ishikawa"; - break; - case 16: - name = "Iwate"; - break; - case 17: - name = "Kagawa"; - break; - case 18: - name = "Kagoshima"; - break; - case 19: - name = "Kanagawa"; - break; - case 20: - name = "Kochi"; - break; - case 21: - name = "Kumamoto"; - break; - case 22: - name = "Kyoto"; - break; - case 23: - name = "Mie"; - break; - case 24: - name = "Miyagi"; - break; - case 25: - name = "Miyazaki"; - break; - case 26: - name = "Nagano"; - break; - case 27: - name = "Nagasaki"; - break; - case 28: - name = "Nara"; - break; - case 29: - name = "Niigata"; - break; - case 30: - name = "Oita"; - break; - case 31: - name = "Okayama"; - break; - case 32: - name = "Osaka"; - break; - case 33: - name = "Saga"; - break; - case 34: - name = "Saitama"; - break; - case 35: - name = "Shiga"; - break; - case 36: - name = "Shimane"; - break; - case 37: - name = "Shizuoka"; - break; - case 38: - name = "Tochigi"; - break; - case 39: - name = "Tokushima"; - break; - case 40: - name = "Tokyo"; - break; - case 41: - name = "Tottori"; - break; - case 42: - name = "Toyama"; - break; - case 43: - name = "Wakayama"; - break; - case 44: - name = "Yamagata"; - break; - case 45: - name = "Yamaguchi"; - break; - case 46: - name = "Yamanashi"; - break; - case 47: - name = "Okinawa"; - break; - } - } - if (strcmp(country_code,"KE") == 0) { - switch (region_code2) { - case 1: - name = "Central"; - break; - case 2: - name = "Coast"; - break; - case 3: - name = "Eastern"; - break; - case 5: - name = "Nairobi Area"; - break; - case 6: - name = "North-Eastern"; - break; - case 7: - name = "Nyanza"; - break; - case 8: - name = "Rift Valley"; - break; - case 9: - name = "Western"; - break; - } - } - if (strcmp(country_code,"KG") == 0) { - switch (region_code2) { - case 1: - name = "Bishkek"; - break; - case 2: - name = "Chuy"; - break; - case 3: - name = "Jalal-Abad"; - break; - case 4: - name = "Naryn"; - break; - case 5: - name = "Osh"; - break; - case 6: - name = "Talas"; - break; - case 7: - name = "Ysyk-Kol"; - break; - case 8: - name = "Osh"; - break; - case 9: - name = "Batken"; - break; - } - } - if (strcmp(country_code,"KH") == 0) { - switch (region_code2) { - case 1: - name = "Batdambang"; - break; - case 2: - name = "Kampong Cham"; - break; - case 3: - name = "Kampong Chhnang"; - break; - case 4: - name = "Kampong Speu"; - break; - case 5: - name = "Kampong Thum"; - break; - case 6: - name = "Kampot"; - break; - case 7: - name = "Kandal"; - break; - case 8: - name = "Koh Kong"; - break; - case 9: - name = "Kracheh"; - break; - case 10: - name = "Mondulkiri"; - break; - case 11: - name = "Phnum Penh"; - break; - case 12: - name = "Pursat"; - break; - case 13: - name = "Preah Vihear"; - break; - case 14: - name = "Prey Veng"; - break; - case 15: - name = "Ratanakiri Kiri"; - break; - case 16: - name = "Siem Reap"; - break; - case 17: - name = "Stung Treng"; - break; - case 18: - name = "Svay Rieng"; - break; - case 19: - name = "Takeo"; - break; - case 25: - name = "Banteay Meanchey"; - break; - case 29: - name = "Batdambang"; - break; - case 30: - name = "Pailin"; - break; - } - } - if (strcmp(country_code,"KI") == 0) { - switch (region_code2) { - case 1: - name = "Gilbert Islands"; - break; - case 2: - name = "Line Islands"; - break; - case 3: - name = "Phoenix Islands"; - break; - } - } - if (strcmp(country_code,"KM") == 0) { - switch (region_code2) { - case 1: - name = "Anjouan"; - break; - case 2: - name = "Grande Comore"; - break; - case 3: - name = "Moheli"; - break; - } - } - if (strcmp(country_code,"KN") == 0) { - switch (region_code2) { - case 1: - name = "Christ Church Nichola Town"; - break; - case 2: - name = "Saint Anne Sandy Point"; - break; - case 3: - name = "Saint George Basseterre"; - break; - case 4: - name = "Saint George Gingerland"; - break; - case 5: - name = "Saint James Windward"; - break; - case 6: - name = "Saint John Capisterre"; - break; - case 7: - name = "Saint John Figtree"; - break; - case 8: - name = "Saint Mary Cayon"; - break; - case 9: - name = "Saint Paul Capisterre"; - break; - case 10: - name = "Saint Paul Charlestown"; - break; - case 11: - name = "Saint Peter Basseterre"; - break; - case 12: - name = "Saint Thomas Lowland"; - break; - case 13: - name = "Saint Thomas Middle Island"; - break; - case 15: - name = "Trinity Palmetto Point"; - break; - } - } - if (strcmp(country_code,"KP") == 0) { - switch (region_code2) { - case 1: - name = "Chagang-do"; - break; - case 3: - name = "Hamgyong-namdo"; - break; - case 6: - name = "Hwanghae-namdo"; - break; - case 7: - name = "Hwanghae-bukto"; - break; - case 8: - name = "Kaesong-si"; - break; - case 9: - name = "Kangwon-do"; - break; - case 11: - name = "P'yongan-bukto"; - break; - case 12: - name = "P'yongyang-si"; - break; - case 13: - name = "Yanggang-do"; - break; - case 14: - name = "Namp'o-si"; - break; - case 15: - name = "P'yongan-namdo"; - break; - case 17: - name = "Hamgyong-bukto"; - break; - case 18: - name = "Najin Sonbong-si"; - break; - } - } - if (strcmp(country_code,"KR") == 0) { - switch (region_code2) { - case 1: - name = "Cheju-do"; - break; - case 3: - name = "Cholla-bukto"; - break; - case 5: - name = "Ch'ungch'ong-bukto"; - break; - case 6: - name = "Kangwon-do"; - break; - case 10: - name = "Pusan-jikhalsi"; - break; - case 11: - name = "Seoul-t'ukpyolsi"; - break; - case 12: - name = "Inch'on-jikhalsi"; - break; - case 13: - name = "Kyonggi-do"; - break; - case 14: - name = "Kyongsang-bukto"; - break; - case 15: - name = "Taegu-jikhalsi"; - break; - case 16: - name = "Cholla-namdo"; - break; - case 17: - name = "Ch'ungch'ong-namdo"; - break; - case 18: - name = "Kwangju-jikhalsi"; - break; - case 19: - name = "Taejon-jikhalsi"; - break; - case 20: - name = "Kyongsang-namdo"; - break; - case 21: - name = "Ulsan-gwangyoksi"; - break; - } - } - if (strcmp(country_code,"KW") == 0) { - switch (region_code2) { - case 1: - name = "Al Ahmadi"; - break; - case 2: - name = "Al Kuwayt"; - break; - case 5: - name = "Al Jahra"; - break; - case 7: - name = "Al Farwaniyah"; - break; - case 8: - name = "Hawalli"; - break; - case 9: - name = "Mubarak al Kabir"; - break; - } - } - if (strcmp(country_code,"KY") == 0) { - switch (region_code2) { - case 1: - name = "Creek"; - break; - case 2: - name = "Eastern"; - break; - case 3: - name = "Midland"; - break; - case 4: - name = "South Town"; - break; - case 5: - name = "Spot Bay"; - break; - case 6: - name = "Stake Bay"; - break; - case 7: - name = "West End"; - break; - case 8: - name = "Western"; - break; - } - } - if (strcmp(country_code,"KZ") == 0) { - switch (region_code2) { - case 1: - name = "Almaty"; - break; - case 2: - name = "Almaty City"; - break; - case 3: - name = "Aqmola"; - break; - case 4: - name = "Aqtobe"; - break; - case 5: - name = "Astana"; - break; - case 6: - name = "Atyrau"; - break; - case 7: - name = "West Kazakhstan"; - break; - case 8: - name = "Bayqonyr"; - break; - case 9: - name = "Mangghystau"; - break; - case 10: - name = "South Kazakhstan"; - break; - case 11: - name = "Pavlodar"; - break; - case 12: - name = "Qaraghandy"; - break; - case 13: - name = "Qostanay"; - break; - case 14: - name = "Qyzylorda"; - break; - case 15: - name = "East Kazakhstan"; - break; - case 16: - name = "North Kazakhstan"; - break; - case 17: - name = "Zhambyl"; - break; - } - } - if (strcmp(country_code,"LA") == 0) { - switch (region_code2) { - case 1: - name = "Attapu"; - break; - case 2: - name = "Champasak"; - break; - case 3: - name = "Houaphan"; - break; - case 4: - name = "Khammouan"; - break; - case 5: - name = "Louang Namtha"; - break; - case 7: - name = "Oudomxai"; - break; - case 8: - name = "Phongsali"; - break; - case 9: - name = "Saravan"; - break; - case 10: - name = "Savannakhet"; - break; - case 11: - name = "Vientiane"; - break; - case 13: - name = "Xaignabouri"; - break; - case 14: - name = "Xiangkhoang"; - break; - case 17: - name = "Louangphrabang"; - break; - } - } - if (strcmp(country_code,"LB") == 0) { - switch (region_code2) { - case 1: - name = "Beqaa"; - break; - case 2: - name = "Al Janub"; - break; - case 3: - name = "Liban-Nord"; - break; - case 4: - name = "Beyrouth"; - break; - case 5: - name = "Mont-Liban"; - break; - case 6: - name = "Liban-Sud"; - break; - case 7: - name = "Nabatiye"; - break; - case 8: - name = "Beqaa"; - break; - case 9: - name = "Liban-Nord"; - break; - case 10: - name = "Aakk,r"; - break; - case 11: - name = "Baalbek-Hermel"; - break; - } - } - if (strcmp(country_code,"LC") == 0) { - switch (region_code2) { - case 1: - name = "Anse-la-Raye"; - break; - case 2: - name = "Dauphin"; - break; - case 3: - name = "Castries"; - break; - case 4: - name = "Choiseul"; - break; - case 5: - name = "Dennery"; - break; - case 6: - name = "Gros-Islet"; - break; - case 7: - name = "Laborie"; - break; - case 8: - name = "Micoud"; - break; - case 9: - name = "Soufriere"; - break; - case 10: - name = "Vieux-Fort"; - break; - case 11: - name = "Praslin"; - break; - } - } - if (strcmp(country_code,"LI") == 0) { - switch (region_code2) { - case 1: - name = "Balzers"; - break; - case 2: - name = "Eschen"; - break; - case 3: - name = "Gamprin"; - break; - case 4: - name = "Mauren"; - break; - case 5: - name = "Planken"; - break; - case 6: - name = "Ruggell"; - break; - case 7: - name = "Schaan"; - break; - case 8: - name = "Schellenberg"; - break; - case 9: - name = "Triesen"; - break; - case 10: - name = "Triesenberg"; - break; - case 11: - name = "Vaduz"; - break; - case 21: - name = "Gbarpolu"; - break; - case 22: - name = "River Gee"; - break; - } - } - if (strcmp(country_code,"LK") == 0) { - switch (region_code2) { - case 1: - name = "Amparai"; - break; - case 2: - name = "Anuradhapura"; - break; - case 3: - name = "Badulla"; - break; - case 4: - name = "Batticaloa"; - break; - case 6: - name = "Galle"; - break; - case 7: - name = "Hambantota"; - break; - case 9: - name = "Kalutara"; - break; - case 10: - name = "Kandy"; - break; - case 11: - name = "Kegalla"; - break; - case 12: - name = "Kurunegala"; - break; - case 14: - name = "Matale"; - break; - case 15: - name = "Matara"; - break; - case 16: - name = "Moneragala"; - break; - case 17: - name = "Nuwara Eliya"; - break; - case 18: - name = "Polonnaruwa"; - break; - case 19: - name = "Puttalam"; - break; - case 20: - name = "Ratnapura"; - break; - case 21: - name = "Trincomalee"; - break; - case 23: - name = "Colombo"; - break; - case 24: - name = "Gampaha"; - break; - case 25: - name = "Jaffna"; - break; - case 26: - name = "Mannar"; - break; - case 27: - name = "Mullaittivu"; - break; - case 28: - name = "Vavuniya"; - break; - case 29: - name = "Central"; - break; - case 30: - name = "North Central"; - break; - case 31: - name = "Northern"; - break; - case 32: - name = "North Western"; - break; - case 33: - name = "Sabaragamuwa"; - break; - case 34: - name = "Southern"; - break; - case 35: - name = "Uva"; - break; - case 36: - name = "Western"; - break; - } - } - if (strcmp(country_code,"LR") == 0) { - switch (region_code2) { - case 1: - name = "Bong"; - break; - case 4: - name = "Grand Cape Mount"; - break; - case 5: - name = "Lofa"; - break; - case 6: - name = "Maryland"; - break; - case 7: - name = "Monrovia"; - break; - case 9: - name = "Nimba"; - break; - case 10: - name = "Sino"; - break; - case 11: - name = "Grand Bassa"; - break; - case 12: - name = "Grand Cape Mount"; - break; - case 13: - name = "Maryland"; - break; - case 14: - name = "Montserrado"; - break; - case 17: - name = "Margibi"; - break; - case 18: - name = "River Cess"; - break; - case 19: - name = "Grand Gedeh"; - break; - case 20: - name = "Lofa"; - break; - case 21: - name = "Gbarpolu"; - break; - case 22: - name = "River Gee"; - break; - } - } - if (strcmp(country_code,"LS") == 0) { - switch (region_code2) { - case 10: - name = "Berea"; - break; - case 11: - name = "Butha-Buthe"; - break; - case 12: - name = "Leribe"; - break; - case 13: - name = "Mafeteng"; - break; - case 14: - name = "Maseru"; - break; - case 15: - name = "Mohales Hoek"; - break; - case 16: - name = "Mokhotlong"; - break; - case 17: - name = "Qachas Nek"; - break; - case 18: - name = "Quthing"; - break; - case 19: - name = "Thaba-Tseka"; - break; - } - } - if (strcmp(country_code,"LT") == 0) { - switch (region_code2) { - case 56: - name = "Alytaus Apskritis"; - break; - case 57: - name = "Kauno Apskritis"; - break; - case 58: - name = "Klaipedos Apskritis"; - break; - case 59: - name = "Marijampoles Apskritis"; - break; - case 60: - name = "Panevezio Apskritis"; - break; - case 61: - name = "Siauliu Apskritis"; - break; - case 62: - name = "Taurages Apskritis"; - break; - case 63: - name = "Telsiu Apskritis"; - break; - case 64: - name = "Utenos Apskritis"; - break; - case 65: - name = "Vilniaus Apskritis"; - break; - } - } - if (strcmp(country_code,"LU") == 0) { - switch (region_code2) { - case 1: - name = "Diekirch"; - break; - case 2: - name = "Grevenmacher"; - break; - case 3: - name = "Luxembourg"; - break; - } - } - if (strcmp(country_code,"LV") == 0) { - switch (region_code2) { - case 1: - name = "Aizkraukles"; - break; - case 2: - name = "Aluksnes"; - break; - case 3: - name = "Balvu"; - break; - case 4: - name = "Bauskas"; - break; - case 5: - name = "Cesu"; - break; - case 6: - name = "Daugavpils"; - break; - case 7: - name = "Daugavpils"; - break; - case 8: - name = "Dobeles"; - break; - case 9: - name = "Gulbenes"; - break; - case 10: - name = "Jekabpils"; - break; - case 11: - name = "Jelgava"; - break; - case 12: - name = "Jelgavas"; - break; - case 13: - name = "Jurmala"; - break; - case 14: - name = "Kraslavas"; - break; - case 15: - name = "Kuldigas"; - break; - case 16: - name = "Liepaja"; - break; - case 17: - name = "Liepajas"; - break; - case 18: - name = "Limbazu"; - break; - case 19: - name = "Ludzas"; - break; - case 20: - name = "Madonas"; - break; - case 21: - name = "Ogres"; - break; - case 22: - name = "Preilu"; - break; - case 23: - name = "Rezekne"; - break; - case 24: - name = "Rezeknes"; - break; - case 25: - name = "Riga"; - break; - case 26: - name = "Rigas"; - break; - case 27: - name = "Saldus"; - break; - case 28: - name = "Talsu"; - break; - case 29: - name = "Tukuma"; - break; - case 30: - name = "Valkas"; - break; - case 31: - name = "Valmieras"; - break; - case 32: - name = "Ventspils"; - break; - case 33: - name = "Ventspils"; - break; - } - } - if (strcmp(country_code,"LY") == 0) { - switch (region_code2) { - case 3: - name = "Al Aziziyah"; - break; - case 5: - name = "Al Jufrah"; - break; - case 8: - name = "Al Kufrah"; - break; - case 13: - name = "Ash Shati'"; - break; - case 30: - name = "Murzuq"; - break; - case 34: - name = "Sabha"; - break; - case 41: - name = "Tarhunah"; - break; - case 42: - name = "Tubruq"; - break; - case 45: - name = "Zlitan"; - break; - case 47: - name = "Ajdabiya"; - break; - case 48: - name = "Al Fatih"; - break; - case 49: - name = "Al Jabal al Akhdar"; - break; - case 50: - name = "Al Khums"; - break; - case 51: - name = "An Nuqat al Khams"; - break; - case 52: - name = "Awbari"; - break; - case 53: - name = "Az Zawiyah"; - break; - case 54: - name = "Banghazi"; - break; - case 55: - name = "Darnah"; - break; - case 56: - name = "Ghadamis"; - break; - case 57: - name = "Gharyan"; - break; - case 58: - name = "Misratah"; - break; - case 59: - name = "Sawfajjin"; - break; - case 60: - name = "Surt"; - break; - case 61: - name = "Tarabulus"; - break; - case 62: - name = "Yafran"; - break; - } - } - if (strcmp(country_code,"MA") == 0) { - switch (region_code2) { - case 45: - name = "Grand Casablanca"; - break; - case 46: - name = "Fes-Boulemane"; - break; - case 47: - name = "Marrakech-Tensift-Al Haouz"; - break; - case 48: - name = "Meknes-Tafilalet"; - break; - case 49: - name = "Rabat-Sale-Zemmour-Zaer"; - break; - case 50: - name = "Chaouia-Ouardigha"; - break; - case 51: - name = "Doukkala-Abda"; - break; - case 52: - name = "Gharb-Chrarda-Beni Hssen"; - break; - case 53: - name = "Guelmim-Es Smara"; - break; - case 54: - name = "Oriental"; - break; - case 55: - name = "Souss-Massa-Dr,a"; - break; - case 56: - name = "Tadla-Azilal"; - break; - case 57: - name = "Tanger-Tetouan"; - break; - case 58: - name = "Taza-Al Hoceima-Taounate"; - break; - case 59: - name = "La,youne-Boujdour-Sakia El Hamra"; - break; - } - } - if (strcmp(country_code,"MC") == 0) { - switch (region_code2) { - case 1: - name = "La Condamine"; - break; - case 2: - name = "Monaco"; - break; - case 3: - name = "Monte-Carlo"; - break; - } - } - if (strcmp(country_code,"MD") == 0) { - switch (region_code2) { - case 51: - name = "Gagauzia"; - break; - case 57: - name = "Chisinau"; - break; - case 58: - name = "Stinga Nistrului"; - break; - case 59: - name = "Anenii Noi"; - break; - case 60: - name = "Balti"; - break; - case 61: - name = "Basarabeasca"; - break; - case 62: - name = "Bender"; - break; - case 63: - name = "Briceni"; - break; - case 64: - name = "Cahul"; - break; - case 65: - name = "Cantemir"; - break; - case 66: - name = "Calarasi"; - break; - case 67: - name = "Causeni"; - break; - case 68: - name = "Cimislia"; - break; - case 69: - name = "Criuleni"; - break; - case 70: - name = "Donduseni"; - break; - case 71: - name = "Drochia"; - break; - case 72: - name = "Dubasari"; - break; - case 73: - name = "Edinet"; - break; - case 74: - name = "Falesti"; - break; - case 75: - name = "Floresti"; - break; - case 76: - name = "Glodeni"; - break; - case 77: - name = "Hincesti"; - break; - case 78: - name = "Ialoveni"; - break; - case 79: - name = "Leova"; - break; - case 80: - name = "Nisporeni"; - break; - case 81: - name = "Ocnita"; - break; - case 83: - name = "Rezina"; - break; - case 84: - name = "Riscani"; - break; - case 85: - name = "Singerei"; - break; - case 86: - name = "Soldanesti"; - break; - case 87: - name = "Soroca"; - break; - case 88: - name = "Stefan-Voda"; - break; - case 89: - name = "Straseni"; - break; - case 90: - name = "Taraclia"; - break; - case 91: - name = "Telenesti"; - break; - case 92: - name = "Ungheni"; - break; - } - } - if (strcmp(country_code,"MG") == 0) { - switch (region_code2) { - case 1: - name = "Antsiranana"; - break; - case 2: - name = "Fianarantsoa"; - break; - case 3: - name = "Mahajanga"; - break; - case 4: - name = "Toamasina"; - break; - case 5: - name = "Antananarivo"; - break; - case 6: - name = "Toliara"; - break; - } - } - if (strcmp(country_code,"MK") == 0) { - switch (region_code2) { - case 1: - name = "Aracinovo"; - break; - case 2: - name = "Bac"; - break; - case 3: - name = "Belcista"; - break; - case 4: - name = "Berovo"; - break; - case 5: - name = "Bistrica"; - break; - case 6: - name = "Bitola"; - break; - case 7: - name = "Blatec"; - break; - case 8: - name = "Bogdanci"; - break; - case 9: - name = "Bogomila"; - break; - case 10: - name = "Bogovinje"; - break; - case 11: - name = "Bosilovo"; - break; - case 12: - name = "Brvenica"; - break; - case 13: - name = "Cair"; - break; - case 14: - name = "Capari"; - break; - case 15: - name = "Caska"; - break; - case 16: - name = "Cegrane"; - break; - case 17: - name = "Centar"; - break; - case 18: - name = "Centar Zupa"; - break; - case 19: - name = "Cesinovo"; - break; - case 20: - name = "Cucer-Sandevo"; - break; - case 21: - name = "Debar"; - break; - case 22: - name = "Delcevo"; - break; - case 23: - name = "Delogozdi"; - break; - case 24: - name = "Demir Hisar"; - break; - case 25: - name = "Demir Kapija"; - break; - case 26: - name = "Dobrusevo"; - break; - case 27: - name = "Dolna Banjica"; - break; - case 28: - name = "Dolneni"; - break; - case 29: - name = "Dorce Petrov"; - break; - case 30: - name = "Drugovo"; - break; - case 31: - name = "Dzepciste"; - break; - case 32: - name = "Gazi Baba"; - break; - case 33: - name = "Gevgelija"; - break; - case 34: - name = "Gostivar"; - break; - case 35: - name = "Gradsko"; - break; - case 36: - name = "Ilinden"; - break; - case 37: - name = "Izvor"; - break; - case 38: - name = "Jegunovce"; - break; - case 39: - name = "Kamenjane"; - break; - case 40: - name = "Karbinci"; - break; - case 41: - name = "Karpos"; - break; - case 42: - name = "Kavadarci"; - break; - case 43: - name = "Kicevo"; - break; - case 44: - name = "Kisela Voda"; - break; - case 45: - name = "Klecevce"; - break; - case 46: - name = "Kocani"; - break; - case 47: - name = "Konce"; - break; - case 48: - name = "Kondovo"; - break; - case 49: - name = "Konopiste"; - break; - case 50: - name = "Kosel"; - break; - case 51: - name = "Kratovo"; - break; - case 52: - name = "Kriva Palanka"; - break; - case 53: - name = "Krivogastani"; - break; - case 54: - name = "Krusevo"; - break; - case 55: - name = "Kuklis"; - break; - case 56: - name = "Kukurecani"; - break; - case 57: - name = "Kumanovo"; - break; - case 58: - name = "Labunista"; - break; - case 59: - name = "Lipkovo"; - break; - case 60: - name = "Lozovo"; - break; - case 61: - name = "Lukovo"; - break; - case 62: - name = "Makedonska Kamenica"; - break; - case 63: - name = "Makedonski Brod"; - break; - case 64: - name = "Mavrovi Anovi"; - break; - case 65: - name = "Meseista"; - break; - case 66: - name = "Miravci"; - break; - case 67: - name = "Mogila"; - break; - case 68: - name = "Murtino"; - break; - case 69: - name = "Negotino"; - break; - case 70: - name = "Negotino-Polosko"; - break; - case 71: - name = "Novaci"; - break; - case 72: - name = "Novo Selo"; - break; - case 73: - name = "Oblesevo"; - break; - case 74: - name = "Ohrid"; - break; - case 75: - name = "Orasac"; - break; - case 76: - name = "Orizari"; - break; - case 77: - name = "Oslomej"; - break; - case 78: - name = "Pehcevo"; - break; - case 79: - name = "Petrovec"; - break; - case 80: - name = "Plasnica"; - break; - case 81: - name = "Podares"; - break; - case 82: - name = "Prilep"; - break; - case 83: - name = "Probistip"; - break; - case 84: - name = "Radovis"; - break; - case 85: - name = "Rankovce"; - break; - case 86: - name = "Resen"; - break; - case 87: - name = "Rosoman"; - break; - case 88: - name = "Rostusa"; - break; - case 89: - name = "Samokov"; - break; - case 90: - name = "Saraj"; - break; - case 91: - name = "Sipkovica"; - break; - case 92: - name = "Sopiste"; - break; - case 93: - name = "Sopotnica"; - break; - case 94: - name = "Srbinovo"; - break; - case 95: - name = "Staravina"; - break; - case 96: - name = "Star Dojran"; - break; - case 97: - name = "Staro Nagoricane"; - break; - case 98: - name = "Stip"; - break; - case 99: - name = "Struga"; - break; - case 832: - name = "Strumica"; - break; - case 833: - name = "Studenicani"; - break; - case 834: - name = "Suto Orizari"; - break; - case 835: - name = "Sveti Nikole"; - break; - case 836: - name = "Tearce"; - break; - case 837: - name = "Tetovo"; - break; - case 838: - name = "Topolcani"; - break; - case 839: - name = "Valandovo"; - break; - case 840: - name = "Vasilevo"; - break; - case 875: - name = "Veles"; - break; - case 876: - name = "Velesta"; - break; - case 877: - name = "Vevcani"; - break; - case 878: - name = "Vinica"; - break; - case 879: - name = "Vitoliste"; - break; - case 880: - name = "Vranestica"; - break; - case 881: - name = "Vrapciste"; - break; - case 882: - name = "Vratnica"; - break; - case 883: - name = "Vrutok"; - break; - case 918: - name = "Zajas"; - break; - case 919: - name = "Zelenikovo"; - break; - case 920: - name = "Zelino"; - break; - case 921: - name = "Zitose"; - break; - case 922: - name = "Zletovo"; - break; - case 923: - name = "Zrnovci"; - break; - } - } - if (strcmp(country_code,"ML") == 0) { - switch (region_code2) { - case 1: - name = "Bamako"; - break; - case 3: - name = "Kayes"; - break; - case 4: - name = "Mopti"; - break; - case 5: - name = "Segou"; - break; - case 6: - name = "Sikasso"; - break; - case 7: - name = "Koulikoro"; - break; - case 8: - name = "Tombouctou"; - break; - case 9: - name = "Gao"; - break; - case 10: - name = "Kidal"; - break; - } - } - if (strcmp(country_code,"MM") == 0) { - switch (region_code2) { - case 1: - name = "Rakhine State"; - break; - case 2: - name = "Chin State"; - break; - case 3: - name = "Irrawaddy"; - break; - case 4: - name = "Kachin State"; - break; - case 5: - name = "Karan State"; - break; - case 6: - name = "Kayah State"; - break; - case 7: - name = "Magwe"; - break; - case 8: - name = "Mandalay"; - break; - case 9: - name = "Pegu"; - break; - case 10: - name = "Sagaing"; - break; - case 11: - name = "Shan State"; - break; - case 12: - name = "Tenasserim"; - break; - case 13: - name = "Mon State"; - break; - case 14: - name = "Rangoon"; - break; - case 17: - name = "Yangon"; - break; - } - } - if (strcmp(country_code,"MN") == 0) { - switch (region_code2) { - case 1: - name = "Arhangay"; - break; - case 2: - name = "Bayanhongor"; - break; - case 3: - name = "Bayan-Olgiy"; - break; - case 5: - name = "Darhan"; - break; - case 6: - name = "Dornod"; - break; - case 7: - name = "Dornogovi"; - break; - case 8: - name = "Dundgovi"; - break; - case 9: - name = "Dzavhan"; - break; - case 10: - name = "Govi-Altay"; - break; - case 11: - name = "Hentiy"; - break; - case 12: - name = "Hovd"; - break; - case 13: - name = "Hovsgol"; - break; - case 14: - name = "Omnogovi"; - break; - case 15: - name = "Ovorhangay"; - break; - case 16: - name = "Selenge"; - break; - case 17: - name = "Suhbaatar"; - break; - case 18: - name = "Tov"; - break; - case 19: - name = "Uvs"; - break; - case 20: - name = "Ulaanbaatar"; - break; - case 21: - name = "Bulgan"; - break; - case 22: - name = "Erdenet"; - break; - case 23: - name = "Darhan-Uul"; - break; - case 24: - name = "Govisumber"; - break; - case 25: - name = "Orhon"; - break; - } - } - if (strcmp(country_code,"MO") == 0) { - switch (region_code2) { - case 1: - name = "Ilhas"; - break; - case 2: - name = "Macau"; - break; - } - } - if (strcmp(country_code,"MR") == 0) { - switch (region_code2) { - case 1: - name = "Hodh Ech Chargui"; - break; - case 2: - name = "Hodh El Gharbi"; - break; - case 3: - name = "Assaba"; - break; - case 4: - name = "Gorgol"; - break; - case 5: - name = "Brakna"; - break; - case 6: - name = "Trarza"; - break; - case 7: - name = "Adrar"; - break; - case 8: - name = "Dakhlet Nouadhibou"; - break; - case 9: - name = "Tagant"; - break; - case 10: - name = "Guidimaka"; - break; - case 11: - name = "Tiris Zemmour"; - break; - case 12: - name = "Inchiri"; - break; - } - } - if (strcmp(country_code,"MS") == 0) { - switch (region_code2) { - case 1: - name = "Saint Anthony"; - break; - case 2: - name = "Saint Georges"; - break; - case 3: - name = "Saint Peter"; - break; - } - } - if (strcmp(country_code,"MU") == 0) { - switch (region_code2) { - case 12: - name = "Black River"; - break; - case 13: - name = "Flacq"; - break; - case 14: - name = "Grand Port"; - break; - case 15: - name = "Moka"; - break; - case 16: - name = "Pamplemousses"; - break; - case 17: - name = "Plaines Wilhems"; - break; - case 18: - name = "Port Louis"; - break; - case 19: - name = "Riviere du Rempart"; - break; - case 20: - name = "Savanne"; - break; - case 21: - name = "Agalega Islands"; - break; - case 22: - name = "Cargados Carajos"; - break; - case 23: - name = "Rodrigues"; - break; - } - } - if (strcmp(country_code,"MV") == 0) { - switch (region_code2) { - case 1: - name = "Seenu"; - break; - case 5: - name = "Laamu"; - break; - case 30: - name = "Alifu"; - break; - case 31: - name = "Baa"; - break; - case 32: - name = "Dhaalu"; - break; - case 33: - name = "Faafu "; - break; - case 34: - name = "Gaafu Alifu"; - break; - case 35: - name = "Gaafu Dhaalu"; - break; - case 36: - name = "Haa Alifu"; - break; - case 37: - name = "Haa Dhaalu"; - break; - case 38: - name = "Kaafu"; - break; - case 39: - name = "Lhaviyani"; - break; - case 40: - name = "Maale"; - break; - case 41: - name = "Meemu"; - break; - case 42: - name = "Gnaviyani"; - break; - case 43: - name = "Noonu"; - break; - case 44: - name = "Raa"; - break; - case 45: - name = "Shaviyani"; - break; - case 46: - name = "Thaa"; - break; - case 47: - name = "Vaavu"; - break; - } - } - if (strcmp(country_code,"MW") == 0) { - switch (region_code2) { - case 2: - name = "Chikwawa"; - break; - case 3: - name = "Chiradzulu"; - break; - case 4: - name = "Chitipa"; - break; - case 5: - name = "Thyolo"; - break; - case 6: - name = "Dedza"; - break; - case 7: - name = "Dowa"; - break; - case 8: - name = "Karonga"; - break; - case 9: - name = "Kasungu"; - break; - case 11: - name = "Lilongwe"; - break; - case 12: - name = "Mangochi"; - break; - case 13: - name = "Mchinji"; - break; - case 15: - name = "Mzimba"; - break; - case 16: - name = "Ntcheu"; - break; - case 17: - name = "Nkhata Bay"; - break; - case 18: - name = "Nkhotakota"; - break; - case 19: - name = "Nsanje"; - break; - case 20: - name = "Ntchisi"; - break; - case 21: - name = "Rumphi"; - break; - case 22: - name = "Salima"; - break; - case 23: - name = "Zomba"; - break; - case 24: - name = "Blantyre"; - break; - case 25: - name = "Mwanza"; - break; - case 26: - name = "Balaka"; - break; - case 27: - name = "Likoma"; - break; - case 28: - name = "Machinga"; - break; - case 29: - name = "Mulanje"; - break; - case 30: - name = "Phalombe"; - break; - } - } - if (strcmp(country_code,"MX") == 0) { - switch (region_code2) { - case 1: - name = "Aguascalientes"; - break; - case 2: - name = "Baja California"; - break; - case 3: - name = "Baja California Sur"; - break; - case 4: - name = "Campeche"; - break; - case 5: - name = "Chiapas"; - break; - case 6: - name = "Chihuahua"; - break; - case 7: - name = "Coahuila de Zaragoza"; - break; - case 8: - name = "Colima"; - break; - case 9: - name = "Distrito Federal"; - break; - case 10: - name = "Durango"; - break; - case 11: - name = "Guanajuato"; - break; - case 12: - name = "Guerrero"; - break; - case 13: - name = "Hidalgo"; - break; - case 14: - name = "Jalisco"; - break; - case 15: - name = "Mexico"; - break; - case 16: - name = "Michoacan de Ocampo"; - break; - case 17: - name = "Morelos"; - break; - case 18: - name = "Nayarit"; - break; - case 19: - name = "Nuevo Leon"; - break; - case 20: - name = "Oaxaca"; - break; - case 21: - name = "Puebla"; - break; - case 22: - name = "Queretaro de Arteaga"; - break; - case 23: - name = "Quintana Roo"; - break; - case 24: - name = "San Luis Potosi"; - break; - case 25: - name = "Sinaloa"; - break; - case 26: - name = "Sonora"; - break; - case 27: - name = "Tabasco"; - break; - case 28: - name = "Tamaulipas"; - break; - case 29: - name = "Tlaxcala"; - break; - case 30: - name = "Veracruz-Llave"; - break; - case 31: - name = "Yucatan"; - break; - case 32: - name = "Zacatecas"; - break; - } - } - if (strcmp(country_code,"MY") == 0) { - switch (region_code2) { - case 1: - name = "Johor"; - break; - case 2: - name = "Kedah"; - break; - case 3: - name = "Kelantan"; - break; - case 4: - name = "Melaka"; - break; - case 5: - name = "Negeri Sembilan"; - break; - case 6: - name = "Pahang"; - break; - case 7: - name = "Perak"; - break; - case 8: - name = "Perlis"; - break; - case 9: - name = "Pulau Pinang"; - break; - case 11: - name = "Sarawak"; - break; - case 12: - name = "Selangor"; - break; - case 13: - name = "Terengganu"; - break; - case 14: - name = "Kuala Lumpur"; - break; - case 15: - name = "Labuan"; - break; - case 16: - name = "Sabah"; - break; - case 17: - name = "Putrajaya"; - break; - } - } - if (strcmp(country_code,"MZ") == 0) { - switch (region_code2) { - case 1: - name = "Cabo Delgado"; - break; - case 2: - name = "Gaza"; - break; - case 3: - name = "Inhambane"; - break; - case 4: - name = "Maputo"; - break; - case 5: - name = "Sofala"; - break; - case 6: - name = "Nampula"; - break; - case 7: - name = "Niassa"; - break; - case 8: - name = "Tete"; - break; - case 9: - name = "Zambezia"; - break; - case 10: - name = "Manica"; - break; - case 11: - name = "Maputo"; - break; - } - } - if (strcmp(country_code,"NA") == 0) { - switch (region_code2) { - case 1: - name = "Bethanien"; - break; - case 2: - name = "Caprivi Oos"; - break; - case 3: - name = "Boesmanland"; - break; - case 4: - name = "Gobabis"; - break; - case 5: - name = "Grootfontein"; - break; - case 6: - name = "Kaokoland"; - break; - case 7: - name = "Karibib"; - break; - case 8: - name = "Keetmanshoop"; - break; - case 9: - name = "Luderitz"; - break; - case 10: - name = "Maltahohe"; - break; - case 11: - name = "Okahandja"; - break; - case 12: - name = "Omaruru"; - break; - case 13: - name = "Otjiwarongo"; - break; - case 14: - name = "Outjo"; - break; - case 15: - name = "Owambo"; - break; - case 16: - name = "Rehoboth"; - break; - case 17: - name = "Swakopmund"; - break; - case 18: - name = "Tsumeb"; - break; - case 20: - name = "Karasburg"; - break; - case 21: - name = "Windhoek"; - break; - case 22: - name = "Damaraland"; - break; - case 23: - name = "Hereroland Oos"; - break; - case 24: - name = "Hereroland Wes"; - break; - case 25: - name = "Kavango"; - break; - case 26: - name = "Mariental"; - break; - case 27: - name = "Namaland"; - break; - case 28: - name = "Caprivi"; - break; - case 29: - name = "Erongo"; - break; - case 30: - name = "Hardap"; - break; - case 31: - name = "Karas"; - break; - case 32: - name = "Kunene"; - break; - case 33: - name = "Ohangwena"; - break; - case 34: - name = "Okavango"; - break; - case 35: - name = "Omaheke"; - break; - case 36: - name = "Omusati"; - break; - case 37: - name = "Oshana"; - break; - case 38: - name = "Oshikoto"; - break; - case 39: - name = "Otjozondjupa"; - break; - } - } - if (strcmp(country_code,"NE") == 0) { - switch (region_code2) { - case 1: - name = "Agadez"; - break; - case 2: - name = "Diffa"; - break; - case 3: - name = "Dosso"; - break; - case 4: - name = "Maradi"; - break; - case 5: - name = "Niamey"; - break; - case 6: - name = "Tahoua"; - break; - case 7: - name = "Zinder"; - break; - case 8: - name = "Niamey"; - break; - } - } - if (strcmp(country_code,"NG") == 0) { - switch (region_code2) { - case 5: - name = "Lagos"; - break; - case 11: - name = "Federal Capital Territory"; - break; - case 16: - name = "Ogun"; - break; - case 21: - name = "Akwa Ibom"; - break; - case 22: - name = "Cross River"; - break; - case 23: - name = "Kaduna"; - break; - case 24: - name = "Katsina"; - break; - case 25: - name = "Anambra"; - break; - case 26: - name = "Benue"; - break; - case 27: - name = "Borno"; - break; - case 28: - name = "Imo"; - break; - case 29: - name = "Kano"; - break; - case 30: - name = "Kwara"; - break; - case 31: - name = "Niger"; - break; - case 32: - name = "Oyo"; - break; - case 35: - name = "Adamawa"; - break; - case 36: - name = "Delta"; - break; - case 37: - name = "Edo"; - break; - case 39: - name = "Jigawa"; - break; - case 40: - name = "Kebbi"; - break; - case 41: - name = "Kogi"; - break; - case 42: - name = "Osun"; - break; - case 43: - name = "Taraba"; - break; - case 44: - name = "Yobe"; - break; - case 45: - name = "Abia"; - break; - case 46: - name = "Bauchi"; - break; - case 47: - name = "Enugu"; - break; - case 48: - name = "Ondo"; - break; - case 49: - name = "Plateau"; - break; - case 50: - name = "Rivers"; - break; - case 51: - name = "Sokoto"; - break; - case 52: - name = "Bayelsa"; - break; - case 53: - name = "Ebonyi"; - break; - case 54: - name = "Ekiti"; - break; - case 55: - name = "Gombe"; - break; - case 56: - name = "Nassarawa"; - break; - case 57: - name = "Zamfara"; - break; - } - } - if (strcmp(country_code,"NI") == 0) { - switch (region_code2) { - case 1: - name = "Boaco"; - break; - case 2: - name = "Carazo"; - break; - case 3: - name = "Chinandega"; - break; - case 4: - name = "Chontales"; - break; - case 5: - name = "Esteli"; - break; - case 6: - name = "Granada"; - break; - case 7: - name = "Jinotega"; - break; - case 8: - name = "Leon"; - break; - case 9: - name = "Madriz"; - break; - case 10: - name = "Managua"; - break; - case 11: - name = "Masaya"; - break; - case 12: - name = "Matagalpa"; - break; - case 13: - name = "Nueva Segovia"; - break; - case 14: - name = "Rio San Juan"; - break; - case 15: - name = "Rivas"; - break; - case 16: - name = "Zelaya"; - break; - case 17: - name = "Autonoma Atlantico Norte"; - break; - case 18: - name = "Region Autonoma Atlantico Sur"; - break; - } - } - if (strcmp(country_code,"NL") == 0) { - switch (region_code2) { - case 1: - name = "Drenthe"; - break; - case 2: - name = "Friesland"; - break; - case 3: - name = "Gelderland"; - break; - case 4: - name = "Groningen"; - break; - case 5: - name = "Limburg"; - break; - case 6: - name = "Noord-Brabant"; - break; - case 7: - name = "Noord-Holland"; - break; - case 8: - name = "Overijssel"; - break; - case 9: - name = "Utrecht"; - break; - case 10: - name = "Zeeland"; - break; - case 11: - name = "Zuid-Holland"; - break; - case 15: - name = "Overijssel"; - break; - case 16: - name = "Flevoland"; - break; - } - } - if (strcmp(country_code,"NO") == 0) { - switch (region_code2) { - case 1: - name = "Akershus"; - break; - case 2: - name = "Aust-Agder"; - break; - case 4: - name = "Buskerud"; - break; - case 5: - name = "Finnmark"; - break; - case 6: - name = "Hedmark"; - break; - case 7: - name = "Hordaland"; - break; - case 8: - name = "More og Romsdal"; - break; - case 9: - name = "Nordland"; - break; - case 10: - name = "Nord-Trondelag"; - break; - case 11: - name = "Oppland"; - break; - case 12: - name = "Oslo"; - break; - case 13: - name = "Ostfold"; - break; - case 14: - name = "Rogaland"; - break; - case 15: - name = "Sogn og Fjordane"; - break; - case 16: - name = "Sor-Trondelag"; - break; - case 17: - name = "Telemark"; - break; - case 18: - name = "Troms"; - break; - case 19: - name = "Vest-Agder"; - break; - case 20: - name = "Vestfold"; - break; - } - } - if (strcmp(country_code,"NP") == 0) { - switch (region_code2) { - case 1: - name = "Bagmati"; - break; - case 2: - name = "Bheri"; - break; - case 3: - name = "Dhawalagiri"; - break; - case 4: - name = "Gandaki"; - break; - case 5: - name = "Janakpur"; - break; - case 6: - name = "Karnali"; - break; - case 7: - name = "Kosi"; - break; - case 8: - name = "Lumbini"; - break; - case 9: - name = "Mahakali"; - break; - case 10: - name = "Mechi"; - break; - case 11: - name = "Narayani"; - break; - case 12: - name = "Rapti"; - break; - case 13: - name = "Sagarmatha"; - break; - case 14: - name = "Seti"; - break; - } - } - if (strcmp(country_code,"NR") == 0) { - switch (region_code2) { - case 1: - name = "Aiwo"; - break; - case 2: - name = "Anabar"; - break; - case 3: - name = "Anetan"; - break; - case 4: - name = "Anibare"; - break; - case 5: - name = "Baiti"; - break; - case 6: - name = "Boe"; - break; - case 7: - name = "Buada"; - break; - case 8: - name = "Denigomodu"; - break; - case 9: - name = "Ewa"; - break; - case 10: - name = "Ijuw"; - break; - case 11: - name = "Meneng"; - break; - case 12: - name = "Nibok"; - break; - case 13: - name = "Uaboe"; - break; - case 14: - name = "Yaren"; - break; - } - } - if (strcmp(country_code,"NZ") == 0) { - switch (region_code2) { - case 10: - name = "Chatham Islands"; - break; - case 1010: - name = "Auckland"; - break; - case 1011: - name = "Bay of Plenty"; - break; - case 1012: - name = "Canterbury"; - break; - case 1047: - name = "Gisborne"; - break; - case 1048: - name = "Hawke's Bay"; - break; - case 1049: - name = "Manawatu-Wanganui"; - break; - case 1050: - name = "Marlborough"; - break; - case 1051: - name = "Nelson"; - break; - case 1052: - name = "Northland"; - break; - case 1053: - name = "Otago"; - break; - case 1054: - name = "Southland"; - break; - case 1055: - name = "Taranaki"; - break; - case 1090: - name = "Waikato"; - break; - case 1091: - name = "Wellington"; - break; - case 1092: - name = "West Coast"; - break; - } - } - if (strcmp(country_code,"OM") == 0) { - switch (region_code2) { - case 1: - name = "Ad Dakhiliyah"; - break; - case 2: - name = "Al Batinah"; - break; - case 3: - name = "Al Wusta"; - break; - case 4: - name = "Ash Sharqiyah"; - break; - case 5: - name = "Az Zahirah"; - break; - case 6: - name = "Masqat"; - break; - case 7: - name = "Musandam"; - break; - case 8: - name = "Zufar"; - break; - } - } - if (strcmp(country_code,"PA") == 0) { - switch (region_code2) { - case 1: - name = "Bocas del Toro"; - break; - case 2: - name = "Chiriqui"; - break; - case 3: - name = "Cocle"; - break; - case 4: - name = "Colon"; - break; - case 5: - name = "Darien"; - break; - case 6: - name = "Herrera"; - break; - case 7: - name = "Los Santos"; - break; - case 8: - name = "Panama"; - break; - case 9: - name = "San Blas"; - break; - case 10: - name = "Veraguas"; - break; - } - } - if (strcmp(country_code,"PE") == 0) { - switch (region_code2) { - case 1: - name = "Amazonas"; - break; - case 2: - name = "Ancash"; - break; - case 3: - name = "Apurimac"; - break; - case 4: - name = "Arequipa"; - break; - case 5: - name = "Ayacucho"; - break; - case 6: - name = "Cajamarca"; - break; - case 7: - name = "Callao"; - break; - case 8: - name = "Cusco"; - break; - case 9: - name = "Huancavelica"; - break; - case 10: - name = "Huanuco"; - break; - case 11: - name = "Ica"; - break; - case 12: - name = "Junin"; - break; - case 13: - name = "La Libertad"; - break; - case 14: - name = "Lambayeque"; - break; - case 15: - name = "Lima"; - break; - case 16: - name = "Loreto"; - break; - case 17: - name = "Madre de Dios"; - break; - case 18: - name = "Moquegua"; - break; - case 19: - name = "Pasco"; - break; - case 20: - name = "Piura"; - break; - case 21: - name = "Puno"; - break; - case 22: - name = "San Martin"; - break; - case 23: - name = "Tacna"; - break; - case 24: - name = "Tumbes"; - break; - case 25: - name = "Ucayali"; - break; - } - } - if (strcmp(country_code,"PG") == 0) { - switch (region_code2) { - case 1: - name = "Central"; - break; - case 2: - name = "Gulf"; - break; - case 3: - name = "Milne Bay"; - break; - case 4: - name = "Northern"; - break; - case 5: - name = "Southern Highlands"; - break; - case 6: - name = "Western"; - break; - case 7: - name = "North Solomons"; - break; - case 8: - name = "Chimbu"; - break; - case 9: - name = "Eastern Highlands"; - break; - case 10: - name = "East New Britain"; - break; - case 11: - name = "East Sepik"; - break; - case 12: - name = "Madang"; - break; - case 13: - name = "Manus"; - break; - case 14: - name = "Morobe"; - break; - case 15: - name = "New Ireland"; - break; - case 16: - name = "Western Highlands"; - break; - case 17: - name = "West New Britain"; - break; - case 18: - name = "Sandaun"; - break; - case 19: - name = "Enga"; - break; - case 20: - name = "National Capital"; - break; - } - } - if (strcmp(country_code,"PH") == 0) { - switch (region_code2) { - case 1: - name = "Abra"; - break; - case 2: - name = "Agusan del Norte"; - break; - case 3: - name = "Agusan del Sur"; - break; - case 4: - name = "Aklan"; - break; - case 5: - name = "Albay"; - break; - case 6: - name = "Antique"; - break; - case 7: - name = "Bataan"; - break; - case 8: - name = "Batanes"; - break; - case 9: - name = "Batangas"; - break; - case 10: - name = "Benguet"; - break; - case 11: - name = "Bohol"; - break; - case 12: - name = "Bukidnon"; - break; - case 13: - name = "Bulacan"; - break; - case 14: - name = "Cagayan"; - break; - case 15: - name = "Camarines Norte"; - break; - case 16: - name = "Camarines Sur"; - break; - case 17: - name = "Camiguin"; - break; - case 18: - name = "Capiz"; - break; - case 19: - name = "Catanduanes"; - break; - case 20: - name = "Cavite"; - break; - case 21: - name = "Cebu"; - break; - case 22: - name = "Basilan"; - break; - case 23: - name = "Eastern Samar"; - break; - case 24: - name = "Davao"; - break; - case 25: - name = "Davao del Sur"; - break; - case 26: - name = "Davao Oriental"; - break; - case 27: - name = "Ifugao"; - break; - case 28: - name = "Ilocos Norte"; - break; - case 29: - name = "Ilocos Sur"; - break; - case 30: - name = "Iloilo"; - break; - case 31: - name = "Isabela"; - break; - case 32: - name = "Kalinga-Apayao"; - break; - case 33: - name = "Laguna"; - break; - case 34: - name = "Lanao del Norte"; - break; - case 35: - name = "Lanao del Sur"; - break; - case 36: - name = "La Union"; - break; - case 37: - name = "Leyte"; - break; - case 38: - name = "Marinduque"; - break; - case 39: - name = "Masbate"; - break; - case 40: - name = "Mindoro Occidental"; - break; - case 41: - name = "Mindoro Oriental"; - break; - case 42: - name = "Misamis Occidental"; - break; - case 43: - name = "Misamis Oriental"; - break; - case 44: - name = "Mountain"; - break; - case 45: - name = "Negros Occidental"; - break; - case 46: - name = "Negros Oriental"; - break; - case 47: - name = "Nueva Ecija"; - break; - case 48: - name = "Nueva Vizcaya"; - break; - case 49: - name = "Palawan"; - break; - case 50: - name = "Pampanga"; - break; - case 51: - name = "Pangasinan"; - break; - case 53: - name = "Rizal"; - break; - case 54: - name = "Romblon"; - break; - case 55: - name = "Samar"; - break; - case 56: - name = "Maguindanao"; - break; - case 57: - name = "North Cotabato"; - break; - case 58: - name = "Sorsogon"; - break; - case 59: - name = "Southern Leyte"; - break; - case 60: - name = "Sulu"; - break; - case 61: - name = "Surigao del Norte"; - break; - case 62: - name = "Surigao del Sur"; - break; - case 63: - name = "Tarlac"; - break; - case 64: - name = "Zambales"; - break; - case 65: - name = "Zamboanga del Norte"; - break; - case 66: - name = "Zamboanga del Sur"; - break; - case 67: - name = "Northern Samar"; - break; - case 68: - name = "Quirino"; - break; - case 69: - name = "Siquijor"; - break; - case 70: - name = "South Cotabato"; - break; - case 71: - name = "Sultan Kudarat"; - break; - case 72: - name = "Tawitawi"; - break; - case 832: - name = "Angeles"; - break; - case 833: - name = "Bacolod"; - break; - case 834: - name = "Bago"; - break; - case 835: - name = "Baguio"; - break; - case 836: - name = "Bais"; - break; - case 837: - name = "Basilan City"; - break; - case 838: - name = "Batangas City"; - break; - case 839: - name = "Butuan"; - break; - case 840: - name = "Cabanatuan"; - break; - case 875: - name = "Cadiz"; - break; - case 876: - name = "Cagayan de Oro"; - break; - case 877: - name = "Calbayog"; - break; - case 878: - name = "Caloocan"; - break; - case 879: - name = "Canlaon"; - break; - case 880: - name = "Cavite City"; - break; - case 881: - name = "Cebu City"; - break; - case 882: - name = "Cotabato"; - break; - case 883: - name = "Dagupan"; - break; - case 918: - name = "Danao"; - break; - case 919: - name = "Dapitan"; - break; - case 920: - name = "Davao City"; - break; - case 921: - name = "Dipolog"; - break; - case 922: - name = "Dumaguete"; - break; - case 923: - name = "General Santos"; - break; - case 924: - name = "Gingoog"; - break; - case 925: - name = "Iligan"; - break; - case 926: - name = "Iloilo City"; - break; - case 961: - name = "Iriga"; - break; - case 962: - name = "La Carlota"; - break; - case 963: - name = "Laoag"; - break; - case 964: - name = "Lapu-Lapu"; - break; - case 965: - name = "Legaspi"; - break; - case 966: - name = "Lipa"; - break; - case 967: - name = "Lucena"; - break; - case 968: - name = "Mandaue"; - break; - case 969: - name = "Manila"; - break; - case 1004: - name = "Marawi"; - break; - case 1005: - name = "Naga"; - break; - case 1006: - name = "Olongapo"; - break; - case 1007: - name = "Ormoc"; - break; - case 1008: - name = "Oroquieta"; - break; - case 1009: - name = "Ozamis"; - break; - case 1010: - name = "Pagadian"; - break; - case 1011: - name = "Palayan"; - break; - case 1012: - name = "Pasay"; - break; - case 1047: - name = "Puerto Princesa"; - break; - case 1048: - name = "Quezon City"; - break; - case 1049: - name = "Roxas"; - break; - case 1050: - name = "San Carlos"; - break; - case 1051: - name = "San Carlos"; - break; - case 1052: - name = "San Jose"; - break; - case 1053: - name = "San Pablo"; - break; - case 1054: - name = "Silay"; - break; - case 1055: - name = "Surigao"; - break; - case 1090: - name = "Tacloban"; - break; - case 1091: - name = "Tagaytay"; - break; - case 1092: - name = "Tagbilaran"; - break; - case 1093: - name = "Tangub"; - break; - case 1094: - name = "Toledo"; - break; - case 1095: - name = "Trece Martires"; - break; - case 1096: - name = "Zamboanga"; - break; - case 1097: - name = "Aurora"; - break; - case 1134: - name = "Quezon"; - break; - case 1135: - name = "Negros Occidental"; - break; - } - } - if (strcmp(country_code,"PK") == 0) { - switch (region_code2) { - case 1: - name = "Federally Administered Tribal Areas"; - break; - case 2: - name = "Balochistan"; - break; - case 3: - name = "North-West Frontier"; - break; - case 4: - name = "Punjab"; - break; - case 5: - name = "Sindh"; - break; - case 6: - name = "Azad Kashmir"; - break; - case 7: - name = "Northern Areas"; - break; - case 8: - name = "Islamabad"; - break; - } - } - if (strcmp(country_code,"PL") == 0) { - switch (region_code2) { - case 72: - name = "Dolnoslaskie"; - break; - case 73: - name = "Kujawsko-Pomorskie"; - break; - case 74: - name = "Lodzkie"; - break; - case 75: - name = "Lubelskie"; - break; - case 76: - name = "Lubuskie"; - break; - case 77: - name = "Malopolskie"; - break; - case 78: - name = "Mazowieckie"; - break; - case 79: - name = "Opolskie"; - break; - case 80: - name = "Podkarpackie"; - break; - case 81: - name = "Podlaskie"; - break; - case 82: - name = "Pomorskie"; - break; - case 83: - name = "Slaskie"; - break; - case 84: - name = "Swietokrzyskie"; - break; - case 85: - name = "Warminsko-Mazurskie"; - break; - case 86: - name = "Wielkopolskie"; - break; - case 87: - name = "Zachodniopomorskie"; - break; - } - } - if (strcmp(country_code,"PS") == 0) { - switch (region_code2) { - case 1131: - name = "Gaza"; - break; - case 1798: - name = "West Bank"; - break; - } - } - if (strcmp(country_code,"PT") == 0) { - switch (region_code2) { - case 2: - name = "Aveiro"; - break; - case 3: - name = "Beja"; - break; - case 4: - name = "Braga"; - break; - case 5: - name = "Braganca"; - break; - case 6: - name = "Castelo Branco"; - break; - case 7: - name = "Coimbra"; - break; - case 8: - name = "Evora"; - break; - case 9: - name = "Faro"; - break; - case 10: - name = "Madeira"; - break; - case 11: - name = "Guarda"; - break; - case 13: - name = "Leiria"; - break; - case 14: - name = "Lisboa"; - break; - case 16: - name = "Portalegre"; - break; - case 17: - name = "Porto"; - break; - case 18: - name = "Santarem"; - break; - case 19: - name = "Setubal"; - break; - case 20: - name = "Viana do Castelo"; - break; - case 21: - name = "Vila Real"; - break; - case 22: - name = "Viseu"; - break; - case 23: - name = "Azores"; - break; - } - } - if (strcmp(country_code,"PY") == 0) { - switch (region_code2) { - case 1: - name = "Alto Parana"; - break; - case 2: - name = "Amambay"; - break; - case 3: - name = "Boqueron"; - break; - case 4: - name = "Caaguazu"; - break; - case 5: - name = "Caazapa"; - break; - case 6: - name = "Central"; - break; - case 7: - name = "Concepcion"; - break; - case 8: - name = "Cordillera"; - break; - case 10: - name = "Guaira"; - break; - case 11: - name = "Itapua"; - break; - case 12: - name = "Misiones"; - break; - case 13: - name = "Neembucu"; - break; - case 15: - name = "Paraguari"; - break; - case 16: - name = "Presidente Hayes"; - break; - case 17: - name = "San Pedro"; - break; - case 19: - name = "Canindeyu"; - break; - case 20: - name = "Chaco"; - break; - case 21: - name = "Nueva Asuncion"; - break; - case 23: - name = "Alto Paraguay"; - break; - } - } - if (strcmp(country_code,"QA") == 0) { - switch (region_code2) { - case 1: - name = "Ad Dawhah"; - break; - case 2: - name = "Al Ghuwariyah"; - break; - case 3: - name = "Al Jumaliyah"; - break; - case 4: - name = "Al Khawr"; - break; - case 5: - name = "Al Wakrah Municipality"; - break; - case 6: - name = "Ar Rayyan"; - break; - case 8: - name = "Madinat ach Shamal"; - break; - case 9: - name = "Umm Salal"; - break; - case 10: - name = "Al Wakrah"; - break; - case 11: - name = "Jariyan al Batnah"; - break; - case 12: - name = "Umm Sa'id"; - break; - } - } - if (strcmp(country_code,"RO") == 0) { - switch (region_code2) { - case 1: - name = "Alba"; - break; - case 2: - name = "Arad"; - break; - case 3: - name = "Arges"; - break; - case 4: - name = "Bacau"; - break; - case 5: - name = "Bihor"; - break; - case 6: - name = "Bistrita-Nasaud"; - break; - case 7: - name = "Botosani"; - break; - case 8: - name = "Braila"; - break; - case 9: - name = "Brasov"; - break; - case 10: - name = "Bucuresti"; - break; - case 11: - name = "Buzau"; - break; - case 12: - name = "Caras-Severin"; - break; - case 13: - name = "Cluj"; - break; - case 14: - name = "Constanta"; - break; - case 15: - name = "Covasna"; - break; - case 16: - name = "Dambovita"; - break; - case 17: - name = "Dolj"; - break; - case 18: - name = "Galati"; - break; - case 19: - name = "Gorj"; - break; - case 20: - name = "Harghita"; - break; - case 21: - name = "Hunedoara"; - break; - case 22: - name = "Ialomita"; - break; - case 23: - name = "Iasi"; - break; - case 25: - name = "Maramures"; - break; - case 26: - name = "Mehedinti"; - break; - case 27: - name = "Mures"; - break; - case 28: - name = "Neamt"; - break; - case 29: - name = "Olt"; - break; - case 30: - name = "Prahova"; - break; - case 31: - name = "Salaj"; - break; - case 32: - name = "Satu Mare"; - break; - case 33: - name = "Sibiu"; - break; - case 34: - name = "Suceava"; - break; - case 35: - name = "Teleorman"; - break; - case 36: - name = "Timis"; - break; - case 37: - name = "Tulcea"; - break; - case 38: - name = "Vaslui"; - break; - case 39: - name = "Valcea"; - break; - case 40: - name = "Vrancea"; - break; - case 41: - name = "Calarasi"; - break; - case 42: - name = "Giurgiu"; - break; - case 43: - name = "Ilfov"; - break; - } - } - if (strcmp(country_code,"RS") == 0) { - switch (region_code2) { - case 1: - name = "Kosovo"; - break; - case 2: - name = "Vojvodina"; - break; - } - } - if (strcmp(country_code,"RU") == 0) { - switch (region_code2) { - case 1: - name = "Adygeya, Republic of"; - break; - case 2: - name = "Aginsky Buryatsky AO"; - break; - case 3: - name = "Gorno-Altay"; - break; - case 4: - name = "Altaisky krai"; - break; - case 5: - name = "Amur"; - break; - case 6: - name = "Arkhangel'sk"; - break; - case 7: - name = "Astrakhan'"; - break; - case 8: - name = "Bashkortostan"; - break; - case 9: - name = "Belgorod"; - break; - case 10: - name = "Bryansk"; - break; - case 11: - name = "Buryat"; - break; - case 12: - name = "Chechnya"; - break; - case 13: - name = "Chelyabinsk"; - break; - case 14: - name = "Chita"; - break; - case 15: - name = "Chukot"; - break; - case 16: - name = "Chuvashia"; - break; - case 17: - name = "Dagestan"; - break; - case 18: - name = "Evenk"; - break; - case 19: - name = "Ingush"; - break; - case 20: - name = "Irkutsk"; - break; - case 21: - name = "Ivanovo"; - break; - case 22: - name = "Kabardin-Balkar"; - break; - case 23: - name = "Kaliningrad"; - break; - case 24: - name = "Kalmyk"; - break; - case 25: - name = "Kaluga"; - break; - case 26: - name = "Kamchatka"; - break; - case 27: - name = "Karachay-Cherkess"; - break; - case 28: - name = "Karelia"; - break; - case 29: - name = "Kemerovo"; - break; - case 30: - name = "Khabarovsk"; - break; - case 31: - name = "Khakass"; - break; - case 32: - name = "Khanty-Mansiy"; - break; - case 33: - name = "Kirov"; - break; - case 34: - name = "Komi"; - break; - case 35: - name = "Komi-Permyak"; - break; - case 36: - name = "Koryak"; - break; - case 37: - name = "Kostroma"; - break; - case 38: - name = "Krasnodar"; - break; - case 39: - name = "Krasnoyarsk"; - break; - case 40: - name = "Kurgan"; - break; - case 41: - name = "Kursk"; - break; - case 42: - name = "Leningrad"; - break; - case 43: - name = "Lipetsk"; - break; - case 44: - name = "Magadan"; - break; - case 45: - name = "Mariy-El"; - break; - case 46: - name = "Mordovia"; - break; - case 47: - name = "Moskva"; - break; - case 48: - name = "Moscow City"; - break; - case 49: - name = "Murmansk"; - break; - case 50: - name = "Nenets"; - break; - case 51: - name = "Nizhegorod"; - break; - case 52: - name = "Novgorod"; - break; - case 53: - name = "Novosibirsk"; - break; - case 54: - name = "Omsk"; - break; - case 55: - name = "Orenburg"; - break; - case 56: - name = "Orel"; - break; - case 57: - name = "Penza"; - break; - case 58: - name = "Perm'"; - break; - case 59: - name = "Primor'ye"; - break; - case 60: - name = "Pskov"; - break; - case 61: - name = "Rostov"; - break; - case 62: - name = "Ryazan'"; - break; - case 63: - name = "Sakha"; - break; - case 64: - name = "Sakhalin"; - break; - case 65: - name = "Samara"; - break; - case 66: - name = "Saint Petersburg City"; - break; - case 67: - name = "Saratov"; - break; - case 68: - name = "North Ossetia"; - break; - case 69: - name = "Smolensk"; - break; - case 70: - name = "Stavropol'"; - break; - case 71: - name = "Sverdlovsk"; - break; - case 72: - name = "Tambovskaya oblast"; - break; - case 73: - name = "Tatarstan"; - break; - case 74: - name = "Taymyr"; - break; - case 75: - name = "Tomsk"; - break; - case 76: - name = "Tula"; - break; - case 77: - name = "Tver'"; - break; - case 78: - name = "Tyumen'"; - break; - case 79: - name = "Tuva"; - break; - case 80: - name = "Udmurt"; - break; - case 81: - name = "Ul'yanovsk"; - break; - case 82: - name = "Ust-Orda Buryat"; - break; - case 83: - name = "Vladimir"; - break; - case 84: - name = "Volgograd"; - break; - case 85: - name = "Vologda"; - break; - case 86: - name = "Voronezh"; - break; - case 87: - name = "Yamal-Nenets"; - break; - case 88: - name = "Yaroslavl'"; - break; - case 89: - name = "Yevrey"; - break; - case 90: - name = "Permskiy Kray"; - break; - case 91: - name = "Krasnoyarskiy Kray"; - break; - case 942: - name = "Chechnya Republic"; - break; - } - } - if (strcmp(country_code,"RW") == 0) { - switch (region_code2) { - case 1: - name = "Butare"; - break; - case 6: - name = "Gitarama"; - break; - case 7: - name = "Kibungo"; - break; - case 9: - name = "Kigali"; - break; - case 11: - name = "Est"; - break; - case 12: - name = "Kigali"; - break; - case 13: - name = "Nord"; - break; - case 14: - name = "Ouest"; - break; - case 15: - name = "Sud"; - break; - } - } - if (strcmp(country_code,"SA") == 0) { - switch (region_code2) { - case 2: - name = "Al Bahah"; - break; - case 3: - name = "Al Jawf"; - break; - case 5: - name = "Al Madinah"; - break; - case 6: - name = "Ash Sharqiyah"; - break; - case 8: - name = "Al Qasim"; - break; - case 9: - name = "Al Qurayyat"; - break; - case 10: - name = "Ar Riyad"; - break; - case 13: - name = "Ha'il"; - break; - case 14: - name = "Makkah"; - break; - case 15: - name = "Al Hudud ash Shamaliyah"; - break; - case 16: - name = "Najran"; - break; - case 17: - name = "Jizan"; - break; - case 19: - name = "Tabuk"; - break; - case 20: - name = "Al Jawf"; - break; - } - } - if (strcmp(country_code,"SB") == 0) { - switch (region_code2) { - case 3: - name = "Malaita"; - break; - case 6: - name = "Guadalcanal"; - break; - case 7: - name = "Isabel"; - break; - case 8: - name = "Makira"; - break; - case 9: - name = "Temotu"; - break; - case 10: - name = "Central"; - break; - case 11: - name = "Western"; - break; - case 12: - name = "Choiseul"; - break; - case 13: - name = "Rennell and Bellona"; - break; - } - } - if (strcmp(country_code,"SC") == 0) { - switch (region_code2) { - case 1: - name = "Anse aux Pins"; - break; - case 2: - name = "Anse Boileau"; - break; - case 3: - name = "Anse Etoile"; - break; - case 4: - name = "Anse Louis"; - break; - case 5: - name = "Anse Royale"; - break; - case 6: - name = "Baie Lazare"; - break; - case 7: - name = "Baie Sainte Anne"; - break; - case 8: - name = "Beau Vallon"; - break; - case 9: - name = "Bel Air"; - break; - case 10: - name = "Bel Ombre"; - break; - case 11: - name = "Cascade"; - break; - case 12: - name = "Glacis"; - break; - case 13: - name = "Grand' Anse"; - break; - case 14: - name = "Grand' Anse"; - break; - case 15: - name = "La Digue"; - break; - case 16: - name = "La Riviere Anglaise"; - break; - case 17: - name = "Mont Buxton"; - break; - case 18: - name = "Mont Fleuri"; - break; - case 19: - name = "Plaisance"; - break; - case 20: - name = "Pointe La Rue"; - break; - case 21: - name = "Port Glaud"; - break; - case 22: - name = "Saint Louis"; - break; - case 23: - name = "Takamaka"; - break; - } - } - if (strcmp(country_code,"SD") == 0) { - switch (region_code2) { - case 27: - name = "Al Wusta"; - break; - case 28: - name = "Al Istiwa'iyah"; - break; - case 29: - name = "Al Khartum"; - break; - case 30: - name = "Ash Shamaliyah"; - break; - case 31: - name = "Ash Sharqiyah"; - break; - case 32: - name = "Bahr al Ghazal"; - break; - case 33: - name = "Darfur"; - break; - case 34: - name = "Kurdufan"; - break; - case 35: - name = "Upper Nile"; - break; - case 40: - name = "Al Wahadah State"; - break; - case 44: - name = "Central Equatoria State"; - break; - } - } - if (strcmp(country_code,"SE") == 0) { - switch (region_code2) { - case 2: - name = "Blekinge Lan"; - break; - case 3: - name = "Gavleborgs Lan"; - break; - case 5: - name = "Gotlands Lan"; - break; - case 6: - name = "Hallands Lan"; - break; - case 7: - name = "Jamtlands Lan"; - break; - case 8: - name = "Jonkopings Lan"; - break; - case 9: - name = "Kalmar Lan"; - break; - case 10: - name = "Dalarnas Lan"; - break; - case 12: - name = "Kronobergs Lan"; - break; - case 14: - name = "Norrbottens Lan"; - break; - case 15: - name = "Orebro Lan"; - break; - case 16: - name = "Ostergotlands Lan"; - break; - case 18: - name = "Sodermanlands Lan"; - break; - case 21: - name = "Uppsala Lan"; - break; - case 22: - name = "Varmlands Lan"; - break; - case 23: - name = "Vasterbottens Lan"; - break; - case 24: - name = "Vasternorrlands Lan"; - break; - case 25: - name = "Vastmanlands Lan"; - break; - case 26: - name = "Stockholms Lan"; - break; - case 27: - name = "Skane Lan"; - break; - case 28: - name = "Vastra Gotaland"; - break; - } - } - if (strcmp(country_code,"SH") == 0) { - switch (region_code2) { - case 1: - name = "Ascension"; - break; - case 2: - name = "Saint Helena"; - break; - case 3: - name = "Tristan da Cunha"; - break; - } - } - if (strcmp(country_code,"SI") == 0) { - switch (region_code2) { - case 1: - name = "Ajdovscina"; - break; - case 2: - name = "Beltinci"; - break; - case 3: - name = "Bled"; - break; - case 4: - name = "Bohinj"; - break; - case 5: - name = "Borovnica"; - break; - case 6: - name = "Bovec"; - break; - case 7: - name = "Brda"; - break; - case 8: - name = "Brezice"; - break; - case 9: - name = "Brezovica"; - break; - case 11: - name = "Celje"; - break; - case 12: - name = "Cerklje na Gorenjskem"; - break; - case 13: - name = "Cerknica"; - break; - case 14: - name = "Cerkno"; - break; - case 15: - name = "Crensovci"; - break; - case 16: - name = "Crna na Koroskem"; - break; - case 17: - name = "Crnomelj"; - break; - case 19: - name = "Divaca"; - break; - case 20: - name = "Dobrepolje"; - break; - case 22: - name = "Dol pri Ljubljani"; - break; - case 24: - name = "Dornava"; - break; - case 25: - name = "Dravograd"; - break; - case 26: - name = "Duplek"; - break; - case 27: - name = "Gorenja Vas-Poljane"; - break; - case 28: - name = "Gorisnica"; - break; - case 29: - name = "Gornja Radgona"; - break; - case 30: - name = "Gornji Grad"; - break; - case 31: - name = "Gornji Petrovci"; - break; - case 32: - name = "Grosuplje"; - break; - case 34: - name = "Hrastnik"; - break; - case 35: - name = "Hrpelje-Kozina"; - break; - case 36: - name = "Idrija"; - break; - case 37: - name = "Ig"; - break; - case 38: - name = "Ilirska Bistrica"; - break; - case 39: - name = "Ivancna Gorica"; - break; - case 40: - name = "Izola-Isola"; - break; - case 42: - name = "Jursinci"; - break; - case 44: - name = "Kanal"; - break; - case 45: - name = "Kidricevo"; - break; - case 46: - name = "Kobarid"; - break; - case 47: - name = "Kobilje"; - break; - case 49: - name = "Komen"; - break; - case 50: - name = "Koper-Capodistria"; - break; - case 51: - name = "Kozje"; - break; - case 52: - name = "Kranj"; - break; - case 53: - name = "Kranjska Gora"; - break; - case 54: - name = "Krsko"; - break; - case 55: - name = "Kungota"; - break; - case 57: - name = "Lasko"; - break; - case 61: - name = "Ljubljana"; - break; - case 62: - name = "Ljubno"; - break; - case 64: - name = "Logatec"; - break; - case 66: - name = "Loski Potok"; - break; - case 68: - name = "Lukovica"; - break; - case 71: - name = "Medvode"; - break; - case 72: - name = "Menges"; - break; - case 73: - name = "Metlika"; - break; - case 74: - name = "Mezica"; - break; - case 76: - name = "Mislinja"; - break; - case 77: - name = "Moravce"; - break; - case 78: - name = "Moravske Toplice"; - break; - case 79: - name = "Mozirje"; - break; - case 80: - name = "Murska Sobota"; - break; - case 81: - name = "Muta"; - break; - case 82: - name = "Naklo"; - break; - case 83: - name = "Nazarje"; - break; - case 84: - name = "Nova Gorica"; - break; - case 86: - name = "Odranci"; - break; - case 87: - name = "Ormoz"; - break; - case 88: - name = "Osilnica"; - break; - case 89: - name = "Pesnica"; - break; - case 91: - name = "Pivka"; - break; - case 92: - name = "Podcetrtek"; - break; - case 94: - name = "Postojna"; - break; - case 97: - name = "Puconci"; - break; - case 98: - name = "Racam"; - break; - case 99: - name = "Radece"; - break; - case 832: - name = "Radenci"; - break; - case 833: - name = "Radlje ob Dravi"; - break; - case 834: - name = "Radovljica"; - break; - case 837: - name = "Rogasovci"; - break; - case 838: - name = "Rogaska Slatina"; - break; - case 839: - name = "Rogatec"; - break; - case 875: - name = "Semic"; - break; - case 876: - name = "Sencur"; - break; - case 877: - name = "Sentilj"; - break; - case 878: - name = "Sentjernej"; - break; - case 880: - name = "Sevnica"; - break; - case 881: - name = "Sezana"; - break; - case 882: - name = "Skocjan"; - break; - case 883: - name = "Skofja Loka"; - break; - case 918: - name = "Skofljica"; - break; - case 919: - name = "Slovenj Gradec"; - break; - case 921: - name = "Slovenske Konjice"; - break; - case 922: - name = "Smarje pri Jelsah"; - break; - case 923: - name = "Smartno ob Paki"; - break; - case 924: - name = "Sostanj"; - break; - case 925: - name = "Starse"; - break; - case 926: - name = "Store"; - break; - case 961: - name = "Sveti Jurij"; - break; - case 962: - name = "Tolmin"; - break; - case 963: - name = "Trbovlje"; - break; - case 964: - name = "Trebnje"; - break; - case 965: - name = "Trzic"; - break; - case 966: - name = "Turnisce"; - break; - case 967: - name = "Velenje"; - break; - case 968: - name = "Velike Lasce"; - break; - case 1004: - name = "Vipava"; - break; - case 1005: - name = "Vitanje"; - break; - case 1006: - name = "Vodice"; - break; - case 1008: - name = "Vrhnika"; - break; - case 1009: - name = "Vuzenica"; - break; - case 1010: - name = "Zagorje ob Savi"; - break; - case 1012: - name = "Zavrc"; - break; - case 1047: - name = "Zelezniki"; - break; - case 1048: - name = "Ziri"; - break; - case 1049: - name = "Zrece"; - break; - case 1093: - name = "Dobrova-Horjul-Polhov Gradec"; - break; - case 1096: - name = "Domzale"; - break; - case 1136: - name = "Jesenice"; - break; - case 1138: - name = "Kamnik"; - break; - case 1139: - name = "Kocevje"; - break; - case 1177: - name = "Kuzma"; - break; - case 1178: - name = "Lenart"; - break; - case 1180: - name = "Litija"; - break; - case 1181: - name = "Ljutomer"; - break; - case 1182: - name = "Loska Dolina"; - break; - case 1184: - name = "Luce"; - break; - case 1219: - name = "Majsperk"; - break; - case 1220: - name = "Maribor"; - break; - case 1223: - name = "Miren-Kostanjevica"; - break; - case 1225: - name = "Novo Mesto"; - break; - case 1227: - name = "Piran"; - break; - case 1266: - name = "Preddvor"; - break; - case 1268: - name = "Ptuj"; - break; - case 1305: - name = "Ribnica"; - break; - case 1307: - name = "Ruse"; - break; - case 1311: - name = "Sentjur pri Celju"; - break; - case 1312: - name = "Slovenska Bistrica"; - break; - case 1392: - name = "Videm"; - break; - case 1393: - name = "Vojnik"; - break; - case 1395: - name = "Zalec"; - break; - } - } - if (strcmp(country_code,"SK") == 0) { - switch (region_code2) { - case 1: - name = "Banska Bystrica"; - break; - case 2: - name = "Bratislava"; - break; - case 3: - name = "Kosice"; - break; - case 4: - name = "Nitra"; - break; - case 5: - name = "Presov"; - break; - case 6: - name = "Trencin"; - break; - case 7: - name = "Trnava"; - break; - case 8: - name = "Zilina"; - break; - } - } - if (strcmp(country_code,"SL") == 0) { - switch (region_code2) { - case 1: - name = "Eastern"; - break; - case 2: - name = "Northern"; - break; - case 3: - name = "Southern"; - break; - case 4: - name = "Western Area"; - break; - } - } - if (strcmp(country_code,"SM") == 0) { - switch (region_code2) { - case 1: - name = "Acquaviva"; - break; - case 2: - name = "Chiesanuova"; - break; - case 3: - name = "Domagnano"; - break; - case 4: - name = "Faetano"; - break; - case 5: - name = "Fiorentino"; - break; - case 6: - name = "Borgo Maggiore"; - break; - case 7: - name = "San Marino"; - break; - case 8: - name = "Monte Giardino"; - break; - case 9: - name = "Serravalle"; - break; - } - } - if (strcmp(country_code,"SN") == 0) { - switch (region_code2) { - case 1: - name = "Dakar"; - break; - case 3: - name = "Diourbel"; - break; - case 5: - name = "Tambacounda"; - break; - case 7: - name = "Thies"; - break; - case 9: - name = "Fatick"; - break; - case 10: - name = "Kaolack"; - break; - case 11: - name = "Kolda"; - break; - case 12: - name = "Ziguinchor"; - break; - case 13: - name = "Louga"; - break; - case 14: - name = "Saint-Louis"; - break; - case 15: - name = "Matam"; - break; - } - } - if (strcmp(country_code,"SO") == 0) { - switch (region_code2) { - case 1: - name = "Bakool"; - break; - case 2: - name = "Banaadir"; - break; - case 3: - name = "Bari"; - break; - case 4: - name = "Bay"; - break; - case 5: - name = "Galguduud"; - break; - case 6: - name = "Gedo"; - break; - case 7: - name = "Hiiraan"; - break; - case 8: - name = "Jubbada Dhexe"; - break; - case 9: - name = "Jubbada Hoose"; - break; - case 10: - name = "Mudug"; - break; - case 11: - name = "Nugaal"; - break; - case 12: - name = "Sanaag"; - break; - case 13: - name = "Shabeellaha Dhexe"; - break; - case 14: - name = "Shabeellaha Hoose"; - break; - case 16: - name = "Woqooyi Galbeed"; - break; - case 18: - name = "Nugaal"; - break; - case 19: - name = "Togdheer"; - break; - case 20: - name = "Woqooyi Galbeed"; - break; - case 21: - name = "Awdal"; - break; - case 22: - name = "Sool"; - break; - } - } - if (strcmp(country_code,"SR") == 0) { - switch (region_code2) { - case 10: - name = "Brokopondo"; - break; - case 11: - name = "Commewijne"; - break; - case 12: - name = "Coronie"; - break; - case 13: - name = "Marowijne"; - break; - case 14: - name = "Nickerie"; - break; - case 15: - name = "Para"; - break; - case 16: - name = "Paramaribo"; - break; - case 17: - name = "Saramacca"; - break; - case 18: - name = "Sipaliwini"; - break; - case 19: - name = "Wanica"; - break; - } - } - if (strcmp(country_code,"ST") == 0) { - switch (region_code2) { - case 1: - name = "Principe"; - break; - case 2: - name = "Sao Tome"; - break; - } - } - if (strcmp(country_code,"SV") == 0) { - switch (region_code2) { - case 1: - name = "Ahuachapan"; - break; - case 2: - name = "Cabanas"; - break; - case 3: - name = "Chalatenango"; - break; - case 4: - name = "Cuscatlan"; - break; - case 5: - name = "La Libertad"; - break; - case 6: - name = "La Paz"; - break; - case 7: - name = "La Union"; - break; - case 8: - name = "Morazan"; - break; - case 9: - name = "San Miguel"; - break; - case 10: - name = "San Salvador"; - break; - case 11: - name = "Santa Ana"; - break; - case 12: - name = "San Vicente"; - break; - case 13: - name = "Sonsonate"; - break; - case 14: - name = "Usulutan"; - break; - } - } - if (strcmp(country_code,"SY") == 0) { - switch (region_code2) { - case 1: - name = "Al Hasakah"; - break; - case 2: - name = "Al Ladhiqiyah"; - break; - case 3: - name = "Al Qunaytirah"; - break; - case 4: - name = "Ar Raqqah"; - break; - case 5: - name = "As Suwayda'"; - break; - case 6: - name = "Dar"; - break; - case 7: - name = "Dayr az Zawr"; - break; - case 8: - name = "Rif Dimashq"; - break; - case 9: - name = "Halab"; - break; - case 10: - name = "Hamah"; - break; - case 11: - name = "Hims"; - break; - case 12: - name = "Idlib"; - break; - case 13: - name = "Dimashq"; - break; - case 14: - name = "Tartus"; - break; - } - } - if (strcmp(country_code,"SZ") == 0) { - switch (region_code2) { - case 1: - name = "Hhohho"; - break; - case 2: - name = "Lubombo"; - break; - case 3: - name = "Manzini"; - break; - case 4: - name = "Shiselweni"; - break; - case 5: - name = "Praslin"; - break; - } - } - if (strcmp(country_code,"TD") == 0) { - switch (region_code2) { - case 1: - name = "Batha"; - break; - case 2: - name = "Biltine"; - break; - case 3: - name = "Borkou-Ennedi-Tibesti"; - break; - case 4: - name = "Chari-Baguirmi"; - break; - case 5: - name = "Guera"; - break; - case 6: - name = "Kanem"; - break; - case 7: - name = "Lac"; - break; - case 8: - name = "Logone Occidental"; - break; - case 9: - name = "Logone Oriental"; - break; - case 10: - name = "Mayo-Kebbi"; - break; - case 11: - name = "Moyen-Chari"; - break; - case 12: - name = "Ouaddai"; - break; - case 13: - name = "Salamat"; - break; - case 14: - name = "Tandjile"; - break; - } - } - if (strcmp(country_code,"TG") == 0) { - switch (region_code2) { - case 22: - name = "Centrale"; - break; - case 23: - name = "Kara"; - break; - case 24: - name = "Maritime"; - break; - case 25: - name = "Plateaux"; - break; - case 26: - name = "Savanes"; - break; - } - } - if (strcmp(country_code,"TH") == 0) { - switch (region_code2) { - case 1: - name = "Mae Hong Son"; - break; - case 2: - name = "Chiang Mai"; - break; - case 3: - name = "Chiang Rai"; - break; - case 4: - name = "Nan"; - break; - case 5: - name = "Lamphun"; - break; - case 6: - name = "Lampang"; - break; - case 7: - name = "Phrae"; - break; - case 8: - name = "Tak"; - break; - case 9: - name = "Sukhothai"; - break; - case 10: - name = "Uttaradit"; - break; - case 11: - name = "Kamphaeng Phet"; - break; - case 12: - name = "Phitsanulok"; - break; - case 13: - name = "Phichit"; - break; - case 14: - name = "Phetchabun"; - break; - case 15: - name = "Uthai Thani"; - break; - case 16: - name = "Nakhon Sawan"; - break; - case 17: - name = "Nong Khai"; - break; - case 18: - name = "Loei"; - break; - case 20: - name = "Sakon Nakhon"; - break; - case 21: - name = "Nakhon Phanom"; - break; - case 22: - name = "Khon Kaen"; - break; - case 23: - name = "Kalasin"; - break; - case 24: - name = "Maha Sarakham"; - break; - case 25: - name = "Roi Et"; - break; - case 26: - name = "Chaiyaphum"; - break; - case 27: - name = "Nakhon Ratchasima"; - break; - case 28: - name = "Buriram"; - break; - case 29: - name = "Surin"; - break; - case 30: - name = "Sisaket"; - break; - case 31: - name = "Narathiwat"; - break; - case 32: - name = "Chai Nat"; - break; - case 33: - name = "Sing Buri"; - break; - case 34: - name = "Lop Buri"; - break; - case 35: - name = "Ang Thong"; - break; - case 36: - name = "Phra Nakhon Si Ayutthaya"; - break; - case 37: - name = "Saraburi"; - break; - case 38: - name = "Nonthaburi"; - break; - case 39: - name = "Pathum Thani"; - break; - case 40: - name = "Krung Thep"; - break; - case 41: - name = "Phayao"; - break; - case 42: - name = "Samut Prakan"; - break; - case 43: - name = "Nakhon Nayok"; - break; - case 44: - name = "Chachoengsao"; - break; - case 45: - name = "Prachin Buri"; - break; - case 46: - name = "Chon Buri"; - break; - case 47: - name = "Rayong"; - break; - case 48: - name = "Chanthaburi"; - break; - case 49: - name = "Trat"; - break; - case 50: - name = "Kanchanaburi"; - break; - case 51: - name = "Suphan Buri"; - break; - case 52: - name = "Ratchaburi"; - break; - case 53: - name = "Nakhon Pathom"; - break; - case 54: - name = "Samut Songkhram"; - break; - case 55: - name = "Samut Sakhon"; - break; - case 56: - name = "Phetchaburi"; - break; - case 57: - name = "Prachuap Khiri Khan"; - break; - case 58: - name = "Chumphon"; - break; - case 59: - name = "Ranong"; - break; - case 60: - name = "Surat Thani"; - break; - case 61: - name = "Phangnga"; - break; - case 62: - name = "Phuket"; - break; - case 63: - name = "Krabi"; - break; - case 64: - name = "Nakhon Si Thammarat"; - break; - case 65: - name = "Trang"; - break; - case 66: - name = "Phatthalung"; - break; - case 67: - name = "Satun"; - break; - case 68: - name = "Songkhla"; - break; - case 69: - name = "Pattani"; - break; - case 70: - name = "Yala"; - break; - case 71: - name = "Ubon Ratchathani"; - break; - case 72: - name = "Yasothon"; - break; - case 73: - name = "Nakhon Phanom"; - break; - case 75: - name = "Ubon Ratchathani"; - break; - case 76: - name = "Udon Thani"; - break; - case 77: - name = "Amnat Charoen"; - break; - case 78: - name = "Mukdahan"; - break; - case 79: - name = "Nong Bua Lamphu"; - break; - case 80: - name = "Sa Kaeo"; - break; - } - } - if (strcmp(country_code,"TJ") == 0) { - switch (region_code2) { - case 1: - name = "Kuhistoni Badakhshon"; - break; - case 2: - name = "Khatlon"; - break; - case 3: - name = "Sughd"; - break; - } - } - if (strcmp(country_code,"TM") == 0) { - switch (region_code2) { - case 1: - name = "Ahal"; - break; - case 2: - name = "Balkan"; - break; - case 3: - name = "Dashoguz"; - break; - case 4: - name = "Lebap"; - break; - case 5: - name = "Mary"; - break; - } - } - if (strcmp(country_code,"TN") == 0) { - switch (region_code2) { - case 2: - name = "Kasserine"; - break; - case 3: - name = "Kairouan"; - break; - case 6: - name = "Jendouba"; - break; - case 10: - name = "Qafsah"; - break; - case 14: - name = "El Kef"; - break; - case 15: - name = "Al Mahdia"; - break; - case 16: - name = "Al Munastir"; - break; - case 17: - name = "Bajah"; - break; - case 18: - name = "Bizerte"; - break; - case 19: - name = "Nabeul"; - break; - case 22: - name = "Siliana"; - break; - case 23: - name = "Sousse"; - break; - case 27: - name = "Ben Arous"; - break; - case 28: - name = "Madanin"; - break; - case 29: - name = "Gabes"; - break; - case 31: - name = "Kebili"; - break; - case 32: - name = "Sfax"; - break; - case 33: - name = "Sidi Bou Zid"; - break; - case 34: - name = "Tataouine"; - break; - case 35: - name = "Tozeur"; - break; - case 36: - name = "Tunis"; - break; - case 37: - name = "Zaghouan"; - break; - case 38: - name = "Aiana"; - break; - case 39: - name = "Manouba"; - break; - } - } - if (strcmp(country_code,"TO") == 0) { - switch (region_code2) { - case 1: - name = "Ha"; - break; - case 2: - name = "Tongatapu"; - break; - case 3: - name = "Vava"; - break; - } - } - if (strcmp(country_code,"TR") == 0) { - switch (region_code2) { - case 2: - name = "Adiyaman"; - break; - case 3: - name = "Afyonkarahisar"; - break; - case 4: - name = "Agri"; - break; - case 5: - name = "Amasya"; - break; - case 7: - name = "Antalya"; - break; - case 8: - name = "Artvin"; - break; - case 9: - name = "Aydin"; - break; - case 10: - name = "Balikesir"; - break; - case 11: - name = "Bilecik"; - break; - case 12: - name = "Bingol"; - break; - case 13: - name = "Bitlis"; - break; - case 14: - name = "Bolu"; - break; - case 15: - name = "Burdur"; - break; - case 16: - name = "Bursa"; - break; - case 17: - name = "Canakkale"; - break; - case 19: - name = "Corum"; - break; - case 20: - name = "Denizli"; - break; - case 21: - name = "Diyarbakir"; - break; - case 22: - name = "Edirne"; - break; - case 23: - name = "Elazig"; - break; - case 24: - name = "Erzincan"; - break; - case 25: - name = "Erzurum"; - break; - case 26: - name = "Eskisehir"; - break; - case 28: - name = "Giresun"; - break; - case 31: - name = "Hatay"; - break; - case 32: - name = "Mersin"; - break; - case 33: - name = "Isparta"; - break; - case 34: - name = "Istanbul"; - break; - case 35: - name = "Izmir"; - break; - case 37: - name = "Kastamonu"; - break; - case 38: - name = "Kayseri"; - break; - case 39: - name = "Kirklareli"; - break; - case 40: - name = "Kirsehir"; - break; - case 41: - name = "Kocaeli"; - break; - case 43: - name = "Kutahya"; - break; - case 44: - name = "Malatya"; - break; - case 45: - name = "Manisa"; - break; - case 46: - name = "Kahramanmaras"; - break; - case 48: - name = "Mugla"; - break; - case 49: - name = "Mus"; - break; - case 50: - name = "Nevsehir"; - break; - case 52: - name = "Ordu"; - break; - case 53: - name = "Rize"; - break; - case 54: - name = "Sakarya"; - break; - case 55: - name = "Samsun"; - break; - case 57: - name = "Sinop"; - break; - case 58: - name = "Sivas"; - break; - case 59: - name = "Tekirdag"; - break; - case 60: - name = "Tokat"; - break; - case 61: - name = "Trabzon"; - break; - case 62: - name = "Tunceli"; - break; - case 63: - name = "Sanliurfa"; - break; - case 64: - name = "Usak"; - break; - case 65: - name = "Van"; - break; - case 66: - name = "Yozgat"; - break; - case 68: - name = "Ankara"; - break; - case 69: - name = "Gumushane"; - break; - case 70: - name = "Hakkari"; - break; - case 71: - name = "Konya"; - break; - case 72: - name = "Mardin"; - break; - case 73: - name = "Nigde"; - break; - case 74: - name = "Siirt"; - break; - case 75: - name = "Aksaray"; - break; - case 76: - name = "Batman"; - break; - case 77: - name = "Bayburt"; - break; - case 78: - name = "Karaman"; - break; - case 79: - name = "Kirikkale"; - break; - case 80: - name = "Sirnak"; - break; - case 81: - name = "Adana"; - break; - case 82: - name = "Cankiri"; - break; - case 83: - name = "Gaziantep"; - break; - case 84: - name = "Kars"; - break; - case 85: - name = "Zonguldak"; - break; - case 86: - name = "Ardahan"; - break; - case 87: - name = "Bartin"; - break; - case 88: - name = "Igdir"; - break; - case 89: - name = "Karabuk"; - break; - case 90: - name = "Kilis"; - break; - case 91: - name = "Osmaniye"; - break; - case 92: - name = "Yalova"; - break; - case 93: - name = "Duzce"; - break; - } - } - if (strcmp(country_code,"TT") == 0) { - switch (region_code2) { - case 1: - name = "Arima"; - break; - case 2: - name = "Caroni"; - break; - case 3: - name = "Mayaro"; - break; - case 4: - name = "Nariva"; - break; - case 5: - name = "Port-of-Spain"; - break; - case 6: - name = "Saint Andrew"; - break; - case 7: - name = "Saint David"; - break; - case 8: - name = "Saint George"; - break; - case 9: - name = "Saint Patrick"; - break; - case 10: - name = "San Fernando"; - break; - case 11: - name = "Tobago"; - break; - case 12: - name = "Victoria"; - break; - } - } - if (strcmp(country_code,"TW") == 0) { - switch (region_code2) { - case 1: - name = "Fu-chien"; - break; - case 2: - name = "Kao-hsiung"; - break; - case 3: - name = "T'ai-pei"; - break; - case 4: - name = "T'ai-wan"; - break; - } - } - if (strcmp(country_code,"TZ") == 0) { - switch (region_code2) { - case 2: - name = "Pwani"; - break; - case 3: - name = "Dodoma"; - break; - case 4: - name = "Iringa"; - break; - case 5: - name = "Kigoma"; - break; - case 6: - name = "Kilimanjaro"; - break; - case 7: - name = "Lindi"; - break; - case 8: - name = "Mara"; - break; - case 9: - name = "Mbeya"; - break; - case 10: - name = "Morogoro"; - break; - case 11: - name = "Mtwara"; - break; - case 12: - name = "Mwanza"; - break; - case 13: - name = "Pemba North"; - break; - case 14: - name = "Ruvuma"; - break; - case 15: - name = "Shinyanga"; - break; - case 16: - name = "Singida"; - break; - case 17: - name = "Tabora"; - break; - case 18: - name = "Tanga"; - break; - case 19: - name = "Kagera"; - break; - case 20: - name = "Pemba South"; - break; - case 21: - name = "Zanzibar Central"; - break; - case 22: - name = "Zanzibar North"; - break; - case 23: - name = "Dar es Salaam"; - break; - case 24: - name = "Rukwa"; - break; - case 25: - name = "Zanzibar Urban"; - break; - case 26: - name = "Arusha"; - break; - case 27: - name = "Manyara"; - break; - } - } - if (strcmp(country_code,"UA") == 0) { - switch (region_code2) { - case 1: - name = "Cherkas'ka Oblast'"; - break; - case 2: - name = "Chernihivs'ka Oblast'"; - break; - case 3: - name = "Chernivets'ka Oblast'"; - break; - case 4: - name = "Dnipropetrovs'ka Oblast'"; - break; - case 5: - name = "Donets'ka Oblast'"; - break; - case 6: - name = "Ivano-Frankivs'ka Oblast'"; - break; - case 7: - name = "Kharkivs'ka Oblast'"; - break; - case 8: - name = "Khersons'ka Oblast'"; - break; - case 9: - name = "Khmel'nyts'ka Oblast'"; - break; - case 10: - name = "Kirovohrads'ka Oblast'"; - break; - case 11: - name = "Krym"; - break; - case 12: - name = "Kyyiv"; - break; - case 13: - name = "Kyyivs'ka Oblast'"; - break; - case 14: - name = "Luhans'ka Oblast'"; - break; - case 15: - name = "L'vivs'ka Oblast'"; - break; - case 16: - name = "Mykolayivs'ka Oblast'"; - break; - case 17: - name = "Odes'ka Oblast'"; - break; - case 18: - name = "Poltavs'ka Oblast'"; - break; - case 19: - name = "Rivnens'ka Oblast'"; - break; - case 20: - name = "Sevastopol'"; - break; - case 21: - name = "Sums'ka Oblast'"; - break; - case 22: - name = "Ternopil's'ka Oblast'"; - break; - case 23: - name = "Vinnyts'ka Oblast'"; - break; - case 24: - name = "Volyns'ka Oblast'"; - break; - case 25: - name = "Zakarpats'ka Oblast'"; - break; - case 26: - name = "Zaporiz'ka Oblast'"; - break; - case 27: - name = "Zhytomyrs'ka Oblast'"; - break; - } - } - if (strcmp(country_code,"UG") == 0) { - switch (region_code2) { - case 26: - name = "Apac"; - break; - case 28: - name = "Bundibugyo"; - break; - case 29: - name = "Bushenyi"; - break; - case 30: - name = "Gulu"; - break; - case 31: - name = "Hoima"; - break; - case 33: - name = "Jinja"; - break; - case 36: - name = "Kalangala"; - break; - case 37: - name = "Kampala"; - break; - case 38: - name = "Kamuli"; - break; - case 39: - name = "Kapchorwa"; - break; - case 40: - name = "Kasese"; - break; - case 41: - name = "Kibale"; - break; - case 42: - name = "Kiboga"; - break; - case 43: - name = "Kisoro"; - break; - case 45: - name = "Kotido"; - break; - case 46: - name = "Kumi"; - break; - case 47: - name = "Lira"; - break; - case 50: - name = "Masindi"; - break; - case 52: - name = "Mbarara"; - break; - case 56: - name = "Mubende"; - break; - case 58: - name = "Nebbi"; - break; - case 59: - name = "Ntungamo"; - break; - case 60: - name = "Pallisa"; - break; - case 61: - name = "Rakai"; - break; - case 65: - name = "Adjumani"; - break; - case 66: - name = "Bugiri"; - break; - case 67: - name = "Busia"; - break; - case 69: - name = "Katakwi"; - break; - case 70: - name = "Luwero"; - break; - case 71: - name = "Masaka"; - break; - case 72: - name = "Moyo"; - break; - case 73: - name = "Nakasongola"; - break; - case 74: - name = "Sembabule"; - break; - case 76: - name = "Tororo"; - break; - case 77: - name = "Arua"; - break; - case 78: - name = "Iganga"; - break; - case 79: - name = "Kabarole"; - break; - case 80: - name = "Kaberamaido"; - break; - case 81: - name = "Kamwenge"; - break; - case 82: - name = "Kanungu"; - break; - case 83: - name = "Kayunga"; - break; - case 84: - name = "Kitgum"; - break; - case 85: - name = "Kyenjojo"; - break; - case 86: - name = "Mayuge"; - break; - case 87: - name = "Mbale"; - break; - case 88: - name = "Moroto"; - break; - case 89: - name = "Mpigi"; - break; - case 90: - name = "Mukono"; - break; - case 91: - name = "Nakapiripirit"; - break; - case 92: - name = "Pader"; - break; - case 93: - name = "Rukungiri"; - break; - case 94: - name = "Sironko"; - break; - case 95: - name = "Soroti"; - break; - case 96: - name = "Wakiso"; - break; - case 97: - name = "Yumbe"; - break; - } - } - if (strcmp(country_code,"UY") == 0) { - switch (region_code2) { - case 1: - name = "Artigas"; - break; - case 2: - name = "Canelones"; - break; - case 3: - name = "Cerro Largo"; - break; - case 4: - name = "Colonia"; - break; - case 5: - name = "Durazno"; - break; - case 6: - name = "Flores"; - break; - case 7: - name = "Florida"; - break; - case 8: - name = "Lavalleja"; - break; - case 9: - name = "Maldonado"; - break; - case 10: - name = "Montevideo"; - break; - case 11: - name = "Paysandu"; - break; - case 12: - name = "Rio Negro"; - break; - case 13: - name = "Rivera"; - break; - case 14: - name = "Rocha"; - break; - case 15: - name = "Salto"; - break; - case 16: - name = "San Jose"; - break; - case 17: - name = "Soriano"; - break; - case 18: - name = "Tacuarembo"; - break; - case 19: - name = "Treinta y Tres"; - break; - } - } - if (strcmp(country_code,"UZ") == 0) { - switch (region_code2) { - case 1: - name = "Andijon"; - break; - case 2: - name = "Bukhoro"; - break; - case 3: - name = "Farghona"; - break; - case 4: - name = "Jizzakh"; - break; - case 5: - name = "Khorazm"; - break; - case 6: - name = "Namangan"; - break; - case 7: - name = "Nawoiy"; - break; - case 8: - name = "Qashqadaryo"; - break; - case 9: - name = "Qoraqalpoghiston"; - break; - case 10: - name = "Samarqand"; - break; - case 11: - name = "Sirdaryo"; - break; - case 12: - name = "Surkhondaryo"; - break; - case 13: - name = "Toshkent"; - break; - case 14: - name = "Toshkent"; - break; - } - } - if (strcmp(country_code,"VC") == 0) { - switch (region_code2) { - case 1: - name = "Charlotte"; - break; - case 2: - name = "Saint Andrew"; - break; - case 3: - name = "Saint David"; - break; - case 4: - name = "Saint George"; - break; - case 5: - name = "Saint Patrick"; - break; - case 6: - name = "Grenadines"; - break; - } - } - if (strcmp(country_code,"VE") == 0) { - switch (region_code2) { - case 1: - name = "Amazonas"; - break; - case 2: - name = "Anzoategui"; - break; - case 3: - name = "Apure"; - break; - case 4: - name = "Aragua"; - break; - case 5: - name = "Barinas"; - break; - case 6: - name = "Bolivar"; - break; - case 7: - name = "Carabobo"; - break; - case 8: - name = "Cojedes"; - break; - case 9: - name = "Delta Amacuro"; - break; - case 11: - name = "Falcon"; - break; - case 12: - name = "Guarico"; - break; - case 13: - name = "Lara"; - break; - case 14: - name = "Merida"; - break; - case 15: - name = "Miranda"; - break; - case 16: - name = "Monagas"; - break; - case 17: - name = "Nueva Esparta"; - break; - case 18: - name = "Portuguesa"; - break; - case 19: - name = "Sucre"; - break; - case 20: - name = "Tachira"; - break; - case 21: - name = "Trujillo"; - break; - case 22: - name = "Yaracuy"; - break; - case 23: - name = "Zulia"; - break; - case 24: - name = "Dependencias Federales"; - break; - case 25: - name = "Distrito Federal"; - break; - case 26: - name = "Vargas"; - break; - } - } - if (strcmp(country_code,"VN") == 0) { - switch (region_code2) { - case 1: - name = "An Giang"; - break; - case 3: - name = "Ben Tre"; - break; - case 5: - name = "Cao Bang"; - break; - case 9: - name = "Dong Thap"; - break; - case 13: - name = "Hai Phong"; - break; - case 20: - name = "Ho Chi Minh"; - break; - case 21: - name = "Kien Giang"; - break; - case 23: - name = "Lam Dong"; - break; - case 24: - name = "Long An"; - break; - case 30: - name = "Quang Ninh"; - break; - case 32: - name = "Son La"; - break; - case 33: - name = "Tay Ninh"; - break; - case 34: - name = "Thanh Hoa"; - break; - case 35: - name = "Thai Binh"; - break; - case 37: - name = "Tien Giang"; - break; - case 39: - name = "Lang Son"; - break; - case 43: - name = "An Giang"; - break; - case 44: - name = "Dac Lac"; - break; - case 45: - name = "Dong Nai"; - break; - case 46: - name = "Dong Thap"; - break; - case 47: - name = "Kien Giang"; - break; - case 49: - name = "Song Be"; - break; - case 50: - name = "Vinh Phu"; - break; - case 51: - name = "Ha Noi"; - break; - case 52: - name = "Ho Chi Minh"; - break; - case 53: - name = "Ba Ria-Vung Tau"; - break; - case 54: - name = "Binh Dinh"; - break; - case 55: - name = "Binh Thuan"; - break; - case 58: - name = "Ha Giang"; - break; - case 59: - name = "Ha Tay"; - break; - case 60: - name = "Ha Tinh"; - break; - case 61: - name = "Hoa Binh"; - break; - case 62: - name = "Khanh Hoa"; - break; - case 63: - name = "Kon Tum"; - break; - case 64: - name = "Quang Tri"; - break; - case 65: - name = "Nam Ha"; - break; - case 66: - name = "Nghe An"; - break; - case 67: - name = "Ninh Binh"; - break; - case 68: - name = "Ninh Thuan"; - break; - case 69: - name = "Phu Yen"; - break; - case 70: - name = "Quang Binh"; - break; - case 71: - name = "Quang Ngai"; - break; - case 72: - name = "Quang Tri"; - break; - case 73: - name = "Soc Trang"; - break; - case 74: - name = "Thua Thien"; - break; - case 75: - name = "Tra Vinh"; - break; - case 76: - name = "Tuyen Quang"; - break; - case 77: - name = "Vinh Long"; - break; - case 78: - name = "Da Nang"; - break; - case 79: - name = "Hai Duong"; - break; - case 80: - name = "Ha Nam"; - break; - case 81: - name = "Hung Yen"; - break; - case 82: - name = "Nam Dinh"; - break; - case 83: - name = "Phu Tho"; - break; - case 84: - name = "Quang Nam"; - break; - case 85: - name = "Thai Nguyen"; - break; - case 86: - name = "Vinh Puc Province"; - break; - case 87: - name = "Can Tho"; - break; - case 88: - name = "Dak Lak"; - break; - case 89: - name = "Lai Chau"; - break; - case 90: - name = "Lao Cai"; - break; - case 91: - name = "Dak Nong"; - break; - case 92: - name = "Dien Bien"; - break; - case 93: - name = "Hau Giang"; - break; - } - } - if (strcmp(country_code,"VU") == 0) { - switch (region_code2) { - case 5: - name = "Ambrym"; - break; - case 6: - name = "Aoba"; - break; - case 7: - name = "Torba"; - break; - case 8: - name = "Efate"; - break; - case 9: - name = "Epi"; - break; - case 10: - name = "Malakula"; - break; - case 11: - name = "Paama"; - break; - case 12: - name = "Pentecote"; - break; - case 13: - name = "Sanma"; - break; - case 14: - name = "Shepherd"; - break; - case 15: - name = "Tafea"; - break; - case 16: - name = "Malampa"; - break; - case 17: - name = "Penama"; - break; - case 18: - name = "Shefa"; - break; - } - } - if (strcmp(country_code,"WS") == 0) { - switch (region_code2) { - case 2: - name = "Aiga-i-le-Tai"; - break; - case 3: - name = "Atua"; - break; - case 4: - name = "Fa"; - break; - case 5: - name = "Gaga"; - break; - case 6: - name = "Va"; - break; - case 7: - name = "Gagaifomauga"; - break; - case 8: - name = "Palauli"; - break; - case 9: - name = "Satupa"; - break; - case 10: - name = "Tuamasaga"; - break; - case 11: - name = "Vaisigano"; - break; - } - } - if (strcmp(country_code,"YE") == 0) { - switch (region_code2) { - case 1: - name = "Abyan"; - break; - case 2: - name = "Adan"; - break; - case 3: - name = "Al Mahrah"; - break; - case 4: - name = "Hadramawt"; - break; - case 5: - name = "Shabwah"; - break; - case 6: - name = "Al Ghaydah"; - break; - case 8: - name = "Al Hudaydah"; - break; - case 10: - name = "Al Mahwit"; - break; - case 11: - name = "Dhamar"; - break; - case 14: - name = "Ma'rib"; - break; - case 15: - name = "Sa"; - break; - case 16: - name = "San"; - break; - case 20: - name = "Al Bayda'"; - break; - case 21: - name = "Al Jawf"; - break; - case 22: - name = "Hajjah"; - break; - case 23: - name = "Ibb"; - break; - case 24: - name = "Lahij"; - break; - case 25: - name = "Ta"; - break; - } - } - if (strcmp(country_code,"ZA") == 0) { - switch (region_code2) { - case 1: - name = "North-Western Province"; - break; - case 2: - name = "KwaZulu-Natal"; - break; - case 3: - name = "Free State"; - break; - case 5: - name = "Eastern Cape"; - break; - case 6: - name = "Gauteng"; - break; - case 7: - name = "Mpumalanga"; - break; - case 8: - name = "Northern Cape"; - break; - case 9: - name = "Limpopo"; - break; - case 10: - name = "North-West"; - break; - case 11: - name = "Western Cape"; - break; - } - } - if (strcmp(country_code,"ZM") == 0) { - switch (region_code2) { - case 1: - name = "Western"; - break; - case 2: - name = "Central"; - break; - case 3: - name = "Eastern"; - break; - case 4: - name = "Luapula"; - break; - case 5: - name = "Northern"; - break; - case 6: - name = "North-Western"; - break; - case 7: - name = "Southern"; - break; - case 8: - name = "Copperbelt"; - break; - case 9: - name = "Lusaka"; - break; - } - } - if (strcmp(country_code,"ZW") == 0) { - switch (region_code2) { - case 1: - name = "Manicaland"; - break; - case 2: - name = "Midlands"; - break; - case 3: - name = "Mashonaland Central"; - break; - case 4: - name = "Mashonaland East"; - break; - case 5: - name = "Mashonaland West"; - break; - case 6: - name = "Matabeleland North"; - break; - case 7: - name = "Matabeleland South"; - break; - case 8: - name = "Masvingo"; - break; - case 9: - name = "Bulawayo"; - break; - case 10: - name = "Harare"; - break; - } - } - return name; -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/timeZone.c b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/timeZone.c deleted file mode 100644 index 9db5fb8a..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/timeZone.c +++ /dev/null @@ -1,2077 +0,0 @@ -#include -const char* GeoIP_time_zone_by_country_and_region(const char * country,const char * region) { - const char* timezone = NULL; - if (country == NULL) { - return NULL; - } - if (region == NULL) { - region = ""; - } - if ( strcmp (country, "AD") == 0 ) { - timezone = "Europe/Andorra"; - } - else if ( strcmp (country, "AE") == 0 ) { - timezone = "Asia/Dubai"; - } - else if ( strcmp (country, "AF") == 0 ) { - timezone = "Asia/Kabul"; - } - else if ( strcmp (country, "AG") == 0 ) { - timezone = "America/Antigua"; - } - else if ( strcmp (country, "AI") == 0 ) { - timezone = "America/Anguilla"; - } - else if ( strcmp (country, "AL") == 0 ) { - timezone = "Europe/Tirane"; - } - else if ( strcmp (country, "AM") == 0 ) { - timezone = "Asia/Yerevan"; - } - else if ( strcmp (country, "AO") == 0 ) { - timezone = "Africa/Luanda"; - } - else if ( strcmp (country, "AR") == 0 ) { - if ( strcmp (region, "01") == 0 ) { - timezone = "America/Argentina/Buenos_Aires"; - } - else if ( strcmp (region, "02") == 0 ) { - timezone = "America/Argentina/Catamarca"; - } - else if ( strcmp (region, "03") == 0 ) { - timezone = "America/Argentina/Tucuman"; - } - else if ( strcmp (region, "04") == 0 ) { - timezone = "America/Argentina/Rio_Gallegos"; - } - else if ( strcmp (region, "05") == 0 ) { - timezone = "America/Argentina/Cordoba"; - } - else if ( strcmp (region, "06") == 0 ) { - timezone = "America/Argentina/Tucuman"; - } - else if ( strcmp (region, "07") == 0 ) { - timezone = "America/Argentina/Buenos_Aires"; - } - else if ( strcmp (region, "08") == 0 ) { - timezone = "America/Argentina/Buenos_Aires"; - } - else if ( strcmp (region, "09") == 0 ) { - timezone = "America/Argentina/Tucuman"; - } - else if ( strcmp (region, "10") == 0 ) { - timezone = "America/Argentina/Jujuy"; - } - else if ( strcmp (region, "11") == 0 ) { - timezone = "America/Argentina/San_Luis"; - } - else if ( strcmp (region, "12") == 0 ) { - timezone = "America/Argentina/La_Rioja"; - } - else if ( strcmp (region, "13") == 0 ) { - timezone = "America/Argentina/Mendoza"; - } - else if ( strcmp (region, "14") == 0 ) { - timezone = "America/Argentina/Buenos_Aires"; - } - else if ( strcmp (region, "15") == 0 ) { - timezone = "America/Argentina/San_Luis"; - } - else if ( strcmp (region, "16") == 0 ) { - timezone = "America/Argentina/Buenos_Aires"; - } - else if ( strcmp (region, "17") == 0 ) { - timezone = "America/Argentina/Salta"; - } - else if ( strcmp (region, "18") == 0 ) { - timezone = "America/Argentina/San_Juan"; - } - else if ( strcmp (region, "19") == 0 ) { - timezone = "America/Argentina/San_Luis"; - } - else if ( strcmp (region, "20") == 0 ) { - timezone = "America/Argentina/Rio_Gallegos"; - } - else if ( strcmp (region, "21") == 0 ) { - timezone = "America/Argentina/Buenos_Aires"; - } - else if ( strcmp (region, "22") == 0 ) { - timezone = "America/Argentina/Catamarca"; - } - else if ( strcmp (region, "23") == 0 ) { - timezone = "America/Argentina/Ushuaia"; - } - else if ( strcmp (region, "24") == 0 ) { - timezone = "America/Argentina/Tucuman"; - } - } - else if ( strcmp (country, "AS") == 0 ) { - timezone = "US/Samoa"; - } - else if ( strcmp (country, "AT") == 0 ) { - timezone = "Europe/Vienna"; - } - else if ( strcmp (country, "AU") == 0 ) { - if ( strcmp (region, "01") == 0 ) { - timezone = "Australia/Canberra"; - } - else if ( strcmp (region, "02") == 0 ) { - timezone = "Australia/NSW"; - } - else if ( strcmp (region, "03") == 0 ) { - timezone = "Australia/North"; - } - else if ( strcmp (region, "04") == 0 ) { - timezone = "Australia/Queensland"; - } - else if ( strcmp (region, "05") == 0 ) { - timezone = "Australia/South"; - } - else if ( strcmp (region, "06") == 0 ) { - timezone = "Australia/Tasmania"; - } - else if ( strcmp (region, "07") == 0 ) { - timezone = "Australia/Victoria"; - } - else if ( strcmp (region, "08") == 0 ) { - timezone = "Australia/West"; - } - } - else if ( strcmp (country, "AW") == 0 ) { - timezone = "America/Aruba"; - } - else if ( strcmp (country, "AX") == 0 ) { - timezone = "Europe/Mariehamn"; - } - else if ( strcmp (country, "AZ") == 0 ) { - timezone = "Asia/Baku"; - } - else if ( strcmp (country, "BA") == 0 ) { - timezone = "Europe/Sarajevo"; - } - else if ( strcmp (country, "BB") == 0 ) { - timezone = "America/Barbados"; - } - else if ( strcmp (country, "BD") == 0 ) { - timezone = "Asia/Dhaka"; - } - else if ( strcmp (country, "BE") == 0 ) { - timezone = "Europe/Brussels"; - } - else if ( strcmp (country, "BF") == 0 ) { - timezone = "Africa/Ouagadougou"; - } - else if ( strcmp (country, "BG") == 0 ) { - timezone = "Europe/Sofia"; - } - else if ( strcmp (country, "BH") == 0 ) { - timezone = "Asia/Bahrain"; - } - else if ( strcmp (country, "BI") == 0 ) { - timezone = "Africa/Bujumbura"; - } - else if ( strcmp (country, "BJ") == 0 ) { - timezone = "Africa/Porto-Novo"; - } - else if ( strcmp (country, "BL") == 0 ) { - timezone = "America/St_Barthelemy"; - } - else if ( strcmp (country, "BM") == 0 ) { - timezone = "Atlantic/Bermuda"; - } - else if ( strcmp (country, "BN") == 0 ) { - timezone = "Asia/Brunei"; - } - else if ( strcmp (country, "BO") == 0 ) { - timezone = "America/La_Paz"; - } - else if ( strcmp (country, "BQ") == 0 ) { - timezone = "America/Curacao"; - } - else if ( strcmp (country, "BR") == 0 ) { - if ( strcmp (region, "01") == 0 ) { - timezone = "America/Rio_Branco"; - } - else if ( strcmp (region, "02") == 0 ) { - timezone = "America/Maceio"; - } - else if ( strcmp (region, "03") == 0 ) { - timezone = "America/Sao_Paulo"; - } - else if ( strcmp (region, "04") == 0 ) { - timezone = "America/Manaus"; - } - else if ( strcmp (region, "05") == 0 ) { - timezone = "America/Bahia"; - } - else if ( strcmp (region, "06") == 0 ) { - timezone = "America/Fortaleza"; - } - else if ( strcmp (region, "07") == 0 ) { - timezone = "America/Sao_Paulo"; - } - else if ( strcmp (region, "08") == 0 ) { - timezone = "America/Sao_Paulo"; - } - else if ( strcmp (region, "11") == 0 ) { - timezone = "America/Campo_Grande"; - } - else if ( strcmp (region, "13") == 0 ) { - timezone = "America/Belem"; - } - else if ( strcmp (region, "14") == 0 ) { - timezone = "America/Cuiaba"; - } - else if ( strcmp (region, "15") == 0 ) { - timezone = "America/Sao_Paulo"; - } - else if ( strcmp (region, "16") == 0 ) { - timezone = "America/Belem"; - } - else if ( strcmp (region, "17") == 0 ) { - timezone = "America/Recife"; - } - else if ( strcmp (region, "18") == 0 ) { - timezone = "America/Sao_Paulo"; - } - else if ( strcmp (region, "20") == 0 ) { - timezone = "America/Fortaleza"; - } - else if ( strcmp (region, "21") == 0 ) { - timezone = "America/Sao_Paulo"; - } - else if ( strcmp (region, "22") == 0 ) { - timezone = "America/Recife"; - } - else if ( strcmp (region, "23") == 0 ) { - timezone = "America/Sao_Paulo"; - } - else if ( strcmp (region, "24") == 0 ) { - timezone = "America/Porto_Velho"; - } - else if ( strcmp (region, "25") == 0 ) { - timezone = "America/Boa_Vista"; - } - else if ( strcmp (region, "26") == 0 ) { - timezone = "America/Sao_Paulo"; - } - else if ( strcmp (region, "27") == 0 ) { - timezone = "America/Sao_Paulo"; - } - else if ( strcmp (region, "28") == 0 ) { - timezone = "America/Maceio"; - } - else if ( strcmp (region, "29") == 0 ) { - timezone = "America/Sao_Paulo"; - } - else if ( strcmp (region, "30") == 0 ) { - timezone = "America/Recife"; - } - else if ( strcmp (region, "31") == 0 ) { - timezone = "America/Araguaina"; - } - } - else if ( strcmp (country, "BS") == 0 ) { - timezone = "America/Nassau"; - } - else if ( strcmp (country, "BT") == 0 ) { - timezone = "Asia/Thimphu"; - } - else if ( strcmp (country, "BW") == 0 ) { - timezone = "Africa/Gaborone"; - } - else if ( strcmp (country, "BY") == 0 ) { - timezone = "Europe/Minsk"; - } - else if ( strcmp (country, "BZ") == 0 ) { - timezone = "America/Belize"; - } - else if ( strcmp (country, "CA") == 0 ) { - if ( strcmp (region, "AB") == 0 ) { - timezone = "America/Edmonton"; - } - else if ( strcmp (region, "BC") == 0 ) { - timezone = "America/Vancouver"; - } - else if ( strcmp (region, "MB") == 0 ) { - timezone = "America/Winnipeg"; - } - else if ( strcmp (region, "NB") == 0 ) { - timezone = "America/Halifax"; - } - else if ( strcmp (region, "NL") == 0 ) { - timezone = "America/St_Johns"; - } - else if ( strcmp (region, "NS") == 0 ) { - timezone = "America/Halifax"; - } - else if ( strcmp (region, "NT") == 0 ) { - timezone = "America/Yellowknife"; - } - else if ( strcmp (region, "NU") == 0 ) { - timezone = "America/Rankin_Inlet"; - } - else if ( strcmp (region, "ON") == 0 ) { - timezone = "America/Rainy_River"; - } - else if ( strcmp (region, "PE") == 0 ) { - timezone = "America/Halifax"; - } - else if ( strcmp (region, "QC") == 0 ) { - timezone = "America/Montreal"; - } - else if ( strcmp (region, "SK") == 0 ) { - timezone = "America/Regina"; - } - else if ( strcmp (region, "YT") == 0 ) { - timezone = "America/Whitehorse"; - } - } - else if ( strcmp (country, "CC") == 0 ) { - timezone = "Indian/Cocos"; - } - else if ( strcmp (country, "CD") == 0 ) { - if ( strcmp (region, "02") == 0 ) { - timezone = "Africa/Kinshasa"; - } - else if ( strcmp (region, "05") == 0 ) { - timezone = "Africa/Lubumbashi"; - } - else if ( strcmp (region, "06") == 0 ) { - timezone = "Africa/Kinshasa"; - } - else if ( strcmp (region, "08") == 0 ) { - timezone = "Africa/Kinshasa"; - } - else if ( strcmp (region, "10") == 0 ) { - timezone = "Africa/Lubumbashi"; - } - else if ( strcmp (region, "11") == 0 ) { - timezone = "Africa/Lubumbashi"; - } - else if ( strcmp (region, "12") == 0 ) { - timezone = "Africa/Lubumbashi"; - } - } - else if ( strcmp (country, "CF") == 0 ) { - timezone = "Africa/Bangui"; - } - else if ( strcmp (country, "CG") == 0 ) { - timezone = "Africa/Brazzaville"; - } - else if ( strcmp (country, "CH") == 0 ) { - timezone = "Europe/Zurich"; - } - else if ( strcmp (country, "CI") == 0 ) { - timezone = "Africa/Abidjan"; - } - else if ( strcmp (country, "CK") == 0 ) { - timezone = "Pacific/Rarotonga"; - } - else if ( strcmp (country, "CL") == 0 ) { - timezone = "Chile/Continental"; - } - else if ( strcmp (country, "CM") == 0 ) { - timezone = "Africa/Lagos"; - } - else if ( strcmp (country, "CN") == 0 ) { - if ( strcmp (region, "01") == 0 ) { - timezone = "Asia/Shanghai"; - } - else if ( strcmp (region, "02") == 0 ) { - timezone = "Asia/Shanghai"; - } - else if ( strcmp (region, "03") == 0 ) { - timezone = "Asia/Shanghai"; - } - else if ( strcmp (region, "04") == 0 ) { - timezone = "Asia/Shanghai"; - } - else if ( strcmp (region, "05") == 0 ) { - timezone = "Asia/Harbin"; - } - else if ( strcmp (region, "06") == 0 ) { - timezone = "Asia/Chongqing"; - } - else if ( strcmp (region, "07") == 0 ) { - timezone = "Asia/Shanghai"; - } - else if ( strcmp (region, "08") == 0 ) { - timezone = "Asia/Harbin"; - } - else if ( strcmp (region, "09") == 0 ) { - timezone = "Asia/Shanghai"; - } - else if ( strcmp (region, "10") == 0 ) { - timezone = "Asia/Shanghai"; - } - else if ( strcmp (region, "11") == 0 ) { - timezone = "Asia/Chongqing"; - } - else if ( strcmp (region, "12") == 0 ) { - timezone = "Asia/Shanghai"; - } - else if ( strcmp (region, "13") == 0 ) { - timezone = "Asia/Urumqi"; - } - else if ( strcmp (region, "14") == 0 ) { - timezone = "Asia/Chongqing"; - } - else if ( strcmp (region, "15") == 0 ) { - timezone = "Asia/Chongqing"; - } - else if ( strcmp (region, "16") == 0 ) { - timezone = "Asia/Chongqing"; - } - else if ( strcmp (region, "18") == 0 ) { - timezone = "Asia/Chongqing"; - } - else if ( strcmp (region, "19") == 0 ) { - timezone = "Asia/Harbin"; - } - else if ( strcmp (region, "20") == 0 ) { - timezone = "Asia/Harbin"; - } - else if ( strcmp (region, "21") == 0 ) { - timezone = "Asia/Chongqing"; - } - else if ( strcmp (region, "22") == 0 ) { - timezone = "Asia/Harbin"; - } - else if ( strcmp (region, "23") == 0 ) { - timezone = "Asia/Shanghai"; - } - else if ( strcmp (region, "24") == 0 ) { - timezone = "Asia/Chongqing"; - } - else if ( strcmp (region, "25") == 0 ) { - timezone = "Asia/Shanghai"; - } - else if ( strcmp (region, "26") == 0 ) { - timezone = "Asia/Chongqing"; - } - else if ( strcmp (region, "28") == 0 ) { - timezone = "Asia/Shanghai"; - } - else if ( strcmp (region, "29") == 0 ) { - timezone = "Asia/Chongqing"; - } - else if ( strcmp (region, "30") == 0 ) { - timezone = "Asia/Chongqing"; - } - else if ( strcmp (region, "31") == 0 ) { - timezone = "Asia/Chongqing"; - } - else if ( strcmp (region, "32") == 0 ) { - timezone = "Asia/Chongqing"; - } - else if ( strcmp (region, "33") == 0 ) { - timezone = "Asia/Chongqing"; - } - } - else if ( strcmp (country, "CO") == 0 ) { - timezone = "America/Bogota"; - } - else if ( strcmp (country, "CR") == 0 ) { - timezone = "America/Costa_Rica"; - } - else if ( strcmp (country, "CU") == 0 ) { - timezone = "America/Havana"; - } - else if ( strcmp (country, "CV") == 0 ) { - timezone = "Atlantic/Cape_Verde"; - } - else if ( strcmp (country, "CW") == 0 ) { - timezone = "America/Curacao"; - } - else if ( strcmp (country, "CX") == 0 ) { - timezone = "Indian/Christmas"; - } - else if ( strcmp (country, "CY") == 0 ) { - timezone = "Asia/Nicosia"; - } - else if ( strcmp (country, "CZ") == 0 ) { - timezone = "Europe/Prague"; - } - else if ( strcmp (country, "DE") == 0 ) { - timezone = "Europe/Berlin"; - } - else if ( strcmp (country, "DJ") == 0 ) { - timezone = "Africa/Djibouti"; - } - else if ( strcmp (country, "DK") == 0 ) { - timezone = "Europe/Copenhagen"; - } - else if ( strcmp (country, "DM") == 0 ) { - timezone = "America/Dominica"; - } - else if ( strcmp (country, "DO") == 0 ) { - timezone = "America/Santo_Domingo"; - } - else if ( strcmp (country, "DZ") == 0 ) { - timezone = "Africa/Algiers"; - } - else if ( strcmp (country, "EC") == 0 ) { - if ( strcmp (region, "01") == 0 ) { - timezone = "Pacific/Galapagos"; - } - else if ( strcmp (region, "02") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "03") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "04") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "05") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "06") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "07") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "08") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "09") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "10") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "11") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "12") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "13") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "14") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "15") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "17") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "18") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "19") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "20") == 0 ) { - timezone = "America/Guayaquil"; - } - else if ( strcmp (region, "22") == 0 ) { - timezone = "America/Guayaquil"; - } - } - else if ( strcmp (country, "EE") == 0 ) { - timezone = "Europe/Tallinn"; - } - else if ( strcmp (country, "EG") == 0 ) { - timezone = "Africa/Cairo"; - } - else if ( strcmp (country, "EH") == 0 ) { - timezone = "Africa/El_Aaiun"; - } - else if ( strcmp (country, "ER") == 0 ) { - timezone = "Africa/Asmera"; - } - else if ( strcmp (country, "ES") == 0 ) { - if ( strcmp (region, "07") == 0 ) { - timezone = "Europe/Madrid"; - } - else if ( strcmp (region, "27") == 0 ) { - timezone = "Europe/Madrid"; - } - else if ( strcmp (region, "29") == 0 ) { - timezone = "Europe/Madrid"; - } - else if ( strcmp (region, "31") == 0 ) { - timezone = "Europe/Madrid"; - } - else if ( strcmp (region, "32") == 0 ) { - timezone = "Europe/Madrid"; - } - else if ( strcmp (region, "34") == 0 ) { - timezone = "Europe/Madrid"; - } - else if ( strcmp (region, "39") == 0 ) { - timezone = "Europe/Madrid"; - } - else if ( strcmp (region, "51") == 0 ) { - timezone = "Africa/Ceuta"; - } - else if ( strcmp (region, "52") == 0 ) { - timezone = "Europe/Madrid"; - } - else if ( strcmp (region, "53") == 0 ) { - timezone = "Atlantic/Canary"; - } - else if ( strcmp (region, "54") == 0 ) { - timezone = "Europe/Madrid"; - } - else if ( strcmp (region, "55") == 0 ) { - timezone = "Europe/Madrid"; - } - else if ( strcmp (region, "56") == 0 ) { - timezone = "Europe/Madrid"; - } - else if ( strcmp (region, "57") == 0 ) { - timezone = "Europe/Madrid"; - } - else if ( strcmp (region, "58") == 0 ) { - timezone = "Europe/Madrid"; - } - else if ( strcmp (region, "59") == 0 ) { - timezone = "Europe/Madrid"; - } - else if ( strcmp (region, "60") == 0 ) { - timezone = "Europe/Madrid"; - } - } - else if ( strcmp (country, "ET") == 0 ) { - timezone = "Africa/Addis_Ababa"; - } - else if ( strcmp (country, "FI") == 0 ) { - timezone = "Europe/Helsinki"; - } - else if ( strcmp (country, "FJ") == 0 ) { - timezone = "Pacific/Fiji"; - } - else if ( strcmp (country, "FK") == 0 ) { - timezone = "Atlantic/Stanley"; - } - else if ( strcmp (country, "FO") == 0 ) { - timezone = "Atlantic/Faeroe"; - } - else if ( strcmp (country, "FR") == 0 ) { - timezone = "Europe/Paris"; - } - else if ( strcmp (country, "GA") == 0 ) { - timezone = "Africa/Libreville"; - } - else if ( strcmp (country, "GB") == 0 ) { - timezone = "Europe/London"; - } - else if ( strcmp (country, "GD") == 0 ) { - timezone = "America/Grenada"; - } - else if ( strcmp (country, "GE") == 0 ) { - timezone = "Asia/Tbilisi"; - } - else if ( strcmp (country, "GF") == 0 ) { - timezone = "America/Cayenne"; - } - else if ( strcmp (country, "GG") == 0 ) { - timezone = "Europe/Guernsey"; - } - else if ( strcmp (country, "GH") == 0 ) { - timezone = "Africa/Accra"; - } - else if ( strcmp (country, "GI") == 0 ) { - timezone = "Europe/Gibraltar"; - } - else if ( strcmp (country, "GL") == 0 ) { - if ( strcmp (region, "01") == 0 ) { - timezone = "America/Thule"; - } - else if ( strcmp (region, "02") == 0 ) { - timezone = "America/Godthab"; - } - else if ( strcmp (region, "03") == 0 ) { - timezone = "America/Godthab"; - } - } - else if ( strcmp (country, "GM") == 0 ) { - timezone = "Africa/Banjul"; - } - else if ( strcmp (country, "GN") == 0 ) { - timezone = "Africa/Conakry"; - } - else if ( strcmp (country, "GP") == 0 ) { - timezone = "America/Guadeloupe"; - } - else if ( strcmp (country, "GQ") == 0 ) { - timezone = "Africa/Malabo"; - } - else if ( strcmp (country, "GR") == 0 ) { - timezone = "Europe/Athens"; - } - else if ( strcmp (country, "GS") == 0 ) { - timezone = "Atlantic/South_Georgia"; - } - else if ( strcmp (country, "GT") == 0 ) { - timezone = "America/Guatemala"; - } - else if ( strcmp (country, "GU") == 0 ) { - timezone = "Pacific/Guam"; - } - else if ( strcmp (country, "GW") == 0 ) { - timezone = "Africa/Bissau"; - } - else if ( strcmp (country, "GY") == 0 ) { - timezone = "America/Guyana"; - } - else if ( strcmp (country, "HK") == 0 ) { - timezone = "Asia/Hong_Kong"; - } - else if ( strcmp (country, "HN") == 0 ) { - timezone = "America/Tegucigalpa"; - } - else if ( strcmp (country, "HR") == 0 ) { - timezone = "Europe/Zagreb"; - } - else if ( strcmp (country, "HT") == 0 ) { - timezone = "America/Port-au-Prince"; - } - else if ( strcmp (country, "HU") == 0 ) { - timezone = "Europe/Budapest"; - } - else if ( strcmp (country, "ID") == 0 ) { - if ( strcmp (region, "01") == 0 ) { - timezone = "Asia/Pontianak"; - } - else if ( strcmp (region, "02") == 0 ) { - timezone = "Asia/Makassar"; - } - else if ( strcmp (region, "03") == 0 ) { - timezone = "Asia/Jakarta"; - } - else if ( strcmp (region, "04") == 0 ) { - timezone = "Asia/Jakarta"; - } - else if ( strcmp (region, "05") == 0 ) { - timezone = "Asia/Jakarta"; - } - else if ( strcmp (region, "06") == 0 ) { - timezone = "Asia/Jakarta"; - } - else if ( strcmp (region, "07") == 0 ) { - timezone = "Asia/Jakarta"; - } - else if ( strcmp (region, "08") == 0 ) { - timezone = "Asia/Jakarta"; - } - else if ( strcmp (region, "09") == 0 ) { - timezone = "Asia/Jayapura"; - } - else if ( strcmp (region, "10") == 0 ) { - timezone = "Asia/Jakarta"; - } - else if ( strcmp (region, "11") == 0 ) { - timezone = "Asia/Pontianak"; - } - else if ( strcmp (region, "12") == 0 ) { - timezone = "Asia/Makassar"; - } - else if ( strcmp (region, "13") == 0 ) { - timezone = "Asia/Makassar"; - } - else if ( strcmp (region, "14") == 0 ) { - timezone = "Asia/Makassar"; - } - else if ( strcmp (region, "15") == 0 ) { - timezone = "Asia/Jakarta"; - } - else if ( strcmp (region, "16") == 0 ) { - timezone = "Asia/Makassar"; - } - else if ( strcmp (region, "17") == 0 ) { - timezone = "Asia/Makassar"; - } - else if ( strcmp (region, "18") == 0 ) { - timezone = "Asia/Makassar"; - } - else if ( strcmp (region, "19") == 0 ) { - timezone = "Asia/Pontianak"; - } - else if ( strcmp (region, "20") == 0 ) { - timezone = "Asia/Makassar"; - } - else if ( strcmp (region, "21") == 0 ) { - timezone = "Asia/Makassar"; - } - else if ( strcmp (region, "22") == 0 ) { - timezone = "Asia/Makassar"; - } - else if ( strcmp (region, "23") == 0 ) { - timezone = "Asia/Makassar"; - } - else if ( strcmp (region, "24") == 0 ) { - timezone = "Asia/Jakarta"; - } - else if ( strcmp (region, "25") == 0 ) { - timezone = "Asia/Pontianak"; - } - else if ( strcmp (region, "26") == 0 ) { - timezone = "Asia/Pontianak"; - } - else if ( strcmp (region, "30") == 0 ) { - timezone = "Asia/Jakarta"; - } - else if ( strcmp (region, "31") == 0 ) { - timezone = "Asia/Makassar"; - } - else if ( strcmp (region, "33") == 0 ) { - timezone = "Asia/Jakarta"; - } - } - else if ( strcmp (country, "IE") == 0 ) { - timezone = "Europe/Dublin"; - } - else if ( strcmp (country, "IL") == 0 ) { - timezone = "Asia/Jerusalem"; - } - else if ( strcmp (country, "IM") == 0 ) { - timezone = "Europe/Isle_of_Man"; - } - else if ( strcmp (country, "IN") == 0 ) { - timezone = "Asia/Calcutta"; - } - else if ( strcmp (country, "IO") == 0 ) { - timezone = "Indian/Chagos"; - } - else if ( strcmp (country, "IQ") == 0 ) { - timezone = "Asia/Baghdad"; - } - else if ( strcmp (country, "IR") == 0 ) { - timezone = "Asia/Tehran"; - } - else if ( strcmp (country, "IS") == 0 ) { - timezone = "Atlantic/Reykjavik"; - } - else if ( strcmp (country, "IT") == 0 ) { - timezone = "Europe/Rome"; - } - else if ( strcmp (country, "JE") == 0 ) { - timezone = "Europe/Jersey"; - } - else if ( strcmp (country, "JM") == 0 ) { - timezone = "America/Jamaica"; - } - else if ( strcmp (country, "JO") == 0 ) { - timezone = "Asia/Amman"; - } - else if ( strcmp (country, "JP") == 0 ) { - timezone = "Asia/Tokyo"; - } - else if ( strcmp (country, "KE") == 0 ) { - timezone = "Africa/Nairobi"; - } - else if ( strcmp (country, "KG") == 0 ) { - timezone = "Asia/Bishkek"; - } - else if ( strcmp (country, "KH") == 0 ) { - timezone = "Asia/Phnom_Penh"; - } - else if ( strcmp (country, "KI") == 0 ) { - timezone = "Pacific/Tarawa"; - } - else if ( strcmp (country, "KM") == 0 ) { - timezone = "Indian/Comoro"; - } - else if ( strcmp (country, "KN") == 0 ) { - timezone = "America/St_Kitts"; - } - else if ( strcmp (country, "KP") == 0 ) { - timezone = "Asia/Pyongyang"; - } - else if ( strcmp (country, "KR") == 0 ) { - timezone = "Asia/Seoul"; - } - else if ( strcmp (country, "KW") == 0 ) { - timezone = "Asia/Kuwait"; - } - else if ( strcmp (country, "KY") == 0 ) { - timezone = "America/Cayman"; - } - else if ( strcmp (country, "KZ") == 0 ) { - if ( strcmp (region, "01") == 0 ) { - timezone = "Asia/Almaty"; - } - else if ( strcmp (region, "02") == 0 ) { - timezone = "Asia/Almaty"; - } - else if ( strcmp (region, "03") == 0 ) { - timezone = "Asia/Qyzylorda"; - } - else if ( strcmp (region, "04") == 0 ) { - timezone = "Asia/Aqtobe"; - } - else if ( strcmp (region, "05") == 0 ) { - timezone = "Asia/Qyzylorda"; - } - else if ( strcmp (region, "06") == 0 ) { - timezone = "Asia/Aqtau"; - } - else if ( strcmp (region, "07") == 0 ) { - timezone = "Asia/Oral"; - } - else if ( strcmp (region, "08") == 0 ) { - timezone = "Asia/Qyzylorda"; - } - else if ( strcmp (region, "09") == 0 ) { - timezone = "Asia/Aqtau"; - } - else if ( strcmp (region, "10") == 0 ) { - timezone = "Asia/Qyzylorda"; - } - else if ( strcmp (region, "11") == 0 ) { - timezone = "Asia/Almaty"; - } - else if ( strcmp (region, "12") == 0 ) { - timezone = "Asia/Qyzylorda"; - } - else if ( strcmp (region, "13") == 0 ) { - timezone = "Asia/Aqtobe"; - } - else if ( strcmp (region, "14") == 0 ) { - timezone = "Asia/Qyzylorda"; - } - else if ( strcmp (region, "15") == 0 ) { - timezone = "Asia/Almaty"; - } - else if ( strcmp (region, "16") == 0 ) { - timezone = "Asia/Aqtobe"; - } - else if ( strcmp (region, "17") == 0 ) { - timezone = "Asia/Almaty"; - } - } - else if ( strcmp (country, "LA") == 0 ) { - timezone = "Asia/Vientiane"; - } - else if ( strcmp (country, "LB") == 0 ) { - timezone = "Asia/Beirut"; - } - else if ( strcmp (country, "LC") == 0 ) { - timezone = "America/St_Lucia"; - } - else if ( strcmp (country, "LI") == 0 ) { - timezone = "Europe/Vaduz"; - } - else if ( strcmp (country, "LK") == 0 ) { - timezone = "Asia/Colombo"; - } - else if ( strcmp (country, "LR") == 0 ) { - timezone = "Africa/Monrovia"; - } - else if ( strcmp (country, "LS") == 0 ) { - timezone = "Africa/Maseru"; - } - else if ( strcmp (country, "LT") == 0 ) { - timezone = "Europe/Vilnius"; - } - else if ( strcmp (country, "LU") == 0 ) { - timezone = "Europe/Luxembourg"; - } - else if ( strcmp (country, "LV") == 0 ) { - timezone = "Europe/Riga"; - } - else if ( strcmp (country, "LY") == 0 ) { - timezone = "Africa/Tripoli"; - } - else if ( strcmp (country, "MA") == 0 ) { - timezone = "Africa/Casablanca"; - } - else if ( strcmp (country, "MC") == 0 ) { - timezone = "Europe/Monaco"; - } - else if ( strcmp (country, "MD") == 0 ) { - timezone = "Europe/Chisinau"; - } - else if ( strcmp (country, "ME") == 0 ) { - timezone = "Europe/Podgorica"; - } - else if ( strcmp (country, "MF") == 0 ) { - timezone = "America/Marigot"; - } - else if ( strcmp (country, "MG") == 0 ) { - timezone = "Indian/Antananarivo"; - } - else if ( strcmp (country, "MK") == 0 ) { - timezone = "Europe/Skopje"; - } - else if ( strcmp (country, "ML") == 0 ) { - timezone = "Africa/Bamako"; - } - else if ( strcmp (country, "MM") == 0 ) { - timezone = "Asia/Rangoon"; - } - else if ( strcmp (country, "MN") == 0 ) { - timezone = "Asia/Choibalsan"; - } - else if ( strcmp (country, "MO") == 0 ) { - timezone = "Asia/Macao"; - } - else if ( strcmp (country, "MP") == 0 ) { - timezone = "Pacific/Saipan"; - } - else if ( strcmp (country, "MQ") == 0 ) { - timezone = "America/Martinique"; - } - else if ( strcmp (country, "MR") == 0 ) { - timezone = "Africa/Nouakchott"; - } - else if ( strcmp (country, "MS") == 0 ) { - timezone = "America/Montserrat"; - } - else if ( strcmp (country, "MT") == 0 ) { - timezone = "Europe/Malta"; - } - else if ( strcmp (country, "MU") == 0 ) { - timezone = "Indian/Mauritius"; - } - else if ( strcmp (country, "MV") == 0 ) { - timezone = "Indian/Maldives"; - } - else if ( strcmp (country, "MW") == 0 ) { - timezone = "Africa/Blantyre"; - } - else if ( strcmp (country, "MX") == 0 ) { - if ( strcmp (region, "01") == 0 ) { - timezone = "America/Mexico_City"; - } - else if ( strcmp (region, "02") == 0 ) { - timezone = "America/Tijuana"; - } - else if ( strcmp (region, "03") == 0 ) { - timezone = "America/Hermosillo"; - } - else if ( strcmp (region, "04") == 0 ) { - timezone = "America/Merida"; - } - else if ( strcmp (region, "05") == 0 ) { - timezone = "America/Mexico_City"; - } - else if ( strcmp (region, "06") == 0 ) { - timezone = "America/Chihuahua"; - } - else if ( strcmp (region, "07") == 0 ) { - timezone = "America/Monterrey"; - } - else if ( strcmp (region, "08") == 0 ) { - timezone = "America/Mexico_City"; - } - else if ( strcmp (region, "09") == 0 ) { - timezone = "America/Mexico_City"; - } - else if ( strcmp (region, "10") == 0 ) { - timezone = "America/Mazatlan"; - } - else if ( strcmp (region, "11") == 0 ) { - timezone = "America/Mexico_City"; - } - else if ( strcmp (region, "12") == 0 ) { - timezone = "America/Mexico_City"; - } - else if ( strcmp (region, "13") == 0 ) { - timezone = "America/Mexico_City"; - } - else if ( strcmp (region, "14") == 0 ) { - timezone = "America/Mazatlan"; - } - else if ( strcmp (region, "15") == 0 ) { - timezone = "America/Chihuahua"; - } - else if ( strcmp (region, "16") == 0 ) { - timezone = "America/Mexico_City"; - } - else if ( strcmp (region, "17") == 0 ) { - timezone = "America/Mexico_City"; - } - else if ( strcmp (region, "18") == 0 ) { - timezone = "America/Mazatlan"; - } - else if ( strcmp (region, "19") == 0 ) { - timezone = "America/Monterrey"; - } - else if ( strcmp (region, "20") == 0 ) { - timezone = "America/Mexico_City"; - } - else if ( strcmp (region, "21") == 0 ) { - timezone = "America/Mexico_City"; - } - else if ( strcmp (region, "22") == 0 ) { - timezone = "America/Mexico_City"; - } - else if ( strcmp (region, "23") == 0 ) { - timezone = "America/Cancun"; - } - else if ( strcmp (region, "24") == 0 ) { - timezone = "America/Mexico_City"; - } - else if ( strcmp (region, "25") == 0 ) { - timezone = "America/Mazatlan"; - } - else if ( strcmp (region, "26") == 0 ) { - timezone = "America/Hermosillo"; - } - else if ( strcmp (region, "27") == 0 ) { - timezone = "America/Merida"; - } - else if ( strcmp (region, "28") == 0 ) { - timezone = "America/Monterrey"; - } - else if ( strcmp (region, "29") == 0 ) { - timezone = "America/Mexico_City"; - } - else if ( strcmp (region, "30") == 0 ) { - timezone = "America/Mexico_City"; - } - else if ( strcmp (region, "31") == 0 ) { - timezone = "America/Merida"; - } - else if ( strcmp (region, "32") == 0 ) { - timezone = "America/Monterrey"; - } - } - else if ( strcmp (country, "MY") == 0 ) { - if ( strcmp (region, "01") == 0 ) { - timezone = "Asia/Kuala_Lumpur"; - } - else if ( strcmp (region, "02") == 0 ) { - timezone = "Asia/Kuala_Lumpur"; - } - else if ( strcmp (region, "03") == 0 ) { - timezone = "Asia/Kuala_Lumpur"; - } - else if ( strcmp (region, "04") == 0 ) { - timezone = "Asia/Kuala_Lumpur"; - } - else if ( strcmp (region, "05") == 0 ) { - timezone = "Asia/Kuala_Lumpur"; - } - else if ( strcmp (region, "06") == 0 ) { - timezone = "Asia/Kuala_Lumpur"; - } - else if ( strcmp (region, "07") == 0 ) { - timezone = "Asia/Kuala_Lumpur"; - } - else if ( strcmp (region, "08") == 0 ) { - timezone = "Asia/Kuala_Lumpur"; - } - else if ( strcmp (region, "09") == 0 ) { - timezone = "Asia/Kuala_Lumpur"; - } - else if ( strcmp (region, "11") == 0 ) { - timezone = "Asia/Kuching"; - } - else if ( strcmp (region, "12") == 0 ) { - timezone = "Asia/Kuala_Lumpur"; - } - else if ( strcmp (region, "13") == 0 ) { - timezone = "Asia/Kuala_Lumpur"; - } - else if ( strcmp (region, "14") == 0 ) { - timezone = "Asia/Kuala_Lumpur"; - } - else if ( strcmp (region, "15") == 0 ) { - timezone = "Asia/Kuching"; - } - else if ( strcmp (region, "16") == 0 ) { - timezone = "Asia/Kuching"; - } - } - else if ( strcmp (country, "MZ") == 0 ) { - timezone = "Africa/Maputo"; - } - else if ( strcmp (country, "NA") == 0 ) { - timezone = "Africa/Windhoek"; - } - else if ( strcmp (country, "NC") == 0 ) { - timezone = "Pacific/Noumea"; - } - else if ( strcmp (country, "NE") == 0 ) { - timezone = "Africa/Niamey"; - } - else if ( strcmp (country, "NF") == 0 ) { - timezone = "Pacific/Norfolk"; - } - else if ( strcmp (country, "NG") == 0 ) { - timezone = "Africa/Lagos"; - } - else if ( strcmp (country, "NI") == 0 ) { - timezone = "America/Managua"; - } - else if ( strcmp (country, "NL") == 0 ) { - timezone = "Europe/Amsterdam"; - } - else if ( strcmp (country, "NO") == 0 ) { - timezone = "Europe/Oslo"; - } - else if ( strcmp (country, "NP") == 0 ) { - timezone = "Asia/Katmandu"; - } - else if ( strcmp (country, "NR") == 0 ) { - timezone = "Pacific/Nauru"; - } - else if ( strcmp (country, "NU") == 0 ) { - timezone = "Pacific/Niue"; - } - else if ( strcmp (country, "NZ") == 0 ) { - if ( strcmp (region, "85") == 0 ) { - timezone = "Pacific/Auckland"; - } - else if ( strcmp (region, "E7") == 0 ) { - timezone = "Pacific/Auckland"; - } - else if ( strcmp (region, "E8") == 0 ) { - timezone = "Pacific/Auckland"; - } - else if ( strcmp (region, "E9") == 0 ) { - timezone = "Pacific/Auckland"; - } - else if ( strcmp (region, "F1") == 0 ) { - timezone = "Pacific/Auckland"; - } - else if ( strcmp (region, "F2") == 0 ) { - timezone = "Pacific/Auckland"; - } - else if ( strcmp (region, "F3") == 0 ) { - timezone = "Pacific/Auckland"; - } - else if ( strcmp (region, "F4") == 0 ) { - timezone = "Pacific/Auckland"; - } - else if ( strcmp (region, "F5") == 0 ) { - timezone = "Pacific/Auckland"; - } - else if ( strcmp (region, "F7") == 0 ) { - timezone = "Pacific/Chatham"; - } - else if ( strcmp (region, "F8") == 0 ) { - timezone = "Pacific/Auckland"; - } - else if ( strcmp (region, "F9") == 0 ) { - timezone = "Pacific/Auckland"; - } - else if ( strcmp (region, "G1") == 0 ) { - timezone = "Pacific/Auckland"; - } - else if ( strcmp (region, "G2") == 0 ) { - timezone = "Pacific/Auckland"; - } - else if ( strcmp (region, "G3") == 0 ) { - timezone = "Pacific/Auckland"; - } - } - else if ( strcmp (country, "OM") == 0 ) { - timezone = "Asia/Muscat"; - } - else if ( strcmp (country, "PA") == 0 ) { - timezone = "America/Panama"; - } - else if ( strcmp (country, "PE") == 0 ) { - timezone = "America/Lima"; - } - else if ( strcmp (country, "PF") == 0 ) { - timezone = "Pacific/Marquesas"; - } - else if ( strcmp (country, "PG") == 0 ) { - timezone = "Pacific/Port_Moresby"; - } - else if ( strcmp (country, "PH") == 0 ) { - timezone = "Asia/Manila"; - } - else if ( strcmp (country, "PK") == 0 ) { - timezone = "Asia/Karachi"; - } - else if ( strcmp (country, "PL") == 0 ) { - timezone = "Europe/Warsaw"; - } - else if ( strcmp (country, "PM") == 0 ) { - timezone = "America/Miquelon"; - } - else if ( strcmp (country, "PN") == 0 ) { - timezone = "Pacific/Pitcairn"; - } - else if ( strcmp (country, "PR") == 0 ) { - timezone = "America/Puerto_Rico"; - } - else if ( strcmp (country, "PS") == 0 ) { - timezone = "Asia/Gaza"; - } - else if ( strcmp (country, "PT") == 0 ) { - if ( strcmp (region, "02") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "03") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "04") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "05") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "06") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "07") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "08") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "09") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "10") == 0 ) { - timezone = "Atlantic/Madeira"; - } - else if ( strcmp (region, "11") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "13") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "14") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "16") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "17") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "18") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "19") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "20") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "21") == 0 ) { - timezone = "Europe/Lisbon"; - } - else if ( strcmp (region, "22") == 0 ) { - timezone = "Europe/Lisbon"; - } - } - else if ( strcmp (country, "PW") == 0 ) { - timezone = "Pacific/Palau"; - } - else if ( strcmp (country, "PY") == 0 ) { - timezone = "America/Asuncion"; - } - else if ( strcmp (country, "QA") == 0 ) { - timezone = "Asia/Qatar"; - } - else if ( strcmp (country, "RE") == 0 ) { - timezone = "Indian/Reunion"; - } - else if ( strcmp (country, "RO") == 0 ) { - timezone = "Europe/Bucharest"; - } - else if ( strcmp (country, "RS") == 0 ) { - timezone = "Europe/Belgrade"; - } - else if ( strcmp (country, "RU") == 0 ) { - if ( strcmp (region, "01") == 0 ) { - timezone = "Europe/Volgograd"; - } - else if ( strcmp (region, "02") == 0 ) { - timezone = "Asia/Irkutsk"; - } - else if ( strcmp (region, "03") == 0 ) { - timezone = "Asia/Novokuznetsk"; - } - else if ( strcmp (region, "04") == 0 ) { - timezone = "Asia/Novosibirsk"; - } - else if ( strcmp (region, "05") == 0 ) { - timezone = "Asia/Vladivostok"; - } - else if ( strcmp (region, "06") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "07") == 0 ) { - timezone = "Europe/Volgograd"; - } - else if ( strcmp (region, "08") == 0 ) { - timezone = "Europe/Samara"; - } - else if ( strcmp (region, "09") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "10") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "11") == 0 ) { - timezone = "Asia/Irkutsk"; - } - else if ( strcmp (region, "13") == 0 ) { - timezone = "Asia/Yekaterinburg"; - } - else if ( strcmp (region, "14") == 0 ) { - timezone = "Asia/Irkutsk"; - } - else if ( strcmp (region, "15") == 0 ) { - timezone = "Asia/Anadyr"; - } - else if ( strcmp (region, "16") == 0 ) { - timezone = "Europe/Samara"; - } - else if ( strcmp (region, "17") == 0 ) { - timezone = "Europe/Volgograd"; - } - else if ( strcmp (region, "18") == 0 ) { - timezone = "Asia/Krasnoyarsk"; - } - else if ( strcmp (region, "20") == 0 ) { - timezone = "Asia/Irkutsk"; - } - else if ( strcmp (region, "21") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "22") == 0 ) { - timezone = "Europe/Volgograd"; - } - else if ( strcmp (region, "23") == 0 ) { - timezone = "Europe/Kaliningrad"; - } - else if ( strcmp (region, "24") == 0 ) { - timezone = "Europe/Volgograd"; - } - else if ( strcmp (region, "25") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "26") == 0 ) { - timezone = "Asia/Kamchatka"; - } - else if ( strcmp (region, "27") == 0 ) { - timezone = "Europe/Volgograd"; - } - else if ( strcmp (region, "28") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "29") == 0 ) { - timezone = "Asia/Novokuznetsk"; - } - else if ( strcmp (region, "30") == 0 ) { - timezone = "Asia/Vladivostok"; - } - else if ( strcmp (region, "31") == 0 ) { - timezone = "Asia/Krasnoyarsk"; - } - else if ( strcmp (region, "32") == 0 ) { - timezone = "Asia/Omsk"; - } - else if ( strcmp (region, "33") == 0 ) { - timezone = "Asia/Yekaterinburg"; - } - else if ( strcmp (region, "34") == 0 ) { - timezone = "Asia/Yekaterinburg"; - } - else if ( strcmp (region, "35") == 0 ) { - timezone = "Asia/Yekaterinburg"; - } - else if ( strcmp (region, "36") == 0 ) { - timezone = "Asia/Anadyr"; - } - else if ( strcmp (region, "37") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "38") == 0 ) { - timezone = "Europe/Volgograd"; - } - else if ( strcmp (region, "39") == 0 ) { - timezone = "Asia/Krasnoyarsk"; - } - else if ( strcmp (region, "40") == 0 ) { - timezone = "Asia/Yekaterinburg"; - } - else if ( strcmp (region, "41") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "42") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "43") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "44") == 0 ) { - timezone = "Asia/Magadan"; - } - else if ( strcmp (region, "45") == 0 ) { - timezone = "Europe/Samara"; - } - else if ( strcmp (region, "46") == 0 ) { - timezone = "Europe/Samara"; - } - else if ( strcmp (region, "47") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "48") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "49") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "50") == 0 ) { - timezone = "Asia/Yekaterinburg"; - } - else if ( strcmp (region, "51") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "52") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "53") == 0 ) { - timezone = "Asia/Novosibirsk"; - } - else if ( strcmp (region, "54") == 0 ) { - timezone = "Asia/Omsk"; - } - else if ( strcmp (region, "55") == 0 ) { - timezone = "Europe/Samara"; - } - else if ( strcmp (region, "56") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "57") == 0 ) { - timezone = "Europe/Samara"; - } - else if ( strcmp (region, "58") == 0 ) { - timezone = "Asia/Yekaterinburg"; - } - else if ( strcmp (region, "59") == 0 ) { - timezone = "Asia/Vladivostok"; - } - else if ( strcmp (region, "60") == 0 ) { - timezone = "Europe/Kaliningrad"; - } - else if ( strcmp (region, "61") == 0 ) { - timezone = "Europe/Volgograd"; - } - else if ( strcmp (region, "62") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "63") == 0 ) { - timezone = "Asia/Yakutsk"; - } - else if ( strcmp (region, "64") == 0 ) { - timezone = "Asia/Sakhalin"; - } - else if ( strcmp (region, "65") == 0 ) { - timezone = "Europe/Samara"; - } - else if ( strcmp (region, "66") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "67") == 0 ) { - timezone = "Europe/Samara"; - } - else if ( strcmp (region, "68") == 0 ) { - timezone = "Europe/Volgograd"; - } - else if ( strcmp (region, "69") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "70") == 0 ) { - timezone = "Europe/Volgograd"; - } - else if ( strcmp (region, "71") == 0 ) { - timezone = "Asia/Yekaterinburg"; - } - else if ( strcmp (region, "72") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "73") == 0 ) { - timezone = "Europe/Samara"; - } - else if ( strcmp (region, "74") == 0 ) { - timezone = "Asia/Krasnoyarsk"; - } - else if ( strcmp (region, "75") == 0 ) { - timezone = "Asia/Novosibirsk"; - } - else if ( strcmp (region, "76") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "77") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "78") == 0 ) { - timezone = "Asia/Yekaterinburg"; - } - else if ( strcmp (region, "79") == 0 ) { - timezone = "Asia/Irkutsk"; - } - else if ( strcmp (region, "80") == 0 ) { - timezone = "Asia/Yekaterinburg"; - } - else if ( strcmp (region, "81") == 0 ) { - timezone = "Europe/Samara"; - } - else if ( strcmp (region, "82") == 0 ) { - timezone = "Asia/Irkutsk"; - } - else if ( strcmp (region, "83") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "84") == 0 ) { - timezone = "Europe/Volgograd"; - } - else if ( strcmp (region, "85") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "86") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "87") == 0 ) { - timezone = "Asia/Novosibirsk"; - } - else if ( strcmp (region, "88") == 0 ) { - timezone = "Europe/Moscow"; - } - else if ( strcmp (region, "89") == 0 ) { - timezone = "Asia/Vladivostok"; - } - } - else if ( strcmp (country, "RW") == 0 ) { - timezone = "Africa/Kigali"; - } - else if ( strcmp (country, "SA") == 0 ) { - timezone = "Asia/Riyadh"; - } - else if ( strcmp (country, "SB") == 0 ) { - timezone = "Pacific/Guadalcanal"; - } - else if ( strcmp (country, "SC") == 0 ) { - timezone = "Indian/Mahe"; - } - else if ( strcmp (country, "SD") == 0 ) { - timezone = "Africa/Khartoum"; - } - else if ( strcmp (country, "SE") == 0 ) { - timezone = "Europe/Stockholm"; - } - else if ( strcmp (country, "SG") == 0 ) { - timezone = "Asia/Singapore"; - } - else if ( strcmp (country, "SH") == 0 ) { - timezone = "Atlantic/St_Helena"; - } - else if ( strcmp (country, "SI") == 0 ) { - timezone = "Europe/Ljubljana"; - } - else if ( strcmp (country, "SJ") == 0 ) { - timezone = "Arctic/Longyearbyen"; - } - else if ( strcmp (country, "SK") == 0 ) { - timezone = "Europe/Bratislava"; - } - else if ( strcmp (country, "SL") == 0 ) { - timezone = "Africa/Freetown"; - } - else if ( strcmp (country, "SM") == 0 ) { - timezone = "Europe/San_Marino"; - } - else if ( strcmp (country, "SN") == 0 ) { - timezone = "Africa/Dakar"; - } - else if ( strcmp (country, "SO") == 0 ) { - timezone = "Africa/Mogadishu"; - } - else if ( strcmp (country, "SR") == 0 ) { - timezone = "America/Paramaribo"; - } - else if ( strcmp (country, "ST") == 0 ) { - timezone = "Africa/Sao_Tome"; - } - else if ( strcmp (country, "SV") == 0 ) { - timezone = "America/El_Salvador"; - } - else if ( strcmp (country, "SX") == 0 ) { - timezone = "America/Curacao"; - } - else if ( strcmp (country, "SY") == 0 ) { - timezone = "Asia/Damascus"; - } - else if ( strcmp (country, "SZ") == 0 ) { - timezone = "Africa/Mbabane"; - } - else if ( strcmp (country, "TC") == 0 ) { - timezone = "America/Grand_Turk"; - } - else if ( strcmp (country, "TD") == 0 ) { - timezone = "Africa/Ndjamena"; - } - else if ( strcmp (country, "TF") == 0 ) { - timezone = "Indian/Kerguelen"; - } - else if ( strcmp (country, "TG") == 0 ) { - timezone = "Africa/Lome"; - } - else if ( strcmp (country, "TH") == 0 ) { - timezone = "Asia/Bangkok"; - } - else if ( strcmp (country, "TJ") == 0 ) { - timezone = "Asia/Dushanbe"; - } - else if ( strcmp (country, "TK") == 0 ) { - timezone = "Pacific/Fakaofo"; - } - else if ( strcmp (country, "TL") == 0 ) { - timezone = "Asia/Dili"; - } - else if ( strcmp (country, "TM") == 0 ) { - timezone = "Asia/Ashgabat"; - } - else if ( strcmp (country, "TN") == 0 ) { - timezone = "Africa/Tunis"; - } - else if ( strcmp (country, "TO") == 0 ) { - timezone = "Pacific/Tongatapu"; - } - else if ( strcmp (country, "TR") == 0 ) { - timezone = "Asia/Istanbul"; - } - else if ( strcmp (country, "TT") == 0 ) { - timezone = "America/Port_of_Spain"; - } - else if ( strcmp (country, "TV") == 0 ) { - timezone = "Pacific/Funafuti"; - } - else if ( strcmp (country, "TW") == 0 ) { - timezone = "Asia/Taipei"; - } - else if ( strcmp (country, "TZ") == 0 ) { - timezone = "Africa/Dar_es_Salaam"; - } - else if ( strcmp (country, "UA") == 0 ) { - if ( strcmp (region, "01") == 0 ) { - timezone = "Europe/Kiev"; - } - else if ( strcmp (region, "02") == 0 ) { - timezone = "Europe/Kiev"; - } - else if ( strcmp (region, "03") == 0 ) { - timezone = "Europe/Uzhgorod"; - } - else if ( strcmp (region, "04") == 0 ) { - timezone = "Europe/Zaporozhye"; - } - else if ( strcmp (region, "05") == 0 ) { - timezone = "Europe/Zaporozhye"; - } - else if ( strcmp (region, "06") == 0 ) { - timezone = "Europe/Uzhgorod"; - } - else if ( strcmp (region, "07") == 0 ) { - timezone = "Europe/Zaporozhye"; - } - else if ( strcmp (region, "08") == 0 ) { - timezone = "Europe/Simferopol"; - } - else if ( strcmp (region, "09") == 0 ) { - timezone = "Europe/Kiev"; - } - else if ( strcmp (region, "10") == 0 ) { - timezone = "Europe/Zaporozhye"; - } - else if ( strcmp (region, "11") == 0 ) { - timezone = "Europe/Simferopol"; - } - else if ( strcmp (region, "13") == 0 ) { - timezone = "Europe/Kiev"; - } - else if ( strcmp (region, "14") == 0 ) { - timezone = "Europe/Zaporozhye"; - } - else if ( strcmp (region, "15") == 0 ) { - timezone = "Europe/Uzhgorod"; - } - else if ( strcmp (region, "16") == 0 ) { - timezone = "Europe/Zaporozhye"; - } - else if ( strcmp (region, "17") == 0 ) { - timezone = "Europe/Simferopol"; - } - else if ( strcmp (region, "18") == 0 ) { - timezone = "Europe/Zaporozhye"; - } - else if ( strcmp (region, "19") == 0 ) { - timezone = "Europe/Kiev"; - } - else if ( strcmp (region, "20") == 0 ) { - timezone = "Europe/Simferopol"; - } - else if ( strcmp (region, "21") == 0 ) { - timezone = "Europe/Kiev"; - } - else if ( strcmp (region, "22") == 0 ) { - timezone = "Europe/Uzhgorod"; - } - else if ( strcmp (region, "23") == 0 ) { - timezone = "Europe/Kiev"; - } - else if ( strcmp (region, "24") == 0 ) { - timezone = "Europe/Uzhgorod"; - } - else if ( strcmp (region, "25") == 0 ) { - timezone = "Europe/Uzhgorod"; - } - else if ( strcmp (region, "26") == 0 ) { - timezone = "Europe/Zaporozhye"; - } - else if ( strcmp (region, "27") == 0 ) { - timezone = "Europe/Kiev"; - } - } - else if ( strcmp (country, "UG") == 0 ) { - timezone = "Africa/Kampala"; - } - else if ( strcmp (country, "US") == 0 ) { - if ( strcmp (region, "AK") == 0 ) { - timezone = "America/Anchorage"; - } - else if ( strcmp (region, "AL") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "AR") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "AZ") == 0 ) { - timezone = "America/Phoenix"; - } - else if ( strcmp (region, "CA") == 0 ) { - timezone = "America/Los_Angeles"; - } - else if ( strcmp (region, "CO") == 0 ) { - timezone = "America/Denver"; - } - else if ( strcmp (region, "CT") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "DC") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "DE") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "FL") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "GA") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "HI") == 0 ) { - timezone = "Pacific/Honolulu"; - } - else if ( strcmp (region, "IA") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "ID") == 0 ) { - timezone = "America/Denver"; - } - else if ( strcmp (region, "IL") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "IN") == 0 ) { - timezone = "America/Indianapolis"; - } - else if ( strcmp (region, "KS") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "KY") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "LA") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "MA") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "MD") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "ME") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "MI") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "MN") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "MO") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "MS") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "MT") == 0 ) { - timezone = "America/Denver"; - } - else if ( strcmp (region, "NC") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "ND") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "NE") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "NH") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "NJ") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "NM") == 0 ) { - timezone = "America/Denver"; - } - else if ( strcmp (region, "NV") == 0 ) { - timezone = "America/Los_Angeles"; - } - else if ( strcmp (region, "NY") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "OH") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "OK") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "OR") == 0 ) { - timezone = "America/Los_Angeles"; - } - else if ( strcmp (region, "PA") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "RI") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "SC") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "SD") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "TN") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "TX") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "UT") == 0 ) { - timezone = "America/Denver"; - } - else if ( strcmp (region, "VA") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "VT") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "WA") == 0 ) { - timezone = "America/Los_Angeles"; - } - else if ( strcmp (region, "WI") == 0 ) { - timezone = "America/Chicago"; - } - else if ( strcmp (region, "WV") == 0 ) { - timezone = "America/New_York"; - } - else if ( strcmp (region, "WY") == 0 ) { - timezone = "America/Denver"; - } - } - else if ( strcmp (country, "UY") == 0 ) { - timezone = "America/Montevideo"; - } - else if ( strcmp (country, "UZ") == 0 ) { - if ( strcmp (region, "01") == 0 ) { - timezone = "Asia/Tashkent"; - } - else if ( strcmp (region, "02") == 0 ) { - timezone = "Asia/Samarkand"; - } - else if ( strcmp (region, "03") == 0 ) { - timezone = "Asia/Tashkent"; - } - else if ( strcmp (region, "06") == 0 ) { - timezone = "Asia/Tashkent"; - } - else if ( strcmp (region, "07") == 0 ) { - timezone = "Asia/Samarkand"; - } - else if ( strcmp (region, "08") == 0 ) { - timezone = "Asia/Samarkand"; - } - else if ( strcmp (region, "09") == 0 ) { - timezone = "Asia/Samarkand"; - } - else if ( strcmp (region, "10") == 0 ) { - timezone = "Asia/Samarkand"; - } - else if ( strcmp (region, "12") == 0 ) { - timezone = "Asia/Samarkand"; - } - else if ( strcmp (region, "13") == 0 ) { - timezone = "Asia/Tashkent"; - } - else if ( strcmp (region, "14") == 0 ) { - timezone = "Asia/Tashkent"; - } - } - else if ( strcmp (country, "VA") == 0 ) { - timezone = "Europe/Vatican"; - } - else if ( strcmp (country, "VC") == 0 ) { - timezone = "America/St_Vincent"; - } - else if ( strcmp (country, "VE") == 0 ) { - timezone = "America/Caracas"; - } - else if ( strcmp (country, "VG") == 0 ) { - timezone = "America/Tortola"; - } - else if ( strcmp (country, "VI") == 0 ) { - timezone = "America/St_Thomas"; - } - else if ( strcmp (country, "VN") == 0 ) { - timezone = "Asia/Phnom_Penh"; - } - else if ( strcmp (country, "VU") == 0 ) { - timezone = "Pacific/Efate"; - } - else if ( strcmp (country, "WF") == 0 ) { - timezone = "Pacific/Wallis"; - } - else if ( strcmp (country, "WS") == 0 ) { - timezone = "Pacific/Samoa"; - } - else if ( strcmp (country, "YE") == 0 ) { - timezone = "Asia/Aden"; - } - else if ( strcmp (country, "YT") == 0 ) { - timezone = "Indian/Mayotte"; - } - else if ( strcmp (country, "YU") == 0 ) { - timezone = "Europe/Belgrade"; - } - else if ( strcmp (country, "ZA") == 0 ) { - timezone = "Africa/Johannesburg"; - } - else if ( strcmp (country, "ZM") == 0 ) { - timezone = "Africa/Lusaka"; - } - else if ( strcmp (country, "ZW") == 0 ) { - timezone = "Africa/Harare"; - } - return timezone; -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/types.h b/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/types.h deleted file mode 100644 index 42c5ddd0..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/libGeoIP/types.h +++ /dev/null @@ -1,140 +0,0 @@ -/* types.h - some common typedefs - * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. - * - * This file is part of GNUPG. - * - * GNUPG 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. - * - * GNUPG is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef G10_TYPES_H -#define G10_TYPES_H - -#ifdef HAVE_INTTYPES_H -/* For uint64_t */ -#include -#endif - -/* The AC_CHECK_SIZEOF() in configure fails for some machines. - * we provide some fallback values here */ -#if !SIZEOF_UNSIGNED_SHORT -#undef SIZEOF_UNSIGNED_SHORT -#define SIZEOF_UNSIGNED_SHORT 2 -#endif -#if !SIZEOF_UNSIGNED_INT -#undef SIZEOF_UNSIGNED_INT -#define SIZEOF_UNSIGNED_INT 4 -#endif -#if !SIZEOF_UNSIGNED_LONG -#undef SIZEOF_UNSIGNED_LONG -#define SIZEOF_UNSIGNED_LONG 4 -#endif - - -#include - -#ifndef HAVE_BYTE_TYPEDEF -#undef byte /* maybe there is a macro with this name */ -#ifndef __riscos__ -typedef unsigned char byte; -#else -/* Norcroft treats char = unsigned char as legal assignment - but char* = unsigned char* as illegal assignment - and the same applies to the signed variants as well */ -typedef char byte; -#endif -#define HAVE_BYTE_TYPEDEF -#endif - -#ifndef HAVE_USHORT_TYPEDEF -#undef ushort /* maybe there is a macro with this name */ -typedef unsigned short ushort; -#define HAVE_USHORT_TYPEDEF -#endif - -#ifndef HAVE_ULONG_TYPEDEF -#undef ulong /* maybe there is a macro with this name */ -typedef unsigned long ulong; -#define HAVE_ULONG_TYPEDEF -#endif - -#ifndef HAVE_U16_TYPEDEF -#undef u16 /* maybe there is a macro with this name */ -#if SIZEOF_UNSIGNED_INT == 2 -typedef unsigned int u16; -#elif SIZEOF_UNSIGNED_SHORT == 2 -typedef unsigned short u16; -#else -#error no typedef for u16 -#endif -#define HAVE_U16_TYPEDEF -#endif - -#ifndef HAVE_U32_TYPEDEF -#undef u32 /* maybe there is a macro with this name */ -#if SIZEOF_UNSIGNED_INT == 4 -typedef unsigned int u32; -#elif SIZEOF_UNSIGNED_LONG == 4 -typedef unsigned long u32; -#else -#error no typedef for u32 -#endif -#define HAVE_U32_TYPEDEF -#endif - -/**************** - * Warning: Some systems segfault when this u64 typedef and - * the dummy code in cipher/md.c is not available. Examples are - * Solaris and IRIX. - */ -#ifndef HAVE_U64_TYPEDEF -#undef u64 /* maybe there is a macro with this name */ -#if SIZEOF_UINT64_T == 8 -typedef uint64_t u64; -#define U64_C(c) (UINT64_C(c)) -#define HAVE_U64_TYPEDEF -#elif SIZEOF_UNSIGNED_INT == 8 -typedef unsigned int u64; -#define U64_C(c) (c ## U) -#define HAVE_U64_TYPEDEF -#elif SIZEOF_UNSIGNED_LONG == 8 -typedef unsigned long u64; -#define U64_C(c) (c ## UL) -#define HAVE_U64_TYPEDEF -#elif SIZEOF_UNSIGNED_LONG_LONG == 8 -typedef unsigned long long u64; -#define U64_C(c) (c ## ULL) -#define HAVE_U64_TYPEDEF -#endif -#endif - -typedef union { - int a; - short b; - char c[1]; - long d; -#ifdef HAVE_U64_TYPEDEF - u64 e; -#endif - float f; - double g; -} PROPERLY_ALIGNED_TYPE; - -typedef struct string_list { - struct string_list *next; - unsigned int flags; - char d[1]; -} *STRLIST; - -#endif /*G10_TYPES_H*/ diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/ltmain.sh b/Src/Plugins/DSP/sc_serv3/GeoIP/ltmain.sh deleted file mode 100644 index 7ed280bc..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/ltmain.sh +++ /dev/null @@ -1,8413 +0,0 @@ -# Generated from ltmain.m4sh. - -# ltmain.sh (GNU libtool) 2.2.6b -# Written by Gordon Matzigkeit , 1996 - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# GNU Libtool is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# Usage: $progname [OPTION]... [MODE-ARG]... -# -# Provide generalized library-building support services. -# -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print informational messages (default) -# --version print version information -# -h, --help print short or long help message -# -# MODE must be one of the following: -# -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory -# -# MODE-ARGS vary depending on the MODE. -# Try `$progname --help --mode=MODE' for a more detailed description of MODE. -# -# When reporting a bug, please describe a test case to reproduce it and -# include the following information: -# -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1 -# automake: $automake_version -# autoconf: $autoconf_version -# -# Report bugs to . - -PROGRAM=ltmain.sh -PACKAGE=libtool -VERSION="2.2.6b Debian-2.2.6b-2ubuntu1" -TIMESTAMP="" -package_revision=1.3017 - -# 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+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# NLS nuisances: We save the old values to restore during execute mode. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -lt_user_locale= -lt_safe_locale= -for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES -do - eval "if test \"\${$lt_var+set}\" = set; then - save_$lt_var=\$$lt_var - $lt_var=C - export $lt_var - lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" - lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" - fi" -done - -$lt_unset CDPATH - - - - - -: ${CP="cp -f"} -: ${ECHO="echo"} -: ${EGREP="/bin/grep -E"} -: ${FGREP="/bin/grep -F"} -: ${GREP="/bin/grep"} -: ${LN_S="ln -s"} -: ${MAKE="make"} -: ${MKDIR="mkdir"} -: ${MV="mv -f"} -: ${RM="rm -f"} -: ${SED="/bin/sed"} -: ${SHELL="${CONFIG_SHELL-/bin/sh}"} -: ${Xsed="$SED -e 1s/^X//"} - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. -EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. - -exit_status=$EXIT_SUCCESS - -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" - -dirname="s,/[^/]*$,," -basename="s,^.*/,," - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` -} - -# Generated shell functions inserted here. - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - -# The name of this program: -# In the unlikely event $progname began with a '-', it would play havoc with -# func_echo (imagine progname=-n), so we prepend ./ in that case: -func_dirname_and_basename "$progpath" -progname=$func_basename_result -case $progname in - -*) progname=./$progname ;; -esac - -# Make sure we have an absolute path for reexecution: -case $progpath in - [\\/]*|[A-Za-z]:\\*) ;; - *[\\/]*) - progdir=$func_dirname_result - progdir=`cd "$progdir" && pwd` - progpath="$progdir/$progname" - ;; - *) - save_IFS="$IFS" - IFS=: - for progdir in $PATH; do - IFS="$save_IFS" - test -x "$progdir/$progname" && break - done - IFS="$save_IFS" - test -n "$progdir" || progdir=`pwd` - progpath="$progdir/$progname" - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Re-`\' parameter expansions in output of double_quote_subst that were -# `\'-ed in input to the same. If an odd number of `\' preceded a '$' -# in input to double_quote_subst, that '$' was protected from expansion. -# Since each input `\' is now two `\'s, look for any number of runs of -# four `\'s followed by two `\'s and then a '$'. `\' that '$'. -bs='\\' -bs2='\\\\' -bs4='\\\\\\\\' -dollar='\$' -sed_double_backslash="\ - s/$bs4/&\\ -/g - s/^$bs2$dollar/$bs&/ - s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g - s/\n//g" - -# Standard options: -opt_dry_run=false -opt_help=false -opt_quiet=false -opt_verbose=false -opt_warning=: - -# func_echo arg... -# Echo program name prefixed message, along with the current mode -# name if it has been set yet. -func_echo () -{ - $ECHO "$progname${mode+: }$mode: $*" -} - -# func_verbose arg... -# Echo program name prefixed message in verbose mode only. -func_verbose () -{ - $opt_verbose && func_echo ${1+"$@"} - - # A bug in bash halts the script if the last line of a function - # fails when set -e is in force, so we need another command to - # work around that: - : -} - -# func_error arg... -# Echo program name prefixed message to standard error. -func_error () -{ - $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 -} - -# func_warning arg... -# Echo program name prefixed warning message to standard error. -func_warning () -{ - $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 - - # bash bug again: - : -} - -# func_fatal_error arg... -# Echo program name prefixed message to standard error, and exit. -func_fatal_error () -{ - func_error ${1+"$@"} - exit $EXIT_FAILURE -} - -# func_fatal_help arg... -# Echo program name prefixed message to standard error, followed by -# a help hint, and exit. -func_fatal_help () -{ - func_error ${1+"$@"} - func_fatal_error "$help" -} -help="Try \`$progname --help' for more information." ## default - - -# func_grep expression filename -# Check whether EXPRESSION matches any line of FILENAME, without output. -func_grep () -{ - $GREP "$1" "$2" >/dev/null 2>&1 -} - - -# func_mkdir_p directory-path -# Make sure the entire path to DIRECTORY-PATH is available. -func_mkdir_p () -{ - my_directory_path="$1" - my_dir_list= - - if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then - - # Protect directory names starting with `-' - case $my_directory_path in - -*) my_directory_path="./$my_directory_path" ;; - esac - - # While some portion of DIR does not yet exist... - while test ! -d "$my_directory_path"; do - # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. - my_dir_list="$my_directory_path:$my_dir_list" - - # If the last portion added has no slash in it, the list is done - case $my_directory_path in */*) ;; *) break ;; esac - - # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"` - done - my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'` - - save_mkdir_p_IFS="$IFS"; IFS=':' - for my_dir in $my_dir_list; do - IFS="$save_mkdir_p_IFS" - # mkdir can fail with a `File exist' error if two processes - # try to create one of the directories concurrently. Don't - # stop in that case! - $MKDIR "$my_dir" 2>/dev/null || : - done - IFS="$save_mkdir_p_IFS" - - # Bail out if we (or some other process) failed to create a directory. - test -d "$my_directory_path" || \ - func_fatal_error "Failed to create \`$1'" - fi -} - - -# func_mktempdir [string] -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. -func_mktempdir () -{ - my_template="${TMPDIR-/tmp}/${1-$progname}" - - if test "$opt_dry_run" = ":"; then - # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" - else - - # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` - - if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" - - save_mktempdir_umask=`umask` - umask 0077 - $MKDIR "$my_tmpdir" - umask $save_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || \ - func_fatal_error "cannot create temporary directory \`$my_tmpdir'" - fi - - $ECHO "X$my_tmpdir" | $Xsed -} - - -# func_quote_for_eval arg -# Aesthetically quote ARG to be evaled later. -# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT -# is double-quoted, suitable for a subsequent eval, whereas -# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters -# which are still active within double quotes backslashified. -func_quote_for_eval () -{ - case $1 in - *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;; - *) - func_quote_for_eval_unquoted_result="$1" ;; - esac - - case $func_quote_for_eval_unquoted_result in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and and variable - # expansion for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" - ;; - *) - func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" - esac -} - - -# func_quote_for_expand arg -# Aesthetically quote ARG to be evaled later; same as above, -# but do not quote variable references. -func_quote_for_expand () -{ - case $1 in - *[\\\`\"]*) - my_arg=`$ECHO "X$1" | $Xsed \ - -e "$double_quote_subst" -e "$sed_double_backslash"` ;; - *) - my_arg="$1" ;; - esac - - case $my_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting and command substitution for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - my_arg="\"$my_arg\"" - ;; - esac - - func_quote_for_expand_result="$my_arg" -} - - -# func_show_eval cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. -func_show_eval () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$my_cmd" - my_status=$? - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - -# func_show_eval_locale cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. Use the saved locale for evaluation. -func_show_eval_locale () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$lt_user_locale - $my_cmd" - my_status=$? - eval "$lt_safe_locale" - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - - - - -# func_version -# Echo version message to standard output and exit. -func_version () -{ - $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# // - s/^# *$// - s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ - p - }' < "$progpath" - exit $? -} - -# func_usage -# Echo short help message to standard output and exit. -func_usage () -{ - $SED -n '/^# Usage:/,/# -h/ { - s/^# // - s/^# *$// - s/\$progname/'$progname'/ - p - }' < "$progpath" - $ECHO - $ECHO "run \`$progname --help | more' for full usage" - exit $? -} - -# func_help -# Echo long help message to standard output and exit. -func_help () -{ - $SED -n '/^# Usage:/,/# Report bugs to/ { - s/^# // - s/^# *$// - s*\$progname*'$progname'* - s*\$host*'"$host"'* - s*\$SHELL*'"$SHELL"'* - s*\$LTCC*'"$LTCC"'* - s*\$LTCFLAGS*'"$LTCFLAGS"'* - s*\$LD*'"$LD"'* - s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ - p - }' < "$progpath" - exit $? -} - -# func_missing_arg argname -# Echo program name prefixed message to standard error and set global -# exit_cmd. -func_missing_arg () -{ - func_error "missing argument for $1" - exit_cmd=exit -} - -exit_cmd=: - - - - - -# Check that we have a working $ECHO. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then - # Yippee, $ECHO works! - : -else - # Restart under the correct shell, and then maybe $ECHO will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null 2>&1; then - taglist="$taglist $tagname" - - # Evaluate the configuration. Be careful to quote the path - # and the sed script, to avoid splitting on whitespace, but - # also don't use non-portable quotes within backquotes within - # quotes we have to do it in 2 steps: - extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` - eval "$extractedcf" - else - func_error "ignoring unknown tag $tagname" - fi - ;; - esac -} - -# Parse options once, thoroughly. This comes as soon as possible in -# the script to make things like `libtool --version' happen quickly. -{ - - # Shorthand for --mode=foo, only valid as the first argument - case $1 in - clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; - compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; - execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; - finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; - install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; - link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; - uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; - esac - - # Parse non-mode specific arguments: - while test "$#" -gt 0; do - opt="$1" - shift - - case $opt in - --config) func_config ;; - - --debug) preserve_args="$preserve_args $opt" - func_echo "enabling shell trace mode" - opt_debug='set -x' - $opt_debug - ;; - - -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break - execute_dlfiles="$execute_dlfiles $1" - shift - ;; - - --dry-run | -n) opt_dry_run=: ;; - --features) func_features ;; - --finish) mode="finish" ;; - - --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break - case $1 in - # Valid mode arguments: - clean) ;; - compile) ;; - execute) ;; - finish) ;; - install) ;; - link) ;; - relink) ;; - uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; - esac - - mode="$1" - shift - ;; - - --preserve-dup-deps) - opt_duplicate_deps=: ;; - - --quiet|--silent) preserve_args="$preserve_args $opt" - opt_silent=: - ;; - - --verbose| -v) preserve_args="$preserve_args $opt" - opt_silent=false - ;; - - --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break - preserve_args="$preserve_args $opt $1" - func_enable_tag "$1" # tagname is set here - shift - ;; - - # Separate optargs to long options: - -dlopen=*|--mode=*|--tag=*) - func_opt_split "$opt" - set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} - shift - ;; - - -\?|-h) func_usage ;; - --help) opt_help=: ;; - --version) func_version ;; - - -*) func_fatal_help "unrecognized option \`$opt'" ;; - - *) nonopt="$opt" - break - ;; - esac - done - - - case $host in - *cygwin* | *mingw* | *pw32* | *cegcc*) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: - ;; - *) - opt_duplicate_compiler_generated_deps=$opt_duplicate_deps - ;; - esac - - # Having warned about all mis-specified options, bail out if - # anything was wrong. - $exit_cmd $EXIT_FAILURE -} - -# func_check_version_match -# Ensure that we are using m4 macros, and libtool script from the same -# release of libtool. -func_check_version_match () -{ - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from an older release. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - fi - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, -$progname: but the definition of this LT_INIT comes from revision $macro_revision. -$progname: You should recreate aclocal.m4 with macros from revision $package_revision -$progname: of $PACKAGE $VERSION and run autoconf again. -_LT_EOF - fi - - exit $EXIT_MISMATCH - fi -} - - -## ----------- ## -## Main. ## -## ----------- ## - -$opt_help || { - # Sanity checks first: - func_check_version_match - - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi - - test -z "$mode" && func_fatal_error "error: you must specify a MODE." - - - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" - - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$mode' for more information." -} - - -# func_lalib_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_lalib_p () -{ - test -f "$1" && - $SED -e 4q "$1" 2>/dev/null \ - | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 -} - -# func_lalib_unsafe_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function implements the same check as func_lalib_p without -# resorting to external programs. To this end, it redirects stdin and -# closes it afterwards, without saving the original file descriptor. -# As a safety measure, use it only where a negative result would be -# fatal anyway. Works if `file' does not exist. -func_lalib_unsafe_p () -{ - lalib_p=no - if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then - for lalib_p_l in 1 2 3 4 - do - read lalib_p_line - case "$lalib_p_line" in - \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; - esac - done - exec 0<&5 5<&- - fi - test "$lalib_p" = yes -} - -# func_ltwrapper_script_p file -# True iff FILE is a libtool wrapper script -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_script_p () -{ - func_lalib_p "$1" -} - -# func_ltwrapper_executable_p file -# True iff FILE is a libtool wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_executable_p () -{ - func_ltwrapper_exec_suffix= - case $1 in - *.exe) ;; - *) func_ltwrapper_exec_suffix=.exe ;; - esac - $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 -} - -# func_ltwrapper_scriptname file -# Assumes file is an ltwrapper_executable -# uses $file to determine the appropriate filename for a -# temporary ltwrapper_script. -func_ltwrapper_scriptname () -{ - func_ltwrapper_scriptname_result="" - if func_ltwrapper_executable_p "$1"; then - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" - fi -} - -# func_ltwrapper_p file -# True iff FILE is a libtool wrapper script or wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_p () -{ - func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" -} - - -# func_execute_cmds commands fail_cmd -# Execute tilde-delimited COMMANDS. -# If FAIL_CMD is given, eval that upon failure. -# FAIL_CMD may read-access the current command in variable CMD! -func_execute_cmds () -{ - $opt_debug - save_ifs=$IFS; IFS='~' - for cmd in $1; do - IFS=$save_ifs - eval cmd=\"$cmd\" - func_show_eval "$cmd" "${2-:}" - done - IFS=$save_ifs -} - - -# func_source file -# Source FILE, adding directory component if necessary. -# Note that it is not necessary on cygwin/mingw to append a dot to -# FILE even if both FILE and FILE.exe exist: automatic-append-.exe -# behavior happens only for exec(3), not for open(2)! Also, sourcing -# `FILE.' does not work on cygwin managed mounts. -func_source () -{ - $opt_debug - case $1 in - */* | *\\*) . "$1" ;; - *) . "./$1" ;; - esac -} - - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () -{ - $opt_debug - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" - done - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" - done - case "$@ " in - " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - func_echo "unable to infer tagged configuration" - func_fatal_error "specify a tag with \`--tag'" -# else -# func_verbose "using $tagname tagged configuration" - fi - ;; - esac - fi -} - - - -# func_write_libtool_object output_name pic_name nonpic_name -# Create a libtool object file (analogous to a ".la" file), -# but don't create it if we're doing a dry run. -func_write_libtool_object () -{ - write_libobj=${1} - if test "$build_libtool_libs" = yes; then - write_lobj=\'${2}\' - else - write_lobj=none - fi - - if test "$build_old_libs" = yes; then - write_oldobj=\'${3}\' - else - write_oldobj=none - fi - - $opt_dry_run || { - cat >${write_libobj}T <?"'"'"' &()|`$[]' \ - && func_warning "libobj name \`$libobj' may not contain shell special characters." - func_dirname_and_basename "$obj" "/" "" - objname="$func_basename_result" - xdir="$func_dirname_result" - lobj=${xdir}$objdir/$objname - - test -z "$base_compile" && \ - func_fatal_help "you must specify a compilation command" - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2* | cegcc*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $ECHO "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - removelist="$removelist $output_obj" - $ECHO "$srcfile" > "$lockfile" - fi - - $opt_dry_run || $RM $removelist - removelist="$removelist $lockfile" - trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - func_quote_for_eval "$srcfile" - qsrcfile=$func_quote_for_eval_result - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" - else - # Don't build PIC code - command="$base_compile $qsrcfile" - fi - - func_mkdir_p "$xdir$objdir" - - if test -z "$output_obj"; then - # Place PIC objects in $objdir - command="$command -o $lobj" - fi - - func_show_eval_locale "$command" \ - 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - func_show_eval '$MV "$output_obj" "$lobj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - - # Allow error messages only from the first compilation. - if test "$suppress_opt" = yes; then - suppress_output=' >/dev/null 2>&1' - fi - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then - # Don't build PIC code - command="$base_compile $qsrcfile$pie_flag" - else - command="$base_compile $qsrcfile $pic_flag" - fi - if test "$compiler_c_o" = yes; then - command="$command -o $obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" - func_show_eval_locale "$command" \ - '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - func_show_eval '$MV "$output_obj" "$obj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - fi - - $opt_dry_run || { - func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - removelist=$lockfile - $RM "$lockfile" - fi - } - - exit $EXIT_SUCCESS -} - -$opt_help || { -test "$mode" = compile && func_mode_compile ${1+"$@"} -} - -func_mode_help () -{ - # We need to display help for each of the modes. - case $mode in - "") - # Generic help is extracted from the usage comments - # at the start of this file. - func_help - ;; - - clean) - $ECHO \ -"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - - compile) - $ECHO \ -"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -no-suppress do not suppress compiler output for multiple passes - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only - -shared do not build a \`.o' file suitable for static linking - -static only build a \`.o' file suitable for static linking - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - - execute) - $ECHO \ -"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - - finish) - $ECHO \ -"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - - install) - $ECHO \ -"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The following components of INSTALL-COMMAND are treated specially: - - -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - - link) - $ECHO \ -"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -shared only do dynamic linking of libtool libraries - -shrext SUFFIX override the standard shared library file extension - -static do not do any dynamic linking of uninstalled libtool libraries - -static-libtool-libs - do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -weak LIBNAME declare that the target provides the LIBNAME interface - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - - uninstall) - $ECHO \ -"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - - *) - func_fatal_help "invalid operation mode \`$mode'" - ;; - esac - - $ECHO - $ECHO "Try \`$progname --help' for more information about other modes." - - exit $? -} - - # Now that we've collected a possible --mode arg, show help if necessary - $opt_help && func_mode_help - - -# func_mode_execute arg... -func_mode_execute () -{ - $opt_debug - # The first argument is the command name. - cmd="$nonopt" - test -z "$cmd" && \ - func_fatal_help "you must specify a COMMAND" - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - test -f "$file" \ - || func_fatal_help "\`$file' is not a file" - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$lib' is not a valid libtool archive" - - # Read the libtool library. - dlname= - library_names= - func_source "$file" - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && \ - func_warning "\`$file' was not linked with \`-export-dynamic'" - continue - fi - - func_dirname "$file" "" "." - dir="$func_dirname_result" - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - if test ! -f "$dir/$dlname"; then - func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" - fi - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - func_dirname "$file" "" "." - dir="$func_dirname_result" - ;; - - *) - func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if func_ltwrapper_script_p "$file"; then - func_source "$file" - # Transform arg to wrapped name. - file="$progdir/$program" - elif func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - func_source "$func_ltwrapper_scriptname_result" - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - func_quote_for_eval "$file" - args="$args $func_quote_for_eval_result" - done - - if test "X$opt_dry_run" = Xfalse; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES - do - eval "if test \"\${save_$lt_var+set}\" = set; then - $lt_var=\$save_$lt_var; export $lt_var - else - $lt_unset $lt_var - fi" - done - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - $ECHO "export $shlibpath_var" - fi - $ECHO "$cmd$args" - exit $EXIT_SUCCESS - fi -} - -test "$mode" = execute && func_mode_execute ${1+"$@"} - - -# func_mode_finish arg... -func_mode_finish () -{ - $opt_debug - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - func_execute_cmds "$finish_cmds" 'admincmds="$admincmds -'"$cmd"'"' - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - $opt_silent && exit $EXIT_SUCCESS - - $ECHO "X----------------------------------------------------------------------" | $Xsed - $ECHO "Libraries have been installed in:" - for libdir in $libdirs; do - $ECHO " $libdir" - done - $ECHO - $ECHO "If you ever happen to want to link against installed libraries" - $ECHO "in a given directory, LIBDIR, you must either use libtool, and" - $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'" - $ECHO "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable" - $ECHO " during execution" - fi - if test -n "$runpath_var"; then - $ECHO " - add LIBDIR to the \`$runpath_var' environment variable" - $ECHO " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $ECHO " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $ECHO " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - $ECHO - - $ECHO "See any operating system documentation about shared libraries for" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual" - $ECHO "pages." - ;; - *) - $ECHO "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - $ECHO "X----------------------------------------------------------------------" | $Xsed - exit $EXIT_SUCCESS -} - -test "$mode" = finish && func_mode_finish ${1+"$@"} - - -# func_mode_install arg... -func_mode_install () -{ - $opt_debug - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - $ECHO "X$nonopt" | $GREP shtool >/dev/null; then - # Aesthetically quote it. - func_quote_for_eval "$nonopt" - install_prog="$func_quote_for_eval_result " - arg=$1 - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - func_quote_for_eval "$arg" - install_prog="$install_prog$func_quote_for_eval_result" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) - case " $install_prog " in - *[\\\ /]cp\ *) ;; - *) prev=$arg ;; - esac - ;; - -g | -m | -o) - prev=$arg - ;; - -s) - stripme=" -s" - continue - ;; - -*) - ;; - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else - dest=$arg - continue - fi - ;; - esac - - # Aesthetically quote the argument. - func_quote_for_eval "$arg" - install_prog="$install_prog $func_quote_for_eval_result" - done - - test -z "$install_prog" && \ - func_fatal_help "you must specify an install program" - - test -n "$prev" && \ - func_fatal_help "the \`$prev' option requires an argument" - - if test -z "$files"; then - if test -z "$dest"; then - func_fatal_help "no file or destination specified" - else - func_fatal_help "you must specify a destination" - fi - fi - - # Strip any trailing slash from the destination. - func_stripname '' '/' "$dest" - dest=$func_stripname_result - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - func_dirname_and_basename "$dest" "" "." - destdir="$func_dirname_result" - destname="$func_basename_result" - - # Not a directory, so check to see that there is only one file specified. - set dummy $files; shift - test "$#" -gt 1 && \ - func_fatal_help "\`$dest' is not a directory" - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - func_fatal_help "\`$destdir' must be an absolute directory name" - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$file' is not a valid libtool archive" - - library_names= - old_library= - relink_command= - func_source "$file" - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - func_dirname "$file" "/" "" - dir="$func_dirname_result" - dir="$dir$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - test "$inst_prefix_dir" = "$destdir" && \ - func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"` - fi - - func_warning "relinking \`$file'" - func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' - fi - - # See the names of the shared library. - set dummy $library_names; shift - if test -n "$1"; then - realname="$1" - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \ - 'exit $?' - tstripme="$stripme" - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - case $realname in - *.dll.a) - tstripme="" - ;; - esac - ;; - esac - if test -n "$tstripme" && test -n "$striplib"; then - func_show_eval "$striplib $destdir/$realname" 'exit $?' - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on - # the symlink we replace! Solaris /bin/ln does not understand -f, - # so we also need to try rm && ln -s. - for linkname - do - test "$linkname" != "$realname" \ - && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - func_execute_cmds "$postinstall_cmds" 'exit $?' - fi - - # Install the pseudo-library for information purposes. - func_basename "$file" - name="$func_basename_result" - instname="$dir/$name"i - func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - func_lo2o "$destfile" - staticdest=$func_lo2o_result - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - func_fatal_help "cannot copy a libtool object to \`$destfile'" - ;; - esac - - # Install the libtool object if requested. - test -n "$destfile" && \ - func_show_eval "$install_prog $file $destfile" 'exit $?' - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - func_lo2o "$file" - staticobj=$func_lo2o_result - func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - func_stripname '' '.exe' "$file" - file=$func_stripname_result - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin* | *mingw*) - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - wrapper=$func_ltwrapper_scriptname_result - else - func_stripname '' '.exe' "$file" - wrapper=$func_stripname_result - fi - ;; - *) - wrapper=$file - ;; - esac - if func_ltwrapper_script_p "$wrapper"; then - notinst_deplibs= - relink_command= - - func_source "$wrapper" - - # Check the variables that should have been set. - test -z "$generated_by_libtool_version" && \ - func_fatal_error "invalid libtool wrapper script \`$wrapper'" - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - func_source "$lib" - fi - libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - func_warning "\`$lib' has not been installed in \`$libdir'" - finalize=no - fi - done - - relink_command= - func_source "$wrapper" - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - $opt_dry_run || { - if test "$finalize" = yes; then - tmpdir=`func_mktempdir` - func_basename "$file$stripped_ext" - file="$func_basename_result" - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $opt_silent || { - func_quote_for_expand "$relink_command" - eval "func_echo $func_quote_for_expand_result" - } - if eval "$relink_command"; then : - else - func_error "error: relink \`$file' with the above command before installing it" - $opt_dry_run || ${RM}r "$tmpdir" - continue - fi - file="$outputname" - else - func_warning "cannot relink \`$file'" - fi - } - else - # Install the binary that we compiled earlier. - file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyway - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - func_stripname '' '.exe' "$destfile" - destfile=$func_stripname_result - ;; - esac - ;; - esac - func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' - $opt_dry_run || if test -n "$outputname"; then - ${RM}r "$tmpdir" - fi - ;; - esac - done - - for file in $staticlibs; do - func_basename "$file" - name="$func_basename_result" - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - func_show_eval "$install_prog \$file \$oldlib" 'exit $?' - - if test -n "$stripme" && test -n "$old_striplib"; then - func_show_eval "$old_striplib $oldlib" 'exit $?' - fi - - # Do each command in the postinstall commands. - func_execute_cmds "$old_postinstall_cmds" 'exit $?' - done - - test -n "$future_libdirs" && \ - func_warning "remember to run \`$progname --finish$future_libdirs'" - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - $opt_dry_run && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi -} - -test "$mode" = install && func_mode_install ${1+"$@"} - - -# func_generate_dlsyms outputname originator pic_p -# Extract symbols from dlprefiles and create ${outputname}S.o with -# a dlpreopen symbol table. -func_generate_dlsyms () -{ - $opt_debug - my_outputname="$1" - my_originator="$2" - my_pic_p="${3-no}" - my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` - my_dlsyms= - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - my_dlsyms="${my_outputname}S.c" - else - func_error "not configured to extract global symbols from dlpreopened files" - fi - fi - - if test -n "$my_dlsyms"; then - case $my_dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${my_outputname}.nm" - - func_show_eval "$RM $nlist ${nlist}S ${nlist}T" - - # Parse the name list into a source file. - func_verbose "creating $output_objdir/$my_dlsyms" - - $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ -/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ -/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - func_verbose "generating symbol list for \`$output'" - - $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - for progfile in $progfiles; do - func_verbose "extracting global C symbols from \`$progfile'" - $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $opt_dry_run || { - eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - if test -n "$export_symbols_regex"; then - $opt_dry_run || { - eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $opt_dry_run || { - $RM $export_symbols - eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' - ;; - esac - } - else - $opt_dry_run || { - eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - case $host in - *cygwin | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' - ;; - esac - } - fi - fi - - for dlprefile in $dlprefiles; do - func_verbose "extracting global C symbols from \`$dlprefile'" - func_basename "$dlprefile" - name="$func_basename_result" - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - done - - $opt_dry_run || { - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $MV "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if $GREP -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - $GREP -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' - else - $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms" - fi - - $ECHO >> "$output_objdir/$my_dlsyms" "\ - -/* The mapping between symbol names and symbols. */ -typedef struct { - const char *name; - void *address; -} lt_dlsymlist; -" - case $host in - *cygwin* | *mingw* | *cegcc* ) - $ECHO >> "$output_objdir/$my_dlsyms" "\ -/* DATA imports from DLLs on WIN32 con't be const, because - runtime relocations are performed -- see ld's documentation - on pseudo-relocs. */" - lt_dlsym_const= ;; - *osf5*) - echo >> "$output_objdir/$my_dlsyms" "\ -/* This system does not cope well with relocations in const data */" - lt_dlsym_const= ;; - *) - lt_dlsym_const=const ;; - esac - - $ECHO >> "$output_objdir/$my_dlsyms" "\ -extern $lt_dlsym_const lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[]; -$lt_dlsym_const lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[] = -{\ - { \"$my_originator\", (void *) 0 }," - - case $need_lib_prefix in - no) - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - *) - eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - esac - $ECHO >> "$output_objdir/$my_dlsyms" "\ - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_${my_prefix}_LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - } # !$opt_dry_run - - pic_flag_for_symtable= - case "$compile_command " in - *" -static "*) ;; - *) - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; - *-*-hpux*) - pic_flag_for_symtable=" $pic_flag" ;; - *) - if test "X$my_pic_p" != Xno; then - pic_flag_for_symtable=" $pic_flag" - fi - ;; - esac - ;; - esac - symtab_cflags= - for arg in $LTCFLAGS; do - case $arg in - -pie | -fpie | -fPIE) ;; - *) symtab_cflags="$symtab_cflags $arg" ;; - esac - done - - # Now compile the dynamic symbol file. - func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' - - # Clean up the generated files. - func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' - - # Transform the symbol file into the correct name. - symfileobj="$output_objdir/${my_outputname}S.$objext" - case $host in - *cygwin* | *mingw* | *cegcc* ) - if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - else - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - fi - ;; - *) - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"` - ;; - esac - ;; - *) - func_fatal_error "unknown suffix for \`$my_dlsyms'" - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi -} - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -func_win32_libid () -{ - $opt_debug - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then - win32_nmres=`eval $NM -f posix -A $1 | - $SED -n -e ' - 1,100{ - / I /{ - s,.*,import, - p - q - } - }'` - case $win32_nmres in - import*) win32_libid_type="x86 archive import";; - *) win32_libid_type="x86 archive static";; - esac - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $ECHO "$win32_libid_type" -} - - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - $opt_debug - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?' - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : - else - func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" - fi -} - - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - $opt_debug - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - func_basename "$my_xlib" - my_xlib="$func_basename_result" - my_xlib_u=$my_xlib - while :; do - case " $extracted_archives " in - *" $my_xlib_u "*) - func_arith $extracted_serial + 1 - extracted_serial=$func_arith_result - my_xlib_u=lt$extracted_serial-$my_xlib ;; - *) break ;; - esac - done - extracted_archives="$extracted_archives $my_xlib_u" - my_xdir="$my_gentop/$my_xlib_u" - - func_mkdir_p "$my_xdir" - - case $host in - *-darwin*) - func_verbose "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - $opt_dry_run || { - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`basename "$darwin_archive"` - darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` - if test -n "$darwin_arches"; then - darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we've a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` - $LIPO -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - $RM -rf unfat-$$ - cd "$darwin_orig_dir" - else - cd $darwin_orig_dir - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - } # !$opt_dry_run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - - func_extract_archives_result="$my_oldobjs" -} - - - -# func_emit_wrapper_part1 [arg=no] -# -# Emit the first part of a libtool wrapper script on stdout. -# For more information, see the description associated with -# func_emit_wrapper(), below. -func_emit_wrapper_part1 () -{ - func_emit_wrapper_part1_arg1=no - if test -n "$1" ; then - func_emit_wrapper_part1_arg1=$1 - fi - - $ECHO "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# 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+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: - generated_by_libtool_version='$macro_version' - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$ECHO are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - ECHO=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$ECHO works! - : - else - # Restart under the correct shell, and then maybe \$ECHO will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $ECHO "\ - - # Find the directory that this script lives in. - thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` - done -" -} -# end: func_emit_wrapper_part1 - -# func_emit_wrapper_part2 [arg=no] -# -# Emit the second part of a libtool wrapper script on stdout. -# For more information, see the description associated with -# func_emit_wrapper(), below. -func_emit_wrapper_part2 () -{ - func_emit_wrapper_part2_arg1=no - if test -n "$1" ; then - func_emit_wrapper_part2_arg1=$1 - fi - - $ECHO "\ - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1 - if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then - # special case for '.' - if test \"\$thisdir\" = \".\"; then - thisdir=\`pwd\` - fi - # remove .libs from thisdir - case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;; - $objdir ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $ECHO "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $MKDIR \"\$progdir\" - else - $RM \"\$progdir/\$file\" - fi" - - $ECHO "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $ECHO \"\$relink_command_output\" >&2 - $RM \"\$progdir/\$file\" - exit 1 - fi - fi - - $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $RM \"\$progdir/\$program\"; - $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $RM \"\$progdir/\$file\" - fi" - else - $ECHO "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $ECHO "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $ECHO "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $ECHO "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 - fi - else - # The program doesn't exist. - \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 - $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" -} -# end: func_emit_wrapper_part2 - - -# func_emit_wrapper [arg=no] -# -# Emit a libtool wrapper script on stdout. -# Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw -# wrapper executable. Must ONLY be called from within -# func_mode_link because it depends on a number of variables -# set therein. -# -# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR -# variable will take. If 'yes', then the emitted script -# will assume that the directory in which it is stored is -# the $objdir directory. This is a cygwin/mingw-specific -# behavior. -func_emit_wrapper () -{ - func_emit_wrapper_arg1=no - if test -n "$1" ; then - func_emit_wrapper_arg1=$1 - fi - - # split this up so that func_emit_cwrapperexe_src - # can call each part independently. - func_emit_wrapper_part1 "${func_emit_wrapper_arg1}" - func_emit_wrapper_part2 "${func_emit_wrapper_arg1}" -} - - -# func_to_host_path arg -# -# Convert paths to host format when used with build tools. -# Intended for use with "native" mingw (where libtool itself -# is running under the msys shell), or in the following cross- -# build environments: -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# where wine is equipped with the `winepath' executable. -# In the native mingw case, the (msys) shell automatically -# converts paths for any non-msys applications it launches, -# but that facility isn't available from inside the cwrapper. -# Similar accommodations are necessary for $host mingw and -# $build cygwin. Calling this function does no harm for other -# $host/$build combinations not listed above. -# -# ARG is the path (on $build) that should be converted to -# the proper representation for $host. The result is stored -# in $func_to_host_path_result. -func_to_host_path () -{ - func_to_host_path_result="$1" - if test -n "$1" ; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - case $build in - *mingw* ) # actually, msys - # awkward: cmd appends spaces to result - lt_sed_strip_trailing_spaces="s/[ ]*\$//" - func_to_host_path_tmp1=`( cmd //c echo "$1" |\ - $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_path_tmp1=`cygpath -w "$1"` - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # Unfortunately, winepath does not exit with a non-zero - # error code, so we are forced to check the contents of - # stdout. On the other hand, if the command is not - # found, the shell will set an exit code of 127 and print - # *an error message* to stdout. So we must check for both - # error code of zero AND non-empty stdout, which explains - # the odd construction: - func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` - if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then - func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\ - $SED -e "$lt_sed_naive_backslashify"` - else - # Allow warning below. - func_to_host_path_result="" - fi - ;; - esac - if test -z "$func_to_host_path_result" ; then - func_error "Could not determine host path corresponding to" - func_error " '$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_path_result="$1" - fi - ;; - esac - fi -} -# end: func_to_host_path - -# func_to_host_pathlist arg -# -# Convert pathlists to host format when used with build tools. -# See func_to_host_path(), above. This function supports the -# following $build/$host combinations (but does no harm for -# combinations not listed here): -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# -# Path separators are also converted from $build format to -# $host format. If ARG begins or ends with a path separator -# character, it is preserved (but converted to $host format) -# on output. -# -# ARG is a pathlist (on $build) that should be converted to -# the proper representation on $host. The result is stored -# in $func_to_host_pathlist_result. -func_to_host_pathlist () -{ - func_to_host_pathlist_result="$1" - if test -n "$1" ; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_to_host_pathlist_tmp2="$1" - # Once set for this call, this variable should not be - # reassigned. It is used in tha fallback case. - func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e 's|^:*||' -e 's|:*$||'` - case $build in - *mingw* ) # Actually, msys. - # Awkward: cmd appends spaces to result. - lt_sed_strip_trailing_spaces="s/[ ]*\$//" - func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\ - $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""` - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"` - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\ - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # unfortunately, winepath doesn't convert pathlists - func_to_host_pathlist_result="" - func_to_host_pathlist_oldIFS=$IFS - IFS=: - for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do - IFS=$func_to_host_pathlist_oldIFS - if test -n "$func_to_host_pathlist_f" ; then - func_to_host_path "$func_to_host_pathlist_f" - if test -n "$func_to_host_path_result" ; then - if test -z "$func_to_host_pathlist_result" ; then - func_to_host_pathlist_result="$func_to_host_path_result" - else - func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result" - fi - fi - fi - IFS=: - done - IFS=$func_to_host_pathlist_oldIFS - ;; - esac - if test -z "$func_to_host_pathlist_result" ; then - func_error "Could not determine the host path(s) corresponding to" - func_error " '$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This may break if $1 contains DOS-style drive - # specifications. The fix is not to complicate the expression - # below, but for the user to provide a working wine installation - # with winepath so that path translation in the cross-to-mingw - # case works properly. - lt_replace_pathsep_nix_to_dos="s|:|;|g" - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ - $SED -e "$lt_replace_pathsep_nix_to_dos"` - fi - # Now, add the leading and trailing path separators back - case "$1" in - :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" - ;; - esac - case "$1" in - *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;" - ;; - esac - ;; - esac - fi -} -# end: func_to_host_pathlist - -# func_emit_cwrapperexe_src -# emit the source code for a wrapper executable on stdout -# Must ONLY be called from within func_mode_link because -# it depends on a number of variable set therein. -func_emit_cwrapperexe_src () -{ - cat < -#include -#ifdef _MSC_VER -# include -# include -# include -# define setmode _setmode -#else -# include -# include -# ifdef __CYGWIN__ -# include -# define HAVE_SETENV -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif -# endif -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef S_IXOTH -# define S_IXOTH 0 -#endif -#ifndef S_IXGRP -# define S_IXGRP 0 -#endif - -#ifdef _MSC_VER -# define S_IXUSR _S_IEXEC -# define stat _stat -# ifndef _INTPTR_T_DEFINED -# define intptr_t int -# endif -#endif - -#ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -# define PATH_SEPARATOR ':' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -# define HAVE_DOS_BASED_FILE_SYSTEM -# define FOPEN_WB "wb" -# ifndef DIR_SEPARATOR_2 -# define DIR_SEPARATOR_2 '\\' -# endif -# ifndef PATH_SEPARATOR_2 -# define PATH_SEPARATOR_2 ';' -# endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#ifndef PATH_SEPARATOR_2 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) -#else /* PATH_SEPARATOR_2 */ -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) -#endif /* PATH_SEPARATOR_2 */ - -#ifdef __CYGWIN__ -# define FOPEN_WB "wb" -#endif - -#ifndef FOPEN_WB -# define FOPEN_WB "w" -#endif -#ifndef _O_BINARY -# define _O_BINARY 0 -#endif - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -#undef LTWRAPPER_DEBUGPRINTF -#if defined DEBUGWRAPPER -# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args -static void -ltwrapper_debugprintf (const char *fmt, ...) -{ - va_list args; - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); -} -#else -# define LTWRAPPER_DEBUGPRINTF(args) -#endif - -const char *program_name = NULL; - -void *xmalloc (size_t num); -char *xstrdup (const char *string); -const char *base_name (const char *name); -char *find_executable (const char *wrapper); -char *chase_symlinks (const char *pathspec); -int make_executable (const char *path); -int check_executable (const char *path); -char *strendzap (char *str, const char *pat); -void lt_fatal (const char *message, ...); -void lt_setenv (const char *name, const char *value); -char *lt_extend_str (const char *orig_value, const char *add, int to_end); -void lt_opt_process_env_set (const char *arg); -void lt_opt_process_env_prepend (const char *arg); -void lt_opt_process_env_append (const char *arg); -int lt_split_name_value (const char *arg, char** name, char** value); -void lt_update_exe_path (const char *name, const char *value); -void lt_update_lib_path (const char *name, const char *value); - -static const char *script_text_part1 = -EOF - - func_emit_wrapper_part1 yes | - $SED -e 's/\([\\"]\)/\\\1/g' \ - -e 's/^/ "/' -e 's/$/\\n"/' - echo ";" - cat <"))); - for (i = 0; i < newargc; i++) - { - LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); - } - -EOF - - case $host_os in - mingw*) - cat <<"EOF" - /* execv doesn't actually work on mingw as expected on unix */ - rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); - if (rval == -1) - { - /* failed to start process */ - LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); - return 127; - } - return rval; -EOF - ;; - *) - cat <<"EOF" - execv (lt_argv_zero, newargz); - return rval; /* =127, but avoids unused variable warning */ -EOF - ;; - esac - - cat <<"EOF" -} - -void * -xmalloc (size_t num) -{ - void *p = (void *) malloc (num); - if (!p) - lt_fatal ("Memory exhausted"); - - return p; -} - -char * -xstrdup (const char *string) -{ - return string ? strcpy ((char *) xmalloc (strlen (string) + 1), - string) : NULL; -} - -const char * -base_name (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha ((unsigned char) name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return base; -} - -int -check_executable (const char *path) -{ - struct stat st; - - LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", - path ? (*path ? path : "EMPTY!") : "NULL!")); - if ((!path) || (!*path)) - return 0; - - if ((stat (path, &st) >= 0) - && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) - return 1; - else - return 0; -} - -int -make_executable (const char *path) -{ - int rval = 0; - struct stat st; - - LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", - path ? (*path ? path : "EMPTY!") : "NULL!")); - if ((!path) || (!*path)) - return 0; - - if (stat (path, &st) >= 0) - { - rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); - } - return rval; -} - -/* Searches for the full path of the wrapper. Returns - newly allocated full path name if found, NULL otherwise - Does not chase symlinks, even on platforms that support them. -*/ -char * -find_executable (const char *wrapper) -{ - int has_slash = 0; - const char *p; - const char *p_next; - /* static buffer for getcwd */ - char tmp[LT_PATHMAX + 1]; - int tmp_len; - char *concat_name; - - LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", - wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); - - if ((wrapper == NULL) || (*wrapper == '\0')) - return NULL; - - /* Absolute path? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - else - { -#endif - if (IS_DIR_SEPARATOR (wrapper[0])) - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - } -#endif - - for (p = wrapper; *p; p++) - if (*p == '/') - { - has_slash = 1; - break; - } - if (!has_slash) - { - /* no slashes; search PATH */ - const char *path = getenv ("PATH"); - if (path != NULL) - { - for (p = path; *p; p = p_next) - { - const char *q; - size_t p_len; - for (q = p; *q; q++) - if (IS_PATH_SEPARATOR (*q)) - break; - p_len = q - p; - p_next = (*q == '\0' ? q : q + 1); - if (p_len == 0) - { - /* empty path: current directory */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - tmp_len = strlen (tmp); - concat_name = - XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - } - else - { - concat_name = - XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, p, p_len); - concat_name[p_len] = '/'; - strcpy (concat_name + p_len + 1, wrapper); - } - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - } - /* not found in PATH; assume curdir */ - } - /* Relative path | not found in path: prepend cwd */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - tmp_len = strlen (tmp); - concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - return NULL; -} - -char * -chase_symlinks (const char *pathspec) -{ -#ifndef S_ISLNK - return xstrdup (pathspec); -#else - char buf[LT_PATHMAX]; - struct stat s; - char *tmp_pathspec = xstrdup (pathspec); - char *p; - int has_symlinks = 0; - while (strlen (tmp_pathspec) && !has_symlinks) - { - LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", - tmp_pathspec)); - if (lstat (tmp_pathspec, &s) == 0) - { - if (S_ISLNK (s.st_mode) != 0) - { - has_symlinks = 1; - break; - } - - /* search backwards for last DIR_SEPARATOR */ - p = tmp_pathspec + strlen (tmp_pathspec) - 1; - while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - p--; - if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - { - /* no more DIR_SEPARATORS left */ - break; - } - *p = '\0'; - } - else - { - char *errstr = strerror (errno); - lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); - } - } - XFREE (tmp_pathspec); - - if (!has_symlinks) - { - return xstrdup (pathspec); - } - - tmp_pathspec = realpath (pathspec, buf); - if (tmp_pathspec == 0) - { - lt_fatal ("Could not follow symlinks for %s", pathspec); - } - return xstrdup (tmp_pathspec); -#endif -} - -char * -strendzap (char *str, const char *pat) -{ - size_t len, patlen; - - assert (str != NULL); - assert (pat != NULL); - - len = strlen (str); - patlen = strlen (pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp (str, pat) == 0) - *str = '\0'; - } - return str; -} - -static void -lt_error_core (int exit_status, const char *mode, - const char *message, va_list ap) -{ - fprintf (stderr, "%s: %s: ", program_name, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); - va_end (ap); -} - -void -lt_setenv (const char *name, const char *value) -{ - LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", - (name ? name : ""), - (value ? value : ""))); - { -#ifdef HAVE_SETENV - /* always make a copy, for consistency with !HAVE_SETENV */ - char *str = xstrdup (value); - setenv (name, str, 1); -#else - int len = strlen (name) + 1 + strlen (value) + 1; - char *str = XMALLOC (char, len); - sprintf (str, "%s=%s", name, value); - if (putenv (str) != EXIT_SUCCESS) - { - XFREE (str); - } -#endif - } -} - -char * -lt_extend_str (const char *orig_value, const char *add, int to_end) -{ - char *new_value; - if (orig_value && *orig_value) - { - int orig_value_len = strlen (orig_value); - int add_len = strlen (add); - new_value = XMALLOC (char, add_len + orig_value_len + 1); - if (to_end) - { - strcpy (new_value, orig_value); - strcpy (new_value + orig_value_len, add); - } - else - { - strcpy (new_value, add); - strcpy (new_value + add_len, orig_value); - } - } - else - { - new_value = xstrdup (add); - } - return new_value; -} - -int -lt_split_name_value (const char *arg, char** name, char** value) -{ - const char *p; - int len; - if (!arg || !*arg) - return 1; - - p = strchr (arg, (int)'='); - - if (!p) - return 1; - - *value = xstrdup (++p); - - len = strlen (arg) - strlen (*value); - *name = XMALLOC (char, len); - strncpy (*name, arg, len-1); - (*name)[len - 1] = '\0'; - - return 0; -} - -void -lt_opt_process_env_set (const char *arg) -{ - char *name = NULL; - char *value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg); - } - - lt_setenv (name, value); - XFREE (name); - XFREE (value); -} - -void -lt_opt_process_env_prepend (const char *arg) -{ - char *name = NULL; - char *value = NULL; - char *new_value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg); - } - - new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - XFREE (name); - XFREE (value); -} - -void -lt_opt_process_env_append (const char *arg) -{ - char *name = NULL; - char *value = NULL; - char *new_value = NULL; - - if (lt_split_name_value (arg, &name, &value) != 0) - { - XFREE (name); - XFREE (value); - lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg); - } - - new_value = lt_extend_str (getenv (name), value, 1); - lt_setenv (name, new_value); - XFREE (new_value); - XFREE (name); - XFREE (value); -} - -void -lt_update_exe_path (const char *name, const char *value) -{ - LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - (name ? name : ""), - (value ? value : ""))); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - /* some systems can't cope with a ':'-terminated path #' */ - int len = strlen (new_value); - while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) - { - new_value[len-1] = '\0'; - } - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -void -lt_update_lib_path (const char *name, const char *value) -{ - LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - (name ? name : ""), - (value ? value : ""))); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - } -} - - -EOF -} -# end: func_emit_cwrapperexe_src - -# func_mode_link arg... -func_mode_link () -{ - $opt_debug - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - ;; - *) - allow_undefined=yes - ;; - esac - libtool_args=$nonopt - base_compile="$nonopt $@" - compile_command=$nonopt - finalize_command=$nonopt - - compile_rpath= - finalize_rpath= - compile_shlibpath= - finalize_shlibpath= - convenience= - old_convenience= - deplibs= - old_deplibs= - compiler_flags= - linker_flags= - dllsearchpath= - lib_search_path=`pwd` - inst_prefix_dir= - new_inherited_linker_flags= - - avoid_version=no - dlfiles= - dlprefiles= - dlself=no - export_dynamic=no - export_symbols= - export_symbols_regex= - generated= - libobjs= - ltlibs= - module=no - no_install=no - objs= - non_pic_objects= - precious_files_regex= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - vinfo_number=no - weak_libs= - single_module="${wl}-single_module" - func_infer_tag $base_compile - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - break - ;; - -all-static | -static | -static-libtool-libs) - case $arg in - -all-static) - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - func_warning "complete static linking is impossible in this configuration" - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - -static) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=built - ;; - -static-libtool-libs) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - esac - build_libtool_libs=no - build_old_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - func_quote_for_eval "$arg" - qarg=$func_quote_for_eval_unquoted_result - func_append libtool_args " $func_quote_for_eval_result" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - func_append compile_command " @OUTPUT@" - func_append finalize_command " @OUTPUT@" - ;; - esac - - case $prev in - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - func_append compile_command " @SYMFILE@" - func_append finalize_command " @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - test -f "$arg" \ - || func_fatal_error "symbol file \`$arg' does not exist" - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - framework) - case $host in - *-*-darwin*) - case "$deplibs " in - *" $qarg.ltframework "*) ;; - *) deplibs="$deplibs $qarg.ltframework" # this is fixed later - ;; - esac - ;; - esac - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat "$save_arg"` - do -# moreargs="$moreargs $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - done - else - func_fatal_error "link input file \`$arg' does not exist" - fi - arg=$save_arg - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath="$rpath $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; - esac - fi - prev= - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - weak) - weak_libs="$weak_libs $arg" - prev= - continue - ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xcompiler) - compiler_flags="$compiler_flags $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" - prev= - func_append compile_command " $wl$qarg" - func_append finalize_command " $wl$qarg" - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - # See comment for -static flag below, for more details. - func_append compile_command " $link_static_flag" - func_append finalize_command " $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - func_fatal_error "\`-allow-undefined' must not be used because it is the default" - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - func_fatal_error "more than one -exported-symbols argument is not allowed" - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -framework) - prev=framework - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - func_append compile_command " $arg" - func_append finalize_command " $arg" - ;; - esac - continue - ;; - - -L*) - func_stripname '-L' '' "$arg" - dir=$func_stripname_result - if test -z "$dir"; then - if test "$#" -gt 0; then - func_fatal_error "require no space between \`-L' and \`$1'" - else - func_fatal_error "need path for \`-L' option" - fi - fi - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - test -z "$absdir" && \ - func_fatal_error "cannot determine absolute directory name of \`$dir'" - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "*) ;; - *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$dir:"*) ;; - ::) dllsearchpath=$dir;; - *) dllsearchpath="$dllsearchpath:$dir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs System.ltframework" - continue - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - test "X$arg" = "X-lc" && continue - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - test "X$arg" = "X-lc" && continue - ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - deplibs="$deplibs $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot) - compiler_flags="$compiler_flags $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - compiler_flags="$compiler_flags $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - case "$new_inherited_linker_flags " in - *" $arg "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; - esac - continue - ;; - - -multi_module) - single_module="${wl}-multi_module" - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) - # The PATH hackery in wrapper scripts is required on Windows - # and Darwin in order for the loader to find any dlls it needs. - func_warning "\`-no-install' is ignored for $host" - func_warning "assuming \`-no-fast-install' instead" - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - func_stripname '-R' '' "$arg" - dir=$func_stripname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -shared) - # The effects of -shared are defined in a previous loop. - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -static | -static-libtool-libs) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -weak) - prev=weak - continue - ;; - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - arg="$arg $wl$func_quote_for_eval_result" - compiler_flags="$compiler_flags $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Wl,*) - func_stripname '-Wl,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - arg="$arg $wl$func_quote_for_eval_result" - compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" - linker_flags="$linker_flags $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # -msg_* for osf cc - -msg_*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - # -64, -mips[0-9] enable 64-bit mode on the SGI compiler - # -r[0-9][0-9]* specifies the processor on the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler - # +DA*, +DD* enable 64-bit mode on the HP compiler - # -q* pass through compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* pass through architecture-specific - # compiler args for GCC - # -F/path gives path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC - # @file GCC response files - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - func_append compile_command " $arg" - func_append finalize_command " $arg" - compiler_flags="$compiler_flags $arg" - continue - ;; - - # Some other compiler flag. - -* | +*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - ;; - - *.$libext) - # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" - prev= - else - deplibs="$deplibs $arg" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - done # argument parsing loop - - test -n "$prev" && \ - func_fatal_help "the \`$prevarg' option requires an argument" - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - func_basename "$output" - outputname="$func_basename_result" - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - func_dirname "$output" "/" "" - output_objdir="$func_dirname_result$objdir" - # Create the object directory. - func_mkdir_p "$output_objdir" - - # Determine the type of output - case $output in - "") - func_fatal_help "you must specify an output file" - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if $opt_duplicate_deps ; then - case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - libs="$libs $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if $opt_duplicate_compiler_generated_deps; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - - case $linkmode in - lib) - passes="conv dlpreopen link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - - for pass in $passes; do - # The preopen pass in lib mode reverses $deplibs; put it back here - # so that -L comes before libs that need it for instance... - if test "$linkmode,$pass" = "lib,link"; then - ## FIXME: Find the place where the list is rebuilt in the wrong - ## order, and fix it there properly - tmp_deplibs= - for deplib in $deplibs; do - tmp_deplibs="$deplib $tmp_deplibs" - done - deplibs="$tmp_deplibs" - fi - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) - libs="$deplibs %DEPLIBS%" - test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" - ;; - esac - fi - if test "$linkmode,$pass" = "lib,dlpreopen"; then - # Collect and forward deplibs of preopened libtool libs - for lib in $dlprefiles; do - # Ignore non-libtool-libs - dependency_libs= - case $lib in - *.la) func_source "$lib" ;; - esac - - # Collect preopened libtool deplibs, except any this library - # has declared as weak libs - for deplib in $dependency_libs; do - deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"` - case " $weak_libs " in - *" $deplib_base "*) ;; - *) deplibs="$deplibs $deplib" ;; - esac - done - done - libs="$dlprefiles" - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - compiler_flags="$compiler_flags $deplib" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; - esac - fi - fi - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - func_warning "\`-l' is ignored for archives/objects" - continue - fi - func_stripname '-l' '' "$deplib" - name=$func_stripname_result - if test "$linkmode" = lib; then - searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" - else - searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" - fi - for searchdir in $searchdirs; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if func_lalib_p "$lib"; then - library_names= - old_library= - func_source "$lib" - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - *.ltframework) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; - esac - fi - fi - continue - ;; - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" - ;; - *) - func_warning "\`-L' is ignored for archives/objects" - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - func_stripname '-R' '' "$deplib" - dir=$func_stripname_result - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) lib="$deplib" ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - # Linking convenience modules into shared libraries is allowed, - # but linking other static libraries is non-portable. - case " $dlpreconveniencelibs " in - *" $deplib "*) ;; - *) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - $ECHO - $ECHO "*** Warning: Trying to link with static lib archive $deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because the file extensions .$libext of this argument makes me believe" - $ECHO "*** that it is just a static archive that I should not use here." - else - $ECHO - $ECHO "*** Warning: Linking the shared library $output against the" - $ECHO "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - ;; - esac - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - - if test "$found" = yes || test -f "$lib"; then : - else - func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" - fi - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$lib" \ - || func_fatal_error "\`$lib' is not a valid libtool archive" - - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - inherited_linker_flags= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - avoidtemprpath= - - - # Read the .la file - func_source "$lib" - - # Convert "-framework foo" to "foo.ltframework" - if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'` - for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do - case " $new_inherited_linker_flags " in - *" $tmp_inherited_linker_flag "*) ;; - *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; - esac - done - fi - dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if $opt_duplicate_deps ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - elif test "$linkmode" != prog && test "$linkmode" != lib; then - func_fatal_error "\`$lib' is not a convenience library" - fi - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - if test -z "$linklib"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - func_fatal_error "cannot -dlopen a convenience library: \`$lib'" - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" - else - newdlfiles="$newdlfiles $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - func_warning "cannot determine absolute directory name of \`$ladir'" - func_warning "passing it literally to the linker, although it might fail" - abs_ladir="$ladir" - fi - ;; - esac - func_basename "$lib" - laname="$func_basename_result" - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - func_warning "library \`$lib' was moved." - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$libdir" - absdir="$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - fi - fi # $installed = yes - func_stripname 'lib' '.la' "$laname" - name=$func_stripname_result - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir" && test "$linkmode" = prog; then - func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" - fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" - ;; - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if $opt_duplicate_deps ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { { test "$prefer_static_libs" = no || - test "$prefer_static_libs,$installed" = "built,yes"; } || - test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath:" in - *"$absdir:"*) ;; - *) temp_rpath="$temp_rpath$absdir:" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - use_static_libs=$prefer_static_libs - if test "$use_static_libs" = built && test "$installed" = yes; then - use_static_libs=no - fi - if test -n "$library_names" && - { test "$use_static_libs" = no || test -z "$old_library"; }; then - case $host in - *cygwin* | *mingw* | *cegcc*) - # No point in relinking DLLs because paths are not encoded - notinst_deplibs="$notinst_deplibs $lib" - need_relink=no - ;; - *) - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi - ;; - esac - # This is a shared library - - # Warn about portability, can't link against -module's on some - # systems (darwin). Don't bleat about dlopened modules though! - dlopenmodule="" - for dlpremoduletest in $dlprefiles; do - if test "X$dlpremoduletest" = "X$lib"; then - dlopenmodule="$dlpremoduletest" - break - fi - done - if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - $ECHO - if test "$linkmode" = prog; then - $ECHO "*** Warning: Linking the executable $output against the loadable module" - else - $ECHO "*** Warning: Linking the shared library $output against the loadable module" - fi - $ECHO "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - shift - realname="$1" - shift - libname=`eval "\\$ECHO \"$libname_spec\""` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw* | *cegcc*) - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - func_basename "$soroot" - soname="$func_basename_result" - func_stripname 'lib' '.dll' "$soname" - newlib=libimp-$func_stripname_result.a - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - func_verbose "extracting exported symbol list from \`$soname'" - func_execute_cmds "$extract_expsyms_cmds" 'exit $?' - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - func_verbose "generating import library for \`$soname'" - func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; - *-*-sysv4*uw2*) add_dir="-L$dir" ;; - *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ - *-*-unixware7*) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a (non-dlopened) module then we can not - # link against it, someone is ignoring the earlier warnings - if /usr/bin/file -L $add 2> /dev/null | - $GREP ": [^:]* bundle" >/dev/null ; then - if test "X$dlopenmodule" != "X$lib"; then - $ECHO "*** Warning: lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - $ECHO - $ECHO "*** And there doesn't seem to be a static archive available" - $ECHO "*** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - elif test -n "$old_library"; then - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - func_fatal_configuration "unsupported hardcode properties" - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && - test "$hardcode_minus_L" != yes && - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - $ECHO - $ECHO "*** Warning: This system can not link to static lib archive $lib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - $ECHO "*** But as you try to build a module library, libtool will still create " - $ECHO "*** a static module, that should work as long as the dlopening application" - $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - $ECHO - $ECHO "*** However, this would only work if libtool was able to extract symbol" - $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" - $ECHO "*** not find such a program. So, this module is probably useless." - $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) func_stripname '-R' '' "$libdir" - temp_xrpath=$func_stripname_result - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - *) temp_deplibs="$temp_deplibs $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - newlib_search_path="$newlib_search_path $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - if $opt_duplicate_deps ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - path= - case $deplib in - -L*) path="$deplib" ;; - *.la) - func_dirname "$deplib" "" "." - dir="$func_dirname_result" - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - func_warning "cannot determine absolute directory name of \`$dir'" - absdir="$dir" - fi - ;; - esac - if $GREP "^installed=no" $deplib > /dev/null; then - case $host in - *-*-darwin*) - depdepl= - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$absdir/$objdir/$depdepl" ; then - depdepl="$absdir/$objdir/$depdepl" - darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - if test -z "$darwin_install_name"; then - darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - fi - compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" - path= - fi - fi - ;; - *) - path="-L$absdir/$objdir" - ;; - esac - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - test "$absdir" != "$libdir" && \ - func_warning "\`$deplib' seems to be moved" - - path="-L$absdir" - fi - ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - if test "$pass" = link; then - if test "$linkmode" = "prog"; then - compile_deplibs="$new_inherited_linker_flags $compile_deplibs" - finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" - else - compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - fi - fi - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - fi - if test "$linkmode" = prog || test "$linkmode" = lib; then - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for archives" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for archives" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for archives" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for archives" - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for archives" - - test -n "$release" && \ - func_warning "\`-release' is ignored for archives" - - test -n "$export_symbols$export_symbols_regex" && \ - func_warning "\`-export-symbols' is ignored for archives" - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - objs="$objs$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - func_stripname 'lib' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - test "$module" = no && \ - func_fatal_help "libtool library \`$output' must begin with \`lib'" - - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - func_stripname '' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - func_stripname '' '.la' "$outputname" - libname=$func_stripname_result - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" - else - $ECHO - $ECHO "*** Warning: Linking the shared library $output against the non-libtool" - $ECHO "*** objects $objs is not portable!" - libobjs="$libobjs $objs" - fi - fi - - test "$dlself" != no && \ - func_warning "\`-dlopen self' is ignored for libtool libraries" - - set dummy $rpath - shift - test "$#" -gt 1 && \ - func_warning "ignoring multiple \`-rpath's for a libtool library" - - install_libdir="$1" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for convenience libraries" - - test -n "$release" && \ - func_warning "\`-release' is ignored for convenience libraries" - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - shift - IFS="$save_ifs" - - test -n "$7" && \ - func_fatal_help "too many parameters to \`-version-info'" - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$1" - number_minor="$2" - number_revision="$3" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows|none) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_minor" - lt_irix_increment=no - ;; - *) - func_fatal_configuration "$modename: unknown library version type \`$version_type'" - ;; - esac - ;; - no) - current="$1" - revision="$2" - age="$3" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "CURRENT \`$current' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "REVISION \`$revision' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "AGE \`$age' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - if test "$age" -gt "$current"; then - func_error "AGE \`$age' is greater than the current interface number \`$current'" - func_fatal_error "\`$vinfo' is not valid version information" - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - func_arith $current + 1 - minor_current=$func_arith_result - xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current" - ;; - - irix | nonstopux) - if test "X$lt_irix_increment" = "Xno"; then - func_arith $current - $age - else - func_arith $current - $age + 1 - fi - major=$func_arith_result - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - func_arith $revision - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - ;; - - osf) - func_arith $current - $age - major=.$func_arith_result - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - func_arith $current - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - qnx) - major=".$current" - versuffix=".$current" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - - *) - func_fatal_configuration "unknown library version type \`$version_type'" - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - func_warning "undefined symbols not allowed in $host shared libraries" - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - - fi - - func_generate_dlsyms "$libname" "$libname" "yes" - libobjs="$libobjs $symfileobj" - test "X$libobjs" = "X " && libobjs= - - if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$ECHO "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext | *.gcno) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - removelist="$removelist $p" - ;; - *) ;; - esac - done - test -n "$removelist" && \ - func_show_eval "${RM}r \$removelist" - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - #for path in $notinst_path; do - # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"` - # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"` - # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"` - #done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - deplibs="$deplibs System.ltframework" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $opt_dry_run || $RM conftest.c - cat > conftest.c </dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null | - $GREP " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | - $SED -e 10q | - $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $ECHO - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for file magic test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a file magic. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - for a_deplib in $deplibs; do - case $a_deplib in - -l*) - func_stripname -l '' "$a_deplib" - name=$func_stripname_result - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval "\\$ECHO \"$libname_spec\""` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \ - $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $ECHO - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - $ECHO "*** I have the capability to make that library automatically link in when" - $ECHO "*** you link to this library. But I can only do this if you have a" - $ECHO "*** shared version of the library, which you do not appear to have" - $ECHO "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a regex pattern. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \ - -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"` - done - fi - if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' | - $GREP . >/dev/null; then - $ECHO - if test "X$deplibs_check_method" = "Xnone"; then - $ECHO "*** Warning: inter-library dependencies are not supported in this platform." - else - $ECHO "*** Warning: inter-library dependencies are not known to be supported." - fi - $ECHO "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - fi - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - $ECHO - $ECHO "*** Warning: libtool could not satisfy all declared inter-library" - $ECHO "*** dependencies of module $libname. Therefore, libtool will create" - $ECHO "*** a static module, that should work as long as the dlopening" - $ECHO "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - $ECHO - $ECHO "*** However, this would only work if libtool was able to extract symbol" - $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could" - $ECHO "*** not find such a program. So, this module is probably useless." - $ECHO "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - $ECHO "*** The inter-library dependencies that have been dropped here will be" - $ECHO "*** automatically added whenever a program is linked with this library" - $ECHO "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - $ECHO - $ECHO "*** Since this library must not contain undefined symbols," - $ECHO "*** because either the platform does not support them or" - $ECHO "*** it was explicitly requested with -no-undefined," - $ECHO "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - case $host in - *-*-darwin*) - newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $deplibs " in - *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; - esac - ;; - *) new_libs="$new_libs $deplib" ;; - esac - done - deplibs="$new_libs" - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - shift - realname="$1" - shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - linknames= - for link - do - linknames="$linknames $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - test "X$libobjs" = "X " && libobjs= - - delfiles= - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" - export_symbols="$output_objdir/$libname.uexp" - delfiles="$delfiles $export_symbols" - fi - - orig_export_symbols= - case $host_os in - cygwin* | mingw* | cegcc*) - if test -n "$export_symbols" && test -z "$export_symbols_regex"; then - # exporting using user supplied symfile - if test "x`$SED 1q $export_symbols`" != xEXPORTS; then - # and it's NOT already a .def file. Must figure out - # which of the given symbols are data symbols and tag - # them as such. So, trigger use of export_symbols_cmds. - # export_symbols gets reassigned inside the "prepare - # the list of exported symbols" if statement, so the - # include_expsyms logic still works. - orig_export_symbols="$export_symbols" - export_symbols= - always_export_symbols=yes - fi - fi - ;; - esac - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - func_len " $cmd" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - func_show_eval "$cmd" 'exit $?' - skipped_export=false - else - # The command line is too long to execute in one step. - func_verbose "using reloadable object file for export list..." - skipped_export=: - # Break out early, otherwise skipped_export may be - # set to false by a later but shorter cmd. - break - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' - fi - - if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs="$tmp_deplibs $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec" && - test "$compiler_needs_object" = yes && - test -z "$libobjs"; then - # extract the archives, so we have objects to list. - # TODO: could optimize this to just extract one archive. - whole_archive_flag_spec= - fi - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - else - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && - func_len " $test_cmds" && - len=$func_len_result && - test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise - # or, if using GNU ld and skipped_export is not :, use a linker - # script. - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - output_la=`$ECHO "X$output" | $Xsed -e "$basename"` - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - last_robj= - k=1 - - if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then - output=${output_objdir}/${output_la}.lnkscript - func_verbose "creating GNU ld script: $output" - $ECHO 'INPUT (' > $output - for obj in $save_libobjs - do - $ECHO "$obj" >> $output - done - $ECHO ')' >> $output - delfiles="$delfiles $output" - elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then - output=${output_objdir}/${output_la}.lnk - func_verbose "creating linker input file list: $output" - : > $output - set x $save_libobjs - shift - firstobj= - if test "$compiler_needs_object" = yes; then - firstobj="$1 " - shift - fi - for obj - do - $ECHO "$obj" >> $output - done - delfiles="$delfiles $output" - output=$firstobj\"$file_list_spec$output\" - else - if test -n "$save_libobjs"; then - func_verbose "creating reloadable object files..." - output=$output_objdir/$output_la-${k}.$objext - eval test_cmds=\"$reload_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - if test "X$objlist" = X || - test "$len" -lt "$max_cmd_len"; then - func_append objlist " $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - eval concat_cmds=\"$reload_cmds $objlist $last_robj\" - else - # All subsequent reloadable object files will link in - # the last one created. - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\" - fi - last_robj=$output_objdir/$output_la-${k}.$objext - func_arith $k + 1 - k=$func_arith_result - output=$output_objdir/$output_la-${k}.$objext - objlist=$obj - func_len " $last_robj" - func_arith $len0 + $func_len_result - len=$func_arith_result - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" - if test -n "$last_robj"; then - eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" - fi - delfiles="$delfiles $output" - - else - output= - fi - - if ${skipped_export-false}; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - libobjs=$output - # Append the command to create the export file. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" - fi - fi - - test -n "$save_libobjs" && - func_verbose "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - if test -n "$export_symbols_regex" && ${skipped_export-false}; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - - if ${skipped_export-false}; then - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"' - fi - - if test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - fi - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - fi - - if test -n "$delfiles"; then - # Append the command to remove temporary files to $cmds. - eval cmds=\"\$cmds~\$RM $delfiles\" - fi - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $dlprefiles - libobjs="$libobjs $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? - - if test -n "$convenience"; then - if test -z "$whole_archive_flag_spec"; then - func_show_eval '${RM}r "$gentop"' - fi - fi - - exit $EXIT_SUCCESS - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for objects" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for objects" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for objects" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for objects" - - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for objects" - - test -n "$release" && \ - func_warning "\`-release' is ignored for objects" - - case $output in - *.lo) - test -n "$objs$old_deplibs" && \ - func_fatal_error "cannot build library object \`$output' from non-libtool objects" - - libobj=$output - func_lo2o "$libobj" - obj=$func_lo2o_result - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $opt_dry_run || $RM $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec and hope we can get by with - # turning comma into space.. - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` - else - gentop="$output_objdir/${obj}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - func_execute_cmds "$reload_cmds" 'exit $?' - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - func_execute_cmds "$reload_cmds" 'exit $?' - fi - - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) func_stripname '' '.exe' "$output" - output=$func_stripname_result.exe;; - esac - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for programs" - - test -n "$release" && \ - func_warning "\`-release' is ignored for programs" - - test "$preload" = yes \ - && test "$dlopen_support" = unknown \ - && test "$dlopen_self" = unknown \ - && test "$dlopen_self_static" = unknown && \ - func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'` - ;; - esac - - case $host in - *-*-darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - # But is supposedly fixed on 10.4 or later (yay!). - if test "$tagname" = CXX ; then - case ${MACOSX_DEPLOYMENT_TARGET-10.0} in - 10.[0123]) - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - ;; - esac - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $compile_deplibs " in - *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $compile_deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; - esac - ;; - *) new_libs="$new_libs $deplib" ;; - esac - done - compile_deplibs="$new_libs" - - - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$libdir:"*) ;; - ::) dllsearchpath=$libdir;; - *) dllsearchpath="$dllsearchpath:$libdir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - fi - - func_generate_dlsyms "$outputname" "@PROGRAM@" "no" - - # template prelinking step - if test -n "$prelink_cmds"; then - func_execute_cmds "$prelink_cmds" 'exit $?' - fi - - wrappers_required=yes - case $host in - *cygwin* | *mingw* ) - if test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - *cegcc) - # Disable wrappers for cegcc, we are cross compiling anyway. - wrappers_required=no - ;; - *) - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - esac - if test "$wrappers_required" = no; then - # Replace the output file specification. - compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - exit_status=0 - func_show_eval "$link_command" 'exit_status=$?' - - # Delete the generated files. - if test -f "$output_objdir/${outputname}S.${objext}"; then - func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' - fi - - exit $exit_status - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $opt_dry_run || $RM $output - # Link the executable and exit - func_show_eval "$link_command" 'exit $?' - exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - func_warning "this platform does not like uninstalled shared libraries" - func_warning "\`$output' will be relinked during installation" - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname - - func_show_eval "$link_command" 'exit $?' - - # Now create the wrapper script. - func_verbose "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $ECHO for shipping. - if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then - case $progpath in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; - *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; - esac - qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"` - fi - - # Only actually do things if not in dry run mode. - $opt_dry_run || { - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) func_stripname '' '.exe' "$output" - output=$func_stripname_result ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - func_stripname '' '.exe' "$outputname" - outputname=$func_stripname_result ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - func_dirname_and_basename "$output" "" "." - output_name=$func_basename_result - output_path=$func_dirname_result - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" - $RM $cwrappersource $cwrapper - trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - func_emit_cwrapperexe_src > $cwrappersource - - # The wrapper executable is built using the $host compiler, - # because it contains $host paths and files. If cross- - # compiling, it, like the target executable, must be - # executed on the $host or under an emulation environment. - $opt_dry_run || { - $LTCC $LTCFLAGS -o $cwrapper $cwrappersource - $STRIP $cwrapper - } - - # Now, create the wrapper script for func_source use: - func_ltwrapper_scriptname $cwrapper - $RM $func_ltwrapper_scriptname_result - trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 - $opt_dry_run || { - # note: this script will not be executed, so do not chmod. - if test "x$build" = "x$host" ; then - $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result - else - func_emit_wrapper no > $func_ltwrapper_scriptname_result - fi - } - ;; - * ) - $RM $output - trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 - - func_emit_wrapper no > $output - chmod +x $output - ;; - esac - } - exit $EXIT_SUCCESS - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save $symfileobj" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - if test "$preload" = yes && test -f "$symfileobj"; then - oldobjs="$oldobjs $symfileobj" - fi - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $addlibs - oldobjs="$oldobjs $func_extract_archives_result" - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds - else - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $dlprefiles - oldobjs="$oldobjs $func_extract_archives_result" - fi - - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - func_basename "$obj" - $ECHO "$func_basename_result" - done | sort | sort -uc >/dev/null 2>&1); then - : - else - $ECHO "copying selected object files to avoid basename conflicts..." - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - func_mkdir_p "$gentop" - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - func_basename "$obj" - objbase="$func_basename_result" - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - func_arith $counter + 1 - counter=$func_arith_result - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" - ;; - *) oldobjs="$oldobjs $obj" ;; - esac - done - fi - eval cmds=\"$old_archive_cmds\" - - func_len " $cmds" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - func_verbose "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - oldobjs= - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - eval test_cmds=\"$old_archive_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - for obj in $save_oldobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - func_append objlist " $obj" - if test "$len" -lt "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - len=$len0 - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" - fi - fi - fi - func_execute_cmds "$cmds" 'exit $?' - done - - test -n "$generated" && \ - func_show_eval "${RM}r$generated" - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - func_verbose "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - - # Only create the output if not a dry run. - $opt_dry_run || { - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - func_basename "$deplib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - newdependency_libs="$newdependency_libs $libdir/$name" - ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - - for lib in $dlfiles; do - case $lib in - *.la) - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - newdlfiles="$newdlfiles $libdir/$name" - ;; - *) newdlfiles="$newdlfiles $lib" ;; - esac - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - *.la) - # Only pass preopened files to the pseudo-archive (for - # eventual linking with the app. that links it) if we - # didn't already link the preopened objects directly into - # the library: - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - newdlprefiles="$newdlprefiles $libdir/$name" - ;; - esac - done - dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlfiles="$newdlfiles $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlprefiles="$newdlprefiles $abs" - done - dlprefiles="$newdlprefiles" - fi - $RM $output - # place dlname in correct position for cygwin - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; - esac - $ECHO > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags='$new_inherited_linker_flags' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Names of additional weak libraries provided by this library -weak_library_names='$weak_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $ECHO >> $output "\ -relink_command=\"$relink_command\"" - fi - done - } - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' - ;; - esac - exit $EXIT_SUCCESS -} - -{ test "$mode" = link || test "$mode" = relink; } && - func_mode_link ${1+"$@"} - - -# func_mode_uninstall arg... -func_mode_uninstall () -{ - $opt_debug - RM="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) RM="$RM $arg"; rmforce=yes ;; - -*) RM="$RM $arg" ;; - *) files="$files $arg" ;; - esac - done - - test -z "$RM" && \ - func_fatal_help "you must specify an RM program" - - rmdirs= - - origobjdir="$objdir" - for file in $files; do - func_dirname "$file" "" "." - dir="$func_dirname_result" - if test "X$dir" = X.; then - objdir="$origobjdir" - else - objdir="$dir/$origobjdir" - fi - func_basename "$file" - name="$func_basename_result" - test "$mode" = uninstall && objdir="$dir" - - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then - case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if { test -L "$file"; } >/dev/null 2>&1 || - { test -h "$file"; } >/dev/null 2>&1 || - test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if func_lalib_p "$file"; then - func_source $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" - done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - - case "$mode" in - clean) - case " $library_names " in - # " " in the beginning catches empty $dlname - *" $dlname "*) ;; - *) rmfiles="$rmfiles $objdir/$dlname" ;; - esac - test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - ;; - uninstall) - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - # FIXME: should reinstall the best remaining shared library. - ;; - esac - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if func_lalib_p "$file"; then - - # Read the .lo file - func_source $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" && - test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" && - test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$mode" = clean ; then - noexename=$name - case $file in - *.exe) - func_stripname '' '.exe' "$file" - file=$func_stripname_result - func_stripname '' '.exe' "$name" - noexename=$func_stripname_result - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles="$rmfiles $file" - ;; - esac - # Do a test to see if this is a libtool program. - if func_ltwrapper_p "$file"; then - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - relink_command= - func_source $func_ltwrapper_scriptname_result - rmfiles="$rmfiles $func_ltwrapper_scriptname_result" - else - relink_command= - func_source $dir/$noexename - fi - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - func_show_eval "$RM $rmfiles" 'exit_status=1' - done - objdir="$origobjdir" - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - func_show_eval "rmdir $dir >/dev/null 2>&1" - fi - done - - exit $exit_status -} - -{ test "$mode" = uninstall || test "$mode" = clean; } && - func_mode_uninstall ${1+"$@"} - -test -z "$mode" && { - help="$generic_help" - func_fatal_help "you must specify a MODE" -} - -test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$mode'" - -if test -n "$exec_cmd"; then - eval exec "$exec_cmd" - exit $EXIT_FAILURE -fi - -exit $exit_status - - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: -# vi:sw=2 - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/man/Makefile.am b/Src/Plugins/DSP/sc_serv3/GeoIP/man/Makefile.am deleted file mode 100644 index 0db02e3c..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/man/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -man_MANS = geoipupdate.1 geoiplookup6.1 geoiplookup.1 - -EXTRA_DIST = geoiplookup6.1.in geoiplookup.1.in geoipupdate.1.in - - -edit = sed \ - -e 's|DATADIR|$(pkgdatadir)|g' \ - -e 's|CONF_DIR|$(sysconfdir)|g' - -geoipupdate.1 geoiplookup.1 geoiplookup6.1: Makefile - rm -f $@ $@.tmp - $(edit) '$(srcdir)/$@.in' >$@.tmp - mv $@.tmp $@ - -geoipupdate.1: geoipupdate.1.in -geoiplookup.1: geoiplookup.1.in -geoiplookup6.1: geoiplookup6.1.in - -CLEANFILES = geoiplookup6.1 geoipupdate.1 geoiplookup.1 - -UPDATE_MAN = $(mandir)/man1/geoipupdate.1 -LOOKUP_MAN = $(mandir)/man1/geoiplookup.1 -LOOKUP6_MAN = $(mandir)/man1/geoiplookup6.1 - -install-data-hook: - cat geoipupdate.1 | sed s,DATADIR,$(pkgdatadir), | sed s,CONF_DIR,$(sysconfdir), > $(DESTDIR)$(UPDATE_MAN) - cat geoiplookup.1 | sed s,DATADIR,$(pkgdatadir), > $(DESTDIR)$(LOOKUP_MAN) - cat geoiplookup6.1 | sed s,DATADIR,$(pkgdatadir), > $(DESTDIR)$(LOOKUP6_MAN) - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/man/Makefile.in b/Src/Plugins/DSP/sc_serv3/GeoIP/man/Makefile.in deleted file mode 100644 index 0e8b1436..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/man/Makefile.in +++ /dev/null @@ -1,455 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in 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. - -@SET_MAKE@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = man -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -SOURCES = -DIST_SOURCES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -man1dir = $(mandir)/man1 -am__installdirs = "$(DESTDIR)$(man1dir)" -NROFF = nroff -MANS = $(man_MANS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -man_MANS = geoipupdate.1 geoiplookup6.1 geoiplookup.1 -EXTRA_DIST = geoiplookup6.1.in geoiplookup.1.in geoipupdate.1.in -edit = sed \ - -e 's|DATADIR|$(pkgdatadir)|g' \ - -e 's|CONF_DIR|$(sysconfdir)|g' - -CLEANFILES = geoiplookup6.1 geoipupdate.1 geoiplookup.1 -UPDATE_MAN = $(mandir)/man1/geoipupdate.1 -LOOKUP_MAN = $(mandir)/man1/geoiplookup.1 -LOOKUP6_MAN = $(mandir)/man1/geoiplookup6.1 -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu man/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-man1: $(man_MANS) - @$(NORMAL_INSTALL) - test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" - @list=''; test -n "$(man1dir)" || exit 0; \ - { for i in $$list; do echo "$$i"; done; \ - l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.1[a-z]*$$/p'; \ - } | while read p; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; echo "$$p"; \ - done | \ - sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ - sed 'N;N;s,\n, ,g' | { \ - list=; while read file base inst; do \ - if test "$$base" = "$$inst"; then list="$$list $$file"; else \ - echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ - $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ - fi; \ - done; \ - for i in $$list; do echo "$$i"; done | $(am__base_list) | \ - while read files; do \ - test -z "$$files" || { \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ - done; } - -uninstall-man1: - @$(NORMAL_UNINSTALL) - @list=''; test -n "$(man1dir)" || exit 0; \ - files=`{ for i in $$list; do echo "$$i"; done; \ - l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.1[a-z]*$$/p'; \ - } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ - test -z "$$files" || { \ - echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @list='$(MANS)'; if test -n "$$list"; then \ - list=`for p in $$list; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ - if test -n "$$list" && \ - grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ - echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ - grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ - echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ - echo " typically \`make maintainer-clean' will remove them" >&2; \ - exit 1; \ - else :; fi; \ - else :; fi - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(MANS) -installdirs: - for dir in "$(DESTDIR)$(man1dir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-man - @$(NORMAL_INSTALL) - $(MAKE) $(AM_MAKEFLAGS) install-data-hook -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: install-man1 - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-man - -uninstall-man: uninstall-man1 - -.MAKE: install-am install-data-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-data-hook install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-man1 install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am uninstall uninstall-am uninstall-man uninstall-man1 - - -geoipupdate.1 geoiplookup.1 geoiplookup6.1: Makefile - rm -f $@ $@.tmp - $(edit) '$(srcdir)/$@.in' >$@.tmp - mv $@.tmp $@ - -geoipupdate.1: geoipupdate.1.in -geoiplookup.1: geoiplookup.1.in -geoiplookup6.1: geoiplookup6.1.in - -install-data-hook: - cat geoipupdate.1 | sed s,DATADIR,$(pkgdatadir), | sed s,CONF_DIR,$(sysconfdir), > $(DESTDIR)$(UPDATE_MAN) - cat geoiplookup.1 | sed s,DATADIR,$(pkgdatadir), > $(DESTDIR)$(LOOKUP_MAN) - cat geoiplookup6.1 | sed s,DATADIR,$(pkgdatadir), > $(DESTDIR)$(LOOKUP6_MAN) - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/man/geoiplookup.1.in b/Src/Plugins/DSP/sc_serv3/GeoIP/man/geoiplookup.1.in deleted file mode 100644 index ede2e518..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/man/geoiplookup.1.in +++ /dev/null @@ -1,37 +0,0 @@ -.TH GEOIPLOOKUP 1 "2 Jan 2007" -.UC 4 -.SH NAME -geoiplookup \- look up country using IP Address or hostname -.SH SYNOPSIS -geoiplookup [\-d directory] [\-f filename] [\-v] -.SH DESCRIPTION -geoiplookup uses the GeoIP library and database to find the Country -that an IP address or hostname originates from. -.PP -For example -.PP -.I geoiplookup 80.60.233.195 -.PP -will find the Country that 80.60.233.195 originates from, in the following format: -.PP -.I NL, Netherlands -.PP -.SH OPTIONS -.IP "\-f" -Specify a custom path to a single GeoIP datafile. -.IP "\-d" -Specify a custom directory containing GeoIP datafile(s). By default geoiplookup looks in DATADIR -.IP "\-v" -Lists the date and build number for the GeoIP datafile(s). -.SH AUTHOR -Written by T.J. Mather -.SH "REPORTING BUGS" -Report bugs to -.SH COPYRIGHT -Copyright © 2006 MaxMind LLC - -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. -.SH "SEE ALSO" -geoipupdate(1), nslookup(1). diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/man/geoiplookup6.1.in b/Src/Plugins/DSP/sc_serv3/GeoIP/man/geoiplookup6.1.in deleted file mode 100644 index 2a49ee1a..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/man/geoiplookup6.1.in +++ /dev/null @@ -1,42 +0,0 @@ -.TH GEOIPLOOKUP6 1 "28 Oct 2008" -.UC 4 -.SH NAME -geouplookup6 \- look up country using IP Address or hostname -.SH SYNOPSIS -geouplookup6 [\-d directory] [\-f filename] [\-v] -.SH DESCRIPTION -geouplookup6 uses the GeoIP library and database to find the Country -that an IP address or hostname originates from. You must install a database suitable for geoiplookup6. IE: GeoIPv6.dat -.PP -For example: -.PP -.I geouplookup6 2001:4860:0:1001::68 -.PP -.I geoiplookup6 ipv6.google.com -.PP -will find the Country that 2001:4860:0:1001::68 originates from, in the following format: -.PP -.I US, United States -.PP -.PP Please notice, that names must resolve to a ipv6 address. For example -.PP geoiplookup6 www.maxmind.com does not work, since there is no ipv6 -.PP DNS entry -.SH OPTIONS -.IP "\-f" -Specify a custom path to a single GeoIP datafile. -.IP "\-d" -Specify a custom directory containing GeoIP datafile(s). By default geouplookup6 looks in DATADIR -.IP "\-v" -Lists the date and build number for the GeoIP datafile(s). -.SH AUTHOR -Written by T.J. Mather -.SH "REPORTING BUGS" -Report bugs to -.SH COPYRIGHT -Copyright © 2008 MaxMind LLC - -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. -.SH "SEE ALSO" -geoipupdate(1), nslookup(1). diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/man/geoipupdate.1.in b/Src/Plugins/DSP/sc_serv3/GeoIP/man/geoipupdate.1.in deleted file mode 100644 index c0f9a854..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/man/geoipupdate.1.in +++ /dev/null @@ -1,68 +0,0 @@ -.TH GEOIPUPDATE 1 "5 Oct 2010" -.UC 4 -.SH NAME -geoipupdate \- a program for updating the MaxMind GeoIP databases -.SH SYNOPSIS -geoipupdate [\-v] [\-f licensefile] -.SH DESCRIPTION -geoipupdate automatically updates the GeoIP database for GeoIP -subscribers. It connects to the MaxMind GeoIP Update server -and checks for an updated database. If it finds an updated -database, then it downloads it, uncompresses it, and installs it. -If you are running a firewall, it requires that the DNS and -HTTP (80) ports be open. -.PP -For example -.PP -.I geoipupdate \-v -.PP -Performs the update in verbose mode. -.PP -.SH OPTIONS -.IP "\-v" -Verbose mode, prints out the steps that geoipupdate takes. -.IP "\-d" -Specify a custom directory target to install the GeoIP datafile(s). By default geoipupdate installs to DATADIR -.IP "\-f" -Specifies the configuration file that contains the license key. -Defaults to CONF_DIR/GeoIP.conf -.SH USAGE -Typically you'll want to write a weekly crontab that will run geoipupdate. -Below is a sample crontab that runs geoipupdate on each Wednesday at noon: -.PP -.RS -# top of crontab -.PP -MAILTO=your@email.com -.PP -0 12 * * 3 BIN_DIR/geoipupdate -.PP -# end of crontab -.RE -To use with a proxy server, set the http_proxy environment variable. -E.g. -.RS -export http_proxy="http://proxy-hostname:port" -.RE -.SH RETURN CODES -geoipupdate returns 0 on success, 1 on error. -.SH FILES -.PP -.I CONF_DIR/GeoIP.conf -.PP -Configuration file for GeoIP, should contain license key. -.SH AUTHOR -Written by T.J. Mather -.SH "REPORTING BUGS" -Report bugs to -.SH COPYRIGHT -Copyright © 2011 MaxMind LLC - -This is free software; see the source for copying conditions. -There is NO warranty; not even for MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. -.SH "SEE ALSO" -Visit to -sign up for a GeoIP subscription. -.PP -geoiplookup(1), crontab(5) diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/missing b/Src/Plugins/DSP/sc_serv3/GeoIP/missing deleted file mode 100644 index 28055d2a..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/missing +++ /dev/null @@ -1,376 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2009-04-28.21; # UTC - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, -# 2008, 2009 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, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: -sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' -sed_minuso='s/.* -o \([^ ]*\).*/\1/p' - -# 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' - autom4te touch the output file, or create a stub one - 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] - -Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and -\`g' are ignored when checking the name. - -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 - -# normalize program name to check for. -program=`echo "$1" | sed ' - s/^gnu-//; t - s/^gnu//; t - s/^g//; t'` - -# 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). This is about non-GNU programs, so use $1 not -# $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 $program 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 "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - 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 test $# -ne 1; then - eval LASTARG="\${$#}" - case $LASTARG in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if test ! -f y.tab.h; then - echo >y.tab.h - fi - if test ! -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 test $# -ne 1; then - eval LASTARG="\${$#}" - case $LASTARG in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if test ! -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 "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit $? - 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 "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - 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-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/Makefile.am b/Src/Plugins/DSP/sc_serv3/GeoIP/test/Makefile.am deleted file mode 100644 index fffcbed3..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir)/libGeoIP \ - -Wall - -check_PROGRAMS = test-geoip - -noinst_PROGRAMS = benchmark test-geoip-region test-geoip-city test-geoip-org test-geoip-asnum test-geoip-isp test-geoip-netspeed - -EXTRA_PROGRAMS = benchmark \ - test-geoip-region \ - test-geoip-city \ - test-geoip-org \ - test-geoip-asnum \ - test-geoip-isp \ - test-geoip-netspeed - -LDADD = $(top_builddir)/libGeoIP/libGeoIP.la -AM_CPPFLAGS = -DSRCDIR=\"$(top_srcdir)\" - -test_geoip_SOURCES = test-geoip.c - -test_geoip_region_SOURCES = test-geoip-region.c - -test_geoip_org_SOURCES = test-geoip-org.c - -test_geoip_isp_SOURCES = test-geoip-isp.c - -test_geoip_asnum_SOURCES = test-geoip-asnum.c - -test_geoip_netspeed_SOURCES = test-geoip-netspeed.c - -test_geoip_city_SOURCES = test-geoip-city.c - -benchmark_SOURCES = benchmark.c - -EXTRA_DIST = Makefile.vc city_test.txt country_test.txt country_test2.txt country_test_name.txt region_test.txt -TESTS = test-geoip diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/Makefile.in b/Src/Plugins/DSP/sc_serv3/GeoIP/test/Makefile.in deleted file mode 100644 index 6d1282bd..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/Makefile.in +++ /dev/null @@ -1,657 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in 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. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -check_PROGRAMS = test-geoip$(EXEEXT) -noinst_PROGRAMS = benchmark$(EXEEXT) test-geoip-region$(EXEEXT) \ - test-geoip-city$(EXEEXT) test-geoip-org$(EXEEXT) \ - test-geoip-asnum$(EXEEXT) test-geoip-isp$(EXEEXT) \ - test-geoip-netspeed$(EXEEXT) -EXTRA_PROGRAMS = benchmark$(EXEEXT) test-geoip-region$(EXEEXT) \ - test-geoip-city$(EXEEXT) test-geoip-org$(EXEEXT) \ - test-geoip-asnum$(EXEEXT) test-geoip-isp$(EXEEXT) \ - test-geoip-netspeed$(EXEEXT) -TESTS = test-geoip$(EXEEXT) -subdir = test -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -PROGRAMS = $(noinst_PROGRAMS) -am_benchmark_OBJECTS = benchmark.$(OBJEXT) -benchmark_OBJECTS = $(am_benchmark_OBJECTS) -benchmark_LDADD = $(LDADD) -benchmark_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la -am_test_geoip_OBJECTS = test-geoip.$(OBJEXT) -test_geoip_OBJECTS = $(am_test_geoip_OBJECTS) -test_geoip_LDADD = $(LDADD) -test_geoip_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la -am_test_geoip_asnum_OBJECTS = test-geoip-asnum.$(OBJEXT) -test_geoip_asnum_OBJECTS = $(am_test_geoip_asnum_OBJECTS) -test_geoip_asnum_LDADD = $(LDADD) -test_geoip_asnum_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la -am_test_geoip_city_OBJECTS = test-geoip-city.$(OBJEXT) -test_geoip_city_OBJECTS = $(am_test_geoip_city_OBJECTS) -test_geoip_city_LDADD = $(LDADD) -test_geoip_city_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la -am_test_geoip_isp_OBJECTS = test-geoip-isp.$(OBJEXT) -test_geoip_isp_OBJECTS = $(am_test_geoip_isp_OBJECTS) -test_geoip_isp_LDADD = $(LDADD) -test_geoip_isp_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la -am_test_geoip_netspeed_OBJECTS = test-geoip-netspeed.$(OBJEXT) -test_geoip_netspeed_OBJECTS = $(am_test_geoip_netspeed_OBJECTS) -test_geoip_netspeed_LDADD = $(LDADD) -test_geoip_netspeed_DEPENDENCIES = \ - $(top_builddir)/libGeoIP/libGeoIP.la -am_test_geoip_org_OBJECTS = test-geoip-org.$(OBJEXT) -test_geoip_org_OBJECTS = $(am_test_geoip_org_OBJECTS) -test_geoip_org_LDADD = $(LDADD) -test_geoip_org_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la -am_test_geoip_region_OBJECTS = test-geoip-region.$(OBJEXT) -test_geoip_region_OBJECTS = $(am_test_geoip_region_OBJECTS) -test_geoip_region_LDADD = $(LDADD) -test_geoip_region_DEPENDENCIES = $(top_builddir)/libGeoIP/libGeoIP.la -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(benchmark_SOURCES) $(test_geoip_SOURCES) \ - $(test_geoip_asnum_SOURCES) $(test_geoip_city_SOURCES) \ - $(test_geoip_isp_SOURCES) $(test_geoip_netspeed_SOURCES) \ - $(test_geoip_org_SOURCES) $(test_geoip_region_SOURCES) -DIST_SOURCES = $(benchmark_SOURCES) $(test_geoip_SOURCES) \ - $(test_geoip_asnum_SOURCES) $(test_geoip_city_SOURCES) \ - $(test_geoip_isp_SOURCES) $(test_geoip_netspeed_SOURCES) \ - $(test_geoip_org_SOURCES) $(test_geoip_region_SOURCES) -ETAGS = etags -CTAGS = ctags -am__tty_colors = \ -red=; grn=; lgn=; blu=; std= -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GEOIP_VERSION_INFO = @GEOIP_VERSION_INFO@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -INCLUDES = \ - -I$(top_srcdir)/libGeoIP \ - -Wall - -LDADD = $(top_builddir)/libGeoIP/libGeoIP.la -AM_CPPFLAGS = -DSRCDIR=\"$(top_srcdir)\" -test_geoip_SOURCES = test-geoip.c -test_geoip_region_SOURCES = test-geoip-region.c -test_geoip_org_SOURCES = test-geoip-org.c -test_geoip_isp_SOURCES = test-geoip-isp.c -test_geoip_asnum_SOURCES = test-geoip-asnum.c -test_geoip_netspeed_SOURCES = test-geoip-netspeed.c -test_geoip_city_SOURCES = test-geoip-city.c -benchmark_SOURCES = benchmark.c -EXTRA_DIST = Makefile.vc city_test.txt country_test.txt country_test2.txt country_test_name.txt region_test.txt -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu test/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -benchmark$(EXEEXT): $(benchmark_OBJECTS) $(benchmark_DEPENDENCIES) - @rm -f benchmark$(EXEEXT) - $(LINK) $(benchmark_OBJECTS) $(benchmark_LDADD) $(LIBS) -test-geoip$(EXEEXT): $(test_geoip_OBJECTS) $(test_geoip_DEPENDENCIES) - @rm -f test-geoip$(EXEEXT) - $(LINK) $(test_geoip_OBJECTS) $(test_geoip_LDADD) $(LIBS) -test-geoip-asnum$(EXEEXT): $(test_geoip_asnum_OBJECTS) $(test_geoip_asnum_DEPENDENCIES) - @rm -f test-geoip-asnum$(EXEEXT) - $(LINK) $(test_geoip_asnum_OBJECTS) $(test_geoip_asnum_LDADD) $(LIBS) -test-geoip-city$(EXEEXT): $(test_geoip_city_OBJECTS) $(test_geoip_city_DEPENDENCIES) - @rm -f test-geoip-city$(EXEEXT) - $(LINK) $(test_geoip_city_OBJECTS) $(test_geoip_city_LDADD) $(LIBS) -test-geoip-isp$(EXEEXT): $(test_geoip_isp_OBJECTS) $(test_geoip_isp_DEPENDENCIES) - @rm -f test-geoip-isp$(EXEEXT) - $(LINK) $(test_geoip_isp_OBJECTS) $(test_geoip_isp_LDADD) $(LIBS) -test-geoip-netspeed$(EXEEXT): $(test_geoip_netspeed_OBJECTS) $(test_geoip_netspeed_DEPENDENCIES) - @rm -f test-geoip-netspeed$(EXEEXT) - $(LINK) $(test_geoip_netspeed_OBJECTS) $(test_geoip_netspeed_LDADD) $(LIBS) -test-geoip-org$(EXEEXT): $(test_geoip_org_OBJECTS) $(test_geoip_org_DEPENDENCIES) - @rm -f test-geoip-org$(EXEEXT) - $(LINK) $(test_geoip_org_OBJECTS) $(test_geoip_org_LDADD) $(LIBS) -test-geoip-region$(EXEEXT): $(test_geoip_region_OBJECTS) $(test_geoip_region_DEPENDENCIES) - @rm -f test-geoip-region$(EXEEXT) - $(LINK) $(test_geoip_region_OBJECTS) $(test_geoip_region_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchmark.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-geoip-asnum.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-geoip-city.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-geoip-isp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-geoip-netspeed.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-geoip-org.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-geoip-region.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-geoip.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; \ - srcdir=$(srcdir); export srcdir; \ - list=' $(TESTS) '; \ - $(am__tty_colors); \ - if test -n "$$list"; then \ - for tst in $$list; do \ - if test -f ./$$tst; then dir=./; \ - elif test -f $$tst; then dir=; \ - else dir="$(srcdir)/"; fi; \ - if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xpass=`expr $$xpass + 1`; \ - failed=`expr $$failed + 1`; \ - col=$$red; res=XPASS; \ - ;; \ - *) \ - col=$$grn; res=PASS; \ - ;; \ - esac; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xfail=`expr $$xfail + 1`; \ - col=$$lgn; res=XFAIL; \ - ;; \ - *) \ - failed=`expr $$failed + 1`; \ - col=$$red; res=FAIL; \ - ;; \ - esac; \ - else \ - skip=`expr $$skip + 1`; \ - col=$$blu; res=SKIP; \ - fi; \ - echo "$${col}$$res$${std}: $$tst"; \ - done; \ - if test "$$all" -eq 1; then \ - tests="test"; \ - All=""; \ - else \ - tests="tests"; \ - All="All "; \ - fi; \ - if test "$$failed" -eq 0; then \ - if test "$$xfail" -eq 0; then \ - banner="$$All$$all $$tests passed"; \ - else \ - if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ - banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ - fi; \ - else \ - if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all $$tests failed"; \ - else \ - if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ - banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ - fi; \ - fi; \ - dashes="$$banner"; \ - skipped=""; \ - if test "$$skip" -ne 0; then \ - if test "$$skip" -eq 1; then \ - skipped="($$skip test was not run)"; \ - else \ - skipped="($$skip tests were not run)"; \ - fi; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$skipped"; \ - fi; \ - report=""; \ - if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$report"; \ - fi; \ - dashes=`echo "$$dashes" | sed s/./=/g`; \ - if test "$$failed" -eq 0; then \ - echo "$$grn$$dashes"; \ - else \ - echo "$$red$$dashes"; \ - fi; \ - echo "$$banner"; \ - test -z "$$skipped" || echo "$$skipped"; \ - test -z "$$report" || echo "$$report"; \ - echo "$$dashes$$std"; \ - test "$$failed" -eq 0; \ - else :; fi - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ - clean-noinstPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: check-am install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ - clean-checkPROGRAMS clean-generic clean-libtool \ - clean-noinstPROGRAMS ctags distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/Makefile.vc b/Src/Plugins/DSP/sc_serv3/GeoIP/test/Makefile.vc deleted file mode 100644 index eaa23763..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/Makefile.vc +++ /dev/null @@ -1,29 +0,0 @@ -#NMAKE makefile for Windows developers. -#Produces a static library (GeoIP.lib). - -COMPILER=cl - -LINK = link -nologo - -CFLAGS=-DWIN32 -MD -nologo - -GEOIPINC = -I..\libGeoIP - -CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) - -GEOIPLIB = ..\libGeoIP\GeoIP.lib - -EXTRA_LIBS= advapi32.lib wsock32.lib - -AR=lib - -TEST: benchmark.exe test-geoip.exe - -benchmark.exe: benchmark.c - $(CC1) -c benchmark.c - $(LINK) benchmark.obj $(GEOIPLIB) - -test-geoip.exe: test-geoip.c - $(CC1) -c test-geoip.c - $(LINK) test-geoip.obj $(GEOIPLIB) - diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/benchmark.c b/Src/Plugins/DSP/sc_serv3/GeoIP/test/benchmark.c deleted file mode 100644 index 3d2346f2..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/benchmark.c +++ /dev/null @@ -1,135 +0,0 @@ -#include -#include -#include -#if !defined(_WIN32) -#include -#endif /* !defined(_WIN32) */ - -char *ipstring[4] = {"24.24.24.24","80.24.24.80", -"200.24.24.40","68.24.24.46"}; -int numipstrings = 4; - -#if !defined(_WIN32) -struct timeval timer_t1; -struct timeval timer_t2; -#else /* !defined(_WIN32) */ -FILETIME timer_t1; /* 100 ns */ -FILETIME timer_t2; -#endif /* !defined(_WIN32) */ - -#if !defined(_WIN32) -void timerstart() { - gettimeofday(&timer_t1,NULL); -} -double timerstop() { - int a1 = 0; - int a2 = 0; - double r = 0; - gettimeofday(&timer_t2,NULL); - a1 = timer_t2.tv_sec - timer_t1.tv_sec; - a2 = timer_t2.tv_usec - timer_t1.tv_usec; - if (a1 < 0) { - a1 = a1 - 1; - a2 = a2 + 1000000; - } - r = (((double) a1) + (((double) a2) / 1000000)); - return r; -} -#else /* !defined(_WIN32) */ -void timerstart() { - GetSystemTimeAsFileTime(&timer_t1); -} -double timerstop() { - __int64 delta; /* VC6 can't convert an unsigned int64 to to double */ - GetSystemTimeAsFileTime(&timer_t2); - delta = FILETIME_TO_USEC(timer_t2) - FILETIME_TO_USEC(timer_t2); - return delta; -} -#endif /* !defined(_WIN32) */ - -void testgeoipcountry(int flags,const char *msg,int numlookups) { - const char *str = NULL; - double t = 0; - int i4 = 0; - int i2 = 0; - GeoIP *i = NULL; - i = GeoIP_open("/usr/local/share/GeoIP/GeoIP.dat",flags); - if (i == NULL) { - printf("error: GeoIP.dat does not exist\n"); - return; - } - timerstart(); - for (i2 = 0;i2 < numlookups;i2++) { - str = GeoIP_country_name_by_addr(i,ipstring[i4]); - i4 = (i4 + 1) % numipstrings; - } - t = timerstop(); - printf("%s\n", msg); - printf("%d lookups made in %f seconds \n",numlookups,t); - GeoIP_delete(i); -} - -void testgeoipregion(int flags,const char *msg,int numlookups) { - GeoIP *i = NULL; - GeoIPRegion *i3 = NULL; - int i4 = 0; - int i2 = 0; - double t = 0; - i = GeoIP_open("/usr/local/share/GeoIP/GeoIPRegion.dat",flags); - if (i == NULL) { - printf("error: GeoIPRegion.dat does not exist\n"); - return; - } - timerstart(); - for (i2 = 0;i2 < numlookups;i2++) { - i3 = GeoIP_region_by_addr(i,ipstring[i4]); - GeoIPRegion_delete(i3); - i4 = (i4 + 1) % numipstrings; - } - t = timerstop(); - printf("%s\n", msg); - printf("%d lookups made in %f seconds \n",numlookups,t); - GeoIP_delete(i); -} - -void testgeoipcity(int flags,const char *msg,int numlookups) { - GeoIP *i = NULL; - GeoIPRecord * i3 = NULL; - int i4 = 0; - int i2 = 0; - double t = 0; - i = GeoIP_open("/usr/local/share/GeoIP/GeoIPCity.dat",flags); - if (i == NULL) { - printf("error: GeoLiteCity.dat does not exist\n"); - return; - } - timerstart(); - for (i2 = 0;i2 < numlookups;i2++) { - i3 = GeoIP_record_by_addr(i,ipstring[i4]); - GeoIPRecord_delete(i3); - i4 = (i4 + 1) % numipstrings; - } - t = timerstop(); - printf("%s\n", msg); - printf("%d lookups made in %f seconds \n",numlookups,t); - GeoIP_delete(i); -} - -int main(){ - int time = 300*numipstrings; - testgeoipcountry(0,"GeoIP Country",100*time); - testgeoipcountry(GEOIP_CHECK_CACHE,"GeoIP Country with GEOIP_CHECK_CACHE",100*time); - testgeoipcountry(GEOIP_MEMORY_CACHE,"GeoIP Country with GEOIP_MEMORY_CACHE",1000*time); - testgeoipcountry(GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE,"GeoIP Country with GEOIP_MEMORY_CACHE and GEOIP_CHECK_CACHE",1000*time); - - testgeoipregion(0,"GeoIP Region",100*time); - testgeoipregion(GEOIP_CHECK_CACHE,"GeoIP Region with GEOIP_CHECK_CACHE",100*time); - testgeoipregion(GEOIP_MEMORY_CACHE,"GeoIP Region with GEOIP_MEMORY_CACHE",1000*time); - testgeoipregion(GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE,"GeoIP Region with GEOIP_MEMORY_CACHE and GEOIP_CHECK_CACHE",1000*time); - - testgeoipcity(0,"GeoIP City",50*time); - testgeoipcity(GEOIP_INDEX_CACHE,"GeoIP City with GEOIP_INDEX_CACHE",200*time); - testgeoipcity(GEOIP_INDEX_CACHE | GEOIP_CHECK_CACHE,"GeoIP City with GEOIP_INDEX_CACHE and GEOIP_CHECK_CACHE",200*time); - testgeoipcity(GEOIP_MEMORY_CACHE,"GeoIP City with GEOIP_MEMORY_CACHE",500*time); - return 0; -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/city_test.txt b/Src/Plugins/DSP/sc_serv3/GeoIP/test/city_test.txt deleted file mode 100644 index 20cd8e15..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/city_test.txt +++ /dev/null @@ -1,2 +0,0 @@ -24.24.24.24 # Should return Ithaca, NY, US -80.24.24.24 # Should return Madrid, 29, ES diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/country_test.txt b/Src/Plugins/DSP/sc_serv3/GeoIP/test/country_test.txt deleted file mode 100644 index eaffb935..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/country_test.txt +++ /dev/null @@ -1,69 +0,0 @@ -216.236.135.152 US USA -192.106.51.100 IT ITA -147.251.48.1 CZ CZE -203.174.65.12 JP JPN -212.208.74.140 FR FRA -200.219.192.106 BR BRA -134.102.101.18 DE DEU -193.75.148.28 BE BEL -194.244.83.2 IT ITA -203.15.106.23 AU AUS -196.31.1.1 ZA ZAF -151.28.39.114 IT ITA -151.38.70.94 IT ITA -193.56.4.124 FR FRA -195.142.146.198 TR TUR -211.232.0.0 KR KOR -211.240.0.0 KR KOR -193.194.4.0 MA MAR -139.20.112.104 DE DEU -139.20.112.3 DE DEU -145.236.125.211 HU HUN -149.225.169.61 DE DEU -151.17.191.46 IT ITA -151.24.176.194 IT ITA -151.25.8.136 IT ITA -151.26.146.192 IT ITA -151.26.153.66 IT ITA -151.26.167.71 IT ITA -151.26.35.204 IT ITA -151.26.64.157 IT ITA -151.27.138.182 IT ITA -151.28.39.114 IT ITA -151.29.150.217 IT ITA -151.29.237.39 IT ITA -151.29.73.189 IT ITA -151.30.134.242 IT ITA -151.30.135.85 IT ITA -151.30.168.224 IT ITA -151.35.80.202 IT ITA -151.35.80.240 IT ITA -151.36.191.229 IT ITA -151.38.70.94 IT ITA -151.38.92.126 IT ITA -151.42.100.132 IT ITA -151.42.169.71 IT ITA -193.56.4.124 FR FRA -195.142.146.198 TR TUR -195.142.49.205 TR TUR -202.247.74.18 JP JPN -202.247.74.71 JP JPN -202.247.74.81 JP JPN -202.247.74.88 JP JPN -203.242.239.188 KR KOR -203.174.65.12 JP JPN -212.208.74.140 FR FRA -200.219.192.106 BR BRA -202.53.254.193 ID IDN -12.168.0.0 US USA -12.169.0.0 US USA -12.200.0.0 US USA -203.121.0.8 MY MYS -203.20.231.1 AU AUS -203.87.98.29 AU AUS -203.181.121.150 JP JPN -202.166.127.246 SG SGP -62.188.202.242 GB GBR -12.12.197.23 US USA -12.12.199.3 US USA -12.12.200.79 US USA diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/country_test2.txt b/Src/Plugins/DSP/sc_serv3/GeoIP/test/country_test2.txt deleted file mode 100644 index eb078a83..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/country_test2.txt +++ /dev/null @@ -1,29 +0,0 @@ -212.118.5.94 JO -64.170.57.29 US -202.7.216.215 AU -212.33.164.149 SA -68.96.110.210 US -213.166.131.168 SA -64.158.191.179 US -24.247.251.23 US -203.199.228.66 IN -195.14.141.225 CY -200.52.94.98 MX -203.197.187.193 IN -203.128.9.170 PK -144.106.240.140 US -195.248.180.102 UA -213.1.0.118 GB -64.255.148.52 US -12.78.124.119 US -212.68.224.183 BE -62.148.73.85 PL -203.146.135.180 TH -209.204.179.145 US -64.123.0.164 US -202.56.198.16 IN -61.0.94.172 IN -62.42.171.190 ES -192.117.245.177 IL -213.123.75.243 GB -80.56.171.62 NL diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/country_test_name.txt b/Src/Plugins/DSP/sc_serv3/GeoIP/test/country_test_name.txt deleted file mode 100644 index 366b2f26..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/country_test_name.txt +++ /dev/null @@ -1 +0,0 @@ -yahoo.com US diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/region_test.txt b/Src/Plugins/DSP/sc_serv3/GeoIP/test/region_test.txt deleted file mode 100644 index 4df7ea79..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/region_test.txt +++ /dev/null @@ -1,24 +0,0 @@ -216.236.135.152 US USA -24.24.24.24 US USA -147.251.48.1 CZ CZE -203.174.65.12 JP JPN -212.208.74.140 FR FRA -200.219.192.106 BR BRA -134.102.101.18 DE DEU -193.75.148.28 BE BEL -194.244.83.2 IT ITA -203.15.106.23 AU AUS -196.31.1.1 ZA ZAF -151.28.39.114 IT ITA -151.38.70.94 IT ITA -193.56.4.124 FR FRA -195.142.146.198 TR TUR -211.232.0.0 KR KOR -211.240.0.0 KR KOR -193.194.4.0 MA MAR -139.20.112.104 DE DEU -139.20.112.3 DE DEU -145.236.125.211 HU HUN -yahoo.com US USA -amazon.com US USA -www.uspto.gov US USA diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-asnum.c b/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-asnum.c deleted file mode 100644 index d6c3afcd..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-asnum.c +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ -/* test-geoip-asnum.c - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "GeoIP.h" - -static const char * _mk_NA( const char * p ){ - return p ? p : "N/A"; -} - -int main (int argc, char* argv[]) { - FILE *f; - GeoIP * gi; - char * org; - int generate = 0; - char host[50]; - - if (argc == 2) - if (!strcmp(argv[1],"gen")) - generate = 1; - - gi = GeoIP_open("../data/GeoIPASNum.dat", GEOIP_STANDARD); - - if (gi == NULL) { - fprintf(stderr, "Error opening database\n"); - exit(1); - } - - f = fopen("asnum_test.txt","r"); - - if (f == NULL) { - fprintf(stderr, "Error opening asnum_test.txt\n"); - exit(1); - } - - while (fscanf(f, "%s", host) != EOF) { - org = GeoIP_org_by_name (gi, (const char *)host); - - if (org != NULL) { - printf("%s\t%s\n", host, _mk_NA(org)); - } - } - - GeoIP_delete(gi); - - return 0; -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-city.c b/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-city.c deleted file mode 100644 index 4a48fdea..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-city.c +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ -/* test-geoip-city.c - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "GeoIP.h" -#include "GeoIPCity.h" - - -static const char * _mk_NA( const char * p ){ - return p ? p : "N/A"; -} - -int -main(int argc, char *argv[]) -{ - FILE *f; - GeoIP *gi; - GeoIPRecord *gir; - int generate = 0; - char host[50]; - const char *time_zone = NULL; - char **ret; - if (argc == 2) - if (!strcmp(argv[1], "gen")) - generate = 1; - - gi = GeoIP_open("../data/GeoIPCity.dat", GEOIP_INDEX_CACHE); - - if (gi == NULL) { - fprintf(stderr, "Error opening database\n"); - exit(1); - } - - f = fopen("city_test.txt", "r"); - - if (f == NULL) { - fprintf(stderr, "Error opening city_test.txt\n"); - exit(1); - } - - while (fscanf(f, "%s", host) != EOF) { - gir = GeoIP_record_by_name(gi, (const char *) host); - - if (gir != NULL) { - ret = GeoIP_range_by_ip(gi, (const char *) host); - time_zone = GeoIP_time_zone_by_country_and_region(gir->country_code, gir->region); - printf("%s\t%s\t%s\t%s\t%s\t%s\t%f\t%f\t%d\t%d\t%s\t%s\t%s\n", host, - _mk_NA(gir->country_code), - _mk_NA(gir->region), - _mk_NA(GeoIP_region_name_by_code(gir->country_code, gir->region)), - _mk_NA(gir->city), - _mk_NA(gir->postal_code), - gir->latitude, - gir->longitude, - gir->metro_code, - gir->area_code, - _mk_NA(time_zone), - ret[0], - ret[1]); - GeoIP_range_by_ip_delete(ret); - GeoIPRecord_delete(gir); - } - } - GeoIP_delete(gi); - return 0; - -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-isp.c b/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-isp.c deleted file mode 100644 index d6212b86..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-isp.c +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ -/* test-geoip-isp.c - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "GeoIP.h" - -static const char * _mk_NA( const char * p ){ - return p ? p : "N/A"; -} - -int main (int argc, char* argv[]) { - FILE *f; - GeoIP * gi; - char * org; - int generate = 0; - char host[50]; - - if (argc == 2) - if (!strcmp(argv[1],"gen")) - generate = 1; - - gi = GeoIP_open("../data/GeoIPISP.dat", GEOIP_STANDARD); - - if (gi == NULL) { - fprintf(stderr, "Error opening database\n"); - exit(1); - } - - f = fopen("isp_test.txt","r"); - - if (f == NULL) { - fprintf(stderr, "Error opening isp_test.txt\n"); - exit(1); - } - - while (fscanf(f, "%s", host) != EOF) { - org = GeoIP_org_by_name (gi, (const char *)host); - - if (org != NULL) { - printf("%s\t%s\n", host, _mk_NA(org)); - free(org); - } - } - - fclose(f); - GeoIP_delete(gi); - - return 0; -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-netspeed.c b/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-netspeed.c deleted file mode 100644 index 05def4e9..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-netspeed.c +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ -/* test-geoip-netspeed.c - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "GeoIP.h" - -int main (int argc, char* argv[]) { - FILE *f; - GeoIP * gi; - int netspeed; - char host[50]; - - gi = GeoIP_open("../data/GeoIPNetSpeed.dat", GEOIP_STANDARD); - - if (gi == NULL) { - fprintf(stderr, "Error opening database\n"); - exit(1); - } - - f = fopen("netspeed_test.txt","r"); - - if (f == NULL) { - fprintf(stderr, "Error opening netspeed_test.txt\n"); - exit(1); - } - - while (fscanf(f, "%s", host) != EOF) { - netspeed = GeoIP_id_by_name (gi, (const char *)host); - if (netspeed == GEOIP_UNKNOWN_SPEED) { - printf("%s\tUnknown\n", host); - } else if (netspeed == GEOIP_DIALUP_SPEED) { - printf("%s\tDialup\n", host); - } else if (netspeed == GEOIP_CABLEDSL_SPEED) { - printf("%s\tCable/DSL\n", host); - } else if (netspeed == GEOIP_CORPORATE_SPEED) { - printf("%s\tCorporate\n", host); - } - } - fclose(f); - GeoIP_delete(gi); - - return 0; -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-org.c b/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-org.c deleted file mode 100644 index 74ba01be..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-org.c +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ -/* test-geoip-org.c - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -#include "GeoIP.h" - -static const char * _mk_NA( const char * p ){ - return p ? p : "N/A"; -} - -int -main(int argc, char *argv[]) -{ - FILE *f; - GeoIP *gi; - char *org; - int generate = 0; - char host[50]; - char **ret; - if (argc == 2) - if (!strcmp(argv[1], "gen")) - generate = 1; - - gi = GeoIP_open("../data/GeoIPOrg.dat", GEOIP_INDEX_CACHE); - - if (gi == NULL) { - fprintf(stderr, "Error opening database\n"); - exit(1); - } - - f = fopen("org_test.txt", "r"); - - if (f == NULL) { - fprintf(stderr, "Error opening org_test.txt\n"); - exit(1); - } - - printf("IP\torganization\tnetmask\tbeginIp\tendIp\n"); - while (fscanf(f, "%s", host) != EOF) { - org = GeoIP_name_by_name(gi, (const char *) host); - - if (org != NULL) { - ret = GeoIP_range_by_ip(gi, (const char *) host); - - printf("%s\t%s\t%d\t%s\t%s\n", host, _mk_NA(org), GeoIP_last_netmask(gi), ret[0], ret[1]); - GeoIP_range_by_ip_delete(ret); - free(org); - } - } - - fclose(f); - GeoIP_delete(gi); - return 0; -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-region.c b/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-region.c deleted file mode 100644 index 0be75177..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip-region.c +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ -/* test-geoip-region.c - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include /* For uint32_t */ -#ifdef HAVE_STDINT_H -#include /* For uint32_t */ -#endif -#if !defined(_WIN32) -#include /* For gethostbyname */ -#include /* For ntohl */ -#else -#include -#include -#endif -#include - -unsigned long inetaddr(const char * name) -{ - struct hostent * host; - struct in_addr inaddr; - - host = gethostbyname(name); assert(host); - inaddr.s_addr = *((uint32_t*)host->h_addr_list[0]); - return inaddr.s_addr; -} - -static const char * _mk_NA ( const char * p ){ - return p ? p : "N/A"; -} - -int main () { - GeoIP * gi; - GeoIPRegion * gir, giRegion; - - FILE *f; - char ipAddress[30]; - char expectedCountry[3]; - char expectedCountry3[4]; - const char * time_zone; - - gi = GeoIP_open("../data/GeoIPRegion.dat", GEOIP_MEMORY_CACHE); - - if (gi == NULL) { - fprintf(stderr, "Error opening database\n"); - exit(1); - } - - f = fopen("region_test.txt","r"); - - if (f == NULL) { - fprintf(stderr, "Error opening region_test.txt\n"); - exit(1); - } - - gir = GeoIP_region_by_addr (gi, "10.0.0.0"); - if (gir != NULL) { - printf("lookup of private IP address: country = %s, region = %s\n", gir->country_code, gir->region); - } - - while (fscanf(f, "%s%s%s", ipAddress, expectedCountry, expectedCountry3 ) != EOF) { - printf("ip = %s\n",ipAddress); - - gir = GeoIP_region_by_name (gi, ipAddress); - time_zone = GeoIP_time_zone_by_country_and_region(gir->country_code, gir->region); - if (gir != NULL) { - printf("%s, %s, %s, %s\n", - gir->country_code, - (!gir->region[0]) ? "N/A" : gir->region, - _mk_NA(GeoIP_region_name_by_code(gir->country_code, gir->region)), - _mk_NA(time_zone)); - } else { - printf("NULL!\n"); - } - - GeoIP_assign_region_by_inetaddr (gi, inetaddr(ipAddress), &giRegion); - if (gir != NULL) { - assert(giRegion.country_code[0]); - assert(!strcmp(gir->country_code, giRegion.country_code)); - if ( gir->region[0] ) { - assert(giRegion.region[0]); - assert(!strcmp(gir->region, giRegion.region)); - } else { - assert(!giRegion.region[0]); - } - } else { - assert(!giRegion.country_code[0]); - } - - if ( gir != NULL ) { - GeoIPRegion_delete(gir); - } - } - - GeoIP_delete(gi); - return 0; -} diff --git a/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip.c b/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip.c deleted file mode 100644 index 4bb209e8..00000000 --- a/Src/Plugins/DSP/sc_serv3/GeoIP/test/test-geoip.c +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */ -/* test-geoip.c - * - * Copyright (C) 2006 MaxMind LLC - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -int main () { - FILE *f; - char ipAddress[30]; - char expectedCountry[3]; - char expectedCountry3[4]; - const char * returnedCountry; - GeoIP * gi; - int failed = 0; - int test_num = 1; - - int i; - for (i = 0; i < 2; ++i) { - if (0 == i) { - /* Read from filesystem, check for updated file */ - gi = GeoIP_open(SRCDIR"/data/GeoIP.dat", GEOIP_STANDARD | GEOIP_CHECK_CACHE); - } else { - /* Read from memory, faster but takes up more memory */ - gi = GeoIP_open(SRCDIR"/data/GeoIP.dat", GEOIP_MEMORY_CACHE); - } - - if (gi == NULL) { - fprintf(stderr, "Error opening database\n"); - exit(1); - } - - /* make sure GeoIP deals with invalid query gracefully */ - returnedCountry = GeoIP_country_code_by_addr(gi,NULL); - if (returnedCountry != NULL) { - fprintf(stderr,"Invalid Query test failed, got non NULL, expected NULL\n"); - failed = 1; - } - - returnedCountry = GeoIP_country_code_by_name(gi,NULL); - if (returnedCountry != NULL) { - fprintf(stderr,"Invalid Query test failed, got non NULL, expected NULL\n"); - failed = 1; - } - - f = fopen(SRCDIR"/test/country_test.txt","r"); - - while (fscanf(f, "%s%s%s", ipAddress, expectedCountry, expectedCountry3) != EOF) { - returnedCountry = GeoIP_country_code_by_addr(gi,ipAddress); - if (returnedCountry == NULL || strcmp(returnedCountry, expectedCountry) != 0) { - fprintf(stderr,"Test addr %d for %s failed, got %s, expected %s\n",test_num,ipAddress,returnedCountry,expectedCountry); - failed = 1; - } - returnedCountry = GeoIP_country_code_by_name(gi,ipAddress); - if (returnedCountry == NULL || strcmp(returnedCountry, expectedCountry) != 0) { - fprintf(stderr,"Test name %d for %s failed, got %s, expected %s\n",test_num,ipAddress,returnedCountry,expectedCountry); - failed = 1; - } - returnedCountry = GeoIP_country_code3_by_addr(gi,ipAddress); - if (returnedCountry == NULL || strcmp(returnedCountry, expectedCountry3) != 0) { - fprintf(stderr,"Test addr %d for %s failed, got %s, expected %s\n",test_num,ipAddress,returnedCountry,expectedCountry); - failed = 1; - } - returnedCountry = GeoIP_country_code3_by_name(gi,ipAddress); - if (returnedCountry == NULL || strcmp(returnedCountry, expectedCountry3) != 0) { - fprintf(stderr,"Test name %d for %s failed, got %s, expected %s\n",test_num,ipAddress,returnedCountry,expectedCountry); - failed = 1; - } - test_num++; - } - fclose(f); - - f = fopen(SRCDIR"/test/country_test2.txt","r"); - while (fscanf(f, "%s%s", ipAddress, expectedCountry ) != EOF) { - returnedCountry = GeoIP_country_code_by_addr(gi,ipAddress); - if (returnedCountry == NULL || strcmp(returnedCountry, expectedCountry) != 0) { - fprintf(stderr,"Test addr %d %s failed, got %s, expected %s\n",test_num,ipAddress,returnedCountry,expectedCountry); - failed = 1; - } - test_num++; - } - fclose(f); - - f = fopen(SRCDIR"/test/country_test_name.txt","r"); - while (fscanf(f, "%s%s", ipAddress, expectedCountry) != EOF) { - returnedCountry = GeoIP_country_code_by_name(gi,ipAddress); - if (returnedCountry == NULL || strcmp(returnedCountry, expectedCountry) != 0) { - fprintf(stderr,"Test addr %d %s failed, got %s, expected %s\n",test_num,ipAddress,returnedCountry,expectedCountry); - failed = 1; - } - test_num++; - } - - fclose(f); - GeoIP_delete(gi); - } - return failed; -} diff --git a/Src/Plugins/DSP/sc_serv3/ID3miniParsers.cpp b/Src/Plugins/DSP/sc_serv3/ID3miniParsers.cpp deleted file mode 100644 index 430c8c4b..00000000 --- a/Src/Plugins/DSP/sc_serv3/ID3miniParsers.cpp +++ /dev/null @@ -1,827 +0,0 @@ -#include "ID3miniParsers.h" -#include "stl/stringUtils.h" -#include - -using namespace ID3V2; -using namespace uniString; -using namespace std; - -static const __uint8 E_LATIN1(0); -static const __uint8 E_UTF16(1); // with COM -static const __uint8 E_UTF16BE(2); // big endian no BOM -static const __uint8 E_UTF8(3); // utf8 - -void ID3V2::base64encode(const char *in,size_t siz,string &out) throw() -{ - char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - int shift = 0; - int accum = 0; - - while (siz) - { - accum <<= 8; - shift += 8; - accum |= *in++; - siz--; - while ( shift >= 6 ) - { - shift -= 6; - out.push_back(alphabet[(accum >> shift) & 0x3F]); - } - } - if (shift == 4) - { - out.push_back(alphabet[(accum & 0xF)<<2]); - out.push_back('='); - } - else if (shift == 2) - { - out.push_back(alphabet[(accum & 0x3)<<4]); - out.push_back('='); - out.push_back('='); - } -} - -// way cool function. Given a hunk of data from an ID3V2 entry, break it into a collection -// of unicode strings based on a format string (sort of like sprintf for ID3V2 data) -vector ID3V2::extractor(const vector<__uint8> &data,const char *format) throw(exception) -{ - vector result; - - __uint8 encoding = E_LATIN1; - - int bytesRemaining = (int)data.size(); - vector<__uint8>::size_type offset = 0; - - const char *f = format; - while((*f) && (bytesRemaining > 0)) - { - switch(*f) - { - case ' ': break; // do nothing, just move to next - case 'e': // encoding - encoding = data[offset++]; - --bytesRemaining; - break; - - case 'c': // single digit code - { - __uint8 code = data[offset++]; - --bytesRemaining; - result.push_back(stringUtil::tos((int)code)); - } - break; - - case 'y': // dynamic counter - { - __uint64 counter = 0; - while(bytesRemaining > 0) - { - counter = counter << 8; - counter += data[offset]; - ++offset; - --bytesRemaining; - } - result.push_back(stringUtil::tos(counter)); - } - break; - - case 'u': // non-encoding string - { - size_t slen = uniString::strlen(&(data[offset]),bytesRemaining); - utf32 u32; - u32.assignFromLatinExtended(&(data[offset]),slen); - offset += (slen+1); - bytesRemaining -= (slen+1); - result.push_back(u32.toUtf8()); - } - break; - - case 's': // encoding string - { - if (encoding == E_LATIN1) - { - size_t slen = uniString::strlen(&(data[offset]),bytesRemaining); - utf32 u32; - u32.assignFromLatinExtended(&(data[offset]),slen); - offset += (slen+1); - bytesRemaining -= (slen+1); - result.push_back(u32.toUtf8()); - } - else if (encoding == E_UTF16) - { - const utf16::value_type *v16 = reinterpret_cast(&(data[offset])); - size_t slen = uniString::strlen(v16,bytesRemaining / 2); - utf32 u32(v16,slen); - offset += ((slen * 2) + 2); - bytesRemaining -= ((slen * 2) + 2); - result.push_back(u32.toUtf8()); - } - else if (encoding == E_UTF16BE) - { - const utf16::value_type *v16 = reinterpret_cast(&(data[offset])); - size_t slen = uniString::strlen(v16,bytesRemaining / 2); - utf32 u32(v16,slen,false); // assume big endian - offset += ((slen * 2) + 2); - bytesRemaining -= ((slen * 2) + 2); - result.push_back(u32.toUtf8()); - } - else if (encoding == E_UTF8) - { - size_t slen = uniString::strlen(&(data[offset]),bytesRemaining); - utf32 u32(&(data[offset]),slen); - offset += (slen+1); - bytesRemaining -= (slen+1); - result.push_back(u32.toUtf8()); - } - else throw runtime_error("unknown encoding " + stringUtil::tos((int)encoding)); - } - break; - - case 'b': // binary data - { - string b64; - base64encode((const char *)&(data[offset]),bytesRemaining,b64); - result.push_back(b64); - offset += bytesRemaining; - bytesRemaining = 0; - } - break; - - case 'l': // three char language code - { - if (bytesRemaining < 3) throw runtime_error("not enough data"); - utf8 l; - bool bad = - (data[offset] < '0' || data[offset] > 'z' || - data[offset+1] < '0' || data[offset+1] > 'z' || - data[offset+2] < '0' || data[offset+2] > 'z'); - - l.push_back(data[offset++]); l.push_back(data[offset++]); l.push_back(data[offset++]); - bytesRemaining -= 3; - if (bad) - result.push_back(utf8()); - else - result.push_back(l); - } - break; - - case '+': - while(f > format && ((*f) == '+' || (*f) == ' ')) --f; - --f; - break; - } - ++f; - } - - while((!result.empty()) && (result.back().empty())) result.pop_back(); - return result; -} - -static const utf8 LT("<"); -static const utf8 GT(">"); -static const utf8 LTSLASH(" &slist,genreList_t &gl) throw(runtime_error) -{ - gl.clear(); - - static const int state_Initial = 0; - static const int state_LeadingParen = 1; - static const int state_Code = 2; - static const int state_Subgenre = 3; - int state = state_Initial; - - genreEntry e; - - for(vector::const_iterator li = slist.begin(); li != slist.end(); ++li) - { - for(utf8::const_iterator i = (*li).begin(); i != (*li).end(); ++i) - { - switch(state) - { - case state_Initial: - e.m_genreCode = EMPTYSTRING; - e.m_refinement = EMPTYSTRING; - if (stringUtil::safe_is_space(*i)) {} - else if ((*i) == LPAREN) - { - state = state_LeadingParen; - } - else - { - state = state_Subgenre; - e.m_refinement += (*i); - } - break; - - case state_LeadingParen: - if ((*i) == LPAREN) - { - state = state_Subgenre; - e.m_refinement += (*i); - } - else if ((*i) == RPAREN) - { - if (!e.m_genreCode.empty() || !e.m_refinement.empty()) - gl.push_back(e); - e.m_genreCode = EMPTYSTRING; - e.m_refinement = EMPTYSTRING; - state = state_Initial; - } - else - { - if (!e.m_genreCode.empty() || !e.m_refinement.empty()) - gl.push_back(e); - e.m_genreCode = EMPTYSTRING; - e.m_refinement = EMPTYSTRING; - e.m_genreCode += (*i); - state = state_Code; - } - break; - - case state_Code: - if ((*i) == RPAREN) - { - state = state_Subgenre; - } - else - { - e.m_genreCode += *i; - } - break; - - case state_Subgenre: - if ((*i) == LPAREN) - { - state = state_LeadingParen; - } - else - { - e.m_refinement += (*i); - } - break; - - default: - throw logic_error(string(__FUNCTION__) + " internal error. Bad state"); - break; - } - } - - switch(state) - { - case state_Initial: - break; - - case state_LeadingParen: - throw runtime_error(string(__FUNCTION__) + " badly formed TCON data " + (*li).hideAsString()); - break; - - case state_Code: - throw runtime_error(string(__FUNCTION__) + " badly formed TCON data " + (*li).hideAsString()); - break; - - case state_Subgenre: - if (!e.m_genreCode.empty() || !e.m_refinement.empty()) - gl.push_back(e); - break; - - default: - throw logic_error(string(__FUNCTION__) + " internal error. Bad state"); - break; - } // character iteration - } // end string list iteration -} - -uniString::utf8 ID3V2::toXML(const utf8 &tag,const genreList_t &l) throw() -{ - utf8 result; - utf8 endTag = utf8(""); - - for(genreList_t::const_iterator i = l.begin(); i != l.end(); ++i) - { - result += LT + tag; - if (!(*i).m_genreCode.empty()) - result += utf8(" v1=\"") + (*i).m_genreCode.escapeXML() + utf8("\""); - result += GT + (*i).m_refinement.escapeXML() + endTag; - } - return result; -} - -uniString::utf8 ID3V2::toString(const genreList_t &l) throw() -{ - for(genreList_t::const_iterator i = l.begin(); i != l.end(); ++i) - { - if (!(*i).m_genreCode.empty()) return (*i).m_genreCode; - } - return uniString::utf8(); -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////// -void ID3V2::fromStringList(const vector &s,stringList_t &l) throw() -{ - //l = stringUtil::tokenizer(s,(utf8::value_type)'/'); - l = s; -} - -uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const stringList_t &l) throw() -{ - utf8 result; - utf8 startTag = LT + tag + GT; - utf8 endTag = LTSLASH + tag + GT; - for(stringList_t::const_iterator i = l.begin(); i != l.end(); ++i) - { - result += startTag + (*i).escapeXML() + endTag; - } - return result; -} - -uniString::utf8 ID3V2::toString(const stringList_t &l) throw() -{ - return (l.empty() ? uniString::utf8() : l.front()); -} - -///////////////////////////////////////////////////////////////////////////////////////////////// -void ID3V2::fromStringList(const std::vector &s,comment_t &c) throw() -{ - if (s.size() >= 3) - { - c.m_languageCode = s[0]; - c.m_id = s[1]; - c.m_comment = s[2]; - } -} - -uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const comment_t &c) throw() -{ - utf8 result; - result += LT + tag; - if (!c.m_languageCode.empty()) - result += utf8(" language=\"") + c.m_languageCode.escapeXML() + utf8("\""); - if (!c.m_id.empty()) - result += utf8(" id=\"") + c.m_id.escapeXML() + utf8("\""); - result += GT + c.m_comment.escapeXML() + LTSLASH + tag + GT; - return result; -} - -uniString::utf8 ID3V2::toString(const comment_t &c) throw() -{ - return c.m_comment; -} - -///////////////////////////////////////////////////////////////////////////////////////////////////// -void ID3V2::fromStringList(const std::vector &s,userUrl_t &c) throw() -{ - if (!s.empty()) - c.m_id = s[0]; - if (s.size() > 1) - c.m_url = s[1]; -} - -uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const userUrl_t &c) throw() -{ - if (c.m_id.empty() && c.m_url.empty()) return utf8(); - - utf8 result = LT + tag; - if (!c.m_id.empty()) - result += utf8(" id=\"") + c.m_id.escapeXML() + utf8("\""); - result += GT + c.m_url.escapeXML() + LTSLASH + tag + GT; - return result; -} - -uniString::utf8 ID3V2::toString(const userUrl_t &c) throw() -{ return c.m_url; } - -///////////////////////////////////////////////////////////////////////////////////////////////////// - -void ID3V2::fromStringList(const std::vector &s,userText_t &t) throw() -{ - if (!s.empty()) - t.m_id = s[0]; - if (s.size() > 1) - t.m_text = s[1]; -} - -uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const userText_t &t) throw() -{ - if (t.m_id.empty() && t.m_text.empty()) return utf8(); - - utf8 result = LT + tag; - if (!t.m_id.empty()) - result += utf8(" id=\"") + t.m_id.escapeXML() + utf8("\""); - result += GT + t.m_text.escapeXML() + LTSLASH + tag + GT; - return result; -} - -uniString::utf8 ID3V2::toString(const userText_t &t) throw() -{ return t.m_text; } - -///////////////////////////////////////////////////////////////////////////////////////////// - -void ID3V2::fromStringList(const std::vector &s,popularimeter_t &p) throw() -{ - vector::size_type siz = s.size(); - - if (siz > 0) - p.m_email = s[0]; - if (siz > 1) - p.m_rating = s[1]; - if (siz > 2) - p.m_counter = s[2]; -} - -uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const popularimeter_t &p) throw() -{ - if (p.m_counter.empty() && p.m_email.empty() && p.m_rating.empty()) return utf8(); - - utf8 result = LT + tag + GT; - - result += LT + utf8("email") + GT; - result += p.m_email.escapeXML(); - result += LTSLASH + utf8("email") + GT; - - result += LT + utf8("rating") + GT; - result += p.m_rating.escapeXML(); - result += LTSLASH + utf8("rating") + GT; - - result += LT + utf8("counter") + GT; - result += p.m_counter.escapeXML(); - result += LTSLASH + utf8("counter") + GT; - - result += LTSLASH + tag + GT; - return result; -} - -uniString::utf8 ID3V2::toString(const popularimeter_t &p) throw() -{ return p.m_rating; } - -///////////////////////////////////////////////////////////////////////////////////////////////// -void ID3V2::fromStringList(const std::vector &s,unsyncLyrics_t &c) throw() -{ - if (s.size() >= 3) - { - c.m_languageCode = s[0]; - c.m_id = s[1]; - c.m_lyrics = s[2]; - } -} - -uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const unsyncLyrics_t &c) throw() -{ - if (c.m_lyrics.empty()) return utf8(); - - utf8 result; - result += LT + tag; - if (!c.m_languageCode.empty()) - result += utf8(" language=\"") + c.m_languageCode.escapeXML() + utf8("\""); - if (!c.m_id.empty()) - result += utf8(" id=\"") + c.m_id.escapeXML() + utf8("\""); - result += GT + c.m_lyrics.escapeXML() + LTSLASH + tag + GT; - return result; -} - -uniString::utf8 ID3V2::toString(const unsyncLyrics_t &c) throw() -{ - return c.m_lyrics; -} - -///////////////////////////////////////////////////////////////////////////////////////// -void ID3V2::fromStringList(const std::vector &s,picture_t &p) throw() -{ - vector::size_type siz = s.size(); - if (siz > 0) p.m_mimeType = s[0]; - if (siz > 1) p.m_pictureType = s[1]; - if (siz > 2) p.m_id = s[2]; - if (siz > 3) p.m_pictureData = s[3]; -} - -uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const picture_t &p) throw() -{ - utf8 result; - result += LT + tag; - if (!p.m_mimeType.empty()) - result += utf8(" mime=\"") + p.m_mimeType.escapeXML() + utf8("\""); - if (!p.m_id.empty()) - result += utf8(" id=\"") + p.m_id.escapeXML() + utf8("\""); - if (!p.m_pictureType.empty()) - result += utf8(" type=\"") + p.m_pictureType.escapeXML() + utf8("\""); - result += GT + p.m_pictureData.escapeXML() + LTSLASH + tag + GT; - return result; -} - -uniString::utf8 ID3V2::toString(const picture_t &p) throw() -{ - return p.m_pictureData; -} - -//////////////////////////////////////////////////////////////////////////////////// -void ID3V2::fromStringList(const std::vector &s,mcdi_t &m) throw() -{ - if (!s.empty()) m.m_cdTOC = s[0]; -} - -uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const mcdi_t &m) throw() -{ - utf8 result; - result += LT + tag; - result += GT + m.m_cdTOC.escapeXML() + LTSLASH + tag + GT; - return result; -} - -uniString::utf8 ID3V2::toString(const mcdi_t &m) throw() -{ return m.m_cdTOC; } - -//////////////////////////////////////////////////////////////////////////////////// - -void ID3V2::fromStringList(const std::vector &s,ufid_t &u) throw() -{ - vector::size_type siz = s.size(); - if (siz > 0) u.m_id = s[0]; - if (siz > 1) u.m_data = s[1]; -} - -uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const ufid_t &u) throw() -{ - utf8 result; - result += LT + tag; - if (!u.m_id.empty()) - result += utf8(" id=\"") + u.m_id.escapeXML() + utf8("\""); - result += GT + u.m_data.escapeXML() + LTSLASH + tag + GT; - return result; -} - -uniString::utf8 ID3V2::toString(const ufid_t &u) throw() -{ return u.m_data; } - -//////////////////////////////////////////////////////////////////////////////////// - -void ID3V2::fromStringList(const std::vector &s,part_t &p) throw() -{ - if (!s.empty()) - { - vector l = stringUtil::tokenizer(s[0],(utf8::value_type)'/'); - if (!l.empty()) p.m_part = l[0]; - if (l.size() > 1) p.m_total = l[1]; - } -} - -uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const part_t &p) throw() -{ - utf8 result; - result += LT + tag; - if (!p.m_total.empty()) - result += utf8(" total=\"") + p.m_total.escapeXML() + utf8("\""); - result += GT + p.m_part.escapeXML() + LTSLASH + tag + GT; - return result; -} - -uniString::utf8 ID3V2::toString(const part_t &p) throw() -{ return p.m_part; } - -//////////////////////////////////////////////////////////////////////////////////// - -void ID3V2::fromStringList(const std::vector &s,geob_t &g) throw() -{ - vector::size_type siz = s.size(); - if (siz > 0) g.m_mimeType = s[0]; - if (siz > 1) g.m_filename = s[1]; - if (siz > 2) g.m_id = s[2]; - if (siz > 3) g.m_data = s[3]; -} - -uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const geob_t &g) throw() -{ - utf8 result; - result += LT + tag; - if (!g.m_mimeType.empty()) - result += utf8(" mime=\"") + g.m_mimeType.escapeXML() + utf8("\""); - if (!g.m_id.empty()) - result += utf8(" id=\"") + g.m_id.escapeXML() + utf8("\""); - if (!g.m_filename.empty()) - result += utf8(" filename=\"") + g.m_filename.escapeXML() + utf8("\""); - result += GT + g.m_data.escapeXML() + LTSLASH + tag + GT; - return result; -} - -uniString::utf8 ID3V2::toString(const geob_t &g) throw() -{ return g.m_data; } - -//////////////////////////////////////////////////////////////////////////////////// - -void ID3V2::fromStringList(const std::vector &s,priv_t &p) throw() -{ - vector::size_type siz = s.size(); - if (siz > 0) p.m_id = s[0]; - if (siz > 1) p.m_data = s[1]; -} - -uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const priv_t &p) throw() -{ - utf8 result; - result += LT + tag; - if (!p.m_id.empty()) - result += utf8(" id=\"") + p.m_id.escapeXML() + utf8("\""); - result += GT + p.m_data.escapeXML() + LTSLASH + tag + GT; - return result; -} - -uniString::utf8 ID3V2::toString(const priv_t &p) throw() -{ return p.m_data; } - -//////////////////////////////////////////////////////////////////////////////////// - -void ID3V2::fromStringList(const std::vector &s,timestamp_t &t) throw(runtime_error) -{ - if (s.empty()) return; - - static const int state_year = 0; - static const int state_month = 1; - static const int state_day = 2; - static const int state_hour = 3; - static const int state_minute = 4; - static const int state_second = 5; - - int state = state_year; - utf8 value; - for(utf8::const_iterator i = s[0].begin(); i != s[0].end(); ++i) - { - switch(state) - { - case state_year: - if (uniString::is_a_number(*i)) - { - value += *i; - if (value.size() > 4) throw runtime_error("Year has too many digits"); - } - else if ((*i) == '-') - { - if (value.size() != 4) throw runtime_error("Year has the wrong digit count"); - t.m_year = value; - value.clear(); - state = state_month; - } - else throw runtime_error("Unexpected character while processing year"); - break; - - case state_month: - if (uniString::is_a_number(*i)) - { - value += *i; - if (value.size() > 2) throw runtime_error("Month has too many digits"); - } - else if ((*i) == '-') - { - if (value.empty()) throw runtime_error("No digits for month"); - t.m_month = value; - value.clear(); - state = state_day; - } - else throw runtime_error("Unexpected character while processing month"); - break; - - case state_day: - if (uniString::is_a_number(*i)) - { - value += *i; - if (value.size() > 2) throw runtime_error("Day has too many digits"); - } - else if ((*i) == 'T') - { - if (value.empty()) throw runtime_error("No digits for day"); - t.m_day = value; - value.clear(); - state = state_hour; - } - else throw runtime_error("Unexpected character while processing day"); - break; - - case state_hour: - if (uniString::is_a_number(*i)) - { - value += *i; - if (value.size() > 2) throw runtime_error("Hour has too many digits"); - } - else if ((*i) == ':') - { - if (value.empty()) throw runtime_error("No digits for hour"); - t.m_hour = value; - value.clear(); - state = state_minute; - } - else throw runtime_error("Unexpected character while processing hour"); - break; - - case state_minute: - if (uniString::is_a_number(*i)) - { - value += *i; - if (value.size() > 2) throw runtime_error("Minute has too many digits"); - } - else if ((*i) == ':') - { - if (value.empty()) throw runtime_error("No digits for minute"); - t.m_minute = value; - value.clear(); - state = state_second; - } - else throw runtime_error("Unexpected character while processing minute"); - break; - - case state_second: - if (uniString::is_a_number(*i)) - { - value += *i; - if (value.size() > 2) throw runtime_error("Second has too many digits"); - } - else throw runtime_error("Unexpected character while processing second"); - break; - - default: - throw runtime_error(string(__FUNCTION__) + " internal error. Unknown state"); - break; - } - } - - if (!value.empty()) - { - switch(state) - { - case state_year: - if (value.size() != 4) throw runtime_error("Wrong digit count for year"); - t.m_year = value; - break; - - case state_month: - if (value.size() > 2) throw runtime_error("Month has too many digits"); - t.m_month = value; - break; - - case state_day: - if (value.size() > 2) throw runtime_error("Day has too many digits"); - t.m_day = value; - break; - - case state_hour: - if (value.size() > 2) throw runtime_error("Hour has too many digits"); - t.m_hour = value; - break; - - case state_minute: - if (value.size() > 2) throw runtime_error("Minute has too many digits"); - t.m_minute = value; - break; - - case state_second: - if (value.size() > 2) throw runtime_error("Second has too many digits"); - t.m_second = value; - break; - - default: - throw runtime_error(string(__FUNCTION__) + " internal error. Unknown state"); - break; - } - } -} - -uniString::utf8 ID3V2::toXML(const uniString::utf8 &tag,const timestamp_t &t) throw() -{ - utf8 result; - if (t.m_year.empty()) return result; - result += LT + tag + GT; - if (!t.m_year.empty()) result += LT + utf8("year") + GT + t.m_year.escapeXML() + LTSLASH + utf8("year") + GT; - if (!t.m_month.empty()) result += LT + utf8("month") + GT + t.m_month.escapeXML() + LTSLASH + utf8("month") + GT; - if (!t.m_day.empty()) result += LT + utf8("day") + GT + t.m_day.escapeXML() + LTSLASH + utf8("day") + GT; - if (!t.m_hour.empty()) result += LT + utf8("hour") + GT + t.m_hour.escapeXML() + LTSLASH + utf8("hour") + GT; - if (!t.m_minute.empty()) result += LT + utf8("minute") + GT + t.m_minute.escapeXML() + LTSLASH + utf8("minute") + GT; - if (!t.m_second.empty()) result += LT + utf8("second") + GT + t.m_second.escapeXML() + LTSLASH + utf8("second") + GT; - result += LTSLASH + tag + GT; - return result; -} - -uniString::utf8 ID3V2::toString(const timestamp_t &t) throw() -{ - utf8 result; - if (t.m_year.empty()) return result; - result += t.m_year; - if (t.m_month.empty()) return result; - result += utf8("-") + t.m_month; - if (t.m_day.empty()) return result; - result += utf8("-") + t.m_day; - if (t.m_hour.empty()) return result; - result += utf8("T") + t.m_hour; - if (t.m_minute.empty()) return result; - result += utf8(":") + t.m_minute; - if (t.m_second.empty()) return result; - result += utf8(":") + t.m_second; - return result; -} diff --git a/Src/Plugins/DSP/sc_serv3/ID3miniParsers.h b/Src/Plugins/DSP/sc_serv3/ID3miniParsers.h deleted file mode 100644 index 263a5cda..00000000 --- a/Src/Plugins/DSP/sc_serv3/ID3miniParsers.h +++ /dev/null @@ -1,184 +0,0 @@ -#ifndef ID3miniParsers_H_ -#define ID3miniParsers_H_ - -#include "unicode/uniString.h" -#include -#include - -// parsers for complex ID3V2 fields (like genre) - -namespace ID3V2 -{ - void base64encode(const char *in,size_t siz,std::string &out) throw(); - - //////////////////// - /* Extracts strings based on a coded formatter - - e - single byte encoding. Will be used for all subsequence encoding based strings - u - non-encoded latin-1 string - s - encoded string - b - binary coded data to end of block - l - three char language code - c - single byte code - y - dynamic counter (value in popularimeter) - - modifiers: - - + - repeats to end of block - */ - - std::vector extractor(const std::vector<__uint8> &data,const char *format) throw(std::exception); - ////////////////////// - //// structs for various tag types - struct genreEntry - { - uniString::utf8 m_genreCode; - uniString::utf8 m_refinement; - }; - - struct comment_t - { - uniString::utf8 m_languageCode; - uniString::utf8 m_id; - uniString::utf8 m_comment; - }; - - struct userUrl_t - { - uniString::utf8 m_id; - uniString::utf8 m_url; - }; - - struct userText_t - { - uniString::utf8 m_id; - uniString::utf8 m_text; - }; - - struct popularimeter_t - { - uniString::utf8 m_email; - uniString::utf8 m_rating; - uniString::utf8 m_counter; - }; - - struct unsyncLyrics_t - { - uniString::utf8 m_languageCode; - uniString::utf8 m_id; - uniString::utf8 m_lyrics; - }; - - struct picture_t - { - uniString::utf8 m_mimeType; - uniString::utf8 m_pictureType; - uniString::utf8 m_id; - uniString::utf8 m_pictureData; - }; - - struct mcdi_t // CD TOC - { - uniString::utf8 m_cdTOC; - }; - - struct ufid_t // universal file id - { - uniString::utf8 m_id; - uniString::utf8 m_data; - }; - - struct part_t // TRCK or TPOS (ie 3/7) - { - uniString::utf8 m_part; - uniString::utf8 m_total; - }; - - struct geob_t // general encapsulated object - { - uniString::utf8 m_mimeType; - uniString::utf8 m_filename; - uniString::utf8 m_id; - uniString::utf8 m_data; - }; - - struct priv_t // private frame - { - uniString::utf8 m_id; - uniString::utf8 m_data; - }; - - struct timestamp_t - { - uniString::utf8 m_year; - uniString::utf8 m_month; - uniString::utf8 m_day; - uniString::utf8 m_hour; - uniString::utf8 m_minute; - uniString::utf8 m_second; - }; - - typedef std::vector genreList_t; - typedef std::vector stringList_t; - typedef uniString::utf8 string_t; - - // parser and extractor overloads for the various data types - ///// - void fromStringList(const std::vector &s,genreList_t &l) throw(std::runtime_error); - uniString::utf8 toXML(const uniString::utf8 &tag,const genreList_t &l) throw(); - uniString::utf8 toString(const genreList_t &l) throw(); - - void fromStringList(const std::vector &s,stringList_t &l) throw(); - uniString::utf8 toXML(const uniString::utf8 &tag,const stringList_t &l) throw(); - uniString::utf8 toString(const stringList_t &l) throw(); - - void fromStringList(const std::vector &s,comment_t &c) throw(); - uniString::utf8 toXML(const uniString::utf8 &tag,const comment_t &c) throw(); - uniString::utf8 toString(const comment_t &c) throw(); - - void fromStringList(const std::vector &s,userUrl_t &c) throw(); - uniString::utf8 toXML(const uniString::utf8 &tag,const userUrl_t &c) throw(); - uniString::utf8 toString(const userUrl_t &c) throw(); - - void fromStringList(const std::vector &s,userText_t &t) throw(); - uniString::utf8 toXML(const uniString::utf8 &tag,const userText_t &t) throw(); - uniString::utf8 toString(const userText_t &t) throw(); - - void fromStringList(const std::vector &s,popularimeter_t &p) throw(); - uniString::utf8 toXML(const uniString::utf8 &tag,const popularimeter_t &p) throw(); - uniString::utf8 toString(const popularimeter_t &p) throw(); - - void fromStringList(const std::vector &s,unsyncLyrics_t &c) throw(); - uniString::utf8 toXML(const uniString::utf8 &tag,const unsyncLyrics_t &c) throw(); - uniString::utf8 toString(const unsyncLyrics_t &c) throw(); - - void fromStringList(const std::vector &s,picture_t &c) throw(); - uniString::utf8 toXML(const uniString::utf8 &tag,const picture_t &c) throw(); - uniString::utf8 toString(const picture_t &c) throw(); - - void fromStringList(const std::vector &s,mcdi_t &m) throw(); - uniString::utf8 toXML(const uniString::utf8 &tag,const mcdi_t &m) throw(); - uniString::utf8 toString(const mcdi_t &m) throw(); - - void fromStringList(const std::vector &s,ufid_t &u) throw(); - uniString::utf8 toXML(const uniString::utf8 &tag,const ufid_t &u) throw(); - uniString::utf8 toString(const ufid_t &u) throw(); - - void fromStringList(const std::vector &s,part_t &u) throw(); - uniString::utf8 toXML(const uniString::utf8 &tag,const part_t &u) throw(); - uniString::utf8 toString(const part_t &u) throw(); - - void fromStringList(const std::vector &s,geob_t &g) throw(); - uniString::utf8 toXML(const uniString::utf8 &tag,const geob_t &g) throw(); - uniString::utf8 toString(const geob_t &g) throw(); - - void fromStringList(const std::vector &s,priv_t &p) throw(); - uniString::utf8 toXML(const uniString::utf8 &tag,const priv_t &p) throw(); - uniString::utf8 toString(const priv_t &p) throw(); - - void fromStringList(const std::vector &s,timestamp_t &t) throw(std::runtime_error); - uniString::utf8 toXML(const uniString::utf8 &tag,const timestamp_t &t) throw(); - uniString::utf8 toString(const timestamp_t &t) throw(); -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/MP3Header.cpp b/Src/Plugins/DSP/sc_serv3/MP3Header.cpp deleted file mode 100644 index 5ac4a465..00000000 --- a/Src/Plugins/DSP/sc_serv3/MP3Header.cpp +++ /dev/null @@ -1,216 +0,0 @@ -#include "MP3Header.h" -#include "global.h" -#include "nmrCommon/stl/stringUtils.h" -#include "nmrCommon/services/stdServiceImpl.h" -#include "nmrCommon/unicode/uniString.h" - -const __uint32 make28BitValue(const __uint8 buf[4]) -{ - return ((((__uint32)buf[0]) << 21) | - (((__uint32)buf[1]) << 14) | - (((__uint32)buf[2]) << 7) | - (((__uint32)buf[3]))); -} - -// Bitrates - use [version][layer][bitrate] -const __uint16 mpeg_bitrates[4][4][16] = { - { // Version 2.5 - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Reserved - { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, // Layer 3 - { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, // Layer 2 - { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0 } // Layer 1 - }, - { // Reserved - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Invalid - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Invalid - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Invalid - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } // Invalid - }, - { // Version 2 - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Reserved - { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, // Layer 3 - { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 }, // Layer 2 - { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0 } // Layer 1 - }, - { // Version 1 - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Reserved - { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0 }, // Layer 3 - { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0 }, // Layer 2 - { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0 }, // Layer 1 - } -}; - -// Sample rates - use [version][srate] -const __uint16 mpeg_srates[4][4] = { - { 11025, 12000, 8000, 0 }, // MPEG 2.5 - { 0, 0, 0, 0 }, // Reserved - { 22050, 24000, 16000, 0 }, // MPEG 2 - { 44100, 48000, 32000, 0 } // MPEG 1 -}; - -// Samples per frame - use [version][layer] -const __uint16 mpeg_frame_samples[4][4] = { -// Rsvd 3 2 1 < Layer v Version - { 0, 576, 1152, 384 }, // 2.5 - { 0, 0, 0, 0 }, // Reserved - { 0, 576, 1152, 384 }, // 2 - { 0, 1152, 1152, 384 } // 1 -}; - -// Slot size (MPEG unit of measurement) - use [layer] -const __uint8 mpeg_slot_size[4] = { 0, 1, 1, 4 }; // Rsvd, 3, 2, 1 - -const char *MP3_FrameInfo::getLayerName() const -{ - switch (m_layer) - { - case 1: return "3"; - case 2: return "2"; - case 3: return "1"; - } - return "unknown layer"; -} - -const char *MP3_FrameInfo::getVersionName() const -{ - switch (m_version) - { - case 0: return "v2.5"; - case 2: return "v2"; - case 3: return "v1"; - } - return "unknown version"; -} - -int getMP3FrameSize (MP3_FrameInfo &info, const unsigned char *hdr, unsigned int len) -{ - if (len < 4) - return 0; - int samples = mpeg_frame_samples[info.m_version][info.m_layer]; - if (samples == 0) - return -1; - int bitrate = mpeg_bitrates [info.m_version] [info.m_layer] [((hdr[2] & 0xf0) >> 4)]; - if (bitrate == 0) - return -1; - info.m_bitrate = bitrate; - info.m_samples = samples; - - return (int)(((float)(samples / 8.0) * (float)bitrate * 1000) / - (float)info.m_samplerate) + (((hdr[2] & 0x02) >> 1) ? mpeg_slot_size[info.m_layer] : 0); -} - -const int getMP3FrameInfo(const char *hdr, unsigned int *samplerate, int *bitrate, bool *mono) -{ - // Quick validity check - if ( ( ((unsigned char)hdr[0] & 0xFF) != 0xFF) - || ( ((unsigned char)hdr[1] & 0xE0) != 0xE0) // 3 sync bits - || ( ((unsigned char)hdr[1] & 0x18) == 0x08) // Version rsvd - || ( ((unsigned char)hdr[1] & 0x06) == 0x00) // Layer rsvd - || ( ((unsigned char)hdr[2] & 0xF0) == 0xF0) // Bitrate rsvd - ) return 0; - - // Data to be extracted from the header - __uint8 ver = (hdr[1] & 0x18) >> 3; // Version index - __uint8 lyr = (hdr[1] & 0x06) >> 1; // Layer index - //__uint8 pad = (hdr[2] & 0x02) >> 1; // Padding? 0/1 - //__uint8 brx = (hdr[2] & 0xf0) >> 4; // Bitrate index - __uint8 srx = (hdr[2] & 0x0c) >> 2; // SampRate index - - if (mono) - { - *mono = (((hdr[3] >> 6) & 3) == 0x3); // Channel mode - } - - // Lookup real values of these fields - *samplerate = mpeg_srates[ver][srx]; - *bitrate = mpeg_bitrates[ver][lyr][((hdr[2] & 0xf0) >> 4)]; - //__uint16 samples = mpeg_frame_samples[ver][lyr]; - //__uint8 slot_size = mpeg_slot_size[lyr]; - - // Frame sizes are truncated integers - return (__uint16)(((float)(mpeg_frame_samples[ver][lyr] / 8.0) * - (float)*bitrate * 1000) / (float)mpeg_srates[ver][srx]) + - (((hdr[2] & 0x02) >> 1) ? mpeg_slot_size[lyr] : 0); -} - - -const int getMP3FrameInfo (const unsigned char *hdr, unsigned int len, MP3_FrameInfo &info) -{ - // Quick validity check - if ( len < 4 - || ( ((unsigned char)hdr[0] & 0xFF) != 0xFF) - || ( ((unsigned char)hdr[1] & 0xE0) != 0xE0) // 3 sync bits - || ( ((unsigned char)hdr[1] & 0x18) == 0x08) // Version rsvd - || ( ((unsigned char)hdr[1] & 0x06) == 0x00) // Layer rsvd - || ( ((unsigned char)hdr[2] & 0xF0) == 0xF0) // Bitrate rsvd - ) return -1; - - // Data to be extracted from the header - __uint8 ver = (hdr[1] & 0x18) >> 3; // Version index - __uint8 lyr = (hdr[1] & 0x06) >> 1; // Layer index - __uint8 srx = (hdr[2] & 0x0c) >> 2; // SampRate index - - do - { - // Lookup real values of these fields - unsigned int samplerate = mpeg_srates [ver][srx]; - if (samplerate == 0) - break; - - int bitrate = mpeg_bitrates [ver][lyr][((hdr[2] & 0xf0) >> 4)]; - if (bitrate == 0) - break; - info.m_bitrate = bitrate; - // the following are not supposed to change - info.m_samplerate = samplerate; - info.m_mono = (((hdr[3] >> 6) & 3) == 0x3); // Channel mode - info.m_layer = lyr; // Layer index - info.m_version = ver; - if (info.m_pattern == 0) - info.m_pattern = (unsigned long)(hdr[0]<<24 | (hdr[1]<<16) | (hdr[2]<<8) | hdr[0]) & info.m_mask; - - // DLOG (uniString::utf8("MPEG ") + info.getVersionName() + " layer " + info.getLayerName() + (info.m_mono ? " mono (" : " stereo (") + stringUtil::tos(bitrate) + "k)"); - - return getMP3FrameSize (info, hdr, 4); - } while (0); - return -1; -} - -int MP3_FrameInfo::verifyFrame (const unsigned char *buf, unsigned int len) -{ - if (len > 4) - { - unsigned long v = (unsigned long)(buf[0])<<24 | (buf[1]<<16) | (buf[2]<<8) | buf[0]; - - if ((v & m_mask) == m_pattern) - { -#if 0 - if (len > 40) - { - unsigned char str[6] = "LAME"; - int i; - for (i=0; i < 5 && buf[36+i] == str[i]; i++) - ; - if (str[i] == '\0') DLOG ("LAME header found"); - } -#endif - return getMP3FrameSize (*this, buf, len); - } - // DLOG ("MPG: mask is " + stringUtil::tos(v&m_mask) + ", patt " + stringUtil::tos(m_pattern)); - return -1; - } - return 0; -} - -MP3_FrameInfo::MP3_FrameInfo (unsigned long value) : parserInfo (0xFFFE0000, value) -{ - m_description = "MPEG "; -} - -MP3_FrameInfo::MP3_FrameInfo(const unsigned char *p, unsigned int len) : parserInfo() -{ - m_mask = 0xFFFE0000; - m_description = "MPEG "; - getMP3FrameInfo (p, len, *this); -} - diff --git a/Src/Plugins/DSP/sc_serv3/MP3Header.h b/Src/Plugins/DSP/sc_serv3/MP3Header.h deleted file mode 100644 index d1fbe704..00000000 --- a/Src/Plugins/DSP/sc_serv3/MP3Header.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once -#ifndef _MP3_HEADER_H -#define _MP3_HEADER_H - -#include "nmrCommon/intTypes.h" -#include -#include "global.h" -#include "uvox2Common.h" - - -struct MP3_FrameInfo : public parserInfo -{ - bool m_mono; - int m_layer; - int m_samples; - - int verifyFrame (const unsigned char *buf, unsigned int len); - - MP3_FrameInfo (unsigned long value = 0); - MP3_FrameInfo (const unsigned char *p, unsigned int len); - - const char *getLayerName() const; - const char *getVersionName() const; - int getUvoxType() { return MP3_DATA; } -}; - - -const __uint32 make28BitValue(const __uint8 buf[4]); -const int getMP3FrameInfo(const char *hdr, unsigned int *samplerate, int *bitrate, bool *mono = 0); -const int getMP3FrameInfo (const unsigned char *hdr, unsigned int len, MP3_FrameInfo &info); -int getMP3FrameSize (MP3_FrameInfo &info, const unsigned char *hdr, unsigned int len); - - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/MSG00001.bin b/Src/Plugins/DSP/sc_serv3/MSG00001.bin deleted file mode 100644 index a528a83b..00000000 Binary files a/Src/Plugins/DSP/sc_serv3/MSG00001.bin and /dev/null differ diff --git a/Src/Plugins/DSP/sc_serv3/adminList.cpp b/Src/Plugins/DSP/sc_serv3/adminList.cpp deleted file mode 100644 index 547a2176..00000000 --- a/Src/Plugins/DSP/sc_serv3/adminList.cpp +++ /dev/null @@ -1,303 +0,0 @@ -#ifdef _WIN32 -#include -#else -#include -#include -#include -#endif - -#include -#include -#include "adminList.h" -#include "global.h" -#include "stl/stringUtils.h" -#include "macros.h" -#include "webNet/socketOps.h" -#include "file/fileUtils.h" -#include "services/stdServiceImpl.h" -#include - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define LOGNAME "[ADMINCGI] " - -#ifdef _WIN32 -typedef unsigned long in_addr_t; -#endif - -adminList g_adminList; - -class adminList::impl -{ -private: - struct adminEntry: public admin_t - { - in_addr_t m_ip; // ip as binary type. Old style, but that's how the old sc_serv did it and we'll - // continue to do it that way until we're ready to break the old software - - bool validIP() throw() - { - return ((m_ip != INADDR_NONE) && (m_ip != 0)); - } - - static in_addr_t stringToIP(const utf8 &sIP, utf8 &hostIP) - { - // default is to assume a raw IP address in the list - in_addr_t ip = inet_addr((const char *)sIP.c_str()); - if (ip == INADDR_NONE) - { - // though if that fails then attempt to - // get an IP address from a hostname... - string sHost; - try - { - sHost = socketOps::hostNameToAddress(sIP.hideAsString()); - } - catch(...) - { - } - if (!sHost.empty()) - { - ip = inet_addr((const char *)sHost.c_str()); - if (ip != INADDR_NONE) - { - hostIP = sHost; - } - } - } - return ip; - } - - explicit adminEntry(const utf8 &numericIP) throw() : admin_t(numericIP), m_ip(stringToIP(numericIP, m_hostIP)) {} - adminEntry() throw() : m_ip(0) {} - }; - - AOL_namespace::mutex m_lock; - list m_list; - -public: - bool load(const uniFile::filenameType &fn) throw(exception) - { - if (fn.empty()) - { - throwEx(LOGNAME "No admin access file"); - } - else if (gOptions.microServerDebug()) - { - DLOG(LOGNAME "Attempting to read admin access file: " + fileUtil::getFullFilePath(fn)); - } - - stackLock sml(m_lock); - - FILE *f = uniFile::fopen(fn,"rb"); - if (!f) return false; - - bool updating = (!m_list.empty()); - m_list.clear(); - - try - { - int l = 0; - int count = 0; - while (true) - { - char buffer[4096] = {0}; - - if (!fgets(buffer, sizeof(buffer), f)) break; // get a line - - ++l; // increment line counter - - utf8 s; - - // skip utf-8 BOM - if ((strlen(buffer) > 2) && - (((unsigned char*)buffer)[0] == 0xef) && - (((unsigned char*)buffer)[1] == 0xbb) && - (((unsigned char*)buffer)[2] == 0xbf)) - { - s = &(buffer[3]); - } - else - { - s = buffer; - } - - adminEntry e(stripWhitespace(s)); - - if (!e.validIP()) - { - WLOG(LOGNAME "Line " + tos(l) + " of admin access list has been ignored (bad IP)"); - } - else - { - if (this->find(e.m_numericIP,false) < 1) - { - m_list.push_back(e); - ++count; - } - } - } - if (!updating) - { - if (count > 0) - { - ILOG(LOGNAME "Enabled " + tos(count) + " IP" + - (count != 1 ? "'s" : "") + " from admin access file"); - } - else if (gOptions.microServerDebug()) - { - DLOG(LOGNAME "No IPs read from admin access file"); - } - } - else - { - ILOG(LOGNAME "Reloaded " + tos(count) + " IP" + - (count != 1 ? "'s" : "") + " from admin access file"); - } - } - catch(...) - { - if (f) ::fclose(f); - throw; - } - if (f) ::fclose(f); - return true; - } - - bool add(const utf8 &ipAddr, const bool soft) throw(exception) - { - // skip loopback addresses as we treat them specially anyway - if ((ipAddr.find(utf8("127.")) == utf8::npos)) - { - adminEntry e(ipAddr); - if (!e.validIP()) - { - if (!soft) - { - throwEx(LOGNAME "Invalid IP specified - `" + ipAddr + "'"); - } - else - { - return false; - } - } - - stackLock sml(m_lock); - m_list.push_back(e); - return true; - } - return false; - } - - // true if removed - bool remove(const utf8 &ipAddr, const bool allStream, const bool fallback = false, const bool use_lock = true) - { - if (use_lock) - { - stackLock sml(m_lock); - } - - for ( list::iterator i = m_list.begin(); i != m_list.end(); ++i ) - { - if ( ( allStream || ( ( !allStream && ( ( *i ).m_numericIP == ipAddr ) ) || ( ( *i ).m_hostIP == ipAddr ) ) ) ) - { - m_list.erase( i ); - return true; - } - } - - // attempt to see if we've got a hostname which has not been detected from the loading mapping - if (!fallback) - { - string sHost; - try - { - sHost = socketOps::hostNameToAddress(ipAddr.hideAsString()); - } - catch(...) - { - } - if (!sHost.empty()) - { - return remove(sHost, allStream, true, false); - } - } - - return false; - } - - // 1 if found, 0 if not, -1 if empty (assume allowed) - int find(const utf8 &ipAddr, const bool use_lock=true) throw() - { - if (use_lock) - { - stackLock sml(m_lock); - } - - if (!m_list.empty()) - { - for (list::const_iterator i = m_list.begin(); i != m_list.end(); ++i) - { - if ((ipAddr == (*i).m_numericIP) || (ipAddr == (*i).m_hostIP)) - { - return 1; - } - } - return 0; - } - return -1; - } -}; - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -adminList::adminList():m_impl(0) -{ - m_impl = new adminList::impl; -} - -adminList::~adminList() throw() -{ - forget(m_impl); -} - -bool adminList::load(const uniFile::filenameType &fn) throw() -{ - assert(m_impl); - - bool result(false); - - try - { - result = m_impl->load(fn); - } - catch(const exception &ex) - { - ELOG(ex.what()); - } - return result; -} - -// throws if parameters are invalid -bool adminList::add(const utf8 &ipAddr, const bool soft) throw(exception) -{ - assert(m_impl); - return m_impl->add(ipAddr, soft); -} - -// true if removed -bool adminList::remove(const utf8 &ipAddr, const bool allStream) throw() -{ - assert(m_impl); - return m_impl->remove(ipAddr, allStream); -} - -// 1 if found, 0 if not, -1 if empty (assume allowed) -int adminList::find(const utf8 &ipAddr) throw() -{ - assert(m_impl); - return m_impl->find(ipAddr); -} diff --git a/Src/Plugins/DSP/sc_serv3/adminList.h b/Src/Plugins/DSP/sc_serv3/adminList.h deleted file mode 100644 index 32645f76..00000000 --- a/Src/Plugins/DSP/sc_serv3/adminList.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once -#ifndef adminList_H_ -#define adminList_H_ - -#include "unicode/uniFile.h" - -// class that manages lists of reserved IPs -// these are remote addresses that must always be allowed in no matter what. - -class adminList -{ -private: - class impl; - impl *m_impl; - -public: - struct admin_t - { - uniString::utf8 m_numericIP; - uniString::utf8 m_hostIP; // used to hold the converted IP from a hostname - - explicit admin_t(const uniString::utf8 &numericIP) throw() : m_numericIP(numericIP) {} - admin_t() throw() {} - }; - - // throws if parameters are invalid - bool add(const uniString::utf8 &ipAddr, const bool soft) throw(std::exception); - // true if removed - bool remove(const uniString::utf8 &ipAddr, const bool allStream) throw(); - // 1 if found, 0 if not, -1 if empty (assume allowed) - int find(const uniString::utf8 &ipAddr) throw(); - - bool load(const uniFile::filenameType &fn) throw(); - - adminList(); - ~adminList() throw(); -}; - -extern adminList g_adminList; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/agentList.cpp b/Src/Plugins/DSP/sc_serv3/agentList.cpp deleted file mode 100644 index 28202f33..00000000 --- a/Src/Plugins/DSP/sc_serv3/agentList.cpp +++ /dev/null @@ -1,294 +0,0 @@ -#include -#include -#include "agentList.h" -#include "global.h" -#include "stl/stringUtils.h" -#include "file/fileUtils.h" -#include "services/stdServiceImpl.h" -#include "macros.h" -#include - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define LOGNAME "[AGENT] " - -agentList g_agentList; - -class agentList::impl -{ -private: - struct agentEntrySave - { - FILE *f; - size_t stream_ID; - }; - - struct agentEntry: public agent_t - { - void save(agentEntrySave entrySave) throw(exception) - { - if(m_stream_ID == entrySave.stream_ID) - { - utf8 s(m_agent + eol()); - if (fwrite(s.c_str(),1,s.size(),entrySave.f) != s.size()) - { - throwEx(LOGNAME "I/O error writing " + (!entrySave.stream_ID ? "global" : "sid=" + tos(entrySave.stream_ID)) + " agent file"); - } - } - } - - agentEntry(const utf8 &agent, const size_t stream_ID) throw() : agent_t(agent, stream_ID) {} - agentEntry() throw() {} - }; - - AOL_namespace::mutex m_lock; - list m_list; - -public: - bool load(const uniFile::filenameType &fn, size_t stream_ID) throw(exception) - { - if (fn.empty()) - { - throwEx(LOGNAME "No " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " agent file"); - } - else if (gOptions.microServerDebug()) - { - DLOG(LOGNAME "Attempting to read agent file: " + fileUtil::getFullFilePath(fn)); - } - - stackLock sml(m_lock); - - FILE *f = uniFile::fopen(fn,"rb"); - if (!f) return false; - - bool updating = (!m_list.empty()); - m_list.clear(); - - try - { - int l = 0; - int count = 0; - while (true) - { - char buffer[4096] = {0}; - - if (!fgets(buffer, sizeof(buffer), f)) break; // get a line - - ++l; // increment line counter - - utf8 s; - - // skip utf-8 BOM - if ((strlen(buffer) > 2) && - (((unsigned char*)buffer)[0] == 0xef) && - (((unsigned char*)buffer)[1] == 0xbb) && - (((unsigned char*)buffer)[2] == 0xbf)) - s = &(buffer[3]); - else - s = buffer; - - if (stripWhitespace(s).empty()) - { - WLOG(LOGNAME "Line " + tos(l) + " of " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " user agent list has been ignored"); - } - else - { - agentEntry e(stripWhitespace(s),stream_ID); - if(this->find(e.m_agent,e.m_stream_ID,false) == false) - { - m_list.push_back(e); - ++count; - } - } - } - if (!updating) - { - ILOG(LOGNAME "Loaded " + tos(count) + " blocked user agents" + (count != 1 ? "'s" : "") + " from " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " agent file"); - } - else - { - ILOG(LOGNAME "Reloaded " + tos(count) + " blocked user agents" + (count != 1 ? "'s" : "") + " from " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " agent file"); - } - } - catch(...) - { - if (f) ::fclose(f); - throw; - } - if (f) ::fclose(f); - return true; - } - - void save(const uniFile::filenameType &fn,size_t stream_ID) throw(exception) - { - stackLock sml(m_lock); - - FILE *f = uniFile::fopen(fn,"wb"); - if (!f) - { - throwEx(LOGNAME "Could not open " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + - " agent file `" + fn + "' for writing (" + errMessage().hideAsString() + ")"); - } - try - { - agentEntrySave entrySave; - entrySave.f = f; - entrySave.stream_ID = stream_ID; - for_each(m_list.begin(),m_list.end(),bind2nd(mem_fun_ref(&agentEntry::save),entrySave)); - } - catch(...) - { - if (f) ::fclose(f); - throw; - } - if (f) ::fclose(f); - - if(!uniFile::fileSize(fn)) - { - uniFile::unlink(fn); - } - } - - bool add(const utf8 &agent, const size_t stream_ID, const bool soft) throw(exception) - { - if (agent.empty()) - { - if (!soft) throwEx(LOGNAME "Empty User Agent specified"); - else return false; - } - - agentEntry e(agent,stream_ID); - stackLock sml(m_lock); - m_list.push_back(e); - return true; - } - - // true if removed - bool remove(const utf8 &agent, const size_t stream_ID, const bool allStream) throw() - { - stackLock sml(m_lock); - - for (list::iterator i = m_list.begin(); i != m_list.end(); ++i) - { - if (allStream || (((!allStream && ((*i).m_agent == agent))) && ((*i).m_stream_ID == stream_ID))) - { - m_list.erase(i); - return true; - } - } - - return false; - } - - // true if found - bool find(const utf8 &agent, size_t stream_ID, bool use_lock = true) throw() - { - if(use_lock) - { - stackLock sml(m_lock); - } - - if(!m_list.empty()) - { - for (list::const_iterator i = m_list.begin(); i != m_list.end(); ++i) - { - if (((*i).m_stream_ID == stream_ID) && (agent == (*i).m_agent)) - { - return true; - } - } - } - - return false; - } - - void get(std::vector &rl, size_t stream_ID) throw() - { - stackLock sml(m_lock); - - for (list::const_iterator i = m_list.begin(); i != m_list.end(); ++i) - { - if ((*i).m_stream_ID == stream_ID) - { - rl.push_back(*i); - } - } - } -}; - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -agentList::agentList():m_impl(0) -{ - m_impl = new agentList::impl; -} - -agentList::~agentList() throw() -{ - forget(m_impl); -} - -bool agentList::load(const uniFile::filenameType &fn,size_t stream_ID) throw() -{ - assert(m_impl); - - bool result(false); - - try - { - result = m_impl->load(fn,stream_ID); - } - catch(const exception &ex) - { - ELOG(ex.what()); - } - return result; -} - -bool agentList::save(const uniFile::filenameType &fn,size_t stream_ID) throw() -{ - assert(m_impl); - - bool result(false); - - try - { - m_impl->save(fn,stream_ID); - result = true; - } - catch(const exception &ex) - { - ELOG(ex.what()); - } - return result; -} - -// throws if parameters are invalid -bool agentList::add(const utf8 &agent, const size_t stream_ID, bool soft) throw(exception) -{ - assert(m_impl); - return m_impl->add(agent,stream_ID,soft); -} - -// true if removed -bool agentList::remove(const utf8 &agent, const size_t stream_ID, bool allStream) throw() -{ - assert(m_impl); - return m_impl->remove(agent,stream_ID,allStream); -} - -// true if found -bool agentList::find(const utf8 &agent, const size_t stream_ID) throw() -{ - assert(m_impl); - return m_impl->find(agent, stream_ID); -} - -void agentList::get(vector &bl,size_t stream_ID) throw() -{ - assert(m_impl); - m_impl->get(bl,stream_ID); -} diff --git a/Src/Plugins/DSP/sc_serv3/agentList.h b/Src/Plugins/DSP/sc_serv3/agentList.h deleted file mode 100644 index 87b1861d..00000000 --- a/Src/Plugins/DSP/sc_serv3/agentList.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once -#ifndef agentList_H_ -#define agentList_H_ - -#include "unicode/uniFile.h" - -// class that manages lists of blocked user agents - -class agentList -{ -private: - class impl; - impl *m_impl; - -public: - struct agent_t - { - uniString::utf8 m_agent; // used to hold the user agent to not allow - size_t m_stream_ID; // used to differentiate - - agent_t(const uniString::utf8 &agent, const size_t stream_ID) throw() : m_agent(agent), m_stream_ID(stream_ID) {} - agent_t() throw() : m_stream_ID(0) {} - }; - - // throws if parameters are invalid - bool add(const uniString::utf8 &agent, const size_t stream_ID, const bool soft) throw(std::exception); - // true if removed - bool remove(const uniString::utf8 &agent, const size_t stream_ID, const bool allStream) throw(); - // true if found - bool find(const uniString::utf8 &agent, const size_t stream_ID) throw(); - - bool load(const uniFile::filenameType &fn, const size_t stream_ID) throw(); - bool save(const uniFile::filenameType &fn, const size_t stream_ID) throw(); - - agentList(); - ~agentList() throw(); - - // for web administration reference - void get(std::vector &rl, const size_t stream_ID) throw(); -}; - -extern agentList g_agentList; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/amf.cpp b/Src/Plugins/DSP/sc_serv3/amf.cpp deleted file mode 100644 index bb7adddb..00000000 --- a/Src/Plugins/DSP/sc_serv3/amf.cpp +++ /dev/null @@ -1,759 +0,0 @@ -#if 0 -#include "amf.h" -#include "global.h" - -#define DEBUG_LOG(x) { if (gOptions.RTMPClientDebug()) DLOG((x)); } - -#ifndef _WIN32 -#include -#endif - -using namespace std; -using namespace stringUtil; -using namespace uniString; - -#ifdef _WIN32 -// Windows is little endian only -#define __LITTLE_ENDIAN 1234 -#define __BIG_ENDIAN 4321 -#define __BYTE_ORDER __LITTLE_ENDIAN -#define __FLOAT_WORD_ORDER __BYTE_ORDER - -typedef unsigned char uint8_t; - -#else /* !_WIN32 */ - -#include - -#if defined(BYTE_ORDER) && !defined(__BYTE_ORDER) -#define __BYTE_ORDER BYTE_ORDER -#endif - -#if defined(BIG_ENDIAN) && !defined(__BIG_ENDIAN) -#define __BIG_ENDIAN BIG_ENDIAN -#endif - -#if defined(LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN) -#define __LITTLE_ENDIAN LITTLE_ENDIAN -#endif - -#endif /* !_WIN32 */ - -// define default endianness -#ifndef __LITTLE_ENDIAN -#define __LITTLE_ENDIAN 1234 -#endif - -#ifndef __BIG_ENDIAN -#define __BIG_ENDIAN 4321 -#endif - -#ifndef __BYTE_ORDER -#warning "Byte order not defined on your system, assuming little endian!" -#define __BYTE_ORDER __LITTLE_ENDIAN -#endif - -// ok, we assume to have the same float word order and byte order if float word order is not defined -#ifndef __FLOAT_WORD_ORDER -//#warning "Float word order not defined, assuming the same as byte order!" -#define __FLOAT_WORD_ORDER __BYTE_ORDER -#endif - -#if !defined(__BYTE_ORDER) || !defined(__FLOAT_WORD_ORDER) -#error "Undefined byte or float word order!" -#endif - -#if __FLOAT_WORD_ORDER != __BIG_ENDIAN && __FLOAT_WORD_ORDER != __LITTLE_ENDIAN -#error "Unknown/unsupported float word order!" -#endif - -#if __BYTE_ORDER != __BIG_ENDIAN && __BYTE_ORDER != __LITTLE_ENDIAN -#error "Unknown/unsupported byte order!" -#endif - -static double -AMF0_DecodeNumber(const char *data) -{ - double dVal; -#if __FLOAT_WORD_ORDER == __BYTE_ORDER -#if __BYTE_ORDER == __BIG_ENDIAN - memcpy(&dVal, data, 8); -#elif __BYTE_ORDER == __LITTLE_ENDIAN - unsigned char *ci, *co; - ci = (unsigned char *)data; - co = (unsigned char *)&dVal; - co[0] = ci[7]; - co[1] = ci[6]; - co[2] = ci[5]; - co[3] = ci[4]; - co[4] = ci[3]; - co[5] = ci[2]; - co[6] = ci[1]; - co[7] = ci[0]; -#endif -#else -#if __BYTE_ORDER == __LITTLE_ENDIAN // __FLOAT_WORD_ORER == __BIG_ENDIAN - unsigned char *ci, *co; - ci = (unsigned char *)data; - co = (unsigned char *)&dVal; - co[0] = ci[3]; - co[1] = ci[2]; - co[2] = ci[1]; - co[3] = ci[0]; - co[4] = ci[7]; - co[5] = ci[6]; - co[6] = ci[5]; - co[7] = ci[4]; -#else // __BYTE_ORDER == __BIG_ENDIAN && __FLOAT_WORD_ORER == __LITTLE_ENDIAN - unsigned char *ci, *co; - ci = (unsigned char *)data; - co = (unsigned char *)&dVal; - co[0] = ci[4]; - co[1] = ci[5]; - co[2] = ci[6]; - co[3] = ci[7]; - co[4] = ci[0]; - co[5] = ci[1]; - co[6] = ci[2]; - co[7] = ci[3]; -#endif -#endif - return dVal; -} - -char * -AMF0_EncodeNumber(char *output, char *outend, double dVal) -{ - if (output+8 > outend) - return NULL; - -// *output++ = AMF_NUMBER; // type: Number - -#if __FLOAT_WORD_ORDER == __BYTE_ORDER -#if __BYTE_ORDER == __BIG_ENDIAN - memcpy(output, &dVal, 8); -#elif __BYTE_ORDER == __LITTLE_ENDIAN - { - unsigned char *ci, *co; - ci = (unsigned char *)&dVal; - co = (unsigned char *)output; - co[0] = ci[7]; - co[1] = ci[6]; - co[2] = ci[5]; - co[3] = ci[4]; - co[4] = ci[3]; - co[5] = ci[2]; - co[6] = ci[1]; - co[7] = ci[0]; - } -#endif -#else -#if __BYTE_ORDER == __LITTLE_ENDIAN /* __FLOAT_WORD_ORER == __BIG_ENDIAN */ - { - unsigned char *ci, *co; - ci = (unsigned char *)&dVal; - co = (unsigned char *)output; - co[0] = ci[3]; - co[1] = ci[2]; - co[2] = ci[1]; - co[3] = ci[0]; - co[4] = ci[7]; - co[5] = ci[6]; - co[6] = ci[5]; - co[7] = ci[4]; - } -#else /* __BYTE_ORDER == __BIG_ENDIAN && __FLOAT_WORD_ORER == __LITTLE_ENDIAN */ - { - unsigned char *ci, *co; - ci = (unsigned char *)&dVal; - co = (unsigned char *)output; - co[0] = ci[4]; - co[1] = ci[5]; - co[2] = ci[6]; - co[3] = ci[7]; - co[4] = ci[0]; - co[5] = ci[1]; - co[6] = ci[2]; - co[7] = ci[3]; - } -#endif -#endif - return output+8; -} - -static void serialize(vector<__uint8> &s,const utf8 &v,int mode,const utf8 &logMsgPrefix) throw(exception) -{ - assert(mode == 0); // AMF3 not yet implemented - __uint16 slen = (__uint16)v.length(); - slen = htons(slen); - s.insert(s.end(),(const char *)&slen,((const char *)&slen) + 2); - s.insert(s.end(),v.begin(),v.end()); -} - -///////////////////////////////////////////////////////////////////////////////////////////////// - -AMFObject::AMFObject() throw() {} - -AMFObject::~AMFObject() throw() -{ - clearProperties(); -} - -AMFObject::AMFObject(const AMFObject &obj) throw() -{ - for(propertyMap_t::const_iterator i = obj.m_properties.begin(); i != obj.m_properties.end(); ++i) - { - m_properties[(*i).first] = new AMFVal(*(*i).second); - } -} - -AMFObject& AMFObject::operator=(const AMFObject &obj) throw() -{ - clearProperties(); - for(propertyMap_t::const_iterator i = obj.m_properties.begin(); i != obj.m_properties.end(); ++i) - { - m_properties[(*i).first] = new AMFVal(*(*i).second); - } - return *this; -} - -void AMFObject::clearProperties() throw() -{ - for(propertyMap_t::iterator i = m_properties.begin(); i != m_properties.end(); ++i) - { - delete (*i).second; - } - m_properties.clear(); -} - -// add property. Takes possession of value "v" -// throws if value already exists -void AMFObject::addProperty(const utf8 &key,AMFVal *v) throw(exception) -{ - assert(v); - assert(m_properties.find(key) == m_properties.end()); - - if (m_properties.find(key) != m_properties.end()) - throwEx(string(__FUNCTION__) + " property " + key + " already exists"); - if (!v) - throwEx(string(__FUNCTION__) + " value is null."); - - m_properties[key] = v; -} - -const AMFVal* AMFObject::getProperty(const uniString::utf8 &key) const throw() -{ - propertyMap_t::const_iterator i = m_properties.find(key); - if (i == m_properties.end()) return 0; - return (*i).second; -} - -utf8 AMFObject::prettyPrint(int mode,const utf8 &tabs) const throw() -{ - utf8 result; - result += tabs + "{" + eol(); - - for(propertyMap_t::const_iterator i = m_properties.begin(); i != m_properties.end(); ++i) - { - assert((*i).second); - result += tabs + "\t" + (*i).first + ": "; - result += (*i).second->prettyPrint(mode,tabs + "\t"); - result += eol(); - } - - result += tabs + "}"; - return result; -} - -void AMFObject::serialize(vector<__uint8> &s,int mode,const utf8 &logMsgPrefix) const throw(exception) -{ - assert(mode == 0); // AMF3 not yet implemented - for(propertyMap_t::const_iterator i = m_properties.begin(); i != m_properties.end(); ++i) - { - assert((*i).second); - ::serialize(s,(*i).first,mode,logMsgPrefix); - (*i).second->serialize(s,mode,logMsgPrefix); - } - s.push_back(0); - s.push_back(0); - s.push_back(AMF0_object_end_marker); -} - -void AMFObject::loadFromBitstream(const char *&bitstream,int &bitstreamLen,int mode,const utf8 &logMsgPrefix) throw(exception) -{ - assert(mode == 0); // AMF3 not implemented yet - propertyMap_t pmap; - - AMFVal *val = 0; - try - { - while(true) - { - if (bitstreamLen < 3) throwEx(logMsgPrefix + " Insufficient data for AMF0 object marker."); - if (bitstream[0] == 0 && bitstream[1] == 0 && bitstream[2] == 9) - { - // end of object - bitstream += 3; - bitstreamLen -= 3; - break; - } - if (bitstream[0] == 0 && bitstream[1] == 0) throwEx(logMsgPrefix + " AMF0 object has null string keyed property"); - if (bitstreamLen < 4) throwEx(logMsgPrefix + " Insufficient data for AMF0 object marker."); - - // alright, we've taken care of the abberant cases and end-of-object. Now let's get a property - int slen = ntohs(*(__uint16*)bitstream); - bitstream += 2; - bitstreamLen -= 2; - if (bitstreamLen < slen) throwEx(logMsgPrefix + " Insufficient data for AMF0 object property key."); - utf8 key(bitstream,bitstream + slen); - bitstream += slen; - bitstreamLen -= slen; - assert(!val); - val = new AMFVal; - val->loadFromBitstream(bitstream,bitstreamLen,mode,logMsgPrefix); - pmap[key] = val; - val = 0; - } - - clearProperties(); - m_properties = pmap; - } - catch(...) - { - delete val; - throw; - } -} - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////// - -AMFEMCAArray::AMFEMCAArray() throw() {} - -AMFEMCAArray::~AMFEMCAArray() throw() -{ - clearProperties(); -} - -AMFEMCAArray::AMFEMCAArray(const AMFEMCAArray &obj) throw() -{ - for(propertyMap_t::const_iterator i = obj.m_properties.begin(); i != obj.m_properties.end(); ++i) - { - m_properties[(*i).first] = new AMFVal(*(*i).second); - } -} - -AMFEMCAArray& AMFEMCAArray::operator=(const AMFEMCAArray &obj) throw() -{ - clearProperties(); - for(propertyMap_t::const_iterator i = obj.m_properties.begin(); i != obj.m_properties.end(); ++i) - { - m_properties[(*i).first] = new AMFVal(*(*i).second); - } - return *this; -} - -void AMFEMCAArray::clearProperties() throw() -{ - for(propertyMap_t::iterator i = m_properties.begin(); i != m_properties.end(); ++i) - { - delete (*i).second; - } - m_properties.clear(); -} - -// add property. Takes possession of value "v" -// throws if value already exists -void AMFEMCAArray::addProperty(const utf8 &key,AMFVal *v) throw(exception) -{ - assert(v); - assert(m_properties.find(key) == m_properties.end()); - - if (m_properties.find(key) != m_properties.end()) - throwEx(string(__FUNCTION__) + " property " + key + " already exists"); - if (!v) - throwEx(string(__FUNCTION__) + " value is null."); - - m_properties[key] = v; -} - -const AMFVal* AMFEMCAArray::getProperty(const uniString::utf8 &key) const throw() -{ - propertyMap_t::const_iterator i = m_properties.find(key); - if (i == m_properties.end()) return 0; - return (*i).second; -} - -utf8 AMFEMCAArray::prettyPrint(int mode,const utf8 &tabs) const throw() -{ - utf8 result; - result += tabs + "{" + eol(); - - for(propertyMap_t::const_iterator i = m_properties.begin(); i != m_properties.end(); ++i) - { - assert((*i).second); - result += tabs + "\t" + (*i).first + ": "; - result += (*i).second->prettyPrint(mode,tabs + "\t"); - result += eol(); - } - - result += tabs + "}"; - return result; -} - -void AMFEMCAArray::serialize(vector<__uint8> &s,int mode,const utf8 &logMsgPrefix) const throw(exception) -{ - assert(mode == 0); // amf3 not implemented - // wowza seems to always just use zero as array length - s.push_back(0); s.push_back(0); s.push_back(0); s.push_back(0); - - for(propertyMap_t::const_iterator i = m_properties.begin(); i != m_properties.end(); ++i) - { - assert((*i).second); - ::serialize(s,(*i).first,mode,logMsgPrefix); - (*i).second->serialize(s,mode,logMsgPrefix); - } - s.push_back(0); - s.push_back(0); - s.push_back(AMF0_object_end_marker); -} - -void AMFEMCAArray::loadFromBitstream(const char *&bitstream,int &bitstreamLen,int mode,const utf8 &logMsgPrefix) throw(exception) -{ - assert(mode == 0); // AMF3 not implemented yet - propertyMap_t pmap; - - AMFVal *val = 0; - try - { - if (bitstreamLen < 7) throwEx(logMsgPrefix + " Insufficient data for AMF0 ECMA array type."); - - // skip length - bitstream += 4; - bitstreamLen -= 4; - - while(true) - { - if (bitstreamLen < 3) throwEx(logMsgPrefix + " Insufficient data for ECMA array type."); - if (bitstream[0] == 0 && bitstream[1] == 0 && bitstream[2] == 9) - { - // end of object - bitstream += 3; - bitstreamLen -= 3; - break; - } - if (bitstream[0] == 0 && bitstream[1] == 0) throwEx(logMsgPrefix + " AMF0 ECMA array type has null string keyed property"); - if (bitstreamLen < 4) throwEx(logMsgPrefix + " Insufficient data for AMF0 ECMA array type."); - - // alright, we've taken care of the abberant cases and end-of-object. Now let's get a property - int slen = ntohs(*(__uint16*)bitstream); - bitstream += 2; - bitstreamLen -= 2; - if (bitstreamLen < slen) throwEx(logMsgPrefix + " Insufficient data for AMF0 ECMA array type property key."); - utf8 key(bitstream,bitstream + slen); - bitstream += slen; - bitstreamLen -= slen; - assert(!val); - val = new AMFVal; - val->loadFromBitstream(bitstream,bitstreamLen,mode,logMsgPrefix); - pmap[key] = val; - val = 0; - } - - clearProperties(); - m_properties = pmap; - } - catch(...) - { - delete val; - throw; - } -} - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -const uniString::utf8 & AMFVal::getString() const throw(std::exception) -{ - if (m_type3 == AMF3_string_marker) return m_string_val; - if (m_type0 != AMF0_string_marker) throwEx("AMFVal type error. Wanted string but type is " + tos(m_type0)); - return m_string_val; -} - -int AMFVal::getInteger() const throw(std::exception) -{ - if (m_type3 != AMF3_integer_marker) throwEx("AMFVal type error. Wanted integer but type is " + tos(m_type3)); - return m_integer_val; -} - -double AMFVal::getNumber() const throw(std::exception) -{ - if (m_type3 == AMF3_double_marker) return m_number_val; - if (m_type0 != AMF0_number_marker) throwEx("AMFVal type error. Wanted number but type is " + tos(m_type0)); - return m_number_val; -} - -bool AMFVal::getBool() const throw(std::exception) -{ - if (m_type3 == AMF3_true_marker) return true; - if (m_type3 == AMF3_false_marker) return false; - if (m_type0 != AMF0_boolean_marker) throwEx("AMFVal type error. Wanted boolean but type is " + tos(m_type0)); - return m_boolean_val; -} - -const AMFObject& AMFVal::getObject() const throw(std::exception) -{ - if (m_type3 == AMF3_object_marker) return m_object_val; - if (m_type0 != AMF0_object_marker) throwEx("AMFVal type error. Wanted object but type is " + tos(m_type0)); - return m_object_val; -} - -void AMFVal::serialize(vector<__uint8> &s,int mode,const utf8 &logMsgPrefix) const throw(exception) -{ - s.push_back(mode == 3 ? (__uint8)m_type3 : (__uint8)m_type0); - if (mode == 3) - { - switch(m_type3) - { - case AMF3_double_marker: - { - __uint8 buf[8] = {0}; - AMF0_EncodeNumber((char *)buf,(char *)buf+8,m_number_val); - s.insert(s.end(),buf,buf+8); - } - break; - - default: - throwEx(logMsgPrefix + __FUNCTION__ + " unsupported type " + tos(m_type3)); - } - } - else - { - switch(m_type0) - { - case AMF0_number_marker: - { - __uint8 buf[8] = {0}; - AMF0_EncodeNumber((char *)buf,(char *)buf+8,m_number_val); - s.insert(s.end(),buf,buf+8); - } - break; - - case AMF0_boolean_marker: - s.push_back(m_boolean_val ? 1 : 0); - break; - - case AMF0_string_marker: - ::serialize(s,m_string_val,mode,logMsgPrefix); - break; - - case AMF0_object_marker: - m_object_val.serialize(s,mode,logMsgPrefix); - break; - - case AMF0_ecma_array_marker: - m_ecma_array_val.serialize(s,mode,logMsgPrefix); - break; - - case AMF0_null_marker: - break; - - default: - throwEx(logMsgPrefix + __FUNCTION__ + " unsupported type " + tos(m_type0)); - break; - } - } -} - -utf8 AMFVal::prettyPrint(int mode,const utf8 &tabs) const throw() -{ - if (mode == 3) - { - switch(m_type3) - { - case AMF3_double_marker: - return tabs + tos(m_number_val); - - case AMF3_integer_marker: - return tabs + tos(m_integer_val); - - default: - break; - } - } - else - { - switch(m_type0) - { - case AMF0_number_marker: - return tabs + tos(m_number_val); - - case AMF0_boolean_marker: - return tabs + (m_boolean_val ? "true" : "false"); - - case AMF0_string_marker: - return tabs + m_string_val; - - case AMF0_object_marker: - return m_object_val.prettyPrint(mode,tabs); - - case AMF0_ecma_array_marker: - return m_ecma_array_val.prettyPrint(mode,tabs); - - default: - break; - } - } - return ""; -} - -void AMFVal::loadFromBitstream(const char *&bitstream,int &bitstreamLen,int mode,const utf8 &logMsgPrefix) throw(exception) -{ - if (!bitstreamLen) throwEx(logMsgPrefix + " AMF bitstream is empty"); - if (mode == 3) - { - m_type3 = (AMF3Marker_t)*bitstream; - bitstreamLen -= 1; - bitstream += 1; - switch(m_type3) - { - case AMF3_double_marker: - if (bitstreamLen < 8) throwEx(logMsgPrefix + " Insufficient data for AMF3 double marker."); - m_number_val = AMF0_DecodeNumber(bitstream); - bitstream += 8; - bitstreamLen -= 8; - break; - - case AMF3_null_marker: - case AMF3_false_marker: - case AMF3_true_marker: - case AMF3_integer_marker: - case AMF3_string_marker: - case AMF3_xml_doc_marker: - case AMF3_date_marker: - case AMF3_array_marker: - case AMF3_object_marker: - case AMF3_xml_marker: - case AMF3_byte_array_marker: - case AMF3_undefined_marker: - throwEx(logMsgPrefix + " Unsupported AMF3 marker " + tos(m_type3)); - break; - - default: - throwEx(logMsgPrefix + " Unknown AMF3 marker " + tos(m_type3)); - break; - } - } - else - { - m_type0 = (AMF0Marker_t)*bitstream; - bitstreamLen -= 1; - bitstream += 1; - switch(m_type0) - { - case AMF0_number_marker: - if (bitstreamLen < 8) throwEx(logMsgPrefix + " Insufficient data for AMF0 number marker."); - m_number_val = AMF0_DecodeNumber(bitstream); - bitstream += 8; - bitstreamLen -= 8; - break; - - case AMF0_boolean_marker: - if (bitstreamLen < 1) throwEx(logMsgPrefix + " Insufficient data for AMF0 boolean marker."); - m_boolean_val = ((*bitstream) ? true : false); - bitstream += 1; - bitstreamLen -= 1; - break; - - case AMF0_string_marker: - { - if (bitstreamLen < 2) throwEx(logMsgPrefix + " Insufficient data for AMF0 string marker."); - __uint16 slen = ntohs(*(__uint16*)bitstream); - bitstream += 2; - bitstreamLen -= 2; - if (bitstreamLen < slen) throwEx(logMsgPrefix + " Insufficient data for AMF0 string marker."); - m_string_val = utf8(bitstream,bitstream + slen); - bitstream += slen; - bitstreamLen -= slen; - } - break; - - case AMF0_object_marker: - m_object_val.loadFromBitstream(bitstream,bitstreamLen,0,logMsgPrefix); - break; - - case AMF0_ecma_array_marker: - m_ecma_array_val.loadFromBitstream(bitstream,bitstreamLen,0,logMsgPrefix); - break; - - case AMF0_undefined_marker: - DEBUG_LOG(logMsgPrefix + "Warning - Undefined AMF0 marker " + tos(m_type0)); - case AMF0_null_marker: - break; - - case AMF0_reference_marker: - case AMF0_object_end_marker: - case AMF0_strict_array_marker: - case AMF0_date_marker: - case AMF0_long_string_marker: - case AMF0_unsupported_marker: - case AMF0_recordset_marker: - case AMF0_xml_Document_marker: - case AMF0_typed_object_marker: - case AMF0_amvplus_object_marker: - case AMF0_movieclip_marker: - throwEx(logMsgPrefix + " Unsupported AMF0 marker " + tos(m_type0)); - break; - - default: - throwEx(logMsgPrefix + " Unknown AMF0 marker " + tos(m_type0)); - break; - } - } -} - -/////////////////////////////////////////////////////////////////////////////////////////// - -void AMFEncoding::loadFromBitstream(const char *bitstream, int bitstreamLen,const uniString::utf8 &logMsgPrefix) throw(exception) -{ - int blen = bitstreamLen; - const char *bs = bitstream; - vector values; - while(blen) - { - AMFVal v; - v.loadFromBitstream(bs,blen,m_mode,logMsgPrefix); - values.push_back(v); - } - m_values=values; -} - -const AMFVal& AMFEncoding::getValue(size_t index) const throw(std::exception) -{ - if (index >= m_values.size()) - throwEx("AMFEncoding::getValue(" + tos(index) + ") out of range"); - return m_values[index]; -} - -void AMFEncoding::appendValue(const AMFVal &v) throw() -{ - m_values.push_back(v); -} - -void AMFEncoding::serialize(vector<__uint8> &s,const utf8 &logMsgPrefix) const throw(exception) -{ - for(vector::const_iterator i = m_values.begin(); i != m_values.end(); ++i) - (*i).serialize(s,m_mode,logMsgPrefix); -} - -utf8 AMFEncoding::prettyPrint() const throw() -{ - utf8 result("INVOKE("); - result += eol(); - for(vector::const_iterator i = m_values.begin(); i != m_values.end(); ++i) - result += (*i).prettyPrint(m_mode,"\t") + eol(); - result += ")"; - return result; -} -#endif diff --git a/Src/Plugins/DSP/sc_serv3/amf.h b/Src/Plugins/DSP/sc_serv3/amf.h deleted file mode 100644 index 41ae87f9..00000000 --- a/Src/Plugins/DSP/sc_serv3/amf.h +++ /dev/null @@ -1,156 +0,0 @@ -#ifndef amf_H_ -#define amf_H_ - -#include -#include -#include -#include "unicode/uniString.h" - -enum AMF0Marker_t -{ - AMF0_number_marker = 0x00, - AMF0_boolean_marker, - AMF0_string_marker, - AMF0_object_marker, - AMF0_movieclip_marker, - AMF0_null_marker, - AMF0_undefined_marker, - AMF0_reference_marker, - AMF0_ecma_array_marker, - AMF0_object_end_marker, - AMF0_strict_array_marker, - AMF0_date_marker, - AMF0_long_string_marker, - AMF0_unsupported_marker, - AMF0_recordset_marker, - AMF0_xml_Document_marker, - AMF0_typed_object_marker, - AMF0_amvplus_object_marker -}; - -enum AMF3Marker_t -{ - AMF3_undefined_marker = 0x00, - AMF3_null_marker, - AMF3_false_marker, - AMF3_true_marker, - AMF3_integer_marker, - AMF3_double_marker, - AMF3_string_marker, - AMF3_xml_doc_marker, - AMF3_date_marker, - AMF3_array_marker, - AMF3_object_marker, - AMF3_xml_marker, - AMF3_byte_array_marker, -}; - -struct AMFStrictArray -{ -}; - -struct AMFDate -{ -}; - -class AMFVal; - -struct AMFEMCAArray -{ -private: - typedef std::map propertyMap_t; - std::map m_properties; - -public: - AMFEMCAArray() throw(); - ~AMFEMCAArray() throw(); - AMFEMCAArray(const AMFEMCAArray &obj) throw(); - AMFEMCAArray& operator=(const AMFEMCAArray &obj) throw(); - - void loadFromBitstream(const char *&bitstream,int &bitstreamLen,int mode,const uniString::utf8 &logMsgPrefix) throw(std::exception); - const AMFVal* getProperty(const uniString::utf8 &key) const throw(); - void addProperty(const uniString::utf8 &key,AMFVal *v) throw(std::exception); // takes possession of "v" - void clearProperties() throw(); - void serialize(std::vector<__uint8> &s,int mode,const uniString::utf8 &logMsgPrefix) const throw(std::exception); - uniString::utf8 prettyPrint(int mode,const uniString::utf8 &tabs) const throw(); -}; - -class AMFObject -{ -private: - typedef std::map propertyMap_t; - std::map m_properties; - -public: - AMFObject() throw(); - ~AMFObject() throw(); - AMFObject(const AMFObject &obj) throw(); - AMFObject& operator=(const AMFObject &obj) throw(); - - void loadFromBitstream(const char *&bitstream,int &bitstreamLen,int mode,const uniString::utf8 &logMsgPrefix) throw(std::exception); - const AMFVal* getProperty(const uniString::utf8 &key) const throw(); - void addProperty(const uniString::utf8 &key,AMFVal *v) throw(std::exception); // takes possession of "v" - void clearProperties() throw(); - void serialize(std::vector<__uint8> &s,int mode,const uniString::utf8 &logMsgPrefix) const throw(std::exception); - uniString::utf8 prettyPrint(int mode,const uniString::utf8 &tabs) const throw(); -}; - -class AMFVal -{ -private: - AMF0Marker_t m_type0; // type - AMF3Marker_t m_type3; - - // value depends on type - int m_integer_val; - double m_number_val; - bool m_boolean_val; - uniString::utf8 m_string_val; - AMFObject m_object_val; - __uint16 m_reference_val; - AMFEMCAArray m_ecma_array_val; - AMFStrictArray m_strict_array_val; - AMFDate m_date_val; - -public: - void loadFromBitstream(const char *&bitstream,int &bitstreamLen,int mode,const uniString::utf8 &logMsgPrefix) throw(std::exception); - - const uniString::utf8 &getString() const throw(std::exception); - double getNumber() const throw(std::exception); - bool getBool() const throw(std::exception); - const AMFObject& getObject() const throw(std::exception); - int getInteger() const throw(std::exception); - - AMFVal() throw(): m_type0(AMF0_null_marker),m_type3(AMF3_undefined_marker){} - AMFVal(double v) throw(): m_type0(AMF0_number_marker),m_type3(AMF3_undefined_marker) ,m_number_val(v){} - AMFVal(bool v) throw(): m_type0(AMF0_boolean_marker),m_type3(AMF3_undefined_marker),m_boolean_val(v){} - AMFVal(const uniString::utf8 &v) throw(): m_type0(AMF0_string_marker),m_type3(AMF3_undefined_marker) ,m_string_val(v){} - AMFVal(const AMFObject &v) throw(): m_type0(AMF0_object_marker),m_type3(AMF3_undefined_marker) ,m_object_val(v){} - AMFVal(const AMFEMCAArray &v) throw(): m_type0(AMF0_ecma_array_marker),m_type3(AMF3_undefined_marker),m_ecma_array_val(v){} - - void serialize(std::vector<__uint8> &s,int mode,const uniString::utf8 &logMsgPrefix) const throw(std::exception); - uniString::utf8 prettyPrint(int mode,const uniString::utf8 &tabs) const throw(); -}; - -class AMFEncoding -{ -private: - std::vector m_values; - int m_mode; - -public: - AMFEncoding(int mode = 0) throw():m_mode(mode){} - ~AMFEncoding() throw(){} - - void clear() throw() { m_values.clear(); } - - void loadFromBitstream(const char *bitstream,int bitstreamLen,const uniString::utf8 &logMsgPrefix) throw(std::exception); - const AMFVal& getValue(size_t index) const throw(std::exception); - - void appendValue(const AMFVal &v) throw(); - void serialize(std::vector<__uint8> &s,const uniString::utf8 &logMsgPrefix) const throw(std::exception); - - uniString::utf8 prettyPrint() const throw(); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/GNUmakefile b/Src/Plugins/DSP/sc_serv3/aolxml/GNUmakefile deleted file mode 100644 index f1a5feaf..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/GNUmakefile +++ /dev/null @@ -1,2 +0,0 @@ -build: - ./unix_build_expat diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/CMake.README b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/CMake.README deleted file mode 100644 index eda302d9..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/CMake.README +++ /dev/null @@ -1,42 +0,0 @@ -== How to build expat with cmake (experimental) == - -The cmake based buildsystem for expat works on Windows (cygwin, mingw, Visual -Studio) and should work on all other platform cmake supports. - -Assuming ~/expat-2.1.0 is the source directory of expat, add a subdirectory -build and change into that directory: -~/expat-2.1.0$ mkdir build && cd build -~/expat-2.1.0/build$ - -From that directory, call cmake first, then call make, make test and -make install in the usual way: -~/expat-2.1.0/build$ cmake .. --- The C compiler identification is GNU --- The CXX compiler identification is GNU -.... --- Configuring done --- Generating done --- Build files have been written to: /home/patrick/expat-2.1.0/build - -If you want to specify the install location for your files, append --DCMAKE_INSTALL_PREFIX=/your/install/path to the cmake call. - -~/expat-2.1.0/build$ make && make test && make install -Scanning dependencies of target expat -[ 5%] Building C object CMakeFiles/expat.dir/lib/xmlparse.c.o -[ 11%] Building C object CMakeFiles/expat.dir/lib/xmlrole.c.o -.... --- Installing: /usr/local/lib/pkgconfig/expat.pc --- Installing: /usr/local/bin/xmlwf --- Installing: /usr/local/share/man/man1/xmlwf.1 - -For Windows builds, you must make sure to call cmake from an environment where -your compiler is reachable, that means either you call it from the -Visual Studio Command Prompt or when using mingw, you must open a cmd.exe and -make sure that gcc can be called. On Windows, you also might want to specify a -special Generator for CMake: -for Visual Studio builds do: -cmake .. -G "Visual Studio 10" && vcexpress expat.sln -for mingw builds do: -cmake .. -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=D:\expat-install - && gmake && gmake install diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/CMakeLists.txt b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/CMakeLists.txt deleted file mode 100644 index 0c923baa..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/CMakeLists.txt +++ /dev/null @@ -1,111 +0,0 @@ -# This file is copyrighted under the BSD-license for buildsystem files of KDE -# copyright 2010, Patrick Spendrin - -project(expat) - -cmake_minimum_required(VERSION 2.6) -set(PACKAGE_BUGREPORT "expat-bugs@libexpat.org") -set(PACKAGE_NAME "expat") -set(PACKAGE_VERSION "2.1.0") -set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") -set(PACKAGE_TARNAME "${PACKAGE_NAME}") - -option(BUILD_tools "build the xmlwf tool for expat library" ON) -option(BUILD_examples "build the examples for expat library" ON) -option(BUILD_tests "build the tests for expat library" ON) -option(BUILD_shared "build a shared expat library" ON) - -# configuration options -set(XML_CONTEXT_BYTES 1024 CACHE STRING "Define to specify how much context to retain around the current parse point") -option(XML_DTD "Define to make parameter entity parsing functionality available" ON) -option(XML_NS "Define to make XML Namespaces functionality available" ON) - -if(XML_DTD) - set(XML_DTD 1) -else(XML_DTD) - set(XML_DTD 0) -endif(XML_DTD) -if(XML_NS) - set(XML_NS 1) -else(XML_NS) - set(XML_NS 0) -endif(XML_NS) - -if(BUILD_tests) - enable_testing() -endif(BUILD_tests) - -include(ConfigureChecks.cmake) - -include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/lib) -if(MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -wd4996) -endif(MSVC) - -set(expat_SRCS - lib/xmlparse.c - lib/xmlrole.c - lib/xmltok.c - lib/xmltok_impl.c - lib/xmltok_ns.c -) - -if(WIN32 AND BUILD_shared) - set(expat_SRCS ${expat_SRCS} lib/libexpat.def) -endif(WIN32 AND BUILD_shared) - -if(BUILD_shared) - set(_SHARED SHARED) -else(BUILD_shared) - set(_SHARED STATIC) -endif(BUILD_shared) - -add_library(expat ${_SHARED} ${expat_SRCS}) - -install(TARGETS expat RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - -set(prefix ${CMAKE_INSTALL_PREFIX}) -set(exec_prefix "\${prefix}/bin") -set(libdir "\${prefix}/lib") -set(includedir "\${prefix}/include") -configure_file(expat.pc.in ${CMAKE_CURRENT_BINARY_DIR}/expat.pc) - -install(FILES lib/expat.h lib/expat_external.h DESTINATION include) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION lib/pkgconfig) - - - -if(BUILD_tools AND NOT WINCE) - set(xmlwf_SRCS - xmlwf/xmlwf.c - xmlwf/xmlfile.c - xmlwf/codepage.c - xmlwf/readfilemap.c - ) - - add_executable(xmlwf ${xmlwf_SRCS}) - target_link_libraries(xmlwf expat) - install(TARGETS xmlwf DESTINATION bin) - install(FILES doc/xmlwf.1 DESTINATION share/man/man1) -endif(BUILD_tools AND NOT WINCE) - -if(BUILD_examples) - add_executable(elements examples/elements.c) - target_link_libraries(elements expat) - - add_executable(outline examples/outline.c) - target_link_libraries(outline expat) -endif(BUILD_examples) - -if(BUILD_tests) - ## these are unittests that can be run on any platform - add_executable(runtests tests/runtests.c tests/chardata.c tests/minicheck.c) - target_link_libraries(runtests expat) - add_test(runtests runtests) - - add_executable(runtestspp tests/runtestspp.cpp tests/chardata.c tests/minicheck.c) - target_link_libraries(runtestspp expat) - add_test(runtestspp runtestspp) -endif(BUILD_tests) diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/COPYING b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/COPYING deleted file mode 100644 index dcb45064..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/COPYING +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - and Clark Cooper -Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers. - -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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/Changes b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/Changes deleted file mode 100644 index 08897b9f..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/Changes +++ /dev/null @@ -1,205 +0,0 @@ -Release 2.1.0 Sat March 24 2012 - - Bug Fixes: - #1742315: Harmful XML_ParserCreateNS suggestion. - #2895533: CVE-2012-1147 - Resource leak in readfilemap.c. - #1785430: Expat build fails on linux-amd64 with gcc version>=4.1 -O3. - #1983953, 2517952, 2517962, 2649838: - Build modifications using autoreconf instead of buildconf.sh. - #2815947, #2884086: OBJEXT and EXEEXT support while building. - #1990430: CVE-2009-3720 - Parser crash with special UTF-8 sequences. - #2517938: xmlwf should return non-zero exit status if not well-formed. - #2517946: Wrong statement about XMLDecl in xmlwf.1 and xmlwf.sgml. - #2855609: Dangling positionPtr after error. - #2894085: CVE-2009-3560 - Buffer over-read and crash in big2_toUtf8(). - #2958794: CVE-2012-1148 - Memory leak in poolGrow. - #2990652: CMake support. - #3010819: UNEXPECTED_STATE with a trailing "%" in entity value. - #3206497: Unitialized memory returned from XML_Parse. - #3287849: make check fails on mingw-w64. - #3496608: CVE-2012-0876 - Hash DOS attack. - - Patches: - #1749198: pkg-config support. - #3010222: Fix for bug #3010819. - #3312568: CMake support. - #3446384: Report byte offsets for attr names and values. - - New Features / API changes: - Added new API member XML_SetHashSalt() that allows setting an intial - value (salt) for hash calculations. This is part of the fix for - bug #3496608 to randomize hash parameters. - When compiled with XML_ATTR_INFO defined, adds new API member - XML_GetAttributeInfo() that allows retrieving the byte - offsets for attribute names and values (patch #3446384). - Added CMake build system. - See bug #2990652 and patch #3312568. - Added run-benchmark target to Makefile.in - relies on testdata module - present in the same relative location as in the repository. - -Release 2.0.1 Tue June 5 2007 - - Fixed bugs #1515266, #1515600: The character data handler's calling - of XML_StopParser() was not handled properly; if the parser was - stopped and the handler set to NULL, the parser would segfault. - - Fixed bug #1690883: Expat failed on EBCDIC systems as it assumed - some character constants to be ASCII encoded. - - Minor cleanups of the test harness. - - Fixed xmlwf bug #1513566: "out of memory" error on file size zero. - - Fixed outline.c bug #1543233: missing a final XML_ParserFree() call. - - Fixes and improvements for Windows platform: - bugs #1409451, #1476160, #1548182, #1602769, #1717322. - - Build fixes for various platforms: - HP-UX, Tru64, Solaris 9: patch #1437840, bug #1196180. - All Unix: #1554618 (refreshed config.sub/config.guess). - #1490371, #1613457: support both, DESTDIR and INSTALL_ROOT, - without relying on GNU-Make specific features. - #1647805: Patched configure.in to work better with Intel compiler. - - Fixes to Makefile.in to have make check work correctly: - bugs #1408143, #1535603, #1536684. - - Added Open Watcom support: patch #1523242. - -Release 2.0.0 Wed Jan 11 2006 - - We no longer use the "check" library for C unit testing; we - always use the (partial) internal implementation of the API. - - Report XML_NS setting via XML_GetFeatureList(). - - Fixed headers for use from C++. - - XML_GetCurrentLineNumber() and XML_GetCurrentColumnNumber() - now return unsigned integers. - - Added XML_LARGE_SIZE switch to enable 64-bit integers for - byte indexes and line/column numbers. - - Updated to use libtool 1.5.22 (the most recent). - - Added support for AmigaOS. - - Some mostly minor bug fixes. SF issues include: #1006708, - #1021776, #1023646, #1114960, #1156398, #1221160, #1271642. - -Release 1.95.8 Fri Jul 23 2004 - - Major new feature: suspend/resume. Handlers can now request - that a parse be suspended for later resumption or aborted - altogether. See "Temporarily Stopping Parsing" in the - documentation for more details. - - Some mostly minor bug fixes, but compilation should no - longer generate warnings on most platforms. SF issues - include: #827319, #840173, #846309, #888329, #896188, #923913, - #928113, #961698, #985192. - -Release 1.95.7 Mon Oct 20 2003 - - Fixed enum XML_Status issue (reported on SourceForge many - times), so compilers that are properly picky will be happy. - - Introduced an XMLCALL macro to control the calling - convention used by the Expat API; this macro should be used - to annotate prototypes and definitions of callback - implementations in code compiled with a calling convention - other than the default convention for the host platform. - - Improved ability to build without the configure-generated - expat_config.h header. This is useful for applications - which embed Expat rather than linking in the library. - - Fixed a variety of bugs: see SF issues #458907, #609603, - #676844, #679754, #692878, #692964, #695401, #699323, #699487, - #820946. - - Improved hash table lookups. - - Added more regression tests and improved documentation. - -Release 1.95.6 Tue Jan 28 2003 - - Added XML_FreeContentModel(). - - Added XML_MemMalloc(), XML_MemRealloc(), XML_MemFree(). - - Fixed a variety of bugs: see SF issues #615606, #616863, - #618199, #653180, #673791. - - Enhanced the regression test suite. - - Man page improvements: includes SF issue #632146. - -Release 1.95.5 Fri Sep 6 2002 - - Added XML_UseForeignDTD() for improved SAX2 support. - - Added XML_GetFeatureList(). - - Defined XML_Bool type and the values XML_TRUE and XML_FALSE. - - Use an incomplete struct instead of a void* for the parser - (may not retain). - - Fixed UTF-8 decoding bug that caused legal UTF-8 to be rejected. - - Finally fixed bug where default handler would report DTD - events that were already handled by another handler. - Initial patch contributed by Darryl Miles. - - Removed unnecessary DllMain() function that caused static - linking into a DLL to be difficult. - - Added VC++ projects for building static libraries. - - Reduced line-length for all source code and headers to be - no longer than 80 characters, to help with AS/400 support. - - Reduced memory copying during parsing (SF patch #600964). - - Fixed a variety of bugs: see SF issues #580793, #434664, - #483514, #580503, #581069, #584041, #584183, #584832, #585537, - #596555, #596678, #598352, #598944, #599715, #600479, #600971. - -Release 1.95.4 Fri Jul 12 2002 - - Added support for VMS, contributed by Craig Berry. See - vms/README.vms for more information. - - Added Mac OS (classic) support, with a makefile for MPW, - contributed by Thomas Wegner and Daryle Walker. - - Added Borland C++ Builder 5 / BCC 5.5 support, contributed - by Patrick McConnell (SF patch #538032). - - Fixed a variety of bugs: see SF issues #441449, #563184, - #564342, #566334, #566901, #569461, #570263, #575168, #579196. - - Made skippedEntityHandler conform to SAX2 (see source comment) - - Re-implemented WFC: Entity Declared from XML 1.0 spec and - added a new error "entity declared in parameter entity": - see SF bug report #569461 and SF patch #578161 - - Re-implemented section 5.1 from XML 1.0 spec: - see SF bug report #570263 and SF patch #578161 - -Release 1.95.3 Mon Jun 3 2002 - - Added a project to the MSVC workspace to create a wchar_t - version of the library; the DLLs are named libexpatw.dll. - - Changed the name of the Windows DLLs from expat.dll to - libexpat.dll; this fixes SF bug #432456. - - Added the XML_ParserReset() API function. - - Fixed XML_SetReturnNSTriplet() to work for element names. - - Made the XML_UNICODE builds usable (thanks, Karl!). - - Allow xmlwf to read from standard input. - - Install a man page for xmlwf on Unix systems. - - Fixed many bugs; see SF bug reports #231864, #461380, #464837, - #466885, #469226, #477667, #484419, #487840, #494749, #496505, - #547350. Other bugs which we can't test as easily may also - have been fixed, especially in the area of build support. - -Release 1.95.2 Fri Jul 27 2001 - - More changes to make MSVC happy with the build; add a single - workspace to support both the library and xmlwf application. - - Added a Windows installer for Windows users; includes - xmlwf.exe. - - Added compile-time constants that can be used to determine the - Expat version - - Removed a lot of GNU-specific dependencies to aide portability - among the various Unix flavors. - - Fix the UTF-8 BOM bug. - - Cleaned up warning messages for several compilers. - - Added the -Wall, -Wstrict-prototypes options for GCC. - -Release 1.95.1 Sun Oct 22 15:11:36 EDT 2000 - - Changes to get expat to build under Microsoft compiler - - Removed all aborts and instead return an UNEXPECTED_STATE error. - - Fixed a bug where a stray '%' in an entity value would cause an - abort. - - Defined XML_SetEndNamespaceDeclHandler. Thanks to Darryl Miles for - finding this oversight. - - Changed default patterns in lib/Makefile.in to fit non-GNU makes - Thanks to robin@unrated.net for reporting and providing an - account to test on. - - The reference had the wrong label for XML_SetStartNamespaceDecl. - Reported by an anonymous user. - -Release 1.95.0 Fri Sep 29 2000 - - XML_ParserCreate_MM - Allows you to set a memory management suite to replace the - standard malloc,realloc, and free. - - XML_SetReturnNSTriplet - If you turn this feature on when namespace processing is in - effect, then qualified, prefixed element and attribute names - are returned as "uri|name|prefix" where '|' is whatever - separator character is used in namespace processing. - - Merged in features from perl-expat - o XML_SetElementDeclHandler - o XML_SetAttlistDeclHandler - o XML_SetXmlDeclHandler - o XML_SetEntityDeclHandler - o StartDoctypeDeclHandler takes 3 additional parameters: - sysid, pubid, has_internal_subset - o Many paired handler setters (like XML_SetElementHandler) - now have corresponding individual handler setters - o XML_GetInputContext for getting the input context of - the current parse position. - - Added reference material - - Packaged into a distribution that builds a sharable library diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/ConfigureChecks.cmake b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/ConfigureChecks.cmake deleted file mode 100644 index f03faa63..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/ConfigureChecks.cmake +++ /dev/null @@ -1,44 +0,0 @@ -include(CheckIncludeFile) -include(CheckIncludeFiles) -include(CheckFunctionExists) -include(CheckSymbolExists) -include(TestBigEndian) - -check_include_file("dlfcn.h" HAVE_DLFCN_H) -check_include_file("fcntl.h" HAVE_FCNTL_H) -check_include_file("inttypes.h" HAVE_INTTYPES_H) -check_include_file("memory.h" HAVE_MEMORY_H) -check_include_file("stdint.h" HAVE_STDINT_H) -check_include_file("stdlib.h" HAVE_STDLIB_H) -check_include_file("strings.h" HAVE_STRINGS_H) -check_include_file("string.h" HAVE_STRING_H) -check_include_file("sys/stat.h" HAVE_SYS_STAT_H) -check_include_file("sys/types.h" HAVE_SYS_TYPES_H) -check_include_file("unistd.h" HAVE_UNISTD_H) - -check_function_exists("getpagesize" HAVE_GETPAGESIZE) -check_function_exists("bcopy" HAVE_BCOPY) -check_symbol_exists("memmove" "string.h" HAVE_MEMMOVE) -check_function_exists("mmap" HAVE_MMAP) - -#/* Define to 1 if you have the ANSI C header files. */ -check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS) - -test_big_endian(WORDS_BIGENDIAN) -#/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -if(WORDS_BIGENDIAN) - set(BYTEORDER 4321) -else(WORDS_BIGENDIAN) - set(BYTEORDER 1234) -endif(WORDS_BIGENDIAN) - -if(HAVE_SYS_TYPES_H) - check_symbol_exists("off_t" "sys/types.h" OFF_T) - check_symbol_exists("size_t" "sys/types.h" SIZE_T) -else(HAVE_SYS_TYPES_H) - set(OFF_T "long") - set(SIZE_T "unsigned") -endif(HAVE_SYS_TYPES_H) - -configure_file(expat_config.h.cmake expat_config.h) -add_definitions(-DHAVE_EXPAT_CONFIG_H) diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/MANIFEST b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/MANIFEST deleted file mode 100644 index 7a020dc0..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/MANIFEST +++ /dev/null @@ -1,141 +0,0 @@ -amiga/launch.c -amiga/expat_68k.c -amiga/expat_68k.h -amiga/expat_68k_handler_stubs.c -amiga/expat_base.h -amiga/expat_vectors.c -amiga/expat_lib.c -amiga/expat.xml -amiga/README.txt -amiga/Makefile -amiga/include/proto/expat.h -amiga/include/libraries/expat.h -amiga/include/interfaces/expat.h -amiga/include/inline4/expat.h -bcb5/README.txt -bcb5/all_projects.bpg -bcb5/elements.bpf -bcb5/elements.bpr -bcb5/elements.mak -bcb5/expat.bpf -bcb5/expat.bpr -bcb5/expat.mak -bcb5/expat_static.bpf -bcb5/expat_static.bpr -bcb5/expat_static.mak -bcb5/expatw.bpf -bcb5/expatw.bpr -bcb5/expatw.mak -bcb5/expatw_static.bpf -bcb5/expatw_static.bpr -bcb5/expatw_static.mak -bcb5/libexpat_mtd.def -bcb5/libexpatw_mtd.def -bcb5/makefile.mak -bcb5/outline.bpf -bcb5/outline.bpr -bcb5/outline.mak -bcb5/setup.bat -bcb5/xmlwf.bpf -bcb5/xmlwf.bpr -bcb5/xmlwf.mak -doc/expat.png -doc/reference.html -doc/style.css -doc/valid-xhtml10.png -doc/xmlwf.1 -doc/xmlwf.sgml -CMakeLists.txt -CMake.README -COPYING -Changes -ConfigureChecks.cmake -MANIFEST -Makefile.in -README -configure -configure.in -expat_config.h.in -expat_config.h.cmake -expat.pc.in -expat.dsw -aclocal.m4 -conftools/PrintPath -conftools/ac_c_bigendian_cross.m4 -conftools/expat.m4 -conftools/get-version.sh -conftools/mkinstalldirs -conftools/config.guess -conftools/config.sub -conftools/install-sh -conftools/ltmain.sh -m4/libtool.m4 -m4/ltversion.m4 -m4/ltoptions.m4 -m4/ltsugar.m4 -m4/lt~obsolete.m4 -examples/elements.c -examples/elements.dsp -examples/outline.c -examples/outline.dsp -lib/Makefile.MPW -lib/amigaconfig.h -lib/ascii.h -lib/asciitab.h -lib/expat.dsp -lib/expat.h -lib/expat_external.h -lib/expat_static.dsp -lib/expatw.dsp -lib/expatw_static.dsp -lib/iasciitab.h -lib/internal.h -lib/latin1tab.h -lib/libexpat.def -lib/libexpatw.def -lib/macconfig.h -lib/nametab.h -lib/utf8tab.h -lib/winconfig.h -lib/xmlparse.c -lib/xmlrole.c -lib/xmlrole.h -lib/xmltok.c -lib/xmltok.h -lib/xmltok_impl.c -lib/xmltok_impl.h -lib/xmltok_ns.c -tests/benchmark/README.txt -tests/benchmark/benchmark.c -tests/benchmark/benchmark.dsp -tests/benchmark/benchmark.dsw -tests/README.txt -tests/chardata.c -tests/chardata.h -tests/minicheck.c -tests/minicheck.h -tests/runtests.c -tests/runtestspp.cpp -tests/xmltest.sh -vms/README.vms -vms/descrip.mms -vms/expat_config.h -win32/MANIFEST.txt -win32/README.txt -win32/expat.iss -xmlwf/codepage.c -xmlwf/codepage.h -xmlwf/ct.c -xmlwf/filemap.h -xmlwf/readfilemap.c -xmlwf/unixfilemap.c -xmlwf/win32filemap.c -xmlwf/xmlfile.c -xmlwf/xmlfile.h -xmlwf/xmlmime.c -xmlwf/xmlmime.h -xmlwf/xmltchar.h -xmlwf/xmlurl.h -xmlwf/xmlwf.c -xmlwf/xmlwf.dsp -xmlwf/xmlwin32url.cxx diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/Makefile.in b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/Makefile.in deleted file mode 100644 index 9c0f5d49..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/Makefile.in +++ /dev/null @@ -1,201 +0,0 @@ -################################################################ -# Process this file with top-level configure script to produce Makefile -# -# Copyright 2000 Clark Cooper -# -# This file is part of EXPAT. -# -# EXPAT is free software; you can redistribute it and/or modify it -# under the terms of the License (based on the MIT/X license) contained -# in the file COPYING that comes with this distribution. -# -# EXPAT 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# SOFTWARE OR THE USE OR OTHER DEALINGS IN EXPAT. -# - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ - -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -libdir = @libdir@ -includedir = @includedir@ -man1dir = @mandir@/man1 -pkgconfigdir = $(libdir)/pkgconfig - -top_builddir = . - - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -mkinstalldirs = $(SHELL) $(top_srcdir)/conftools/mkinstalldirs - -MANFILE = $(srcdir)/doc/xmlwf.1 -APIHEADER = $(srcdir)/lib/expat.h $(srcdir)/lib/expat_external.h -LIBRARY = libexpat.la - -DESTDIR = $(INSTALL_ROOT) - -default: buildlib xmlwf/xmlwf@EXEEXT@ - -buildlib: $(LIBRARY) expat.pc - -all: $(LIBRARY) expat.pc xmlwf/xmlwf@EXEEXT@ examples/elements examples/outline - -clean: - cd lib && rm -f $(LIBRARY) *.@OBJEXT@ *.lo && rm -rf .libs _libs - cd xmlwf && rm -f xmlwf *.@OBJEXT@ *.lo && rm -rf .libs _libs - cd examples && rm -f elements outline *.@OBJEXT@ *.lo && rm -rf .libs _libs - cd tests && rm -rf .libs runtests runtests.@OBJEXT@ runtestspp runtestspp.@OBJEXT@ - cd tests && rm -f chardata.@OBJEXT@ minicheck.@OBJEXT@ - rm -rf .libs libexpat.la - rm -f examples/core tests/core xmlwf/core - -clobber: clean - -distclean: clean - rm -f expat_config.h config.status config.log config.cache libtool - rm -f Makefile expat.pc - -extraclean: distclean - rm -f expat_config.h.in configure - rm -f aclocal.m4 m4/* - rm -f conftools/ltmain.sh conftools/install-sh conftools/config.guess conftools/config.sub - -check: tests/runtests tests/runtestspp - tests/runtests - tests/runtestspp - -install: xmlwf/xmlwf@EXEEXT@ installlib - $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf@EXEEXT@ $(DESTDIR)$(bindir)/xmlwf - $(INSTALL_DATA) $(MANFILE) $(DESTDIR)$(man1dir) - -installlib: $(LIBRARY) $(APIHEADER) expat.pc - $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) $(DESTDIR)$(pkgconfigdir) - $(LIBTOOL) --mode=install $(INSTALL) $(LIBRARY) $(DESTDIR)$(libdir)/$(LIBRARY) - for FN in $(APIHEADER) ; do $(INSTALL_DATA) $$FN $(DESTDIR)$(includedir) ; done - $(INSTALL_DATA) expat.pc $(DESTDIR)$(pkgconfigdir)/expat.pc - -uninstall: uninstalllib - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bindir)/xmlwf@EXEEXT@ - rm -f $(DESTDIR)$(man1dir)/xmlwf.1 - -uninstalllib: - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(LIBRARY) - rm -f $(DESTDIR)$(includedir)/expat.h - rm -f $(DESTDIR)$(includedir)/expat_external.h - rm -f $(DESTDIR)$(pkgconfigdir)/expat.pc - -# for VPATH builds (invoked by configure) -mkdir-init: - @for d in lib xmlwf examples tests ; do \ - (mkdir $$d 2> /dev/null || test 1) ; \ - done - -CC = @CC@ -CXX = @CXX@ -LIBTOOL = @LIBTOOL@ - -INCLUDES = -I$(srcdir)/lib -I. -LDFLAGS = @LDFLAGS@ -CPPFLAGS = @CPPFLAGS@ -DHAVE_EXPAT_CONFIG_H -CFLAGS = @CFLAGS@ -CXXFLAGS = @CXXFLAGS@ -VSNFLAG = -version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@ - -### autoconf this? -LTFLAGS = --silent - -COMPILE = $(CC) $(INCLUDES) $(CFLAGS) $(DEFS) $(CPPFLAGS) -CXXCOMPILE = $(CXX) $(INCLUDES) $(CXXFLAGS) $(DEFS) $(CPPFLAGS) -LTCOMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) -LINK_LIB = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) -no-undefined $(VSNFLAG) -rpath $(libdir) $(LDFLAGS) -o $@ -LINK_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(LDFLAGS) -o $@ -LINK_CXX_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(CXXCOMPILE) $(LDFLAGS) -o $@ - -LIB_OBJS = lib/xmlparse.lo lib/xmltok.lo lib/xmlrole.lo -$(LIBRARY): $(LIB_OBJS) - $(LINK_LIB) $(LIB_OBJS) - -expat.pc: $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $@ - -lib/xmlparse.lo: lib/xmlparse.c lib/expat.h lib/xmlrole.h lib/xmltok.h \ - $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h - -lib/xmlrole.lo: lib/xmlrole.c lib/ascii.h lib/xmlrole.h \ - $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h - -lib/xmltok.lo: lib/xmltok.c lib/xmltok_impl.c lib/xmltok_ns.c \ - lib/ascii.h lib/asciitab.h lib/iasciitab.h lib/latin1tab.h \ - lib/nametab.h lib/utf8tab.h lib/xmltok.h lib/xmltok_impl.h \ - $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h - - -XMLWF_OBJS = xmlwf/xmlwf.@OBJEXT@ xmlwf/xmlfile.@OBJEXT@ xmlwf/codepage.@OBJEXT@ xmlwf/@FILEMAP@.@OBJEXT@ -xmlwf/xmlwf.@OBJEXT@: xmlwf/xmlwf.c -xmlwf/xmlfile.@OBJEXT@: xmlwf/xmlfile.c -xmlwf/codepage.@OBJEXT@: xmlwf/codepage.c -xmlwf/@FILEMAP@.@OBJEXT@: xmlwf/@FILEMAP@.c -xmlwf/xmlwf@EXEEXT@: $(XMLWF_OBJS) $(LIBRARY) - $(LINK_EXE) $(XMLWF_OBJS) $(LIBRARY) - -examples/elements.@OBJEXT@: examples/elements.c -examples/elements: examples/elements.@OBJEXT@ $(LIBRARY) - $(LINK_EXE) $< $(LIBRARY) - -examples/outline.@OBJEXT@: examples/outline.c -examples/outline: examples/outline.@OBJEXT@ $(LIBRARY) - $(LINK_EXE) $< $(LIBRARY) - -tests/chardata.@OBJEXT@: tests/chardata.c tests/chardata.h -tests/minicheck.@OBJEXT@: tests/minicheck.c tests/minicheck.h -tests/runtests.@OBJEXT@: tests/runtests.c tests/chardata.h -tests/runtests: tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) - $(LINK_EXE) tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) -tests/runtestspp.@OBJEXT@: tests/runtestspp.cpp tests/runtests.c tests/chardata.h -tests/runtestspp: tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) - $(LINK_CXX_EXE) tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) - -tests/benchmark/benchmark.@OBJEXT@: tests/benchmark/benchmark.c -tests/benchmark/benchmark: tests/benchmark/benchmark.@OBJEXT@ $(LIBRARY) - $(LINK_EXE) tests/benchmark/benchmark.@OBJEXT@ $(LIBRARY) - -run-benchmark: tests/benchmark/benchmark - tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3 - -tests/xmlts.zip: - wget --output-document=tests/xmlts.zip \ - http://www.w3.org/XML/Test/xmlts20080827.zip - -tests/XML-Test-Suite: tests/xmlts.zip - cd tests && unzip -q xmlts.zip - -run-xmltest: xmlwf/xmlwf@EXEEXT@ tests/XML-Test-Suite - tests/xmltest.sh - -.SUFFIXES: .c .cpp .lo .@OBJEXT@ - -.cpp.@OBJEXT@: - $(CXXCOMPILE) -o $@ -c $< -.c.@OBJEXT@: - $(COMPILE) -o $@ -c $< -.c.lo: - $(LTCOMPILE) -o $@ -c $< - -.PHONY: buildlib all \ - clean distclean extraclean maintainer-clean \ - dist distdir \ - install uninstall diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/README b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/README deleted file mode 100644 index 1f88467d..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/README +++ /dev/null @@ -1,139 +0,0 @@ - - Expat, Release 2.1.0 - -This is Expat, a C library for parsing XML, written by James Clark. -Expat is a stream-oriented XML parser. This means that you register -handlers with the parser before starting the parse. These handlers -are called when the parser discovers the associated structures in the -document being parsed. A start tag is an example of the kind of -structures for which you may register handlers. - -Windows users should use the expat_win32bin package, which includes -both precompiled libraries and executables, and source code for -developers. - -Expat is free software. You may copy, distribute, and modify it under -the terms of the License contained in the file COPYING distributed -with this package. This license is the same as the MIT/X Consortium -license. - -Versions of Expat that have an odd minor version (the middle number in -the release above), are development releases and should be considered -as beta software. Releases with even minor version numbers are -intended to be production grade software. - -If you are building Expat from a check-out from the CVS repository, -you need to run a script that generates the configure script using the -GNU autoconf and libtool tools. To do this, you need to have -autoconf 2.58 or newer. Run the script like this: - - ./buildconf.sh - -Once this has been done, follow the same instructions as for building -from a source distribution. - -To build Expat from a source distribution, you first run the -configuration shell script in the top level distribution directory: - - ./configure - -There are many options which you may provide to configure (which you -can discover by running configure with the --help option). But the -one of most interest is the one that sets the installation directory. -By default, the configure script will set things up to install -libexpat into /usr/local/lib, expat.h into /usr/local/include, and -xmlwf into /usr/local/bin. If, for example, you'd prefer to install -into /home/me/mystuff/lib, /home/me/mystuff/include, and -/home/me/mystuff/bin, you can tell configure about that with: - - ./configure --prefix=/home/me/mystuff - -Another interesting option is to enable 64-bit integer support for -line and column numbers and the over-all byte index: - - ./configure CPPFLAGS=-DXML_LARGE_SIZE - -However, such a modification would be a breaking change to the ABI -and is therefore not recommended for general use - e.g. as part of -a Linux distribution - but rather for builds with special requirements. - -After running the configure script, the "make" command will build -things and "make install" will install things into their proper -location. Have a look at the "Makefile" to learn about additional -"make" options. Note that you need to have write permission into -the directories into which things will be installed. - -If you are interested in building Expat to provide document -information in UTF-16 encoding rather than the default UTF-8, follow -these instructions (after having run "make distclean"): - - 1. For UTF-16 output as unsigned short (and version/error - strings as char), run: - - ./configure CPPFLAGS=-DXML_UNICODE - - For UTF-16 output as wchar_t (incl. version/error strings), - run: - - ./configure CFLAGS="-g -O2 -fshort-wchar" \ - CPPFLAGS=-DXML_UNICODE_WCHAR_T - - 2. Edit the MakeFile, changing: - - LIBRARY = libexpat.la - - to: - - LIBRARY = libexpatw.la - - (Note the additional "w" in the library name.) - - 3. Run "make buildlib" (which builds the library only). - Or, to save step 2, run "make buildlib LIBRARY=libexpatw.la". - - 4. Run "make installlib" (which installs the library only). - Or, if step 2 was omitted, run "make installlib LIBRARY=libexpatw.la". - -Using DESTDIR or INSTALL_ROOT is enabled, with INSTALL_ROOT being the default -value for DESTDIR, and the rest of the make file using only DESTDIR. -It works as follows: - $ make install DESTDIR=/path/to/image -overrides the in-makefile set DESTDIR, while both - $ INSTALL_ROOT=/path/to/image make install - $ make install INSTALL_ROOT=/path/to/image -use DESTDIR=$(INSTALL_ROOT), even if DESTDIR eventually is defined in the -environment, because variable-setting priority is -1) commandline -2) in-makefile -3) environment - -Note: This only applies to the Expat library itself, building UTF-16 versions -of xmlwf and the tests is currently not supported. - -Note for Solaris users: The "ar" command is usually located in -"/usr/ccs/bin", which is not in the default PATH. You will need to -add this to your path for the "make" command, and probably also switch -to GNU make (the "make" found in /usr/ccs/bin does not seem to work -properly -- appearantly it does not understand .PHONY directives). If -you're using ksh or bash, use this command to build: - - PATH=/usr/ccs/bin:$PATH make - -When using Expat with a project using autoconf for configuration, you -can use the probing macro in conftools/expat.m4 to determine how to -include Expat. See the comments at the top of that file for more -information. - -A reference manual is available in the file doc/reference.html in this -distribution. - -The homepage for this project is http://www.libexpat.org/. There -are links there to connect you to the bug reports page. If you need -to report a bug when you don't have access to a browser, you may also -send a bug report by email to expat-bugs@mail.libexpat.org. - -Discussion related to the direction of future expat development takes -place on expat-discuss@mail.libexpat.org. Archives of this list and -other Expat-related lists may be found at: - - http://mail.libexpat.org/mailman/listinfo/ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/aclocal.m4 b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/aclocal.m4 deleted file mode 100644 index 6fe5ffd2..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/aclocal.m4 +++ /dev/null @@ -1,8460 +0,0 @@ -# generated automatically by aclocal 1.11.1 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009 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. - -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -# Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -m4_define([_LT_COPYING], [dnl -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -# Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -]) - -# serial 57 LT_INIT - - -# LT_PREREQ(VERSION) -# ------------------ -# Complain and exit if this libtool version is less that VERSION. -m4_defun([LT_PREREQ], -[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, - [m4_default([$3], - [m4_fatal([Libtool version $1 or higher is required], - 63)])], - [$2])]) - - -# _LT_CHECK_BUILDDIR -# ------------------ -# Complain if the absolute build directory name contains unusual characters -m4_defun([_LT_CHECK_BUILDDIR], -[case `pwd` in - *\ * | *\ *) - AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; -esac -]) - - -# LT_INIT([OPTIONS]) -# ------------------ -AC_DEFUN([LT_INIT], -[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT -AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -AC_BEFORE([$0], [LT_LANG])dnl -AC_BEFORE([$0], [LT_OUTPUT])dnl -AC_BEFORE([$0], [LTDL_INIT])dnl -m4_require([_LT_CHECK_BUILDDIR])dnl - -dnl Autoconf doesn't catch unexpanded LT_ macros by default: -m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl -m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl -dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 -dnl unless we require an AC_DEFUNed macro: -AC_REQUIRE([LTOPTIONS_VERSION])dnl -AC_REQUIRE([LTSUGAR_VERSION])dnl -AC_REQUIRE([LTVERSION_VERSION])dnl -AC_REQUIRE([LTOBSOLETE_VERSION])dnl -m4_require([_LT_PROG_LTMAIN])dnl - -_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) - -dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -_LT_SETUP - -# Only expand once: -m4_define([LT_INIT]) -])# LT_INIT - -# Old names: -AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) -AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PROG_LIBTOOL], []) -dnl AC_DEFUN([AM_PROG_LIBTOOL], []) - - -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -m4_defun([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -]) - - -# _LT_FILEUTILS_DEFAULTS -# ---------------------- -# It is okay to use these file commands and assume they have been set -# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. -m4_defun([_LT_FILEUTILS_DEFAULTS], -[: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} -])# _LT_FILEUTILS_DEFAULTS - - -# _LT_SETUP -# --------- -m4_defun([_LT_SETUP], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl - -_LT_DECL([], [host_alias], [0], [The host system])dnl -_LT_DECL([], [host], [0])dnl -_LT_DECL([], [host_os], [0])dnl -dnl -_LT_DECL([], [build_alias], [0], [The build system])dnl -_LT_DECL([], [build], [0])dnl -_LT_DECL([], [build_os], [0])dnl -dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -test -z "$LN_S" && LN_S="ln -s" -_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl -dnl -AC_REQUIRE([LT_CMD_MAX_LEN])dnl -_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl -_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl -dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl -m4_require([_LT_CMD_RELOAD])dnl -m4_require([_LT_CHECK_MAGIC_METHOD])dnl -m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl -m4_require([_LT_CMD_OLD_ARCHIVE])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_WITH_SYSROOT])dnl - -_LT_CONFIG_LIBTOOL_INIT([ -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi -]) -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -_LT_CHECK_OBJDIR - -m4_require([_LT_TAG_COMPILER])dnl - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -_LT_CC_BASENAME([$compiler]) - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - _LT_PATH_MAGIC - fi - ;; -esac - -# Use C for the default configuration in the libtool script -LT_SUPPORTED_TAG([CC]) -_LT_LANG_C_CONFIG -_LT_LANG_DEFAULT_CONFIG -_LT_CONFIG_COMMANDS -])# _LT_SETUP - - -# _LT_PREPARE_SED_QUOTE_VARS -# -------------------------- -# Define a few sed substitution that help us do robust quoting. -m4_defun([_LT_PREPARE_SED_QUOTE_VARS], -[# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([["`\\]]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' -]) - -# _LT_PROG_LTMAIN -# --------------- -# Note that this code is called both from `configure', and `config.status' -# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, -# `config.status' has no value for ac_aux_dir unless we are using Automake, -# so we pass a copy along to make sure it has a sensible value anyway. -m4_defun([_LT_PROG_LTMAIN], -[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl -_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) -ltmain="$ac_aux_dir/ltmain.sh" -])# _LT_PROG_LTMAIN - - - -# So that we can recreate a full libtool script including additional -# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS -# in macros and then make a single call at the end using the `libtool' -# label. - - -# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) -# ---------------------------------------- -# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL_INIT], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_INIT], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_INIT]) - - -# _LT_CONFIG_LIBTOOL([COMMANDS]) -# ------------------------------ -# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) - - -# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) -# ----------------------------------------------------- -m4_defun([_LT_CONFIG_SAVE_COMMANDS], -[_LT_CONFIG_LIBTOOL([$1]) -_LT_CONFIG_LIBTOOL_INIT([$2]) -]) - - -# _LT_FORMAT_COMMENT([COMMENT]) -# ----------------------------- -# Add leading comment marks to the start of each line, and a trailing -# full-stop to the whole comment if one is not present already. -m4_define([_LT_FORMAT_COMMENT], -[m4_ifval([$1], [ -m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], - [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) -)]) - - - - - -# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) -# ------------------------------------------------------------------- -# CONFIGNAME is the name given to the value in the libtool script. -# VARNAME is the (base) name used in the configure script. -# VALUE may be 0, 1 or 2 for a computed quote escaped value based on -# VARNAME. Any other value will be used directly. -m4_define([_LT_DECL], -[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], - [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], - [m4_ifval([$1], [$1], [$2])]) - lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) - m4_ifval([$4], - [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) - lt_dict_add_subkey([lt_decl_dict], [$2], - [tagged?], [m4_ifval([$5], [yes], [no])])]) -]) - - -# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) -# -------------------------------------------------------- -m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) - - -# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_tag_varnames], -[_lt_decl_filter([tagged?], [yes], $@)]) - - -# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) -# --------------------------------------------------------- -m4_define([_lt_decl_filter], -[m4_case([$#], - [0], [m4_fatal([$0: too few arguments: $#])], - [1], [m4_fatal([$0: too few arguments: $#: $1])], - [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], - [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], - [lt_dict_filter([lt_decl_dict], $@)])[]dnl -]) - - -# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) -# -------------------------------------------------- -m4_define([lt_decl_quote_varnames], -[_lt_decl_filter([value], [1], $@)]) - - -# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_dquote_varnames], -[_lt_decl_filter([value], [2], $@)]) - - -# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_varnames_tagged], -[m4_assert([$# <= 2])dnl -_$0(m4_quote(m4_default([$1], [[, ]])), - m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), - m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) -m4_define([_lt_decl_varnames_tagged], -[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) - - -# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_all_varnames], -[_$0(m4_quote(m4_default([$1], [[, ]])), - m4_if([$2], [], - m4_quote(lt_decl_varnames), - m4_quote(m4_shift($@))))[]dnl -]) -m4_define([_lt_decl_all_varnames], -[lt_join($@, lt_decl_varnames_tagged([$1], - lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl -]) - - -# _LT_CONFIG_STATUS_DECLARE([VARNAME]) -# ------------------------------------ -# Quote a variable value, and forward it to `config.status' so that its -# declaration there will have the same value as in `configure'. VARNAME -# must have a single quote delimited value for this to work. -m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) - - -# _LT_CONFIG_STATUS_DECLARATIONS -# ------------------------------ -# We delimit libtool config variables with single quotes, so when -# we write them to config.status, we have to be sure to quote all -# embedded single quotes properly. In configure, this macro expands -# each variable declared with _LT_DECL (and _LT_TAGDECL) into: -# -# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' -m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], -[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), - [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAGS -# ---------------- -# Output comment and list of tags supported by the script -m4_defun([_LT_LIBTOOL_TAGS], -[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl -available_tags="_LT_TAGS"dnl -]) - - -# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) -# ----------------------------------- -# Extract the dictionary values for VARNAME (optionally with TAG) and -# expand to a commented shell variable setting: -# -# # Some comment about what VAR is for. -# visible_name=$lt_internal_name -m4_define([_LT_LIBTOOL_DECLARE], -[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], - [description])))[]dnl -m4_pushdef([_libtool_name], - m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl -m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), - [0], [_libtool_name=[$]$1], - [1], [_libtool_name=$lt_[]$1], - [2], [_libtool_name=$lt_[]$1], - [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl -m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl -]) - - -# _LT_LIBTOOL_CONFIG_VARS -# ----------------------- -# Produce commented declarations of non-tagged libtool config variables -# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' -# script. Tagged libtool config variables (even for the LIBTOOL CONFIG -# section) are produced by _LT_LIBTOOL_TAG_VARS. -m4_defun([_LT_LIBTOOL_CONFIG_VARS], -[m4_foreach([_lt_var], - m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAG_VARS(TAG) -# ------------------------- -m4_define([_LT_LIBTOOL_TAG_VARS], -[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) - - -# _LT_TAGVAR(VARNAME, [TAGNAME]) -# ------------------------------ -m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) - - -# _LT_CONFIG_COMMANDS -# ------------------- -# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of -# variables for single and double quote escaping we saved from calls -# to _LT_DECL, we can put quote escaped variables declarations -# into `config.status', and then the shell code to quote escape them in -# for loops in `config.status'. Finally, any additional code accumulated -# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. -m4_defun([_LT_CONFIG_COMMANDS], -[AC_PROVIDE_IFELSE([LT_OUTPUT], - dnl If the libtool generation code has been placed in $CONFIG_LT, - dnl instead of duplicating it all over again into config.status, - dnl then we will have config.status run $CONFIG_LT later, so it - dnl needs to know what name is stored there: - [AC_CONFIG_COMMANDS([libtool], - [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], - dnl If the libtool generation code is destined for config.status, - dnl expand the accumulated commands and init code now: - [AC_CONFIG_COMMANDS([libtool], - [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) -])#_LT_CONFIG_COMMANDS - - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], -[ - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -_LT_CONFIG_STATUS_DECLARATIONS -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$[]1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -_LT_OUTPUT_LIBTOOL_INIT -]) - -# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) -# ------------------------------------ -# Generate a child script FILE with all initialization necessary to -# reuse the environment learned by the parent script, and make the -# file executable. If COMMENT is supplied, it is inserted after the -# `#!' sequence but before initialization text begins. After this -# macro, additional text can be appended to FILE to form the body of -# the child script. The macro ends with non-zero status if the -# file could not be fully written (such as if the disk is full). -m4_ifdef([AS_INIT_GENERATED], -[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], -[m4_defun([_LT_GENERATED_FILE_INIT], -[m4_require([AS_PREPARE])]dnl -[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl -[lt_write_fail=0 -cat >$1 <<_ASEOF || lt_write_fail=1 -#! $SHELL -# Generated by $as_me. -$2 -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$1 <<\_ASEOF || lt_write_fail=1 -AS_SHELL_SANITIZE -_AS_PREPARE -exec AS_MESSAGE_FD>&1 -_ASEOF -test $lt_write_fail = 0 && chmod +x $1[]dnl -m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT - -# LT_OUTPUT -# --------- -# This macro allows early generation of the libtool script (before -# AC_OUTPUT is called), incase it is used in configure for compilation -# tests. -AC_DEFUN([LT_OUTPUT], -[: ${CONFIG_LT=./config.lt} -AC_MSG_NOTICE([creating $CONFIG_LT]) -_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], -[# Run this file to recreate a libtool stub with the current configuration.]) - -cat >>"$CONFIG_LT" <<\_LTEOF -lt_cl_silent=false -exec AS_MESSAGE_LOG_FD>>config.log -{ - echo - AS_BOX([Running $as_me.]) -} >&AS_MESSAGE_LOG_FD - -lt_cl_help="\ -\`$as_me' creates a local libtool stub from the current configuration, -for use in further configure time tests before the real libtool is -generated. - -Usage: $[0] [[OPTIONS]] - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - -Report bugs to ." - -lt_cl_version="\ -m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl -m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) -configured by $[0], generated by m4_PACKAGE_STRING. - -Copyright (C) 2010 Free Software Foundation, Inc. -This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." - -while test $[#] != 0 -do - case $[1] in - --version | --v* | -V ) - echo "$lt_cl_version"; exit 0 ;; - --help | --h* | -h ) - echo "$lt_cl_help"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --quiet | --q* | --silent | --s* | -q ) - lt_cl_silent=: ;; - - -*) AC_MSG_ERROR([unrecognized option: $[1] -Try \`$[0] --help' for more information.]) ;; - - *) AC_MSG_ERROR([unrecognized argument: $[1] -Try \`$[0] --help' for more information.]) ;; - esac - shift -done - -if $lt_cl_silent; then - exec AS_MESSAGE_FD>/dev/null -fi -_LTEOF - -cat >>"$CONFIG_LT" <<_LTEOF -_LT_OUTPUT_LIBTOOL_COMMANDS_INIT -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AC_MSG_NOTICE([creating $ofile]) -_LT_OUTPUT_LIBTOOL_COMMANDS -AS_EXIT(0) -_LTEOF -chmod +x "$CONFIG_LT" - -# configure is writing to config.log, but config.lt does its own redirection, -# appending to config.log, which fails on DOS, as config.log is still kept -# open by configure. Here we exec the FD to /dev/null, effectively closing -# config.log, so it can be properly (re)opened and appended to by config.lt. -lt_cl_success=: -test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" -exec AS_MESSAGE_LOG_FD>/dev/null -$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false -exec AS_MESSAGE_LOG_FD>>config.log -$lt_cl_success || AS_EXIT(1) -])# LT_OUTPUT - - -# _LT_CONFIG(TAG) -# --------------- -# If TAG is the built-in tag, create an initial libtool script with a -# default configuration from the untagged config vars. Otherwise add code -# to config.status for appending the configuration named by TAG from the -# matching tagged config vars. -m4_defun([_LT_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_CONFIG_SAVE_COMMANDS([ - m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl - m4_if(_LT_TAG, [C], [ - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -_LT_COPYING -_LT_LIBTOOL_TAGS - -# ### BEGIN LIBTOOL CONFIG -_LT_LIBTOOL_CONFIG_VARS -_LT_LIBTOOL_TAG_VARS -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - _LT_PROG_LTMAIN - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - _LT_PROG_REPLACE_SHELLFNS - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -], -[cat <<_LT_EOF >> "$ofile" - -dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded -dnl in a comment (ie after a #). -# ### BEGIN LIBTOOL TAG CONFIG: $1 -_LT_LIBTOOL_TAG_VARS(_LT_TAG) -# ### END LIBTOOL TAG CONFIG: $1 -_LT_EOF -])dnl /m4_if -], -[m4_if([$1], [], [ - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile'], []) -])dnl /_LT_CONFIG_SAVE_COMMANDS -])# _LT_CONFIG - - -# LT_SUPPORTED_TAG(TAG) -# --------------------- -# Trace this macro to discover what tags are supported by the libtool -# --tag option, using: -# autoconf --trace 'LT_SUPPORTED_TAG:$1' -AC_DEFUN([LT_SUPPORTED_TAG], []) - - -# C support is built-in for now -m4_define([_LT_LANG_C_enabled], []) -m4_define([_LT_TAGS], []) - - -# LT_LANG(LANG) -# ------------- -# Enable libtool support for the given language if not already enabled. -AC_DEFUN([LT_LANG], -[AC_BEFORE([$0], [LT_OUTPUT])dnl -m4_case([$1], - [C], [_LT_LANG(C)], - [C++], [_LT_LANG(CXX)], - [Java], [_LT_LANG(GCJ)], - [Fortran 77], [_LT_LANG(F77)], - [Fortran], [_LT_LANG(FC)], - [Windows Resource], [_LT_LANG(RC)], - [m4_ifdef([_LT_LANG_]$1[_CONFIG], - [_LT_LANG($1)], - [m4_fatal([$0: unsupported language: "$1"])])])dnl -])# LT_LANG - - -# _LT_LANG(LANGNAME) -# ------------------ -m4_defun([_LT_LANG], -[m4_ifdef([_LT_LANG_]$1[_enabled], [], - [LT_SUPPORTED_TAG([$1])dnl - m4_append([_LT_TAGS], [$1 ])dnl - m4_define([_LT_LANG_]$1[_enabled], [])dnl - _LT_LANG_$1_CONFIG($1)])dnl -])# _LT_LANG - - -# _LT_LANG_DEFAULT_CONFIG -# ----------------------- -m4_defun([_LT_LANG_DEFAULT_CONFIG], -[AC_PROVIDE_IFELSE([AC_PROG_CXX], - [LT_LANG(CXX)], - [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) - -AC_PROVIDE_IFELSE([AC_PROG_F77], - [LT_LANG(F77)], - [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) - -AC_PROVIDE_IFELSE([AC_PROG_FC], - [LT_LANG(FC)], - [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) - -dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal -dnl pulling things in needlessly. -AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([LT_PROG_GCJ], - [LT_LANG(GCJ)], - [m4_ifdef([AC_PROG_GCJ], - [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([A][M_PROG_GCJ], - [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([LT_PROG_GCJ], - [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) - -AC_PROVIDE_IFELSE([LT_PROG_RC], - [LT_LANG(RC)], - [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) -])# _LT_LANG_DEFAULT_CONFIG - -# Obsolete macros: -AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) -AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) -AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) -AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) -AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_CXX], []) -dnl AC_DEFUN([AC_LIBTOOL_F77], []) -dnl AC_DEFUN([AC_LIBTOOL_FC], []) -dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) -dnl AC_DEFUN([AC_LIBTOOL_RC], []) - - -# _LT_TAG_COMPILER -# ---------------- -m4_defun([_LT_TAG_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl -_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl -_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_TAG_COMPILER - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -m4_defun([_LT_COMPILER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -m4_defun([_LT_LINKER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* -])# _LT_LINKER_BOILERPLATE - -# _LT_REQUIRED_DARWIN_CHECKS -# ------------------------- -m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ - case $host_os in - rhapsody* | darwin*) - AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) - AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) - AC_CHECK_TOOL([LIPO], [lipo], [:]) - AC_CHECK_TOOL([OTOOL], [otool], [:]) - AC_CHECK_TOOL([OTOOL64], [otool64], [:]) - _LT_DECL([], [DSYMUTIL], [1], - [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) - _LT_DECL([], [NMEDIT], [1], - [Tool to change global to local symbols on Mac OS X]) - _LT_DECL([], [LIPO], [1], - [Tool to manipulate fat objects and archives on Mac OS X]) - _LT_DECL([], [OTOOL], [1], - [ldd/readelf like tool for Mach-O binaries on Mac OS X]) - _LT_DECL([], [OTOOL64], [1], - [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) - - AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], - [lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi]) - AC_CACHE_CHECK([for -exported_symbols_list linker flag], - [lt_cv_ld_exported_symbols_list], - [lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [lt_cv_ld_exported_symbols_list=yes], - [lt_cv_ld_exported_symbols_list=no]) - LDFLAGS="$save_LDFLAGS" - ]) - AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], - [lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD - echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD - $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - ]) - case $host_os in - rhapsody* | darwin1.[[012]]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[[012]]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac -]) - - -# _LT_DARWIN_LINKER_FEATURES -# -------------------------- -# Checks for linker and compiler features on darwin -m4_defun([_LT_DARWIN_LINKER_FEATURES], -[ - m4_require([_LT_REQUIRED_DARWIN_CHECKS]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_automatic, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='' - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - m4_if([$1], [CXX], -[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then - _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" - fi -],[]) - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi -]) - -# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) -# ---------------------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -# Store the results from the different compilers for each TAGNAME. -# Allow to override them for all tags through lt_cv_aix_libpath. -m4_defun([_LT_SYS_MODULE_PATH_AIX], -[m4_require([_LT_DECL_SED])dnl -if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], - [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ - lt_aix_libpath_sed='[ - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }]' - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi],[]) - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" - fi - ]) - aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) -fi -])# _LT_SYS_MODULE_PATH_AIX - - -# _LT_SHELL_INIT(ARG) -# ------------------- -m4_define([_LT_SHELL_INIT], -[m4_divert_text([M4SH-INIT], [$1 -])])# _LT_SHELL_INIT - - - -# _LT_PROG_ECHO_BACKSLASH -# ----------------------- -# Find how we can fake an echo command that does not interpret backslash. -# In particular, with Autoconf 2.60 or later we add some code to the start -# of the generated configure script which will find a shell with a builtin -# printf (which we can use as an echo command). -m4_defun([_LT_PROG_ECHO_BACKSLASH], -[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -AC_MSG_CHECKING([how to print strings]) -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$[]1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -case "$ECHO" in - printf*) AC_MSG_RESULT([printf]) ;; - print*) AC_MSG_RESULT([print -r]) ;; - *) AC_MSG_RESULT([cat]) ;; -esac - -m4_ifdef([_AS_DETECT_SUGGESTED], -[_AS_DETECT_SUGGESTED([ - test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test "X`printf %s $ECHO`" = "X$ECHO" \ - || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) - -_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) -])# _LT_PROG_ECHO_BACKSLASH - - -# _LT_WITH_SYSROOT -# ---------------- -AC_DEFUN([_LT_WITH_SYSROOT], -[AC_MSG_CHECKING([for sysroot]) -AC_ARG_WITH([sysroot], -[ --with-sysroot[=DIR] Search for dependent libraries within DIR - (or the compiler's sysroot if not specified).], -[], [with_sysroot=no]) - -dnl lt_sysroot will always be passed unquoted. We quote it here -dnl in case the user passed a directory name. -lt_sysroot= -case ${with_sysroot} in #( - yes) - if test "$GCC" = yes; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - AC_MSG_RESULT([${with_sysroot}]) - AC_MSG_ERROR([The sysroot must be an absolute path.]) - ;; -esac - - AC_MSG_RESULT([${lt_sysroot:-no}]) -_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl -[dependent libraries, and in which our libraries should be installed.])]) - -# _LT_ENABLE_LOCK -# --------------- -m4_defun([_LT_ENABLE_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AS_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" -])# _LT_ENABLE_LOCK - - -# _LT_PROG_AR -# ----------- -m4_defun([_LT_PROG_AR], -[AC_CHECK_TOOLS(AR, [ar], false) -: ${AR=ar} -: ${AR_FLAGS=cru} -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) - -AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], - [lt_cv_ar_at_file=no - AC_COMPILE_IFELSE([AC_LANG_PROGRAM], - [echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -eq 0; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -ne 0; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - ]) - ]) - -if test "x$lt_cv_ar_at_file" = xno; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi -_LT_DECL([], [archiver_list_spec], [1], - [How to feed a file listing to the archiver]) -])# _LT_PROG_AR - - -# _LT_CMD_OLD_ARCHIVE -# ------------------- -m4_defun([_LT_CMD_OLD_ARCHIVE], -[_LT_PROG_AR - -AC_CHECK_TOOL(STRIP, strip, :) -test -z "$STRIP" && STRIP=: -_LT_DECL([], [STRIP], [1], [A symbol stripping program]) - -AC_CHECK_TOOL(RANLIB, ranlib, :) -test -z "$RANLIB" && RANLIB=: -_LT_DECL([], [RANLIB], [1], - [Commands used to install an old-style archive]) - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac -_LT_DECL([], [old_postinstall_cmds], [2]) -_LT_DECL([], [old_postuninstall_cmds], [2]) -_LT_TAGDECL([], [old_archive_cmds], [2], - [Commands used to build an old-style archive]) -_LT_DECL([], [lock_old_archive_extraction], [0], - [Whether to use a lock for old archive extraction]) -])# _LT_CMD_OLD_ARCHIVE - - -# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([_LT_COMPILER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - fi - $RM conftest* -]) - -if test x"[$]$2" = xyes; then - m4_if([$5], , :, [$5]) -else - m4_if([$6], , :, [$6]) -fi -])# _LT_COMPILER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) - - -# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------- -# Check whether the given linker option works -AC_DEFUN([_LT_LINKER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - else - $2=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - m4_if([$4], , :, [$4]) -else - m4_if([$5], , :, [$5]) -fi -])# _LT_LINKER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) - - -# LT_CMD_MAX_LEN -#--------------- -AC_DEFUN([LT_CMD_MAX_LEN], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -max_cmd_len=$lt_cv_sys_max_cmd_len -_LT_DECL([], [max_cmd_len], [0], - [What is the maximum length of a command?]) -])# LT_CMD_MAX_LEN - -# Old name: -AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) - - -# _LT_HEADER_DLFCN -# ---------------- -m4_defun([_LT_HEADER_DLFCN], -[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl -])# _LT_HEADER_DLFCN - - -# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ---------------------------------------------------------------- -m4_defun([_LT_TRY_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -[#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -}] -_LT_EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_dlunknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_TRY_DLOPEN_SELF - - -# LT_SYS_DLOPEN_SELF -# ------------------ -AC_DEFUN([LT_SYS_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -_LT_DECL([dlopen_support], [enable_dlopen], [0], - [Whether dlopen is supported]) -_LT_DECL([dlopen_self], [enable_dlopen_self], [0], - [Whether dlopen of programs is supported]) -_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], - [Whether dlopen of statically linked programs is supported]) -])# LT_SYS_DLOPEN_SELF - -# Old name: -AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) - - -# _LT_COMPILER_C_O([TAGNAME]) -# --------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler. -# This macro does not hard code the compiler like AC_PROG_CC_C_O. -m4_defun([_LT_COMPILER_C_O], -[m4_require([_LT_DECL_SED])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . 2>&AS_MESSAGE_LOG_FD - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* -]) -_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], - [Does compiler simultaneously support -c and -o options?]) -])# _LT_COMPILER_C_O - - -# _LT_COMPILER_FILE_LOCKS([TAGNAME]) -# ---------------------------------- -# Check to see if we can do hard links to lock some files if needed -m4_defun([_LT_COMPILER_FILE_LOCKS], -[m4_require([_LT_ENABLE_LOCK])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_COMPILER_C_O([$1]) - -hard_links="nottested" -if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) -])# _LT_COMPILER_FILE_LOCKS - - -# _LT_CHECK_OBJDIR -# ---------------- -m4_defun([_LT_CHECK_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -_LT_DECL([], [objdir], [0], - [The name of the directory that contains temporary libtool files])dnl -m4_pattern_allow([LT_OBJDIR])dnl -AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", - [Define to the sub-directory in which libtool stores uninstalled libraries.]) -])# _LT_CHECK_OBJDIR - - -# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) -# -------------------------------------- -# Check hardcoding attributes. -m4_defun([_LT_LINKER_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || - test -n "$_LT_TAGVAR(runpath_var, $1)" || - test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || - test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -_LT_TAGDECL([], [hardcode_action], [0], - [How to hardcode a shared library path into an executable]) -])# _LT_LINKER_HARDCODE_LIBPATH - - -# _LT_CMD_STRIPLIB -# ---------------- -m4_defun([_LT_CMD_STRIPLIB], -[m4_require([_LT_DECL_EGREP]) -striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) -_LT_DECL([], [striplib], [1]) -])# _LT_CMD_STRIPLIB - - -# _LT_SYS_DYNAMIC_LINKER([TAG]) -# ----------------------------- -# PORTME Fill in your ld.so characteristics -m4_defun([_LT_SYS_DYNAMIC_LINKER], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_OBJDUMP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -AC_MSG_CHECKING([dynamic linker characteristics]) -m4_if([$1], - [], [ -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[[lt_foo]]++; } - if (lt_freq[[lt_foo]] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[[4-9]]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[[45]]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[[123]]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[[01]]* | freebsdelf3.[[01]]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ - freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -haiku*) - version_type=linux - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[[3-9]]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], - [lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [lt_cv_shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - ]) - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - -_LT_DECL([], [variables_saved_for_relink], [1], - [Variables whose values should be saved in libtool wrapper scripts and - restored at link time]) -_LT_DECL([], [need_lib_prefix], [0], - [Do we need the "lib" prefix for modules?]) -_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) -_LT_DECL([], [version_type], [0], [Library versioning type]) -_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) -_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) -_LT_DECL([], [shlibpath_overrides_runpath], [0], - [Is shlibpath searched before the hard-coded library search path?]) -_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) -_LT_DECL([], [library_names_spec], [1], - [[List of archive names. First name is the real one, the rest are links. - The last name is the one that the linker finds with -lNAME]]) -_LT_DECL([], [soname_spec], [1], - [[The coded name of the library, if different from the real name]]) -_LT_DECL([], [install_override_mode], [1], - [Permission mode override for installation of shared libraries]) -_LT_DECL([], [postinstall_cmds], [2], - [Command to use after installation of a shared archive]) -_LT_DECL([], [postuninstall_cmds], [2], - [Command to use after uninstallation of a shared archive]) -_LT_DECL([], [finish_cmds], [2], - [Commands used to finish a libtool library installation in a directory]) -_LT_DECL([], [finish_eval], [1], - [[As "finish_cmds", except a single script fragment to be evaled but - not shown]]) -_LT_DECL([], [hardcode_into_libs], [0], - [Whether we should hardcode library paths into libraries]) -_LT_DECL([], [sys_lib_search_path_spec], [2], - [Compile-time system search path for libraries]) -_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], - [Run-time system search path for libraries]) -])# _LT_SYS_DYNAMIC_LINKER - - -# _LT_PATH_TOOL_PREFIX(TOOL) -# -------------------------- -# find a file program which can recognize shared library -AC_DEFUN([_LT_PATH_TOOL_PREFIX], -[m4_require([_LT_DECL_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="m4_if([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -_LT_DECL([], [MAGIC_CMD], [0], - [Used to examine libraries when file_magic_cmd begins with "file"])dnl -])# _LT_PATH_TOOL_PREFIX - -# Old name: -AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) - - -# _LT_PATH_MAGIC -# -------------- -# find a file program which can recognize a shared library -m4_defun([_LT_PATH_MAGIC], -[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# _LT_PATH_MAGIC - - -# LT_PATH_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([LT_PATH_LD], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PROG_ECHO_BACKSLASH])dnl - -AC_ARG_WITH([gnu-ld], - [AS_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no])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 - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[[3-9]]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` - fi - ;; - esac -fi - -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -_LT_DECL([], [deplibs_check_method], [1], - [Method to check whether dependent libraries are shared objects]) -_LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method = "file_magic"]) -_LT_DECL([], [file_magic_glob], [1], - [How to find potential files when deplibs_check_method = "file_magic"]) -_LT_DECL([], [want_nocaseglob], [1], - [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) -])# _LT_CHECK_MAGIC_METHOD - - -# LT_PATH_NM -# ---------- -# find the pathname to a BSD- or MS-compatible name lister -AC_DEFUN([LT_PATH_NM], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi]) -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - AC_SUBST([DUMPBIN]) - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm -AC_SUBST([NM]) -_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl - -AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], - [lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) - cat conftest.out >&AS_MESSAGE_LOG_FD - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest*]) -])# LT_PATH_NM - -# Old names: -AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) -AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_PROG_NM], []) -dnl AC_DEFUN([AC_PROG_NM], []) - -# _LT_CHECK_SHAREDLIB_FROM_LINKLIB -# -------------------------------- -# how to determine the name of the shared library -# associated with a specific link library. -# -- PORTME fill in with the dynamic library characteristics -m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], -[m4_require([_LT_DECL_EGREP]) -m4_require([_LT_DECL_OBJDUMP]) -m4_require([_LT_DECL_DLLTOOL]) -AC_CACHE_CHECK([how to associate runtime and link libraries], -lt_cv_sharedlib_from_linklib_cmd, -[lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" - ;; -esac -]) -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - -_LT_DECL([], [sharedlib_from_linklib_cmd], [1], - [Command to associate shared and link libraries]) -])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB - - -# _LT_PATH_MANIFEST_TOOL -# ---------------------- -# locate the manifest tool -m4_defun([_LT_PATH_MANIFEST_TOOL], -[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], - [lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&AS_MESSAGE_LOG_FD - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest*]) -if test "x$lt_cv_path_mainfest_tool" != xyes; then - MANIFEST_TOOL=: -fi -_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl -])# _LT_PATH_MANIFEST_TOOL - - -# LT_LIB_M -# -------- -# check for math library -AC_DEFUN([LT_LIB_M], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -AC_SUBST([LIBM]) -])# LT_LIB_M - -# Old name: -AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_CHECK_LIBM], []) - - -# _LT_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------- -m4_defun([_LT_COMPILER_NO_RTTI], -[m4_require([_LT_TAG_COMPILER])dnl - -_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; - *) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; - esac - - _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], - [Compiler flag to turn off builtin functions]) -])# _LT_COMPILER_NO_RTTI - - -# _LT_CMD_GLOBAL_SYMBOLS -# ---------------------- -m4_defun([_LT_CMD_GLOBAL_SYMBOLS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([LT_PATH_NM])dnl -AC_REQUIRE([LT_PATH_LD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_TAG_COMPILER])dnl - -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris*) - symcode='[[BDRT]]' - ;; -sco3.2v5*) - symcode='[[DT]]' - ;; -sysv4.2uw2*) - symcode='[[DT]]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[[ABDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK ['"\ -" {last_section=section; section=\$ 3};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx]" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT@&t@_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT@&t@_DLSYM_CONST -#else -# define LT@&t@_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -LT@&t@_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[[]] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi - -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - -_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], - [Take the output of nm and produce a listing of raw symbols and C names]) -_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], - [Transform the output of nm in a proper C declaration]) -_LT_DECL([global_symbol_to_c_name_address], - [lt_cv_sys_global_symbol_to_c_name_address], [1], - [Transform the output of nm in a C name address pair]) -_LT_DECL([global_symbol_to_c_name_address_lib_prefix], - [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], - [Transform the output of nm in a C name address pair when lib prefix is needed]) -_LT_DECL([], [nm_file_list_spec], [1], - [Specify filename containing input files for $NM]) -]) # _LT_CMD_GLOBAL_SYMBOLS - - -# _LT_COMPILER_PIC([TAGNAME]) -# --------------------------- -m4_defun([_LT_COMPILER_PIC], -[m4_require([_LT_TAG_COMPILER])dnl -_LT_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_TAGVAR(lt_prog_compiler_static, $1)= - -m4_if([$1], [CXX], [ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix[[4-9]]*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - dgux*) - case $cc_basename in - ec++*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - KCC*) - # KAI C++ Compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - ecpc* ) - # old Intel C++ for x86_64 which still supported -KPIC. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - icpc* ) - # Intel C++, used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) - # IBM XL 8.0, 9.0 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd* | netbsdelf*-gnu) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx*) - # Digital/Compaq C++ - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc*) - # Lucid - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - hpux9* | hpux10* | hpux11*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' - _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' - ;; - nagfor*) - # NAG Fortran compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - ccc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ F* | *Sun*Fortran*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' - ;; - *Sun\ C*) - # Sun C 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - esac - ;; - - newsos6) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - rdos*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - solaris*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac - ;; - - sunos4*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - unicos*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" - ;; -esac - -AC_CACHE_CHECK([for $compiler option to produce PIC], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], - [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], - [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], - [Additional compiler flags for building library objects]) - -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) -# -# Check to make sure the static flag actually works. -# -wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" -_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], - _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), - $lt_tmp_static_flag, - [], - [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) -_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], - [Compiler flag to prevent dynamic linking]) -])# _LT_COMPILER_PIC - - -# _LT_LINKER_SHLIBS([TAGNAME]) -# ---------------------------- -# See if the linker supports building shared libraries. -m4_defun([_LT_LINKER_SHLIBS], -[AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -m4_if([$1], [CXX], [ - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - case $host_os in - aix[[4-9]]*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global defined - # symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw* | cegcc*) - case $cc_basename in - cl*) ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] - ;; - esac - ;; - linux* | k*bsd*-gnu | gnu*) - _LT_TAGVAR(link_all_deplibs, $1)=no - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -], [ - runpath_var= - _LT_TAGVAR(allow_undefined_flag, $1)= - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(archive_cmds, $1)= - _LT_TAGVAR(archive_expsym_cmds, $1)= - _LT_TAGVAR(compiler_needs_object, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(hardcode_automatic, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_TAGVAR(hardcode_libdir_separator, $1)= - _LT_TAGVAR(hardcode_minus_L, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(inherit_rpath, $1)=no - _LT_TAGVAR(link_all_deplibs, $1)=unknown - _LT_TAGVAR(module_cmds, $1)= - _LT_TAGVAR(module_expsym_cmds, $1)= - _LT_TAGVAR(old_archive_from_new_cmds, $1)= - _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_TAGVAR(thread_safe_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. -dnl Note also adjust exclude_expsyms for C++ above. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - linux* | k*bsd*-gnu | gnu*) - _LT_TAGVAR(link_all_deplibs, $1)=no - ;; - esac - - _LT_TAGVAR(ld_shlibs, $1)=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; - *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[[3-9]]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - _LT_TAGVAR(whole_archive_flag_spec, $1)= - tmp_sharedflag='--shared' ;; - xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - sunos4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - _LT_TAGVAR(link_all_deplibs, $1)=no - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - bsdi[[45]]*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - esac - ;; - - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - m4_if($1, [], [ - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - _LT_LINKER_OPTION([if $CC understands -b], - _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], - [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) - ;; - esac - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], - [lt_cv_irix_exported_symbol], - [save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE( - [AC_LANG_SOURCE( - [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], - [C++], [[int foo (void) { return 0; }]], - [Fortran 77], [[ - subroutine foo - end]], - [Fortran], [[ - subroutine foo - end]])])], - [lt_cv_irix_exported_symbol=yes], - [lt_cv_irix_exported_symbol=no]) - LDFLAGS="$save_LDFLAGS"]) - if test "$lt_cv_irix_exported_symbol" = yes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - fi - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - solaris*) - _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - fi - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' - ;; - esac - fi - fi -]) -AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) -test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld - -_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl -_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl -_LT_DECL([], [extract_expsyms_cmds], [2], - [The commands to extract the exported symbol list from a shared archive]) - -# -# Do we need to explicitly link libc? -# -case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_CACHE_CHECK([whether -lc should be explicitly linked in], - [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), - [$RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - ]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) - ;; - esac - fi - ;; -esac - -_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], - [Whether or not to add -lc for building shared libraries]) -_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], - [enable_shared_with_static_runtimes], [0], - [Whether or not to disallow shared libs when runtime libs are static]) -_LT_TAGDECL([], [export_dynamic_flag_spec], [1], - [Compiler flag to allow reflexive dlopens]) -_LT_TAGDECL([], [whole_archive_flag_spec], [1], - [Compiler flag to generate shared objects directly from archives]) -_LT_TAGDECL([], [compiler_needs_object], [1], - [Whether the compiler copes with passing no objects directly]) -_LT_TAGDECL([], [old_archive_from_new_cmds], [2], - [Create an old-style archive from a shared archive]) -_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], - [Create a temporary old-style archive to link instead of a shared archive]) -_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) -_LT_TAGDECL([], [archive_expsym_cmds], [2]) -_LT_TAGDECL([], [module_cmds], [2], - [Commands used to build a loadable module if different from building - a shared archive.]) -_LT_TAGDECL([], [module_expsym_cmds], [2]) -_LT_TAGDECL([], [with_gnu_ld], [1], - [Whether we are building with GNU ld or not]) -_LT_TAGDECL([], [allow_undefined_flag], [1], - [Flag that allows shared libraries with undefined symbols to be built]) -_LT_TAGDECL([], [no_undefined_flag], [1], - [Flag that enforces no undefined symbols]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], - [Flag to hardcode $libdir into a binary during linking. - This must work even if $libdir does not exist]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], - [[If ld is used when linking, flag to hardcode $libdir into a binary - during linking. This must work even if $libdir does not exist]]) -_LT_TAGDECL([], [hardcode_libdir_separator], [1], - [Whether we need a single "-rpath" flag with a separated argument]) -_LT_TAGDECL([], [hardcode_direct], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary]) -_LT_TAGDECL([], [hardcode_direct_absolute], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary and the resulting library dependency is - "absolute", i.e impossible to change by setting ${shlibpath_var} if the - library is relocated]) -_LT_TAGDECL([], [hardcode_minus_L], [0], - [Set to "yes" if using the -LDIR flag during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_shlibpath_var], [0], - [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_automatic], [0], - [Set to "yes" if building a shared library automatically hardcodes DIR - into the library and all subsequent libraries and executables linked - against it]) -_LT_TAGDECL([], [inherit_rpath], [0], - [Set to yes if linker adds runtime paths of dependent libraries - to runtime path list]) -_LT_TAGDECL([], [link_all_deplibs], [0], - [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [always_export_symbols], [0], - [Set to "yes" if exported symbols are required]) -_LT_TAGDECL([], [export_symbols_cmds], [2], - [The commands to list exported symbols]) -_LT_TAGDECL([], [exclude_expsyms], [1], - [Symbols that should not be listed in the preloaded symbols]) -_LT_TAGDECL([], [include_expsyms], [1], - [Symbols that must always be exported]) -_LT_TAGDECL([], [prelink_cmds], [2], - [Commands necessary for linking programs (against libraries) with templates]) -_LT_TAGDECL([], [postlink_cmds], [2], - [Commands necessary for finishing linking programs]) -_LT_TAGDECL([], [file_list_spec], [1], - [Specify filename containing input files]) -dnl FIXME: Not yet implemented -dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], -dnl [Compiler flag to generate thread safe objects]) -])# _LT_LINKER_SHLIBS - - -# _LT_LANG_C_CONFIG([TAG]) -# ------------------------ -# Ensure that the configuration variables for a C compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_C_CONFIG], -[m4_require([_LT_DECL_EGREP])dnl -lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - -_LT_TAG_COMPILER -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - LT_SYS_DLOPEN_SELF - _LT_CMD_STRIPLIB - - # Report which library types will actually be built - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_CONFIG($1) -fi -AC_LANG_POP -CC="$lt_save_CC" -])# _LT_LANG_C_CONFIG - - -# _LT_LANG_CXX_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a C++ compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_CXX_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -else - _lt_caught_CXX_error=yes -fi - -AC_LANG_PUSH(C++) -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(compiler_needs_object, $1)=no -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_caught_CXX_error" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_CFLAGS=$CFLAGS - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - CFLAGS=$CXXFLAGS - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - else - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - fi - - if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - LT_PATH_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - GXX=no - with_gnu_ld=no - wlarc= - fi - - # PORTME: fill in a description of your system's C++ link characteristics - AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) - _LT_TAGVAR(ld_shlibs, $1)=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GXX" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32* | cegcc*) - case $GXX,$cc_basename in - ,cl* | no,cl*) - # Native MSVC - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - func_to_tool_file "$lt_outputfile"~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # g++ - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - freebsd[[12]]*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - freebsd-elf*) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - gnu*) - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - hpux9*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' - fi - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) - _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' - _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ - $RANLIB $oldlib' - _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - *) # Version 6 and above use weak symbols - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' - ;; - xl* | mpixl* | bgxl*) - # IBM XL 8.0 on PPC, with GNU ld - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - - *nto* | *qnx*) - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - openbsd2*) - # C++ shared libraries are fairly broken - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd=func_echo_all - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - case $host in - osf3*) - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - ;; - *) - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ - $RM $lib.exp' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - case $host in - osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(archive_cmds_need_lc,$1)=yes - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - fi - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ - '"$_LT_TAGVAR(old_archive_cmds, $1)" - _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ - '"$_LT_TAGVAR(reload_cmds, $1)" - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) - test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - - _LT_TAGVAR(GCC, $1)="$GXX" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test "$_lt_caught_CXX_error" != yes - -AC_LANG_POP -])# _LT_LANG_CXX_CONFIG - - -# _LT_FUNC_STRIPNAME_CNF -# ---------------------- -# func_stripname_cnf prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# -# This function is identical to the (non-XSI) version of func_stripname, -# except this one can be used by m4 code that may be executed by configure, -# rather than the libtool script. -m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl -AC_REQUIRE([_LT_DECL_SED]) -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) -func_stripname_cnf () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname_cnf -])# _LT_FUNC_STRIPNAME_CNF - -# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) -# --------------------------------- -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -m4_defun([_LT_SYS_HIDDEN_LIBDEPS], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl -# Dependencies to place before and after the object being linked: -_LT_TAGVAR(predep_objects, $1)= -_LT_TAGVAR(postdep_objects, $1)= -_LT_TAGVAR(predeps, $1)= -_LT_TAGVAR(postdeps, $1)= -_LT_TAGVAR(compiler_lib_search_path, $1)= - -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF -int a; -void foo (void) { a = 0; } -_LT_EOF -], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF -], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer*4 a - a=0 - return - end -_LT_EOF -], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer a - a=0 - return - end -_LT_EOF -], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF -public class foo { - private int a; - public void bar (void) { - a = 0; - } -}; -_LT_EOF -]) - -_lt_libdeps_save_CFLAGS=$CFLAGS -case "$CC $CFLAGS " in #( -*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; -*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; -esac - -dnl Parse the compiler output and extract the necessary -dnl objects, libraries and library flags. -if AC_TRY_EVAL(ac_compile); then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case ${prev}${p} in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" || - test $p = "-R"; then - prev=$p - continue - fi - - # Expand the sysroot to ease extracting the directories later. - if test -z "$prev"; then - case $p in - -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; - -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; - -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; - esac - fi - case $p in - =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; - esac - if test "$pre_test_object_deps_done" = no; then - case ${prev} in - -L | -R) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" - else - _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$_LT_TAGVAR(postdeps, $1)"; then - _LT_TAGVAR(postdeps, $1)="${prev}${p}" - else - _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" - fi - fi - prev= - ;; - - *.lto.$objext) ;; # Ignore GCC LTO objects - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$_LT_TAGVAR(predep_objects, $1)"; then - _LT_TAGVAR(predep_objects, $1)="$p" - else - _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" - fi - else - if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then - _LT_TAGVAR(postdep_objects, $1)="$p" - else - _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling $1 test program" -fi - -$RM -f confest.$objext -CFLAGS=$_lt_libdeps_save_CFLAGS - -# PORTME: override above test on systems where it is broken -m4_if([$1], [CXX], -[case $host_os in -interix[[3-9]]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - _LT_TAGVAR(predep_objects,$1)= - _LT_TAGVAR(postdep_objects,$1)= - _LT_TAGVAR(postdeps,$1)= - ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC* | sunCC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac -]) - -case " $_LT_TAGVAR(postdeps, $1) " in -*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; -esac - _LT_TAGVAR(compiler_lib_search_dirs, $1)= -if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then - _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` -fi -_LT_TAGDECL([], [compiler_lib_search_dirs], [1], - [The directories searched by this compiler when creating a shared library]) -_LT_TAGDECL([], [predep_objects], [1], - [Dependencies to place before and after the objects being linked to - create a shared library]) -_LT_TAGDECL([], [postdep_objects], [1]) -_LT_TAGDECL([], [predeps], [1]) -_LT_TAGDECL([], [postdeps], [1]) -_LT_TAGDECL([], [compiler_lib_search_path], [1], - [The library search path used internally by the compiler when linking - a shared library]) -])# _LT_SYS_HIDDEN_LIBDEPS - - -# _LT_LANG_F77_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a Fortran 77 compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_F77_CONFIG], -[AC_LANG_PUSH(Fortran 77) -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the F77 compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_F77" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS - CC=${F77-"f77"} - CFLAGS=$FFLAGS - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - GCC=$G77 - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$G77" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" - CFLAGS="$lt_save_CFLAGS" -fi # test "$_lt_disable_F77" != yes - -AC_LANG_POP -])# _LT_LANG_F77_CONFIG - - -# _LT_LANG_FC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for a Fortran compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_FC_CONFIG], -[AC_LANG_PUSH(Fortran) - -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for fc test sources. -ac_ext=${ac_fc_srcext-f} - -# Object file extension for compiled fc test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the FC compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_FC" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS - CC=${FC-"f95"} - CFLAGS=$FCFLAGS - compiler=$CC - GCC=$ac_cv_fc_compiler_gnu - - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS -fi # test "$_lt_disable_FC" != yes - -AC_LANG_POP -])# _LT_LANG_FC_CONFIG - - -# _LT_LANG_GCJ_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Java Compiler compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_GCJ_CONFIG], -[AC_REQUIRE([LT_PROG_GCJ])dnl -AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC=yes -CC=${GCJ-"gcj"} -CFLAGS=$GCJFLAGS -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" -_LT_CC_BASENAME([$compiler]) - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds - -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_GCJ_CONFIG - - -# _LT_LANG_RC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for the Windows resource compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_RC_CONFIG], -[AC_REQUIRE([LT_PROG_RC])dnl -AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC= -CC=${RC-"windres"} -CFLAGS= -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) -_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -if test -n "$compiler"; then - : - _LT_CONFIG($1) -fi - -GCC=$lt_save_GCC -AC_LANG_RESTORE -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_RC_CONFIG - - -# LT_PROG_GCJ -# ----------- -AC_DEFUN([LT_PROG_GCJ], -[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], - [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], - [AC_CHECK_TOOL(GCJ, gcj,) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS)])])[]dnl -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_GCJ], []) - - -# LT_PROG_RC -# ---------- -AC_DEFUN([LT_PROG_RC], -[AC_CHECK_TOOL(RC, windres,) -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_RC], []) - - -# _LT_DECL_EGREP -# -------------- -# If we don't have a new enough Autoconf to choose the best grep -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_EGREP], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_REQUIRE([AC_PROG_FGREP])dnl -test -z "$GREP" && GREP=grep -_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) -_LT_DECL([], [EGREP], [1], [An ERE matcher]) -_LT_DECL([], [FGREP], [1], [A literal string matcher]) -dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too -AC_SUBST([GREP]) -]) - - -# _LT_DECL_OBJDUMP -# -------------- -# If we don't have a new enough Autoconf to choose the best objdump -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_OBJDUMP], -[AC_CHECK_TOOL(OBJDUMP, objdump, false) -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) -AC_SUBST([OBJDUMP]) -]) - -# _LT_DECL_DLLTOOL -# ---------------- -# Ensure DLLTOOL variable is set. -m4_defun([_LT_DECL_DLLTOOL], -[AC_CHECK_TOOL(DLLTOOL, dlltool, false) -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) -AC_SUBST([DLLTOOL]) -]) - -# _LT_DECL_SED -# ------------ -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -m4_defun([_LT_DECL_SED], -[AC_PROG_SED -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" -_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) -_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], - [Sed that helps us avoid accidentally triggering echo(1) options like -n]) -])# _LT_DECL_SED - -m4_ifndef([AC_PROG_SED], [ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # - -m4_defun([AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -IFS=$as_save_IFS -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -]) -SED=$lt_cv_path_SED -AC_SUBST([SED]) -AC_MSG_RESULT([$SED]) -])#AC_PROG_SED -])#m4_ifndef - -# Old name: -AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_SED], []) - - -# _LT_CHECK_SHELL_FEATURES -# ------------------------ -# Find out whether the shell is Bourne or XSI compatible, -# or has some other useful features. -m4_defun([_LT_CHECK_SHELL_FEATURES], -[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -AC_MSG_RESULT([$xsi_shell]) -_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) - -AC_MSG_CHECKING([whether the shell understands "+="]) -lt_shell_append=no -( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -AC_MSG_RESULT([$lt_shell_append]) -_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi -_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac -_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl -_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl -])# _LT_CHECK_SHELL_FEATURES - - -# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) -# ------------------------------------------------------ -# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and -# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. -m4_defun([_LT_PROG_FUNCTION_REPLACE], -[dnl { -sed -e '/^$1 ()$/,/^} # $1 /c\ -$1 ()\ -{\ -m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) -} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: -]) - - -# _LT_PROG_REPLACE_SHELLFNS -# ------------------------- -# Replace existing portable implementations of several shell functions with -# equivalent extended shell implementations where those features are available.. -m4_defun([_LT_PROG_REPLACE_SHELLFNS], -[if test x"$xsi_shell" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac]) - - _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl - func_basename_result="${1##*/}"]) - - _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}"]) - - _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"}]) - - _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl - func_split_long_opt_name=${1%%=*} - func_split_long_opt_arg=${1#*=}]) - - _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl - func_split_short_opt_arg=${1#??} - func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) - - _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac]) - - _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) - - _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) - - _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) -fi - -if test x"$lt_shell_append" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) - - _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl - func_quote_for_eval "${2}" -dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ - eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) - - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi - -if test x"$_lt_function_replace_fail" = x":"; then - AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) -fi -]) - -# _LT_PATH_CONVERSION_FUNCTIONS -# ----------------------------- -# Determine which file name conversion functions should be used by -# func_to_host_file (and, implicitly, by func_to_host_path). These are needed -# for certain cross-compile configurations and native mingw. -m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_MSG_CHECKING([how to convert $build file names to $host format]) -AC_CACHE_VAL(lt_cv_to_host_file_cmd, -[case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac -]) -to_host_file_cmd=$lt_cv_to_host_file_cmd -AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) -_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], - [0], [convert $build file names to $host format])dnl - -AC_MSG_CHECKING([how to convert $build file names to toolchain format]) -AC_CACHE_VAL(lt_cv_to_tool_file_cmd, -[#assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac -]) -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) -_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], - [0], [convert $build files to toolchain format])dnl -])# _LT_PATH_CONVERSION_FUNCTIONS - -# Helper functions for option handling. -*- Autoconf -*- -# -# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 7 ltoptions.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) - - -# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) -# ------------------------------------------ -m4_define([_LT_MANGLE_OPTION], -[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) - - -# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) -# --------------------------------------- -# Set option OPTION-NAME for macro MACRO-NAME, and if there is a -# matching handler defined, dispatch to it. Other OPTION-NAMEs are -# saved as a flag. -m4_define([_LT_SET_OPTION], -[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl -m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), - _LT_MANGLE_DEFUN([$1], [$2]), - [m4_warning([Unknown $1 option `$2'])])[]dnl -]) - - -# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) -# ------------------------------------------------------------ -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -m4_define([_LT_IF_OPTION], -[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) - - -# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) -# ------------------------------------------------------- -# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME -# are set. -m4_define([_LT_UNLESS_OPTIONS], -[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), - [m4_define([$0_found])])])[]dnl -m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 -])[]dnl -]) - - -# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) -# ---------------------------------------- -# OPTION-LIST is a space-separated list of Libtool options associated -# with MACRO-NAME. If any OPTION has a matching handler declared with -# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about -# the unknown option and exit. -m4_defun([_LT_SET_OPTIONS], -[# Set options -m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [_LT_SET_OPTION([$1], _LT_Option)]) - -m4_if([$1],[LT_INIT],[ - dnl - dnl Simply set some default values (i.e off) if boolean options were not - dnl specified: - _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no - ]) - _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no - ]) - dnl - dnl If no reference was made to various pairs of opposing options, then - dnl we run the default mode handler for the pair. For example, if neither - dnl `shared' nor `disable-shared' was passed, we enable building of shared - dnl archives by default: - _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) - _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], - [_LT_ENABLE_FAST_INSTALL]) - ]) -])# _LT_SET_OPTIONS - - - -# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) -# ----------------------------------------- -m4_define([_LT_MANGLE_DEFUN], -[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) - - -# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) -# ----------------------------------------------- -m4_define([LT_OPTION_DEFINE], -[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl -])# LT_OPTION_DEFINE - - -# dlopen -# ------ -LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes -]) - -AU_DEFUN([AC_LIBTOOL_DLOPEN], -[_LT_SET_OPTION([LT_INIT], [dlopen]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `dlopen' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) - - -# win32-dll -# --------- -# Declare package support for building win32 dll's. -LT_OPTION_DEFINE([LT_INIT], [win32-dll], -[enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -esac - -test -z "$AS" && AS=as -_LT_DECL([], [AS], [1], [Assembler program])dnl - -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl - -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl -])# win32-dll - -AU_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -_LT_SET_OPTION([LT_INIT], [win32-dll]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `win32-dll' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) - - -# _LT_ENABLE_SHARED([DEFAULT]) -# ---------------------------- -# implement the --enable-shared flag, and supports the `shared' and -# `disable-shared' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_SHARED], -[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([shared], - [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) - - _LT_DECL([build_libtool_libs], [enable_shared], [0], - [Whether or not to build shared libraries]) -])# _LT_ENABLE_SHARED - -LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) -]) - -AC_DEFUN([AC_DISABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], [disable-shared]) -]) - -AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_SHARED], []) -dnl AC_DEFUN([AM_DISABLE_SHARED], []) - - - -# _LT_ENABLE_STATIC([DEFAULT]) -# ---------------------------- -# implement the --enable-static flag, and support the `static' and -# `disable-static' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_STATIC], -[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([static], - [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]_LT_ENABLE_STATIC_DEFAULT) - - _LT_DECL([build_old_libs], [enable_static], [0], - [Whether or not to build static libraries]) -])# _LT_ENABLE_STATIC - -LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) -]) - -AC_DEFUN([AC_DISABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], [disable-static]) -]) - -AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_STATIC], []) -dnl AC_DEFUN([AM_DISABLE_STATIC], []) - - - -# _LT_ENABLE_FAST_INSTALL([DEFAULT]) -# ---------------------------------- -# implement the --enable-fast-install flag, and support the `fast-install' -# and `disable-fast-install' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_FAST_INSTALL], -[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([fast-install], - [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) - -_LT_DECL([fast_install], [enable_fast_install], [0], - [Whether or not to optimize for fast installation])dnl -])# _LT_ENABLE_FAST_INSTALL - -LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) - -# Old names: -AU_DEFUN([AC_ENABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `fast-install' option into LT_INIT's first parameter.]) -]) - -AU_DEFUN([AC_DISABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `disable-fast-install' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) -dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) - - -# _LT_WITH_PIC([MODE]) -# -------------------- -# implement the --with-pic flag, and support the `pic-only' and `no-pic' -# LT_INIT options. -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -m4_define([_LT_WITH_PIC], -[AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) - -test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) - -_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl -])# _LT_WITH_PIC - -LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) - -# Old name: -AU_DEFUN([AC_LIBTOOL_PICMODE], -[_LT_SET_OPTION([LT_INIT], [pic-only]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `pic-only' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) - - -m4_define([_LTDL_MODE], []) -LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], - [m4_define([_LTDL_MODE], [nonrecursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [recursive], - [m4_define([_LTDL_MODE], [recursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [subproject], - [m4_define([_LTDL_MODE], [subproject])]) - -m4_define([_LTDL_TYPE], []) -LT_OPTION_DEFINE([LTDL_INIT], [installable], - [m4_define([_LTDL_TYPE], [installable])]) -LT_OPTION_DEFINE([LTDL_INIT], [convenience], - [m4_define([_LTDL_TYPE], [convenience])]) - -# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 6 ltsugar.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) - - -# lt_join(SEP, ARG1, [ARG2...]) -# ----------------------------- -# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their -# associated separator. -# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier -# versions in m4sugar had bugs. -m4_define([lt_join], -[m4_if([$#], [1], [], - [$#], [2], [[$2]], - [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) -m4_define([_lt_join], -[m4_if([$#$2], [2], [], - [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) - - -# lt_car(LIST) -# lt_cdr(LIST) -# ------------ -# Manipulate m4 lists. -# These macros are necessary as long as will still need to support -# Autoconf-2.59 which quotes differently. -m4_define([lt_car], [[$1]]) -m4_define([lt_cdr], -[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], - [$#], 1, [], - [m4_dquote(m4_shift($@))])]) -m4_define([lt_unquote], $1) - - -# lt_append(MACRO-NAME, STRING, [SEPARATOR]) -# ------------------------------------------ -# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. -# Note that neither SEPARATOR nor STRING are expanded; they are appended -# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). -# No SEPARATOR is output if MACRO-NAME was previously undefined (different -# than defined and empty). -# -# This macro is needed until we can rely on Autoconf 2.62, since earlier -# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. -m4_define([lt_append], -[m4_define([$1], - m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) - - - -# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) -# ---------------------------------------------------------- -# Produce a SEP delimited list of all paired combinations of elements of -# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list -# has the form PREFIXmINFIXSUFFIXn. -# Needed until we can rely on m4_combine added in Autoconf 2.62. -m4_define([lt_combine], -[m4_if(m4_eval([$# > 3]), [1], - [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl -[[m4_foreach([_Lt_prefix], [$2], - [m4_foreach([_Lt_suffix], - ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, - [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) - - -# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) -# ----------------------------------------------------------------------- -# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited -# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. -m4_define([lt_if_append_uniq], -[m4_ifdef([$1], - [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], - [lt_append([$1], [$2], [$3])$4], - [$5])], - [lt_append([$1], [$2], [$3])$4])]) - - -# lt_dict_add(DICT, KEY, VALUE) -# ----------------------------- -m4_define([lt_dict_add], -[m4_define([$1($2)], [$3])]) - - -# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) -# -------------------------------------------- -m4_define([lt_dict_add_subkey], -[m4_define([$1($2:$3)], [$4])]) - - -# lt_dict_fetch(DICT, KEY, [SUBKEY]) -# ---------------------------------- -m4_define([lt_dict_fetch], -[m4_ifval([$3], - m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), - m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) - - -# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) -# ----------------------------------------------------------------- -m4_define([lt_if_dict_fetch], -[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], - [$5], - [$6])]) - - -# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) -# -------------------------------------------------------------- -m4_define([lt_dict_filter], -[m4_if([$5], [], [], - [lt_join(m4_quote(m4_default([$4], [[, ]])), - lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), - [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl -]) - -# ltversion.m4 -- version numbers -*- Autoconf -*- -# -# Copyright (C) 2004 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# @configure_input@ - -# serial 3293 ltversion.m4 -# This file is part of GNU Libtool - -m4_define([LT_PACKAGE_VERSION], [2.4]) -m4_define([LT_PACKAGE_REVISION], [1.3293]) - -AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4' -macro_revision='1.3293' -_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) -_LT_DECL(, macro_revision, 0) -]) - -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 5 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) -m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) -m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) -m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) -m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) -m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) -m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) - diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/configure b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/configure deleted file mode 100644 index 247d0ef2..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/configure +++ /dev/null @@ -1,18632 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for expat 2.1.0. -# -# Report bugs to . -# -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# 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 - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# 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 - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) 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 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 - - test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ - || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: expat-bugs@libexpat.org about your system, including -$0: any error possibly output before this message. Then -$0: install a modern shell, or manually run the script -$0: under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -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 - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$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; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -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='mkdir -p "$as_dir"' -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'" - -SHELL=${CONFIG_SHELL-/bin/sh} - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='expat' -PACKAGE_TARNAME='expat' -PACKAGE_VERSION='2.1.0' -PACKAGE_STRING='expat 2.1.0' -PACKAGE_BUGREPORT='expat-bugs@libexpat.org' -PACKAGE_URL='' - -ac_unique_file="Makefile.in" -# 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_header_list= -ac_subst_vars='LTLIBOBJS -LIBOBJS -FILEMAP -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -CXXCPP -ac_ct_CXX -CXXFLAGS -CXX -LIBAGE -LIBREVISION -LIBCURRENT -CPP -OTOOL64 -OTOOL -LIPO -NMEDIT -DSYMUTIL -MANIFEST_TOOL -AWK -RANLIB -STRIP -ac_ct_AR -AR -LN_S -NM -ac_ct_DUMPBIN -DUMPBIN -LD -FGREP -EGREP -GREP -SED -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -LIBTOOL -OBJDUMP -DLLTOOL -AS -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_shared -enable_static -with_pic -enable_fast_install -with_gnu_ld -with_sysroot -enable_libtool_lock -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP -CXX -CXXFLAGS -CCC -CXXCPP' - - -# 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_TARNAME}' -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= ;; - *) 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_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -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_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --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_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - 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_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $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_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# 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_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$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_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - 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 expat 2.1.0 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/expat] - --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 - case $ac_init_help in - short | recursive ) echo "Configuration of expat 2.1.0:";; - esac - 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-shared[=PKGS] build shared libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pic try to use only PIC/non-PIC objects [default=use - both] - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-sysroot=DIR Search for dependent libraries within DIR - (or the compiler's sysroot if not specified). - -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 (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CXXCPP C++ preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -ac_status=$? -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 -expat configure 2.1.0 -generated by GNU Autoconf 2.68 - -Copyright (C) 2010 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func - -# ac_fn_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_compile - -# ac_fn_cxx_try_cpp LINENO -# ------------------------ -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_cpp - -# ac_fn_cxx_try_link LINENO -# ------------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_link - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_type - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## -------------------------------------- ## -## Report this to expat-bugs@libexpat.org ## -## -------------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel -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 expat $as_me 2.1.0, which was -generated by GNU Autoconf 2.68. 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) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - 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 - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# 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 - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - 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:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; 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 - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - 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 - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - 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 - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - 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'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -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 /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -as_fn_append ac_header_list " stdlib.h" -as_fn_append ac_header_list " unistd.h" -as_fn_append ac_header_list " sys/param.h" -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - -ac_aux_dir= -for ac_dir in conftools "$srcdir"/conftools; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in conftools \"$srcdir\"/conftools" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - - - - - -LIBCURRENT=7 -LIBREVISION=0 -LIBAGE=6 - -ac_config_headers="$ac_config_headers expat_config.h" - - - - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -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 - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -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 - - -enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. -set dummy ${ac_tool_prefix}as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # 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_AS="${ac_tool_prefix}as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AS=$ac_cv_prog_AS -if test -n "$AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 -$as_echo "$AS" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_AS"; then - ac_ct_AS=$AS - # Extract the first word of "as", so it can be a program name with args. -set dummy as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AS"; then - ac_cv_prog_ac_ct_AS="$ac_ct_AS" # 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_AS="as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AS=$ac_cv_prog_ac_ct_AS -if test -n "$ac_ct_AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 -$as_echo "$ac_ct_AS" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_AS" = x; then - AS="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AS=$ac_ct_AS - fi -else - AS="$ac_cv_prog_AS" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # 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_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # 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_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # 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_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - - ;; -esac - -test -z "$AS" && AS=as - - - - - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - - -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac - - - -macro_version='2.4' -macro_revision='1.3293' - - - - - - - - - - - - - -ltmain="$ac_aux_dir/ltmain.sh" - -# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -$as_echo_n "checking how to print strings... " >&6; } -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "" -} - -case "$ECHO" in - printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -$as_echo "printf" >&6; } ;; - print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -$as_echo "print -r" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -$as_echo "cat" >&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 -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#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" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else - 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" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_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 -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_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 '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_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_SED_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 - fi -else - ac_cv_path_SED=$SED -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed - -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { 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 - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { 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 - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_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 fgrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_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 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_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_FGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_FGREP=$FGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -test -z "$GREP" && GREP=grep - - - - - - - - - - - - - - - - - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - 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 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - if test -n "$ac_tool_prefix"; then - for ac_prog in dumpbin "link -dump" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DUMPBIN"; then - ac_cv_prog_DUMPBIN="$DUMPBIN" # 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_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DUMPBIN=$ac_cv_prog_DUMPBIN -if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$DUMPBIN" && break - done -fi -if test -z "$DUMPBIN"; then - ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in dumpbin "link -dump" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DUMPBIN"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # 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_DUMPBIN="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN -if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_DUMPBIN" && break -done - - if test "x$ac_ct_DUMPBIN" = x; then - DUMPBIN=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DUMPBIN=$ac_ct_DUMPBIN - fi -fi - - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: output\"" >&5) - cat conftest.out >&5 - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - -# find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : - $as_echo_n "(cached) " >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } -fi -max_cmd_len=$lt_cv_sys_max_cmd_len - - - - - - -: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 -$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 -$as_echo "$xsi_shell" >&6; } - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 -$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } -lt_shell_append=no -( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 -$as_echo "$lt_shell_append" >&6; } - - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi - - - - - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -$as_echo_n "checking how to convert $build file names to $host format... " >&6; } -if ${lt_cv_to_host_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac - -fi - -to_host_file_cmd=$lt_cv_to_host_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -$as_echo "$lt_cv_to_host_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } -if ${lt_cv_to_tool_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - #assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac - -fi - -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 -$as_echo "$lt_cv_to_tool_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_reload_flag='-r' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - if test "$GCC" != yes; then - reload_cmds=false - fi - ;; - darwin*) - if test "$GCC" = yes; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # 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_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # 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_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix[4-9]*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. - if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` - fi - ;; - esac -fi - -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - - - - - - - - - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # 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_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -$as_echo_n "checking how to associate runtime and link libraries... " >&6; } -if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - - - - - - - - -if test -n "$ac_tool_prefix"; then - for ac_prog in ar - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # 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_AR="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AR" && break - done -fi -if test -z "$AR"; then - ac_ct_AR=$AR - for ac_prog in ar -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_AR" && break -done - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -fi - -: ${AR=ar} -: ${AR_FLAGS=cru} - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 -$as_echo_n "checking for archiver @FILE support... " >&6; } -if ${lt_cv_ar_at_file+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ar_at_file=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -ne 0; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 -$as_echo "$lt_cv_ar_at_file" >&6; } - -if test "x$lt_cv_ar_at_file" = xno; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # 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_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -test -z "$STRIP" && STRIP=: - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -test -z "$RANLIB" && RANLIB=: - - - - - - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac - - - - - - - - - - - - - - - - - - - - - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # 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_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - - - - - - - - - - - - - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : - $as_echo_n "(cached) " >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[ABCDGISTW]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK '"\ -" {last_section=section; section=\$ 3};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -LT_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } -fi - -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 -$as_echo_n "checking for sysroot... " >&6; } - -# Check whether --with-sysroot was given. -if test "${with_sysroot+set}" = set; then : - withval=$with_sysroot; -else - with_sysroot=no -fi - - -lt_sysroot= -case ${with_sysroot} in #( - yes) - if test "$GCC" = yes; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 -$as_echo "${with_sysroot}" >&6; } - as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 - ;; -esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 -$as_echo "${lt_sysroot:-no}" >&6; } - - - - - -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : - enableval=$enable_libtool_lock; -fi - -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : - $as_echo_n "(cached) " >&6 -else - 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 - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_cc_needs_belf=yes -else - lt_cv_cc_needs_belf=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext 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 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. -set dummy ${ac_tool_prefix}mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$MANIFEST_TOOL"; then - ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # 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_MANIFEST_TOOL="${ac_tool_prefix}mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL -if test -n "$MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 -$as_echo "$MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_MANIFEST_TOOL"; then - ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL - # Extract the first word of "mt", so it can be a program name with args. -set dummy mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_MANIFEST_TOOL"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # 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_MANIFEST_TOOL="mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL -if test -n "$ac_ct_MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 -$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_MANIFEST_TOOL" = x; then - MANIFEST_TOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL - fi -else - MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" -fi - -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 -$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if ${lt_cv_path_mainfest_tool+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&5 - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -$as_echo "$lt_cv_path_mainfest_tool" >&6; } -if test "x$lt_cv_path_mainfest_tool" != xyes; then - MANIFEST_TOOL=: -fi - - - - - - - case $host_os in - rhapsody* | darwin*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. -set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DSYMUTIL"; then - ac_cv_prog_DSYMUTIL="$DSYMUTIL" # 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_DSYMUTIL="${ac_tool_prefix}dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DSYMUTIL=$ac_cv_prog_DSYMUTIL -if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DSYMUTIL"; then - ac_ct_DSYMUTIL=$DSYMUTIL - # Extract the first word of "dsymutil", so it can be a program name with args. -set dummy dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DSYMUTIL"; then - ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # 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_DSYMUTIL="dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL -if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DSYMUTIL" = x; then - DSYMUTIL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DSYMUTIL=$ac_ct_DSYMUTIL - fi -else - DSYMUTIL="$ac_cv_prog_DSYMUTIL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. -set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NMEDIT"; then - ac_cv_prog_NMEDIT="$NMEDIT" # 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_NMEDIT="${ac_tool_prefix}nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -NMEDIT=$ac_cv_prog_NMEDIT -if test -n "$NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -$as_echo "$NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_NMEDIT"; then - ac_ct_NMEDIT=$NMEDIT - # Extract the first word of "nmedit", so it can be a program name with args. -set dummy nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_NMEDIT"; then - ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # 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_NMEDIT="nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT -if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -$as_echo "$ac_ct_NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_NMEDIT" = x; then - NMEDIT=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - NMEDIT=$ac_ct_NMEDIT - fi -else - NMEDIT="$ac_cv_prog_NMEDIT" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. -set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LIPO"; then - ac_cv_prog_LIPO="$LIPO" # 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_LIPO="${ac_tool_prefix}lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -LIPO=$ac_cv_prog_LIPO -if test -n "$LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -$as_echo "$LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_LIPO"; then - ac_ct_LIPO=$LIPO - # Extract the first word of "lipo", so it can be a program name with args. -set dummy lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_LIPO"; then - ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # 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_LIPO="lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO -if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -$as_echo "$ac_ct_LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_LIPO" = x; then - LIPO=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LIPO=$ac_ct_LIPO - fi -else - LIPO="$ac_cv_prog_LIPO" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL"; then - ac_cv_prog_OTOOL="$OTOOL" # 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_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL=$ac_cv_prog_OTOOL -if test -n "$OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -$as_echo "$OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL"; then - ac_ct_OTOOL=$OTOOL - # Extract the first word of "otool", so it can be a program name with args. -set dummy otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL"; then - ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # 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_OTOOL="otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL -if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -$as_echo "$ac_ct_OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL" = x; then - OTOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL=$ac_ct_OTOOL - fi -else - OTOOL="$ac_cv_prog_OTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL64"; then - ac_cv_prog_OTOOL64="$OTOOL64" # 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_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL64=$ac_cv_prog_OTOOL64 -if test -n "$OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -$as_echo "$OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL64"; then - ac_ct_OTOOL64=$OTOOL64 - # Extract the first word of "otool64", so it can be a program name with args. -set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL64"; then - ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # 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_OTOOL64="otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 -if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -$as_echo "$ac_ct_OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL64" = x; then - OTOOL64=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL64=$ac_ct_OTOOL64 - fi -else - OTOOL64="$ac_cv_prog_OTOOL64" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -$as_echo_n "checking for -single_module linker flag... " >&6; } -if ${lt_cv_apple_cc_single_mod+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&5 - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -$as_echo "$lt_cv_apple_cc_single_mod" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if ${lt_cv_ld_exported_symbols_list+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_ld_exported_symbols_list=yes -else - lt_cv_ld_exported_symbols_list=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -$as_echo_n "checking for -force_load linker flag... " >&6; } -if ${lt_cv_ld_force_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 - echo "$RANLIB libconftest.a" >&5 - $RANLIB libconftest.a 2>&5 - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&5 - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -$as_echo "$lt_cv_ld_force_load" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[012]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF - -fi - -done - - - - - -# Set options - - - - enable_dlopen=no - - - - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi - - - - - - - - - - # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi - - - - - - - - - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : - withval=$with_pic; pic_mode="$withval" -else - pic_mode=default -fi - - -test -z "$pic_mode" && pic_mode=default - - - - - - - - # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi - - - - - - - - - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - - - - - - - - - - - - - - - - - - - - - - - - - - -test -z "$LN_S" && LN_S="ln -s" - - - - - - - - - - - - - - -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir - - - - - -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` - - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -# Use C for the default configuration in the libtool script - -lt_save_CC="$CC" -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 - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - -if test -n "$compiler"; then - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; - *) - lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - - - - - - - lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - - - if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - lt_prog_compiler_wl='-Xlinker ' - lt_prog_compiler_pic='-Xcompiler -fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='--shared' - lt_prog_compiler_static='--static' - ;; - nagfor*) - # NAG Fortran compiler - lt_prog_compiler_wl='-Wl,-Wl,,' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-qpic' - lt_prog_compiler_static='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ F* | *Sun*Fortran*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' - ;; - esac - ;; - esac - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic=$lt_prog_compiler_pic -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 -$as_echo "$lt_cv_prog_compiler_pic" >&6; } -lt_prog_compiler_pic=$lt_cv_prog_compiler_pic - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_cv_prog_compiler_pic_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } - -if test x"$lt_cv_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi - - - - - - - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works=yes - fi - else - lt_cv_prog_compiler_static_works=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -$as_echo "$lt_cv_prog_compiler_static_works" >&6; } - -if test x"$lt_cv_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - runpath_var= - allow_undefined_flag= - always_export_symbols=no - archive_cmds= - archive_expsym_cmds= - compiler_needs_object=no - enable_shared_with_static_runtimes=no - export_dynamic_flag_spec= - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - hardcode_automatic=no - hardcode_direct=no - hardcode_direct_absolute=no - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= - hardcode_libdir_separator= - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - inherit_rpath=no - link_all_deplibs=unknown - module_cmds= - module_expsym_cmds= - old_archive_from_new_cmds= - old_archive_from_expsyms_cmds= - thread_safe_flag_spec= - whole_archive_flag_spec= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - linux* | k*bsd*-gnu | gnu*) - link_all_deplibs=no - ;; - esac - - ld_shlibs=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; - *\ \(GNU\ Binutils\)\ [3-9]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[3-9]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - export_dynamic_flag_spec='${wl}--export-all-symbols' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - - haiku*) - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - link_all_deplibs=yes - ;; - - interix[3-9]*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - whole_archive_flag_spec= - tmp_sharedflag='--shared' ;; - xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld='-rpath $libdir' - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - ld_shlibs=no - fi - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_direct_absolute=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - file_list_spec='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - link_all_deplibs=no - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - export_dynamic_flag_spec='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - fi - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - always_export_symbols=yes - file_list_spec='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, )='true' - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - old_postinstall_cmds='chmod 644 $oldlib' - postlink_cmds='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - enable_shared_with_static_runtimes=yes - ;; - esac - ;; - - darwin* | rhapsody*) - - - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - else - whole_archive_flag_spec='' - fi - link_all_deplibs=yes - allow_undefined_flag="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - - else - ld_shlibs=no - fi - - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -$as_echo_n "checking if $CC understands -b... " >&6; } -if ${lt_cv_prog_compiler__b+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler__b=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -b" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler__b=yes - fi - else - lt_cv_prog_compiler__b=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -$as_echo "$lt_cv_prog_compiler__b" >&6; } - -if test x"$lt_cv_prog_compiler__b" = xyes; then - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' -fi - - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if ${lt_cv_irix_exported_symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo (void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_irix_exported_symbol=yes -else - lt_cv_irix_exported_symbol=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -$as_echo "$lt_cv_irix_exported_symbol" >&6; } - if test "$lt_cv_irix_exported_symbol" = yes; then - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - fi - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - inherit_rpath=yes - link_all_deplibs=yes - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - hardcode_shlibpath_var=no - hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - archive_cmds_need_lc='no' - hardcode_libdir_separator=: - ;; - - solaris*) - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='${wl}-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='${wl}-z,text' - allow_undefined_flag='${wl}-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-R,$libdir' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='${wl}-Blargedynsym' - ;; - esac - fi - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } -test "$ld_shlibs" = no && can_build_shared=no - -with_gnu_ld=$with_gnu_ld - - - - - - - - - - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc+:} false; then : - $as_echo_n "(cached) " >&6 -else - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } - archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } - -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[lt_foo]++; } - if (lt_freq[lt_foo] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([A-Za-z]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[4-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -haiku*) - version_type=linux - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[3-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - lt_cv_shlibpath_overrides_runpath=yes -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - -fi - - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || - test -n "$runpath_var" || - test "X$hardcode_automatic" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } - -if test "$hardcode_action" = relink || - test "$inherit_rpath" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_shl_load=yes -else - ac_cv_lib_dld_shl_load=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -else - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_svld_dlopen=yes -else - ac_cv_lib_svld_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); -int -main () -{ -return dld_link (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_dld_link=yes -else - ac_cv_lib_dld_dld_link=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - - - - - - - - - - - - - - - - -striplib= -old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac -fi - - - - - - - - - - - - - # Report which library types will actually be built - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[4-9]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } - - - - -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - - - - - - - - - - - - - ac_config_commands="$ac_config_commands libtool" - - - - -# Only expand once: - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { 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:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#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" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -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_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe 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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe 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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -else - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - -else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -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 -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 - - - -func_stripname_cnf () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname_cnf - - if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 -$as_echo_n "checking how to run the C++ preprocessor... " >&6; } -if test -z "$CXXCPP"; then - if ${ac_cv_prog_CXXCPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 -$as_echo "$CXXCPP" >&6; } -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -else - _lt_caught_CXX_error=yes -fi - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -archive_cmds_need_lc_CXX=no -allow_undefined_flag_CXX= -always_export_symbols_CXX=no -archive_expsym_cmds_CXX= -compiler_needs_object_CXX=no -export_dynamic_flag_spec_CXX= -hardcode_direct_CXX=no -hardcode_direct_absolute_CXX=no -hardcode_libdir_flag_spec_CXX= -hardcode_libdir_flag_spec_ld_CXX= -hardcode_libdir_separator_CXX= -hardcode_minus_L_CXX=no -hardcode_shlibpath_var_CXX=unsupported -hardcode_automatic_CXX=no -inherit_rpath_CXX=no -module_cmds_CXX= -module_expsym_cmds_CXX= -link_all_deplibs_CXX=unknown -old_archive_cmds_CXX=$old_archive_cmds -reload_flag_CXX=$reload_flag -reload_cmds_CXX=$reload_cmds -no_undefined_flag_CXX= -whole_archive_flag_spec_CXX= -enable_shared_with_static_runtimes_CXX=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -objext_CXX=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_caught_CXX_error" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - - # save warnings/boilerplate of simple test code - ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - - ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_CFLAGS=$CFLAGS - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - CFLAGS=$CXXFLAGS - compiler=$CC - compiler_CXX=$CC - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` - - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test "$GXX" = yes; then - lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' - else - lt_prog_compiler_no_builtin_flag_CXX= - fi - - if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - 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 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_CXX= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - GXX=no - with_gnu_ld=no - wlarc= - fi - - # PORTME: fill in a description of your system's C++ link characteristics - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - ld_shlibs_CXX=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_CXX='' - hardcode_direct_CXX=yes - hardcode_direct_absolute_CXX=yes - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - file_list_spec_CXX='${wl}-f,' - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct_CXX=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_CXX=yes - hardcode_libdir_flag_spec_CXX='-L$libdir' - hardcode_libdir_separator_CXX= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - export_dynamic_flag_spec_CXX='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - always_export_symbols_CXX=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_CXX='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath__CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath__CXX -fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - - archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_CXX="-z nodefs" - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath__CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath__CXX -fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_CXX=' ${wl}-bernotok' - allow_undefined_flag_CXX=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_CXX='$convenience' - fi - archive_cmds_need_lc_CXX=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_CXX=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_CXX=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - cygwin* | mingw* | pw32* | cegcc*) - case $GXX,$cc_basename in - ,cl* | no,cl*) - # Native MSVC - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_CXX=' ' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=yes - file_list_spec_CXX='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' - enable_shared_with_static_runtimes_CXX=yes - # Don't use ranlib - old_postinstall_cmds_CXX='chmod 644 $oldlib' - postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - func_to_tool_file "$lt_outputfile"~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # g++ - # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_CXX='-L$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-all-symbols' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=no - enable_shared_with_static_runtimes_CXX=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs_CXX=no - fi - ;; - esac - ;; - darwin* | rhapsody*) - - - archive_cmds_need_lc_CXX=no - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - else - whole_archive_flag_spec_CXX='' - fi - link_all_deplibs_CXX=yes - allow_undefined_flag_CXX="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - if test "$lt_cv_apple_cc_single_mod" != "yes"; then - archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" - fi - - else - ld_shlibs_CXX=no - fi - - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - ld_shlibs_CXX=no - ;; - - freebsd-elf*) - archive_cmds_need_lc_CXX=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - ld_shlibs_CXX=yes - ;; - - gnu*) - ;; - - haiku*) - archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - link_all_deplibs_CXX=yes - ;; - - hpux9*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC*) - archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - export_dynamic_flag_spec_CXX='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - ;; - *) - hardcode_direct_CXX=yes - hardcode_direct_absolute_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - - interix[3-9]*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' - fi - fi - link_all_deplibs_CXX=yes - ;; - esac - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - inherit_rpath_CXX=yes - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [1-5].* | *pgcpp\ [1-5].*) - prelink_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' - old_archive_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ - $RANLIB $oldlib' - archive_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - *) # Version 6 and above use weak symbols - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - esac - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' - ;; - xl* | mpixl* | bgxl*) - # IBM XL 8.0 on PPC, with GNU ld - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - hardcode_libdir_flag_spec_CXX='-R$libdir' - whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object_CXX=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - - *nto* | *qnx*) - ld_shlibs_CXX=yes - ;; - - openbsd2*) - # C++ shared libraries are fairly broken - ld_shlibs_CXX=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - hardcode_direct_absolute_CXX=yes - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - export_dynamic_flag_spec_CXX='${wl}-E' - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd=func_echo_all - else - ld_shlibs_CXX=no - fi - ;; - - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx*) - case $host in - osf3*) - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - ;; - *) - allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ - $RM $lib.exp' - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - ;; - esac - - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - case $host in - osf3*) - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - *) - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - esac - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - archive_cmds_need_lc_CXX=yes - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_shlibpath_var_CXX=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' - ;; - esac - link_all_deplibs_CXX=yes - - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - no_undefined_flag_CXX=' ${wl}-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - fi - - hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag_CXX='${wl}-z,text' - archive_cmds_need_lc_CXX=no - hardcode_shlibpath_var_CXX=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag_CXX='${wl}-z,text' - allow_undefined_flag_CXX='${wl}-z,nodefs' - archive_cmds_need_lc_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir' - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - export_dynamic_flag_spec_CXX='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ - '"$old_archive_cmds_CXX" - reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ - '"$reload_cmds_CXX" - ;; - *) - archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -$as_echo "$ld_shlibs_CXX" >&6; } - test "$ld_shlibs_CXX" = no && can_build_shared=no - - GCC_CXX="$GXX" - LD_CXX="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - # Dependencies to place before and after the object being linked: -predep_objects_CXX= -postdep_objects_CXX= -predeps_CXX= -postdeps_CXX= -compiler_lib_search_path_CXX= - -cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF - - -_lt_libdeps_save_CFLAGS=$CFLAGS -case "$CC $CFLAGS " in #( -*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; -*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; -esac - -if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case ${prev}${p} in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" || - test $p = "-R"; then - prev=$p - continue - fi - - # Expand the sysroot to ease extracting the directories later. - if test -z "$prev"; then - case $p in - -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; - -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; - -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; - esac - fi - case $p in - =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; - esac - if test "$pre_test_object_deps_done" = no; then - case ${prev} in - -L | -R) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$compiler_lib_search_path_CXX"; then - compiler_lib_search_path_CXX="${prev}${p}" - else - compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$postdeps_CXX"; then - postdeps_CXX="${prev}${p}" - else - postdeps_CXX="${postdeps_CXX} ${prev}${p}" - fi - fi - prev= - ;; - - *.lto.$objext) ;; # Ignore GCC LTO objects - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$predep_objects_CXX"; then - predep_objects_CXX="$p" - else - predep_objects_CXX="$predep_objects_CXX $p" - fi - else - if test -z "$postdep_objects_CXX"; then - postdep_objects_CXX="$p" - else - postdep_objects_CXX="$postdep_objects_CXX $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling CXX test program" -fi - -$RM -f confest.$objext -CFLAGS=$_lt_libdeps_save_CFLAGS - -# PORTME: override above test on systems where it is broken -case $host_os in -interix[3-9]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - predep_objects_CXX= - postdep_objects_CXX= - postdeps_CXX= - ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test "$solaris_use_stlport4" != yes; then - postdeps_CXX='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC* | sunCC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - postdeps_CXX='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac - - -case " $postdeps_CXX " in -*" -lc "*) archive_cmds_need_lc_CXX=no ;; -esac - compiler_lib_search_dirs_CXX= -if test -n "${compiler_lib_search_path_CXX}"; then - compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - lt_prog_compiler_wl_CXX= -lt_prog_compiler_pic_CXX= -lt_prog_compiler_static_CXX= - - - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic_CXX='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_CXX='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - lt_prog_compiler_pic_CXX= - ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static_CXX= - ;; - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_CXX=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic_CXX='-fPIC -shared' - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - else - case $host_os in - aix[4-9]*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - else - lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - dgux*) - case $cc_basename in - ec++*) - lt_prog_compiler_pic_CXX='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - lt_prog_compiler_pic_CXX='+Z' - fi - ;; - aCC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_CXX='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - KCC*) - # KAI C++ Compiler - lt_prog_compiler_wl_CXX='--backend -Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - ;; - ecpc* ) - # old Intel C++ for x86_64 which still supported -KPIC. - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-static' - ;; - icpc* ) - # Intel C++, used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - lt_prog_compiler_static_CXX='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-fpic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) - # IBM XL 8.0, 9.0 on PPC and BlueGene - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-qpic' - lt_prog_compiler_static_CXX='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - lt_prog_compiler_pic_CXX='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd* | netbsdelf*-gnu) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic_CXX='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - lt_prog_compiler_wl_CXX='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - lt_prog_compiler_pic_CXX='-pic' - ;; - cxx*) - # Digital/Compaq C++ - lt_prog_compiler_wl_CXX='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - lt_prog_compiler_pic_CXX='-pic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - lcc*) - # Lucid - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - lt_prog_compiler_pic_CXX='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - lt_prog_compiler_can_build_shared_CXX=no - ;; - esac - fi - -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_CXX= - ;; - *) - lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } -lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } -if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works_CXX=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works_CXX=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } - -if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then - case $lt_prog_compiler_pic_CXX in - "" | " "*) ;; - *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; - esac -else - lt_prog_compiler_pic_CXX= - lt_prog_compiler_can_build_shared_CXX=no -fi - -fi - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works_CXX=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works_CXX=yes - fi - else - lt_cv_prog_compiler_static_works_CXX=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } - -if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then - : -else - lt_prog_compiler_static_CXX= -fi - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } - - - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - case $host_os in - aix[4-9]*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global defined - # symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - export_symbols_cmds_CXX="$ltdll_cmds" - ;; - cygwin* | mingw* | cegcc*) - case $cc_basename in - cl*) ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' - ;; - esac - ;; - linux* | k*bsd*-gnu | gnu*) - link_all_deplibs_CXX=no - ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -$as_echo "$ld_shlibs_CXX" >&6; } -test "$ld_shlibs_CXX" = no && can_build_shared=no - -with_gnu_ld_CXX=$with_gnu_ld - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_CXX" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_CXX=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_CXX in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_CXX - pic_flag=$lt_prog_compiler_pic_CXX - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_CXX - allow_undefined_flag_CXX= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc_CXX=no - else - lt_cv_archive_cmds_need_lc_CXX=yes - fi - allow_undefined_flag_CXX=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } - archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } - -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[4-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -haiku*) - version_type=linux - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[3-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - lt_cv_shlibpath_overrides_runpath=yes -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - -fi - - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action_CXX= -if test -n "$hardcode_libdir_flag_spec_CXX" || - test -n "$runpath_var_CXX" || - test "X$hardcode_automatic_CXX" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$hardcode_direct_CXX" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && - test "$hardcode_minus_L_CXX" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_CXX=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_CXX=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_CXX=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 -$as_echo "$hardcode_action_CXX" >&6; } - -if test "$hardcode_action_CXX" = relink || - test "$inherit_rpath_CXX" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - - fi # test -n "$compiler" - - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test "$_lt_caught_CXX_error" != yes - -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 - - -# 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:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /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:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -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 "$GCC" = yes ; then - OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes" - CFLAGS="$OLDCFLAGS -fexceptions" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -fexceptions" >&5 -$as_echo_n "checking whether $CC accepts -fexceptions... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; }; CFLAGS="$OLDCFLAGS" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'` -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if ${ac_cv_c_bigendian+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_bigendian=unknown -# See if sys/param.h defines the BYTE_ORDER macro. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main () -{ - -#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN - bogus endian macros -#endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to BIG_ENDIAN or not. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main () -{ - -#if BYTE_ORDER != BIG_ENDIAN - not big endian -#endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -if test $ac_cv_c_bigendian = unknown; then -if test "$cross_compiling" = yes; then : - echo $ac_n "cross-compiling... " 2>&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -main () { - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long l; - char c[sizeof (long)]; - } u; - u.l = 1; - exit (u.c[sizeof (long) - 1] == 1); -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_bigendian=no -else - ac_cv_c_bigendian=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } -if test $ac_cv_c_bigendian = unknown; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking to probe for byte ordering" >&5 -$as_echo_n "checking to probe for byte ordering... " >&6; } - -cat >conftest.c <&6 - ac_cv_c_bigendian=yes - fi - if test `grep -l LiTTleEnDian conftest.o` ; then - echo $ac_n ' little endian probe OK, ' 1>&6 - if test $ac_cv_c_bigendian = yes ; then - ac_cv_c_bigendian=unknown; - else - ac_cv_c_bigendian=no - fi - fi - echo $ac_n 'guessing bigendian ... ' >&6 - fi - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } -fi -if test $ac_cv_c_bigendian = yes; then - -$as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h - - BYTEORDER=4321 -else - BYTEORDER=1234 -fi - -cat >>confdefs.h <<_ACEOF -#define BYTEORDER $BYTEORDER -_ACEOF - -if test $ac_cv_c_bigendian = unknown; then - as_fn_error please pre-set ac_cv_c_bigendian "unknown endianess - sorry" "$LINENO" 5 -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset cs; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *pcpcc; - char **ppc; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - pcpcc = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++pcpcc; - ppc = (char**) pcpcc; - pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - if (s) return 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - if (!foo) return 0; - } - return !cs[0] && !zero.x; -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_const=yes -else - ac_cv_c_const=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then - -$as_echo "#define const /**/" >>confdefs.h - -fi - -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - -fi - -for ac_func in memmove bcopy -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -for ac_header in fcntl.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" -if test "x$ac_cv_type_off_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define off_t long int -_ACEOF - -fi - - - - - for ac_header in $ac_header_list -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - - - - - -for ac_func in getpagesize -do : - ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" -if test "x$ac_cv_func_getpagesize" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GETPAGESIZE 1 -_ACEOF - -fi -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 -$as_echo_n "checking for working mmap... " >&6; } -if ${ac_cv_func_mmap_fixed_mapped+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_mmap_fixed_mapped=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -/* malloc might have been renamed as rpl_malloc. */ -#undef malloc - -/* Thanks to Mike Haertel and Jim Avera for this test. - Here is a matrix of mmap possibilities: - mmap private not fixed - mmap private fixed at somewhere currently unmapped - mmap private fixed at somewhere already mapped - mmap shared not fixed - mmap shared fixed at somewhere currently unmapped - mmap shared fixed at somewhere already mapped - For private mappings, we should verify that changes cannot be read() - back from the file, nor mmap's back from the file at a different - address. (There have been systems where private was not correctly - implemented like the infamous i386 svr4.0, and systems where the - VM page cache was not coherent with the file system buffer cache - like early versions of FreeBSD and possibly contemporary NetBSD.) - For shared mappings, we should conversely verify that changes get - propagated back to all the places they're supposed to be. - - Grep wants private fixed already mapped. - The main things grep needs to know about mmap are: - * does it exist and is it safe to write into the mmap'd area - * how to use it (BSD variants) */ - -#include -#include - -#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H -char *malloc (); -#endif - -/* This mess was copied from the GNU getpagesize.h. */ -#ifndef HAVE_GETPAGESIZE -# ifdef _SC_PAGESIZE -# define getpagesize() sysconf(_SC_PAGESIZE) -# else /* no _SC_PAGESIZE */ -# ifdef HAVE_SYS_PARAM_H -# include -# ifdef EXEC_PAGESIZE -# define getpagesize() EXEC_PAGESIZE -# else /* no EXEC_PAGESIZE */ -# ifdef NBPG -# define getpagesize() NBPG * CLSIZE -# ifndef CLSIZE -# define CLSIZE 1 -# endif /* no CLSIZE */ -# else /* no NBPG */ -# ifdef NBPC -# define getpagesize() NBPC -# else /* no NBPC */ -# ifdef PAGESIZE -# define getpagesize() PAGESIZE -# endif /* PAGESIZE */ -# endif /* no NBPC */ -# endif /* no NBPG */ -# endif /* no EXEC_PAGESIZE */ -# else /* no HAVE_SYS_PARAM_H */ -# define getpagesize() 8192 /* punt totally */ -# endif /* no HAVE_SYS_PARAM_H */ -# endif /* no _SC_PAGESIZE */ - -#endif /* no HAVE_GETPAGESIZE */ - -int -main () -{ - char *data, *data2, *data3; - const char *cdata2; - int i, pagesize; - int fd, fd2; - - pagesize = getpagesize (); - - /* First, make a file with some known garbage in it. */ - data = (char *) malloc (pagesize); - if (!data) - return 1; - for (i = 0; i < pagesize; ++i) - *(data + i) = rand (); - umask (0); - fd = creat ("conftest.mmap", 0600); - if (fd < 0) - return 2; - if (write (fd, data, pagesize) != pagesize) - return 3; - close (fd); - - /* Next, check that the tail of a page is zero-filled. File must have - non-zero length, otherwise we risk SIGBUS for entire page. */ - fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); - if (fd2 < 0) - return 4; - cdata2 = ""; - if (write (fd2, cdata2, 1) != 1) - return 5; - data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); - if (data2 == MAP_FAILED) - return 6; - for (i = 0; i < pagesize; ++i) - if (*(data2 + i)) - return 7; - close (fd2); - if (munmap (data2, pagesize)) - return 8; - - /* Next, try to mmap the file at a fixed address which already has - something else allocated at it. If we can, also make sure that - we see the same garbage. */ - fd = open ("conftest.mmap", O_RDWR); - if (fd < 0) - return 9; - if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - return 10; - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - return 11; - - /* Finally, make sure that changes to the mapped area do not - percolate back to the file as seen by read(). (This is a bug on - some variants of i386 svr4.0.) */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = (char *) malloc (pagesize); - if (!data3) - return 12; - if (read (fd, data3, pagesize) != pagesize) - return 13; - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - return 14; - close (fd); - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_mmap_fixed_mapped=yes -else - ac_cv_func_mmap_fixed_mapped=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5 -$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } -if test $ac_cv_func_mmap_fixed_mapped = yes; then - -$as_echo "#define HAVE_MMAP 1" >>confdefs.h - -fi -rm -f conftest.mmap conftest.txt - - -if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then - FILEMAP=unixfilemap -else - FILEMAP=readfilemap -fi - - - -# AC_CPP_FUNC -# ------------------ # -# Checks to see if ANSI C99 CPP variable __func__ works. -# If not, perhaps __FUNCTION__ works instead. -# If not, we'll just define __func__ to "". -# AC_CPP_FUNC - - case $ac_cv_prog_cc_stdc in #( - no) : - ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #( - *) : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 -$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } -if ${ac_cv_prog_cc_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -#include - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -#define debug(...) fprintf (stderr, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - your preprocessor is broken; -#endif -#if BIG_OK -#else - your preprocessor is broken; -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\0'; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static void -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str; - int number; - float fnumber; - - while (*format) - { - switch (*format++) - { - case 's': // string - str = va_arg (args_copy, const char *); - break; - case 'd': // int - number = va_arg (args_copy, int); - break; - case 'f': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); -} - -int -main () -{ - - // Check bool. - _Bool success = false; - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - test_varargs ("s, d' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' - || dynamic_array[ni.number - 1] != 543); - - ; - return 0; -} -_ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c99=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c99" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c99" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c99" != xno; then : - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#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" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 -else - ac_cv_prog_cc_stdc=no -fi - -fi - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5 -$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } - if ${ac_cv_prog_cc_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -fi - - case $ac_cv_prog_cc_stdc in #( - no) : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; #( - '') : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; #( - *) : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5 -$as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C99-conforming __func__" >&5 -$as_echo_n "checking for an ANSI C99-conforming __func__... " >&6; } -if ${ac_cv_cpp_func+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -char *foo = __func__; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_cpp_func=yes -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -char *foo = __FUNCTION__; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_cpp_func=__FUNCTION__ -else - ac_cv_cpp_func=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cpp_func" >&5 -$as_echo "$ac_cv_cpp_func" >&6; } -if test $ac_cv_cpp_func = __FUNCTION__; then - -$as_echo "#define __func__ __FUNCTION__" >>confdefs.h - -elif test $ac_cv_cpp_func = no; then - -$as_echo "#define __func__ \"\"" >>confdefs.h - -fi - - - - -$as_echo "#define XML_NS 1" >>confdefs.h - - -$as_echo "#define XML_DTD 1" >>confdefs.h - - -$as_echo "#define XML_CONTEXT_BYTES 1024" >>confdefs.h - - -ac_config_files="$ac_config_files Makefile expat.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, 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:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; 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 - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -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= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -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:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# 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} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - 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_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# 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 - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) 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 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -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 - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -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 - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -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 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by expat $as_me 2.1.0, which was -generated by GNU Autoconf 2.68. 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 - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --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 - -Configuration commands: -$config_commands - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -expat config.status 2.1.0 -configured by $0, generated by GNU Autoconf 2.68, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2010 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -AWK='$AWK' -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=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - 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 ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append 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 -# -# INIT-COMMANDS -# - - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' -DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' -macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' -macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' -enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' -enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' -pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' -SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' -ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' -host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' -host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' -host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' -build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' -build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' -build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' -SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' -Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' -GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' -EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' -FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' -LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' -NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' -LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' -ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' -exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' -lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' -lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' -lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' -reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' -file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' -want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' -sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' -AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' -archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' -STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' -RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' -lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' -CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' -compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' -GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' -nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' -lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' -objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' -need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' -MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' -LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' -libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' -module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' -postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' -version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' -runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' -libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' -soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' -install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' -finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' -old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' -striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' -predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' -postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' -predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' -postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' -LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' -reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' -reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' -old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' -compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' -GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' -archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' -export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' -whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' -compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' -old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' -archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' -archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' -module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' -module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' -with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' -allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' -no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld_CXX='`$ECHO "$hardcode_libdir_flag_spec_ld_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' -inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' -link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' -always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' -export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' -exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' -include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' -prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' -postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' -file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' -predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' -postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' -predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' -postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' - -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in AS \ -DLLTOOL \ -OBJDUMP \ -SHELL \ -ECHO \ -SED \ -GREP \ -EGREP \ -FGREP \ -LD \ -NM \ -LN_S \ -lt_SP2NL \ -lt_NL2SP \ -reload_flag \ -deplibs_check_method \ -file_magic_cmd \ -file_magic_glob \ -want_nocaseglob \ -sharedlib_from_linklib_cmd \ -AR \ -AR_FLAGS \ -archiver_list_spec \ -STRIP \ -RANLIB \ -CC \ -CFLAGS \ -compiler \ -lt_cv_sys_global_symbol_pipe \ -lt_cv_sys_global_symbol_to_cdecl \ -lt_cv_sys_global_symbol_to_c_name_address \ -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -nm_file_list_spec \ -lt_prog_compiler_no_builtin_flag \ -lt_prog_compiler_pic \ -lt_prog_compiler_wl \ -lt_prog_compiler_static \ -lt_cv_prog_compiler_c_o \ -need_locks \ -MANIFEST_TOOL \ -DSYMUTIL \ -NMEDIT \ -LIPO \ -OTOOL \ -OTOOL64 \ -shrext_cmds \ -export_dynamic_flag_spec \ -whole_archive_flag_spec \ -compiler_needs_object \ -with_gnu_ld \ -allow_undefined_flag \ -no_undefined_flag \ -hardcode_libdir_flag_spec \ -hardcode_libdir_flag_spec_ld \ -hardcode_libdir_separator \ -exclude_expsyms \ -include_expsyms \ -file_list_spec \ -variables_saved_for_relink \ -libname_spec \ -library_names_spec \ -soname_spec \ -install_override_mode \ -finish_eval \ -old_striplib \ -striplib \ -compiler_lib_search_dirs \ -predep_objects \ -postdep_objects \ -predeps \ -postdeps \ -compiler_lib_search_path \ -LD_CXX \ -reload_flag_CXX \ -compiler_CXX \ -lt_prog_compiler_no_builtin_flag_CXX \ -lt_prog_compiler_pic_CXX \ -lt_prog_compiler_wl_CXX \ -lt_prog_compiler_static_CXX \ -lt_cv_prog_compiler_c_o_CXX \ -export_dynamic_flag_spec_CXX \ -whole_archive_flag_spec_CXX \ -compiler_needs_object_CXX \ -with_gnu_ld_CXX \ -allow_undefined_flag_CXX \ -no_undefined_flag_CXX \ -hardcode_libdir_flag_spec_CXX \ -hardcode_libdir_flag_spec_ld_CXX \ -hardcode_libdir_separator_CXX \ -exclude_expsyms_CXX \ -include_expsyms_CXX \ -file_list_spec_CXX \ -compiler_lib_search_dirs_CXX \ -predep_objects_CXX \ -postdep_objects_CXX \ -predeps_CXX \ -postdeps_CXX \ -compiler_lib_search_path_CXX; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in reload_cmds \ -old_postinstall_cmds \ -old_postuninstall_cmds \ -old_archive_cmds \ -extract_expsyms_cmds \ -old_archive_from_new_cmds \ -old_archive_from_expsyms_cmds \ -archive_cmds \ -archive_expsym_cmds \ -module_cmds \ -module_expsym_cmds \ -export_symbols_cmds \ -prelink_cmds \ -postlink_cmds \ -postinstall_cmds \ -postuninstall_cmds \ -finish_cmds \ -sys_lib_search_path_spec \ -sys_lib_dlsearch_path_spec \ -reload_cmds_CXX \ -old_archive_cmds_CXX \ -old_archive_from_new_cmds_CXX \ -old_archive_from_expsyms_cmds_CXX \ -archive_cmds_CXX \ -archive_expsym_cmds_CXX \ -module_cmds_CXX \ -module_expsym_cmds_CXX \ -export_symbols_cmds_CXX \ -prelink_cmds_CXX \ -postlink_cmds_CXX; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -ac_aux_dir='$ac_aux_dir' -xsi_shell='$xsi_shell' -lt_shell_append='$lt_shell_append' - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - - - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile' - - - - - - -_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 - "expat_config.h") CONFIG_HEADERS="$CONFIG_HEADERS expat_config.h" ;; - "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "expat.pc") CONFIG_FILES="$CONFIG_FILES expat.pc" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - 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 - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -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= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_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 < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # 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. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" -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_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[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="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $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:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - 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"; as_fn_mkdir_p - 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:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - 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 "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi - ;; - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "libtool":C) - - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -# Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - -# The names of the tagged configurations supported by this script. -available_tags="CXX " - -# ### BEGIN LIBTOOL CONFIG - -# Assembler program. -AS=$lt_AS - -# DLL creation program. -DLLTOOL=$lt_DLLTOOL - -# Object dumper program. -OBJDUMP=$lt_OBJDUMP - -# Which release of libtool.m4 was used? -macro_version=$macro_version -macro_revision=$macro_revision - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# What type of objects to build. -pic_mode=$pic_mode - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that protects backslashes. -ECHO=$lt_ECHO - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="\$SED -e 1s/^X//" - -# A grep program that handles long lines. -GREP=$lt_GREP - -# An ERE matcher. -EGREP=$lt_EGREP - -# A literal string matcher. -FGREP=$lt_FGREP - -# A BSD- or MS-compatible name lister. -NM=$lt_NM - -# Whether we need soft or hard links. -LN_S=$lt_LN_S - -# What is the maximum length of a command? -max_cmd_len=$max_cmd_len - -# Object file suffix (normally "o"). -objext=$ac_objext - -# Executable file suffix (normally ""). -exeext=$exeext - -# whether the shell understands "unset". -lt_unset=$lt_unset - -# turn spaces into newlines. -SP2NL=$lt_lt_SP2NL - -# turn newlines into spaces. -NL2SP=$lt_lt_NL2SP - -# convert \$build file names to \$host format. -to_host_file_cmd=$lt_cv_to_host_file_cmd - -# convert \$build files to toolchain format. -to_tool_file_cmd=$lt_cv_to_tool_file_cmd - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method = "file_magic". -file_magic_cmd=$lt_file_magic_cmd - -# How to find potential files when deplibs_check_method = "file_magic". -file_magic_glob=$lt_file_magic_glob - -# Find potential files using nocaseglob when deplibs_check_method = "file_magic". -want_nocaseglob=$lt_want_nocaseglob - -# Command to associate shared and link libraries. -sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd - -# The archiver. -AR=$lt_AR - -# Flags to create an archive. -AR_FLAGS=$lt_AR_FLAGS - -# How to feed a file listing to the archiver. -archiver_list_spec=$lt_archiver_list_spec - -# A symbol stripping program. -STRIP=$lt_STRIP - -# Commands used to install an old-style archive. -RANLIB=$lt_RANLIB -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Whether to use a lock for old archive extraction. -lock_old_archive_extraction=$lock_old_archive_extraction - -# A C compiler. -LTCC=$lt_CC - -# LTCC compiler flags. -LTCFLAGS=$lt_CFLAGS - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration. -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair. -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# Transform the output of nm in a C name address pair when lib prefix is needed. -global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix - -# Specify filename containing input files for \$NM. -nm_file_list_spec=$lt_nm_file_list_spec - -# The root where to search for dependent libraries,and in which our libraries should be installed. -lt_sysroot=$lt_sysroot - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# Used to examine libraries when file_magic_cmd begins with "file". -MAGIC_CMD=$MAGIC_CMD - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Manifest tool. -MANIFEST_TOOL=$lt_MANIFEST_TOOL - -# Tool to manipulate archived DWARF debug symbol files on Mac OS X. -DSYMUTIL=$lt_DSYMUTIL - -# Tool to change global to local symbols on Mac OS X. -NMEDIT=$lt_NMEDIT - -# Tool to manipulate fat objects and archives on Mac OS X. -LIPO=$lt_LIPO - -# ldd/readelf like tool for Mach-O binaries on Mac OS X. -OTOOL=$lt_OTOOL - -# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. -OTOOL64=$lt_OTOOL64 - -# Old archive suffix (normally "a"). -libext=$libext - -# Shared library suffix (normally ".so"). -shrext_cmds=$lt_shrext_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at link time. -variables_saved_for_relink=$lt_variables_saved_for_relink - -# Do we need the "lib" prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Library versioning type. -version_type=$version_type - -# Shared library runtime path variable. -runpath_var=$runpath_var - -# Shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Permission mode override for installation of shared libraries. -install_override_mode=$lt_install_override_mode - -# Command to use after installation of a shared archive. -postinstall_cmds=$lt_postinstall_cmds - -# Command to use after uninstallation of a shared archive. -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# As "finish_cmds", except a single script fragment to be evaled but -# not shown. -finish_eval=$lt_finish_eval - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Compile-time system search path for libraries. -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries. -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - - -# The linker used to build libraries. -LD=$lt_LD - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds - -# A language specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU compiler? -with_gcc=$GCC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# If ld is used when linking, flag to hardcode \$libdir into a binary -# during linking. This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds - -# Commands necessary for finishing linking programs. -postlink_cmds=$lt_postlink_cmds - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs=$lt_compiler_lib_search_dirs - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects=$lt_predep_objects -postdep_objects=$lt_postdep_objects -predeps=$lt_predeps -postdeps=$lt_postdeps - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path - -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - -ltmain="$ac_aux_dir/ltmain.sh" - - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - if test x"$xsi_shell" = xyes; then - sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ -func_dirname ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_basename ()$/,/^} # func_basename /c\ -func_basename ()\ -{\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ -func_dirname_and_basename ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ -func_stripname ()\ -{\ -\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ -\ # positional parameters, so assign one to ordinary parameter first.\ -\ func_stripname_result=${3}\ -\ func_stripname_result=${func_stripname_result#"${1}"}\ -\ func_stripname_result=${func_stripname_result%"${2}"}\ -} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ -func_split_long_opt ()\ -{\ -\ func_split_long_opt_name=${1%%=*}\ -\ func_split_long_opt_arg=${1#*=}\ -} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ -func_split_short_opt ()\ -{\ -\ func_split_short_opt_arg=${1#??}\ -\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ -} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ -func_lo2o ()\ -{\ -\ case ${1} in\ -\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ -\ *) func_lo2o_result=${1} ;;\ -\ esac\ -} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_xform ()$/,/^} # func_xform /c\ -func_xform ()\ -{\ - func_xform_result=${1%.*}.lo\ -} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_arith ()$/,/^} # func_arith /c\ -func_arith ()\ -{\ - func_arith_result=$(( $* ))\ -} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_len ()$/,/^} # func_len /c\ -func_len ()\ -{\ - func_len_result=${#1}\ -} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - -fi - -if test x"$lt_shell_append" = xyes; then - sed -e '/^func_append ()$/,/^} # func_append /c\ -func_append ()\ -{\ - eval "${1}+=\\${2}"\ -} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ -func_append_quoted ()\ -{\ -\ func_quote_for_eval "${2}"\ -\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ -} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi - -if test x"$_lt_function_replace_fail" = x":"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 -$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} -fi - - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - - - cat <<_LT_EOF >> "$ofile" - -# ### BEGIN LIBTOOL TAG CONFIG: CXX - -# The linker used to build libraries. -LD=$lt_LD_CXX - -# How to create reloadable object files. -reload_flag=$lt_reload_flag_CXX -reload_cmds=$lt_reload_cmds_CXX - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds_CXX - -# A language specific compiler. -CC=$lt_compiler_CXX - -# Is the compiler the GNU compiler? -with_gcc=$GCC_CXX - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_CXX - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_CXX - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_CXX - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_CXX - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object_CXX - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds_CXX -archive_expsym_cmds=$lt_archive_expsym_cmds_CXX - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds_CXX -module_expsym_cmds=$lt_module_expsym_cmds_CXX - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld_CXX - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_CXX - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_CXX - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX - -# If ld is used when linking, flag to hardcode \$libdir into a binary -# during linking. This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct_CXX - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute_CXX - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L_CXX - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic_CXX - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath_CXX - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_CXX - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols_CXX - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_CXX - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_CXX - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_CXX - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds_CXX - -# Commands necessary for finishing linking programs. -postlink_cmds=$lt_postlink_cmds_CXX - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec_CXX - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_CXX - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects=$lt_predep_objects_CXX -postdep_objects=$lt_postdep_objects_CXX -predeps=$lt_predeps_CXX -postdeps=$lt_postdeps_CXX - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_CXX - -# ### END LIBTOOL TAG CONFIG: CXX -_LT_EOF - - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# 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 || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - - -abs_srcdir="`cd $srcdir && pwd`" -abs_builddir="`pwd`" -if test "$abs_srcdir" != "$abs_builddir"; then - make mkdir-init -fi diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/configure.in b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/configure.in deleted file mode 100644 index 7e968c46..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/configure.in +++ /dev/null @@ -1,155 +0,0 @@ -dnl configuration script for expat -dnl Process this file with autoconf to produce a configure script. -dnl -dnl Copyright 2000 Clark Cooper -dnl -dnl This file is part of EXPAT. -dnl -dnl EXPAT is free software; you can redistribute it and/or modify it -dnl under the terms of the License (based on the MIT/X license) contained -dnl in the file COPYING that comes with this distribution. -dnl - -dnl Ensure that Expat is configured with autoconf 2.58 or newer -AC_PREREQ(2.58) - -dnl Get the version number of Expat, using m4's esyscmd() command to run -dnl the command at m4-generation time. This allows us to create an m4 -dnl symbol holding the correct version number. AC_INIT() requires the -dnl version number at m4-time, rather than when ./configure is run, so -dnl all this must happen as part of m4, not as part of the shell code -dnl contained in ./configure. -dnl -dnl NOTE: esyscmd() is a GNU M4 extension. Thus, we wrap it in an appropriate -dnl test. I believe this test will work, but I don't have a place with non- -dnl GNU M4 to test it right now. -define([expat_version], ifdef([__gnu__], - [esyscmd(conftools/get-version.sh lib/expat.h)], - [2.1.x])) -AC_INIT(expat, expat_version, expat-bugs@libexpat.org) -undefine([expat_version]) - -AC_CONFIG_SRCDIR(Makefile.in) -AC_CONFIG_AUX_DIR(conftools) -AC_CONFIG_MACRO_DIR([m4]) - - -dnl -dnl Increment LIBREVISION if source code has changed at all -dnl -dnl If the API has changed, increment LIBCURRENT and set LIBREVISION to 0 -dnl -dnl If the API changes compatibly (i.e. simply adding a new function -dnl without changing or removing earlier interfaces), then increment LIBAGE. -dnl -dnl If the API changes incompatibly set LIBAGE back to 0 -dnl - -LIBCURRENT=7 -LIBREVISION=0 -LIBAGE=6 - -AC_CONFIG_HEADER(expat_config.h) - -sinclude(conftools/ac_c_bigendian_cross.m4) - -AC_LIBTOOL_WIN32_DLL -AC_PROG_LIBTOOL - -AC_SUBST(LIBCURRENT) -AC_SUBST(LIBREVISION) -AC_SUBST(LIBAGE) - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_CXX -AC_PROG_INSTALL - -if test "$GCC" = yes ; then - dnl - dnl Be careful about adding the -fexceptions option; some versions of - dnl GCC don't support it and it causes extra warnings that are only - dnl distracting; avoid. - dnl - OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes" - CFLAGS="$OLDCFLAGS -fexceptions" - AC_MSG_CHECKING(whether $CC accepts -fexceptions) - AC_TRY_LINK( , , - AC_MSG_RESULT(yes), - AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS") - CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'` -fi - -dnl Checks for header files. -AC_HEADER_STDC - -dnl Checks for typedefs, structures, and compiler characteristics. - -dnl Note: Avoid using AC_C_BIGENDIAN because it does not -dnl work in a cross compile. -AC_C_BIGENDIAN_CROSS - -AC_C_CONST -AC_TYPE_SIZE_T -AC_CHECK_FUNCS(memmove bcopy) - -dnl Only needed for xmlwf: -AC_CHECK_HEADERS(fcntl.h unistd.h) -AC_TYPE_OFF_T -AC_FUNC_MMAP - -if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then - FILEMAP=unixfilemap -else - FILEMAP=readfilemap -fi -AC_SUBST(FILEMAP) - -dnl Needed for the test support code; this was found at -dnl http://lists.gnu.org/archive/html/bug-autoconf/2002-07/msg00028.html - -# AC_CPP_FUNC -# ------------------ # -# Checks to see if ANSI C99 CPP variable __func__ works. -# If not, perhaps __FUNCTION__ works instead. -# If not, we'll just define __func__ to "". -AC_DEFUN([AC_CPP_FUNC], -[AC_REQUIRE([AC_PROG_CC_STDC])dnl -AC_CACHE_CHECK([for an ANSI C99-conforming __func__], ac_cv_cpp_func, -[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], -[[char *foo = __func__;]])], - [ac_cv_cpp_func=yes], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], -[[char *foo = __FUNCTION__;]])], - [ac_cv_cpp_func=__FUNCTION__], - [ac_cv_cpp_func=no])])]) -if test $ac_cv_cpp_func = __FUNCTION__; then - AC_DEFINE(__func__,__FUNCTION__, - [Define to __FUNCTION__ or "" if `__func__' does not conform to -ANSI C.]) -elif test $ac_cv_cpp_func = no; then - AC_DEFINE(__func__,"", - [Define to __FUNCTION__ or "" if `__func__' does not conform to -ANSI C.]) -fi -])# AC_CPP_FUNC - -AC_CPP_FUNC - - -dnl Some basic configuration: -AC_DEFINE([XML_NS], 1, - [Define to make XML Namespaces functionality available.]) -AC_DEFINE([XML_DTD], 1, - [Define to make parameter entity parsing functionality available.]) -AC_DEFINE([XML_CONTEXT_BYTES], 1024, - [Define to specify how much context to retain around the current parse point.]) - -AC_CONFIG_FILES([Makefile expat.pc]) -AC_OUTPUT - -abs_srcdir="`cd $srcdir && pwd`" -abs_builddir="`pwd`" -if test "$abs_srcdir" != "$abs_builddir"; then - make mkdir-init -fi diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/PrintPath b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/PrintPath deleted file mode 100644 index e8559a3d..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/PrintPath +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/sh -# Look for program[s] somewhere in $PATH. -# -# Options: -# -s -# Do not print out full pathname. (silent) -# -pPATHNAME -# Look in PATHNAME instead of $PATH -# -# Usage: -# PrintPath [-s] [-pPATHNAME] program [program ...] -# -# Initially written by Jim Jagielski for the Apache configuration mechanism -# (with kudos to Kernighan/Pike) -# -# This script falls under the Apache License. -# See http://www.apache.org/licenses/LICENSE - -## -# Some "constants" -## -pathname=$PATH -echo="yes" - -## -# Find out what OS we are running for later on -## -os=`(uname) 2>/dev/null` - -## -# Parse command line -## -for args in $* -do - case $args in - -s ) echo="no" ;; - -p* ) pathname="`echo $args | sed 's/^..//'`" ;; - * ) programs="$programs $args" ;; - esac -done - -## -# Now we make the adjustments required for OS/2 and everyone -# else :) -# -# First of all, all OS/2 programs have the '.exe' extension. -# Next, we adjust PATH (or what was given to us as PATH) to -# be whitespace separated directories. -# Finally, we try to determine the best flag to use for -# test/[] to look for an executable file. OS/2 just has '-r' -# but with other OSs, we do some funny stuff to check to see -# if test/[] knows about -x, which is the preferred flag. -## - -if [ "x$os" = "xOS/2" ] -then - ext=".exe" - pathname=`echo -E $pathname | - sed 's/^;/.;/ - s/;;/;.;/g - s/;$/;./ - s/;/ /g - s/\\\\/\\//g' ` - test_exec_flag="-r" -else - ext="" # No default extensions - pathname=`echo $pathname | - sed 's/^:/.:/ - s/::/:.:/g - s/:$/:./ - s/:/ /g' ` - # Here is how we test to see if test/[] can handle -x - testfile="pp.t.$$" - - cat > $testfile </dev/null`; then - test_exec_flag="-x" - else - test_exec_flag="-r" - fi - rm -f $testfile -fi - -for program in $programs -do - for path in $pathname - do - if [ $test_exec_flag $path/${program}${ext} ] && \ - [ ! -d $path/${program}${ext} ]; then - if [ "x$echo" = "xyes" ]; then - echo $path/${program}${ext} - fi - exit 0 - fi - -# Next try without extension (if one was used above) - if [ "x$ext" != "x" ]; then - if [ $test_exec_flag $path/${program} ] && \ - [ ! -d $path/${program} ]; then - if [ "x$echo" = "xyes" ]; then - echo $path/${program} - fi - exit 0 - fi - fi - done -done -exit 1 - diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/ac_c_bigendian_cross.m4 b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/ac_c_bigendian_cross.m4 deleted file mode 100644 index 67577364..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/ac_c_bigendian_cross.m4 +++ /dev/null @@ -1,81 +0,0 @@ -dnl @synopsis AC_C_BIGENDIAN_CROSS -dnl -dnl Check endianess even when crosscompiling -dnl (partially based on the original AC_C_BIGENDIAN). -dnl -dnl The implementation will create a binary, and instead of running -dnl the binary it will be grep'ed for some symbols that will look -dnl different for different endianess of the binary. -dnl -dnl @version $Id: ac_c_bigendian_cross.m4,v 1.1 2012/06/15 13:38:48 dromagod Exp $ -dnl @author Guido Draheim -dnl -AC_DEFUN([AC_C_BIGENDIAN_CROSS], -[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian, -[ac_cv_c_bigendian=unknown -# See if sys/param.h defines the BYTE_ORDER macro. -AC_TRY_COMPILE([#include -#include ], [ -#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN - bogus endian macros -#endif], [# It does; now see whether it defined to BIG_ENDIAN or not. -AC_TRY_COMPILE([#include -#include ], [ -#if BYTE_ORDER != BIG_ENDIAN - not big endian -#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) -if test $ac_cv_c_bigendian = unknown; then -AC_TRY_RUN([main () { - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long l; - char c[sizeof (long)]; - } u; - u.l = 1; - exit (u.c[sizeof (long) - 1] == 1); -}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes, -[ echo $ac_n "cross-compiling... " 2>&AC_FD_MSG ]) -fi]) -if test $ac_cv_c_bigendian = unknown; then -AC_MSG_CHECKING(to probe for byte ordering) -[ -cat >conftest.c <&AC_FD_MSG - ac_cv_c_bigendian=yes - fi - if test `grep -l LiTTleEnDian conftest.o` ; then - echo $ac_n ' little endian probe OK, ' 1>&AC_FD_MSG - if test $ac_cv_c_bigendian = yes ; then - ac_cv_c_bigendian=unknown; - else - ac_cv_c_bigendian=no - fi - fi - echo $ac_n 'guessing bigendian ... ' >&AC_FD_MSG - fi - fi -AC_MSG_RESULT($ac_cv_c_bigendian) -fi -if test $ac_cv_c_bigendian = yes; then - AC_DEFINE(WORDS_BIGENDIAN, 1, [whether byteorder is bigendian]) - BYTEORDER=4321 -else - BYTEORDER=1234 -fi -AC_DEFINE_UNQUOTED(BYTEORDER, $BYTEORDER, [1234 = LIL_ENDIAN, 4321 = BIGENDIAN]) -if test $ac_cv_c_bigendian = unknown; then - AC_MSG_ERROR(unknown endianess - sorry, please pre-set ac_cv_c_bigendian) -fi -]) diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/config.guess b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/config.guess deleted file mode 100644 index 40eaed48..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/config.guess +++ /dev/null @@ -1,1517 +0,0 @@ -#! /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, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. - -timestamp='2011-05-11' - -# 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 (context -# diff format) to and include a 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. -# -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD - -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, 2006, 2007, 2008, 2009, 2010, 2011 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 ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/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 -q __LP64__ - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - amd64) - echo x86_64-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 ;; - *: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 ;; - *:Interix*:*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-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 ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-gnu - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi - else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf - fi - fi - exit ;; - avr32*: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 ;; - i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - 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:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-gnu - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - 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 ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-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 ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-tilera-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - 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 ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; -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: diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/config.sub b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/config.sub deleted file mode 100644 index 30fdca81..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/config.sub +++ /dev/null @@ -1,1760 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. - -timestamp='2011-03-23' - -# 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 GNU 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. - -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - 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 | avr32 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 \ - | ns16k | ns32k \ - | open8 \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) - # 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 - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | 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-* | avr32-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile-* | tilegx-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'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 - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze) - basic_machine=microblaze-xilinx - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - 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 - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - # This must be matched before tile*. - tilegx*) - basic_machine=tilegx-unknown - os=-linux-gnu - ;; - tile*) - basic_machine=tile-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -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* | -toppers* | -drops* | -es*) - # 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 - ;; - -dicos*) - os=-dicos - ;; - -nacl*) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/expat.m4 b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/expat.m4 deleted file mode 100644 index 57e579b3..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/expat.m4 +++ /dev/null @@ -1,43 +0,0 @@ -dnl Check if --with-expat[=PREFIX] is specified and -dnl Expat >= 1.95.0 is installed in the system. -dnl If yes, substitute EXPAT_CFLAGS, EXPAT_LIBS with regard to -dnl the specified PREFIX and set with_expat to PREFIX, or 'yes' if PREFIX -dnl has not been specified. Also HAVE_LIBEXPAT, HAVE_EXPAT_H are defined. -dnl If --with-expat has not been specified, set with_expat to 'no'. -dnl In addition, an Automake conditional EXPAT_INSTALLED is set accordingly. -dnl This is necessary to adapt a whole lot of packages that have expat -dnl bundled as a static library. -AC_DEFUN([AM_WITH_EXPAT], -[ AC_ARG_WITH(expat, - [ --with-expat=PREFIX Use system Expat library], - , with_expat=no) - - AM_CONDITIONAL(EXPAT_INSTALLED, test $with_expat != no) - - EXPAT_CFLAGS= - EXPAT_LIBS= - if test $with_expat != no; then - if test $with_expat != yes; then - EXPAT_CFLAGS="-I$with_expat/include" - EXPAT_LIBS="-L$with_expat/lib" - fi - AC_CHECK_LIB(expat, XML_ParserCreate, - [ EXPAT_LIBS="$EXPAT_LIBS -lexpat" - expat_found=yes ], - [ expat_found=no ], - "$EXPAT_LIBS") - if test $expat_found = no; then - AC_MSG_ERROR([Could not find the Expat library]) - fi - expat_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $EXPAT_CFLAGS" - AC_CHECK_HEADERS(expat.h, , expat_found=no) - if test $expat_found = no; then - AC_MSG_ERROR([Could not find expat.h]) - fi - CFLAGS="$expat_save_CFLAGS" - fi - - AC_SUBST(EXPAT_CFLAGS) - AC_SUBST(EXPAT_LIBS) -]) diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/get-version.sh b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/get-version.sh deleted file mode 100644 index a70e0fb4..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/get-version.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -# -# USAGE: get-version.sh path/to/expat.h -# -# This script will print Expat's version number on stdout. For example: -# -# $ ./conftools/get-version.sh ./lib/expat.h -# 1.95.3 -# $ -# - -if test $# = 0; then - echo "ERROR: pathname for expat.h was not provided." - echo "" - echo "USAGE: $0 path/to/expat.h" - exit 1 -fi -if test $# != 1; then - echo "ERROR: too many arguments were provided." - echo "" - echo "USAGE: $0 path/to/expat.h" - exit 1 -fi - -hdr="$1" -if test ! -r "$hdr"; then - echo "ERROR: '$hdr' does not exist, or is not readable." - exit 1 -fi - -MAJOR_VERSION="`sed -n -e '/MAJOR_VERSION/s/[^0-9]*//gp' $hdr`" -MINOR_VERSION="`sed -n -e '/MINOR_VERSION/s/[^0-9]*//gp' $hdr`" -MICRO_VERSION="`sed -n -e '/MICRO_VERSION/s/[^0-9]*//gp' $hdr`" - -# Determine how to tell echo not to print the trailing \n. This is -# similar to Autoconf's @ECHO_C@ and @ECHO_N@; however, we don't -# generate this file via autoconf (in fact, get-version.sh is used -# to *create* ./configure), so we just do something similar inline. -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ;; - *c*,* ) ECHO_N=-n ECHO_C= ;; - *) ECHO_N= ECHO_C='\c' ;; -esac - -echo $ECHO_N "$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$ECHO_C" diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/install-sh b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/install-sh deleted file mode 100644 index 6781b987..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/install-sh +++ /dev/null @@ -1,520 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2009-04-28.21; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -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: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) dst_arg=$2 - shift;; - - -T) no_target_directory=true;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - trap '(exit $?); exit' 1 2 13 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dst_arg - # 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: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - -*) prefix='./';; - *) prefix='';; - esac - - eval "$initialize_posix_glob" - - oIFS=$IFS - IFS=/ - $posix_glob set -f - set fnord $dstdir - shift - $posix_glob set +f - IFS=$oIFS - - prefixes= - - for d - do - test -z "$d" && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/ltmain.sh b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/ltmain.sh deleted file mode 100644 index b4a3231c..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/ltmain.sh +++ /dev/null @@ -1,9642 +0,0 @@ - -# libtool (GNU libtool) 2.4 -# Written by Gordon Matzigkeit , 1996 - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# GNU Libtool is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# Usage: $progname [OPTION]... [MODE-ARG]... -# -# Provide generalized library-building support services. -# -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --no-quiet, --no-silent -# print informational messages (default) -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print more informational messages than default -# --no-verbose don't print the extra informational messages -# --version print version information -# -h, --help, --help-all print short, long, or detailed help message -# -# MODE must be one of the following: -# -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory -# -# MODE-ARGS vary depending on the MODE. When passed as first option, -# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. -# Try `$progname --help --mode=MODE' for a more detailed description of MODE. -# -# When reporting a bug, please describe a test case to reproduce it and -# include the following information: -# -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4 Debian-2.4-2ubuntu1 -# automake: $automake_version -# autoconf: $autoconf_version -# -# Report bugs to . -# GNU libtool home page: . -# General help using GNU software: . - -PROGRAM=libtool -PACKAGE=libtool -VERSION="2.4 Debian-2.4-2ubuntu1" -TIMESTAMP="" -package_revision=1.3293 - -# 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+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - -# NLS nuisances: We save the old values to restore during execute mode. -lt_user_locale= -lt_safe_locale= -for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES -do - eval "if test \"\${$lt_var+set}\" = set; then - save_$lt_var=\$$lt_var - $lt_var=C - export $lt_var - lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" - lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" - fi" -done -LC_ALL=C -LANGUAGE=C -export LANGUAGE LC_ALL - -$lt_unset CDPATH - - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - - - -: ${CP="cp -f"} -test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} -: ${EGREP="/bin/grep -E"} -: ${FGREP="/bin/grep -F"} -: ${GREP="/bin/grep"} -: ${LN_S="ln -s"} -: ${MAKE="make"} -: ${MKDIR="mkdir"} -: ${MV="mv -f"} -: ${RM="rm -f"} -: ${SED="/bin/sed"} -: ${SHELL="${CONFIG_SHELL-/bin/sh}"} -: ${Xsed="$SED -e 1s/^X//"} - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. -EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. - -exit_status=$EXIT_SUCCESS - -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" - -dirname="s,/[^/]*$,," -basename="s,^.*/,," - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} # func_dirname may be replaced by extended shell implementation - - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} # func_basename may be replaced by extended shell implementation - - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` -} # func_dirname_and_basename may be replaced by extended shell implementation - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname may be replaced by extended shell implementation - - -# These SED scripts presuppose an absolute path with a trailing slash. -pathcar='s,^/\([^/]*\).*$,\1,' -pathcdr='s,^/[^/]*,,' -removedotparts=':dotsl - s@/\./@/@g - t dotsl - s,/\.$,/,' -collapseslashes='s@/\{1,\}@/@g' -finalslash='s,/*$,/,' - -# func_normal_abspath PATH -# Remove doubled-up and trailing slashes, "." path components, -# and cancel out any ".." path components in PATH after making -# it an absolute path. -# value returned in "$func_normal_abspath_result" -func_normal_abspath () -{ - # Start from root dir and reassemble the path. - func_normal_abspath_result= - func_normal_abspath_tpath=$1 - func_normal_abspath_altnamespace= - case $func_normal_abspath_tpath in - "") - # Empty path, that just means $cwd. - func_stripname '' '/' "`pwd`" - func_normal_abspath_result=$func_stripname_result - return - ;; - # The next three entries are used to spot a run of precisely - # two leading slashes without using negated character classes; - # we take advantage of case's first-match behaviour. - ///*) - # Unusual form of absolute path, do nothing. - ;; - //*) - # Not necessarily an ordinary path; POSIX reserves leading '//' - # and for example Cygwin uses it to access remote file shares - # over CIFS/SMB, so we conserve a leading double slash if found. - func_normal_abspath_altnamespace=/ - ;; - /*) - # Absolute path, do nothing. - ;; - *) - # Relative path, prepend $cwd. - func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath - ;; - esac - # Cancel out all the simple stuff to save iterations. We also want - # the path to end with a slash for ease of parsing, so make sure - # there is one (and only one) here. - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` - while :; do - # Processed it all yet? - if test "$func_normal_abspath_tpath" = / ; then - # If we ascended to the root using ".." the result may be empty now. - if test -z "$func_normal_abspath_result" ; then - func_normal_abspath_result=/ - fi - break - fi - func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcar"` - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcdr"` - # Figure out what to do with it - case $func_normal_abspath_tcomponent in - "") - # Trailing empty path component, ignore it. - ;; - ..) - # Parent dir; strip last assembled component from result. - func_dirname "$func_normal_abspath_result" - func_normal_abspath_result=$func_dirname_result - ;; - *) - # Actual path component, append it. - func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent - ;; - esac - done - # Restore leading double-slash if one was found on entry. - func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result -} - -# func_relative_path SRCDIR DSTDIR -# generates a relative path from SRCDIR to DSTDIR, with a trailing -# slash if non-empty, suitable for immediately appending a filename -# without needing to append a separator. -# value returned in "$func_relative_path_result" -func_relative_path () -{ - func_relative_path_result= - func_normal_abspath "$1" - func_relative_path_tlibdir=$func_normal_abspath_result - func_normal_abspath "$2" - func_relative_path_tbindir=$func_normal_abspath_result - - # Ascend the tree starting from libdir - while :; do - # check if we have found a prefix of bindir - case $func_relative_path_tbindir in - $func_relative_path_tlibdir) - # found an exact match - func_relative_path_tcancelled= - break - ;; - $func_relative_path_tlibdir*) - # found a matching prefix - func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" - func_relative_path_tcancelled=$func_stripname_result - if test -z "$func_relative_path_result"; then - func_relative_path_result=. - fi - break - ;; - *) - func_dirname $func_relative_path_tlibdir - func_relative_path_tlibdir=${func_dirname_result} - if test "x$func_relative_path_tlibdir" = x ; then - # Have to descend all the way to the root! - func_relative_path_result=../$func_relative_path_result - func_relative_path_tcancelled=$func_relative_path_tbindir - break - fi - func_relative_path_result=../$func_relative_path_result - ;; - esac - done - - # Now calculate path; take care to avoid doubling-up slashes. - func_stripname '' '/' "$func_relative_path_result" - func_relative_path_result=$func_stripname_result - func_stripname '/' '/' "$func_relative_path_tcancelled" - if test "x$func_stripname_result" != x ; then - func_relative_path_result=${func_relative_path_result}/${func_stripname_result} - fi - - # Normalisation. If bindir is libdir, return empty string, - # else relative path ending with a slash; either way, target - # file name can be directly appended. - if test ! -z "$func_relative_path_result"; then - func_stripname './' '' "$func_relative_path_result/" - func_relative_path_result=$func_stripname_result - fi -} - -# The name of this program: -func_dirname_and_basename "$progpath" -progname=$func_basename_result - -# Make sure we have an absolute path for reexecution: -case $progpath in - [\\/]*|[A-Za-z]:\\*) ;; - *[\\/]*) - progdir=$func_dirname_result - progdir=`cd "$progdir" && pwd` - progpath="$progdir/$progname" - ;; - *) - save_IFS="$IFS" - IFS=: - for progdir in $PATH; do - IFS="$save_IFS" - test -x "$progdir/$progname" && break - done - IFS="$save_IFS" - test -n "$progdir" || progdir=`pwd` - progpath="$progdir/$progname" - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution that turns a string into a regex matching for the -# string literally. -sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' - -# Sed substitution that converts a w32 file name or path -# which contains forward slashes, into one that contains -# (escaped) backslashes. A very naive implementation. -lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - -# Re-`\' parameter expansions in output of double_quote_subst that were -# `\'-ed in input to the same. If an odd number of `\' preceded a '$' -# in input to double_quote_subst, that '$' was protected from expansion. -# Since each input `\' is now two `\'s, look for any number of runs of -# four `\'s followed by two `\'s and then a '$'. `\' that '$'. -bs='\\' -bs2='\\\\' -bs4='\\\\\\\\' -dollar='\$' -sed_double_backslash="\ - s/$bs4/&\\ -/g - s/^$bs2$dollar/$bs&/ - s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g - s/\n//g" - -# Standard options: -opt_dry_run=false -opt_help=false -opt_quiet=false -opt_verbose=false -opt_warning=: - -# func_echo arg... -# Echo program name prefixed message, along with the current mode -# name if it has been set yet. -func_echo () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }$*" -} - -# func_verbose arg... -# Echo program name prefixed message in verbose mode only. -func_verbose () -{ - $opt_verbose && func_echo ${1+"$@"} - - # A bug in bash halts the script if the last line of a function - # fails when set -e is in force, so we need another command to - # work around that: - : -} - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -# func_error arg... -# Echo program name prefixed message to standard error. -func_error () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 -} - -# func_warning arg... -# Echo program name prefixed warning message to standard error. -func_warning () -{ - $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 - - # bash bug again: - : -} - -# func_fatal_error arg... -# Echo program name prefixed message to standard error, and exit. -func_fatal_error () -{ - func_error ${1+"$@"} - exit $EXIT_FAILURE -} - -# func_fatal_help arg... -# Echo program name prefixed message to standard error, followed by -# a help hint, and exit. -func_fatal_help () -{ - func_error ${1+"$@"} - func_fatal_error "$help" -} -help="Try \`$progname --help' for more information." ## default - - -# func_grep expression filename -# Check whether EXPRESSION matches any line of FILENAME, without output. -func_grep () -{ - $GREP "$1" "$2" >/dev/null 2>&1 -} - - -# func_mkdir_p directory-path -# Make sure the entire path to DIRECTORY-PATH is available. -func_mkdir_p () -{ - my_directory_path="$1" - my_dir_list= - - if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then - - # Protect directory names starting with `-' - case $my_directory_path in - -*) my_directory_path="./$my_directory_path" ;; - esac - - # While some portion of DIR does not yet exist... - while test ! -d "$my_directory_path"; do - # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. - my_dir_list="$my_directory_path:$my_dir_list" - - # If the last portion added has no slash in it, the list is done - case $my_directory_path in */*) ;; *) break ;; esac - - # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` - done - my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` - - save_mkdir_p_IFS="$IFS"; IFS=':' - for my_dir in $my_dir_list; do - IFS="$save_mkdir_p_IFS" - # mkdir can fail with a `File exist' error if two processes - # try to create one of the directories concurrently. Don't - # stop in that case! - $MKDIR "$my_dir" 2>/dev/null || : - done - IFS="$save_mkdir_p_IFS" - - # Bail out if we (or some other process) failed to create a directory. - test -d "$my_directory_path" || \ - func_fatal_error "Failed to create \`$1'" - fi -} - - -# func_mktempdir [string] -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. -func_mktempdir () -{ - my_template="${TMPDIR-/tmp}/${1-$progname}" - - if test "$opt_dry_run" = ":"; then - # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" - else - - # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` - - if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" - - save_mktempdir_umask=`umask` - umask 0077 - $MKDIR "$my_tmpdir" - umask $save_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || \ - func_fatal_error "cannot create temporary directory \`$my_tmpdir'" - fi - - $ECHO "$my_tmpdir" -} - - -# func_quote_for_eval arg -# Aesthetically quote ARG to be evaled later. -# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT -# is double-quoted, suitable for a subsequent eval, whereas -# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters -# which are still active within double quotes backslashified. -func_quote_for_eval () -{ - case $1 in - *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; - *) - func_quote_for_eval_unquoted_result="$1" ;; - esac - - case $func_quote_for_eval_unquoted_result in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and and variable - # expansion for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" - ;; - *) - func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" - esac -} - - -# func_quote_for_expand arg -# Aesthetically quote ARG to be evaled later; same as above, -# but do not quote variable references. -func_quote_for_expand () -{ - case $1 in - *[\\\`\"]*) - my_arg=`$ECHO "$1" | $SED \ - -e "$double_quote_subst" -e "$sed_double_backslash"` ;; - *) - my_arg="$1" ;; - esac - - case $my_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting and command substitution for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - my_arg="\"$my_arg\"" - ;; - esac - - func_quote_for_expand_result="$my_arg" -} - - -# func_show_eval cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. -func_show_eval () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$my_cmd" - my_status=$? - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - -# func_show_eval_locale cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. Use the saved locale for evaluation. -func_show_eval_locale () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$lt_user_locale - $my_cmd" - my_status=$? - eval "$lt_safe_locale" - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - -# func_tr_sh -# Turn $1 into a string suitable for a shell variable name. -# Result is stored in $func_tr_sh_result. All characters -# not in the set a-zA-Z0-9_ are replaced with '_'. Further, -# if $1 begins with a digit, a '_' is prepended as well. -func_tr_sh () -{ - case $1 in - [0-9]* | *[!a-zA-Z0-9_]*) - func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` - ;; - * ) - func_tr_sh_result=$1 - ;; - esac -} - - -# func_version -# Echo version message to standard output and exit. -func_version () -{ - $opt_debug - - $SED -n '/(C)/!b go - :more - /\./!{ - N - s/\n# / / - b more - } - :go - /^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# // - s/^# *$// - s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ - p - }' < "$progpath" - exit $? -} - -# func_usage -# Echo short help message to standard output and exit. -func_usage () -{ - $opt_debug - - $SED -n '/^# Usage:/,/^# *.*--help/ { - s/^# // - s/^# *$// - s/\$progname/'$progname'/ - p - }' < "$progpath" - echo - $ECHO "run \`$progname --help | more' for full usage" - exit $? -} - -# func_help [NOEXIT] -# Echo long help message to standard output and exit, -# unless 'noexit' is passed as argument. -func_help () -{ - $opt_debug - - $SED -n '/^# Usage:/,/# Report bugs to/ { - :print - s/^# // - s/^# *$// - s*\$progname*'$progname'* - s*\$host*'"$host"'* - s*\$SHELL*'"$SHELL"'* - s*\$LTCC*'"$LTCC"'* - s*\$LTCFLAGS*'"$LTCFLAGS"'* - s*\$LD*'"$LD"'* - s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ - p - d - } - /^# .* home page:/b print - /^# General help using/b print - ' < "$progpath" - ret=$? - if test -z "$1"; then - exit $ret - fi -} - -# func_missing_arg argname -# Echo program name prefixed message to standard error and set global -# exit_cmd. -func_missing_arg () -{ - $opt_debug - - func_error "missing argument for $1." - exit_cmd=exit -} - - -# func_split_short_opt shortopt -# Set func_split_short_opt_name and func_split_short_opt_arg shell -# variables after splitting SHORTOPT after the 2nd character. -func_split_short_opt () -{ - my_sed_short_opt='1s/^\(..\).*$/\1/;q' - my_sed_short_rest='1s/^..\(.*\)$/\1/;q' - - func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` - func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` -} # func_split_short_opt may be replaced by extended shell implementation - - -# func_split_long_opt longopt -# Set func_split_long_opt_name and func_split_long_opt_arg shell -# variables after splitting LONGOPT at the `=' sign. -func_split_long_opt () -{ - my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' - my_sed_long_arg='1s/^--[^=]*=//' - - func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` - func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` -} # func_split_long_opt may be replaced by extended shell implementation - -exit_cmd=: - - - - - -magic="%%%MAGIC variable%%%" -magic_exe="%%%MAGIC EXE variable%%%" - -# Global variables. -nonopt= -preserve_args= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" -extracted_archives= -extracted_serial=0 - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "${1}=\$${1}\${2}" -} # func_append may be replaced by extended shell implementation - -# func_append_quoted var value -# Quote VALUE and append to the end of shell variable VAR, separated -# by a space. -func_append_quoted () -{ - func_quote_for_eval "${2}" - eval "${1}=\$${1}\\ \$func_quote_for_eval_result" -} # func_append_quoted may be replaced by extended shell implementation - - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "${@}"` -} # func_arith may be replaced by extended shell implementation - - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` -} # func_len may be replaced by extended shell implementation - - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` -} # func_lo2o may be replaced by extended shell implementation - - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` -} # func_xform may be replaced by extended shell implementation - - -# func_fatal_configuration arg... -# Echo program name prefixed message to standard error, followed by -# a configuration failure hint, and exit. -func_fatal_configuration () -{ - func_error ${1+"$@"} - func_error "See the $PACKAGE documentation for more information." - func_fatal_error "Fatal configuration error." -} - - -# func_config -# Display the configuration for all the tags in this script. -func_config () -{ - re_begincf='^# ### BEGIN LIBTOOL' - re_endcf='^# ### END LIBTOOL' - - # Default configuration. - $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" - - # Now print the configurations for the tags. - for tagname in $taglist; do - $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" - done - - exit $? -} - -# func_features -# Display the features supported by this script. -func_features () -{ - echo "host: $host" - if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" - else - echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - echo "enable static libraries" - else - echo "disable static libraries" - fi - - exit $? -} - -# func_enable_tag tagname -# Verify that TAGNAME is valid, and either flag an error and exit, or -# enable the TAGNAME tag. We also add TAGNAME to the global $taglist -# variable here. -func_enable_tag () -{ - # Global variable: - tagname="$1" - - re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" - re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" - sed_extractcf="/$re_begincf/,/$re_endcf/p" - - # Validate tagname. - case $tagname in - *[!-_A-Za-z0-9,/]*) - func_fatal_error "invalid tag name: $tagname" - ;; - esac - - # Don't test for the "default" C tag, as we know it's - # there but not specially marked. - case $tagname in - CC) ;; - *) - if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then - taglist="$taglist $tagname" - - # Evaluate the configuration. Be careful to quote the path - # and the sed script, to avoid splitting on whitespace, but - # also don't use non-portable quotes within backquotes within - # quotes we have to do it in 2 steps: - extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` - eval "$extractedcf" - else - func_error "ignoring unknown tag $tagname" - fi - ;; - esac -} - -# func_check_version_match -# Ensure that we are using m4 macros, and libtool script from the same -# release of libtool. -func_check_version_match () -{ - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from an older release. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - fi - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, -$progname: but the definition of this LT_INIT comes from revision $macro_revision. -$progname: You should recreate aclocal.m4 with macros from revision $package_revision -$progname: of $PACKAGE $VERSION and run autoconf again. -_LT_EOF - fi - - exit $EXIT_MISMATCH - fi -} - - -# Shorthand for --mode=foo, only valid as the first argument -case $1 in -clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; -compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; -execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; -finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; -install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; -link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; -uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; -esac - - - -# Option defaults: -opt_debug=: -opt_dry_run=false -opt_config=false -opt_preserve_dup_deps=false -opt_features=false -opt_finish=false -opt_help=false -opt_help_all=false -opt_silent=: -opt_verbose=: -opt_silent=false -opt_verbose=false - - -# Parse options once, thoroughly. This comes as soon as possible in the -# script to make things like `--version' happen as quickly as we can. -{ - # this just eases exit handling - while test $# -gt 0; do - opt="$1" - shift - case $opt in - --debug|-x) opt_debug='set -x' - func_echo "enabling shell trace mode" - $opt_debug - ;; - --dry-run|--dryrun|-n) - opt_dry_run=: - ;; - --config) - opt_config=: -func_config - ;; - --dlopen|-dlopen) - optarg="$1" - opt_dlopen="${opt_dlopen+$opt_dlopen -}$optarg" - shift - ;; - --preserve-dup-deps) - opt_preserve_dup_deps=: - ;; - --features) - opt_features=: -func_features - ;; - --finish) - opt_finish=: -set dummy --mode finish ${1+"$@"}; shift - ;; - --help) - opt_help=: - ;; - --help-all) - opt_help_all=: -opt_help=': help-all' - ;; - --mode) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_mode="$optarg" -case $optarg in - # Valid mode arguments: - clean|compile|execute|finish|install|link|relink|uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; -esac - shift - ;; - --no-silent|--no-quiet) - opt_silent=false -func_append preserve_args " $opt" - ;; - --no-verbose) - opt_verbose=false -func_append preserve_args " $opt" - ;; - --silent|--quiet) - opt_silent=: -func_append preserve_args " $opt" - opt_verbose=false - ;; - --verbose|-v) - opt_verbose=: -func_append preserve_args " $opt" -opt_silent=false - ;; - --tag) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_tag="$optarg" -func_append preserve_args " $opt $optarg" -func_enable_tag "$optarg" - shift - ;; - - -\?|-h) func_usage ;; - --help) func_help ;; - --version) func_version ;; - - # Separate optargs to long options: - --*=*) - func_split_long_opt "$opt" - set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} - shift - ;; - - # Separate non-argument short options: - -\?*|-h*|-n*|-v*) - func_split_short_opt "$opt" - set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} - shift - ;; - - --) break ;; - -*) func_fatal_help "unrecognized option \`$opt'" ;; - *) set dummy "$opt" ${1+"$@"}; shift; break ;; - esac - done - - # Validate options: - - # save first non-option argument - if test "$#" -gt 0; then - nonopt="$opt" - shift - fi - - # preserve --debug - test "$opt_debug" = : || func_append preserve_args " --debug" - - case $host in - *cygwin* | *mingw* | *pw32* | *cegcc*) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: - ;; - *) - opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps - ;; - esac - - $opt_help || { - # Sanity checks first: - func_check_version_match - - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi - - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$opt_dlopen" && test "$opt_mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$opt_mode' for more information." - } - - - # Bail if the options were screwed - $exit_cmd $EXIT_FAILURE -} - - - - -## ----------- ## -## Main. ## -## ----------- ## - -# func_lalib_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_lalib_p () -{ - test -f "$1" && - $SED -e 4q "$1" 2>/dev/null \ - | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 -} - -# func_lalib_unsafe_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function implements the same check as func_lalib_p without -# resorting to external programs. To this end, it redirects stdin and -# closes it afterwards, without saving the original file descriptor. -# As a safety measure, use it only where a negative result would be -# fatal anyway. Works if `file' does not exist. -func_lalib_unsafe_p () -{ - lalib_p=no - if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then - for lalib_p_l in 1 2 3 4 - do - read lalib_p_line - case "$lalib_p_line" in - \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; - esac - done - exec 0<&5 5<&- - fi - test "$lalib_p" = yes -} - -# func_ltwrapper_script_p file -# True iff FILE is a libtool wrapper script -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_script_p () -{ - func_lalib_p "$1" -} - -# func_ltwrapper_executable_p file -# True iff FILE is a libtool wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_executable_p () -{ - func_ltwrapper_exec_suffix= - case $1 in - *.exe) ;; - *) func_ltwrapper_exec_suffix=.exe ;; - esac - $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 -} - -# func_ltwrapper_scriptname file -# Assumes file is an ltwrapper_executable -# uses $file to determine the appropriate filename for a -# temporary ltwrapper_script. -func_ltwrapper_scriptname () -{ - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" -} - -# func_ltwrapper_p file -# True iff FILE is a libtool wrapper script or wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_p () -{ - func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" -} - - -# func_execute_cmds commands fail_cmd -# Execute tilde-delimited COMMANDS. -# If FAIL_CMD is given, eval that upon failure. -# FAIL_CMD may read-access the current command in variable CMD! -func_execute_cmds () -{ - $opt_debug - save_ifs=$IFS; IFS='~' - for cmd in $1; do - IFS=$save_ifs - eval cmd=\"$cmd\" - func_show_eval "$cmd" "${2-:}" - done - IFS=$save_ifs -} - - -# func_source file -# Source FILE, adding directory component if necessary. -# Note that it is not necessary on cygwin/mingw to append a dot to -# FILE even if both FILE and FILE.exe exist: automatic-append-.exe -# behavior happens only for exec(3), not for open(2)! Also, sourcing -# `FILE.' does not work on cygwin managed mounts. -func_source () -{ - $opt_debug - case $1 in - */* | *\\*) . "$1" ;; - *) . "./$1" ;; - esac -} - - -# func_resolve_sysroot PATH -# Replace a leading = in PATH with a sysroot. Store the result into -# func_resolve_sysroot_result -func_resolve_sysroot () -{ - func_resolve_sysroot_result=$1 - case $func_resolve_sysroot_result in - =*) - func_stripname '=' '' "$func_resolve_sysroot_result" - func_resolve_sysroot_result=$lt_sysroot$func_stripname_result - ;; - esac -} - -# func_replace_sysroot PATH -# If PATH begins with the sysroot, replace it with = and -# store the result into func_replace_sysroot_result. -func_replace_sysroot () -{ - case "$lt_sysroot:$1" in - ?*:"$lt_sysroot"*) - func_stripname "$lt_sysroot" '' "$1" - func_replace_sysroot_result="=$func_stripname_result" - ;; - *) - # Including no sysroot. - func_replace_sysroot_result=$1 - ;; - esac -} - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () -{ - $opt_debug - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - func_append_quoted CC_quoted "$arg" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - func_append_quoted CC_quoted "$arg" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case "$@ " in - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - func_echo "unable to infer tagged configuration" - func_fatal_error "specify a tag with \`--tag'" -# else -# func_verbose "using $tagname tagged configuration" - fi - ;; - esac - fi -} - - - -# func_write_libtool_object output_name pic_name nonpic_name -# Create a libtool object file (analogous to a ".la" file), -# but don't create it if we're doing a dry run. -func_write_libtool_object () -{ - write_libobj=${1} - if test "$build_libtool_libs" = yes; then - write_lobj=\'${2}\' - else - write_lobj=none - fi - - if test "$build_old_libs" = yes; then - write_oldobj=\'${3}\' - else - write_oldobj=none - fi - - $opt_dry_run || { - cat >${write_libobj}T </dev/null` - if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then - func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | - $SED -e "$lt_sed_naive_backslashify"` - else - func_convert_core_file_wine_to_w32_result= - fi - fi -} -# end: func_convert_core_file_wine_to_w32 - - -# func_convert_core_path_wine_to_w32 ARG -# Helper function used by path conversion functions when $build is *nix, and -# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly -# configured wine environment available, with the winepath program in $build's -# $PATH. Assumes ARG has no leading or trailing path separator characters. -# -# ARG is path to be converted from $build format to win32. -# Result is available in $func_convert_core_path_wine_to_w32_result. -# Unconvertible file (directory) names in ARG are skipped; if no directory names -# are convertible, then the result may be empty. -func_convert_core_path_wine_to_w32 () -{ - $opt_debug - # unfortunately, winepath doesn't convert paths, only file names - func_convert_core_path_wine_to_w32_result="" - if test -n "$1"; then - oldIFS=$IFS - IFS=: - for func_convert_core_path_wine_to_w32_f in $1; do - IFS=$oldIFS - func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" - if test -n "$func_convert_core_file_wine_to_w32_result" ; then - if test -z "$func_convert_core_path_wine_to_w32_result"; then - func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" - else - func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" - fi - fi - done - IFS=$oldIFS - fi -} -# end: func_convert_core_path_wine_to_w32 - - -# func_cygpath ARGS... -# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when -# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) -# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or -# (2), returns the Cygwin file name or path in func_cygpath_result (input -# file name or path is assumed to be in w32 format, as previously converted -# from $build's *nix or MSYS format). In case (3), returns the w32 file name -# or path in func_cygpath_result (input file name or path is assumed to be in -# Cygwin format). Returns an empty string on error. -# -# ARGS are passed to cygpath, with the last one being the file name or path to -# be converted. -# -# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH -# environment variable; do not put it in $PATH. -func_cygpath () -{ - $opt_debug - if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then - func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` - if test "$?" -ne 0; then - # on failure, ensure result is empty - func_cygpath_result= - fi - else - func_cygpath_result= - func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" - fi -} -#end: func_cygpath - - -# func_convert_core_msys_to_w32 ARG -# Convert file name or path ARG from MSYS format to w32 format. Return -# result in func_convert_core_msys_to_w32_result. -func_convert_core_msys_to_w32 () -{ - $opt_debug - # awkward: cmd appends spaces to result - func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` -} -#end: func_convert_core_msys_to_w32 - - -# func_convert_file_check ARG1 ARG2 -# Verify that ARG1 (a file name in $build format) was converted to $host -# format in ARG2. Otherwise, emit an error message, but continue (resetting -# func_to_host_file_result to ARG1). -func_convert_file_check () -{ - $opt_debug - if test -z "$2" && test -n "$1" ; then - func_error "Could not determine host file name corresponding to" - func_error " \`$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_file_result="$1" - fi -} -# end func_convert_file_check - - -# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH -# Verify that FROM_PATH (a path in $build format) was converted to $host -# format in TO_PATH. Otherwise, emit an error message, but continue, resetting -# func_to_host_file_result to a simplistic fallback value (see below). -func_convert_path_check () -{ - $opt_debug - if test -z "$4" && test -n "$3"; then - func_error "Could not determine the host path corresponding to" - func_error " \`$3'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This is a deliberately simplistic "conversion" and - # should not be "improved". See libtool.info. - if test "x$1" != "x$2"; then - lt_replace_pathsep_chars="s|$1|$2|g" - func_to_host_path_result=`echo "$3" | - $SED -e "$lt_replace_pathsep_chars"` - else - func_to_host_path_result="$3" - fi - fi -} -# end func_convert_path_check - - -# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG -# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT -# and appending REPL if ORIG matches BACKPAT. -func_convert_path_front_back_pathsep () -{ - $opt_debug - case $4 in - $1 ) func_to_host_path_result="$3$func_to_host_path_result" - ;; - esac - case $4 in - $2 ) func_append func_to_host_path_result "$3" - ;; - esac -} -# end func_convert_path_front_back_pathsep - - -################################################## -# $build to $host FILE NAME CONVERSION FUNCTIONS # -################################################## -# invoked via `$to_host_file_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# Result will be available in $func_to_host_file_result. - - -# func_to_host_file ARG -# Converts the file name ARG from $build format to $host format. Return result -# in func_to_host_file_result. -func_to_host_file () -{ - $opt_debug - $to_host_file_cmd "$1" -} -# end func_to_host_file - - -# func_to_tool_file ARG LAZY -# converts the file name ARG from $build format to toolchain format. Return -# result in func_to_tool_file_result. If the conversion in use is listed -# in (the comma separated) LAZY, no conversion takes place. -func_to_tool_file () -{ - $opt_debug - case ,$2, in - *,"$to_tool_file_cmd",*) - func_to_tool_file_result=$1 - ;; - *) - $to_tool_file_cmd "$1" - func_to_tool_file_result=$func_to_host_file_result - ;; - esac -} -# end func_to_tool_file - - -# func_convert_file_noop ARG -# Copy ARG to func_to_host_file_result. -func_convert_file_noop () -{ - func_to_host_file_result="$1" -} -# end func_convert_file_noop - - -# func_convert_file_msys_to_w32 ARG -# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_file_result. -func_convert_file_msys_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_to_host_file_result="$func_convert_core_msys_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_w32 - - -# func_convert_file_cygwin_to_w32 ARG -# Convert file name ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_file_cygwin_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # because $build is cygwin, we call "the" cygpath in $PATH; no need to use - # LT_CYGPATH in this case. - func_to_host_file_result=`cygpath -m "$1"` - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_cygwin_to_w32 - - -# func_convert_file_nix_to_w32 ARG -# Convert file name ARG from *nix to w32 format. Requires a wine environment -# and a working winepath. Returns result in func_to_host_file_result. -func_convert_file_nix_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_file_wine_to_w32 "$1" - func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_w32 - - -# func_convert_file_msys_to_cygwin ARG -# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_file_msys_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_cygpath -u "$func_convert_core_msys_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_cygwin - - -# func_convert_file_nix_to_cygwin ARG -# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed -# in a wine environment, working winepath, and LT_CYGPATH set. Returns result -# in func_to_host_file_result. -func_convert_file_nix_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. - func_convert_core_file_wine_to_w32 "$1" - func_cygpath -u "$func_convert_core_file_wine_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_cygwin - - -############################################# -# $build to $host PATH CONVERSION FUNCTIONS # -############################################# -# invoked via `$to_host_path_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# The result will be available in $func_to_host_path_result. -# -# Path separators are also converted from $build format to $host format. If -# ARG begins or ends with a path separator character, it is preserved (but -# converted to $host format) on output. -# -# All path conversion functions are named using the following convention: -# file name conversion function : func_convert_file_X_to_Y () -# path conversion function : func_convert_path_X_to_Y () -# where, for any given $build/$host combination the 'X_to_Y' value is the -# same. If conversion functions are added for new $build/$host combinations, -# the two new functions must follow this pattern, or func_init_to_host_path_cmd -# will break. - - -# func_init_to_host_path_cmd -# Ensures that function "pointer" variable $to_host_path_cmd is set to the -# appropriate value, based on the value of $to_host_file_cmd. -to_host_path_cmd= -func_init_to_host_path_cmd () -{ - $opt_debug - if test -z "$to_host_path_cmd"; then - func_stripname 'func_convert_file_' '' "$to_host_file_cmd" - to_host_path_cmd="func_convert_path_${func_stripname_result}" - fi -} - - -# func_to_host_path ARG -# Converts the path ARG from $build format to $host format. Return result -# in func_to_host_path_result. -func_to_host_path () -{ - $opt_debug - func_init_to_host_path_cmd - $to_host_path_cmd "$1" -} -# end func_to_host_path - - -# func_convert_path_noop ARG -# Copy ARG to func_to_host_path_result. -func_convert_path_noop () -{ - func_to_host_path_result="$1" -} -# end func_convert_path_noop - - -# func_convert_path_msys_to_w32 ARG -# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_path_result. -func_convert_path_msys_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from ARG. MSYS - # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; - # and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_msys_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_msys_to_w32 - - -# func_convert_path_cygwin_to_w32 ARG -# Convert path ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_path_cygwin_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_cygwin_to_w32 - - -# func_convert_path_nix_to_w32 ARG -# Convert path ARG from *nix to w32 format. Requires a wine environment and -# a working winepath. Returns result in func_to_host_file_result. -func_convert_path_nix_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_nix_to_w32 - - -# func_convert_path_msys_to_cygwin ARG -# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_path_msys_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_msys_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_msys_to_cygwin - - -# func_convert_path_nix_to_cygwin ARG -# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a -# a wine environment, working winepath, and LT_CYGPATH set. Returns result in -# func_to_host_file_result. -func_convert_path_nix_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_nix_to_cygwin - - -# func_mode_compile arg... -func_mode_compile () -{ - $opt_debug - # Get the compilation command and the source file. - base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes - suppress_output= - arg_mode=normal - libobj= - later= - pie_flag= - - for arg - do - case $arg_mode in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; - - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - test -n "$libobj" && \ - func_fatal_error "you cannot specify \`-o' more than once" - arg_mode=target - continue - ;; - - -pie | -fpie | -fPIE) - func_append pie_flag " $arg" - continue - ;; - - -shared | -static | -prefer-pic | -prefer-non-pic) - func_append later " $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - func_append_quoted lastarg "$arg" - done - IFS="$save_ifs" - func_stripname ' ' '' "$lastarg" - lastarg=$func_stripname_result - - # Add the arguments to base_compile. - func_append base_compile " $lastarg" - continue - ;; - - *) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - func_append_quoted base_compile "$lastarg" - done # for arg - - case $arg_mode in - arg) - func_fatal_error "you must specify an argument for -Xcompile" - ;; - target) - func_fatal_error "you must specify a target with \`-o'" - ;; - *) - # Get the name of the library object. - test -z "$libobj" && { - func_basename "$srcfile" - libobj="$func_basename_result" - } - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - case $libobj in - *.[cCFSifmso] | \ - *.ada | *.adb | *.ads | *.asm | \ - *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ - *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) - func_xform "$libobj" - libobj=$func_xform_result - ;; - esac - - case $libobj in - *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; - *) - func_fatal_error "cannot determine name of library object from \`$libobj'" - ;; - esac - - func_infer_tag $base_compile - - for arg in $later; do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - continue - ;; - - -static) - build_libtool_libs=no - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - esac - done - - func_quote_for_eval "$libobj" - test "X$libobj" != "X$func_quote_for_eval_result" \ - && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ - && func_warning "libobj name \`$libobj' may not contain shell special characters." - func_dirname_and_basename "$obj" "/" "" - objname="$func_basename_result" - xdir="$func_dirname_result" - lobj=${xdir}$objdir/$objname - - test -z "$base_compile" && \ - func_fatal_help "you must specify a compilation command" - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2* | cegcc*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $ECHO "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - func_append removelist " $output_obj" - $ECHO "$srcfile" > "$lockfile" - fi - - $opt_dry_run || $RM $removelist - func_append removelist " $lockfile" - trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - - func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 - srcfile=$func_to_tool_file_result - func_quote_for_eval "$srcfile" - qsrcfile=$func_quote_for_eval_result - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" - else - # Don't build PIC code - command="$base_compile $qsrcfile" - fi - - func_mkdir_p "$xdir$objdir" - - if test -z "$output_obj"; then - # Place PIC objects in $objdir - func_append command " -o $lobj" - fi - - func_show_eval_locale "$command" \ - 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - func_show_eval '$MV "$output_obj" "$lobj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - - # Allow error messages only from the first compilation. - if test "$suppress_opt" = yes; then - suppress_output=' >/dev/null 2>&1' - fi - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then - # Don't build PIC code - command="$base_compile $qsrcfile$pie_flag" - else - command="$base_compile $qsrcfile $pic_flag" - fi - if test "$compiler_c_o" = yes; then - func_append command " -o $obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - func_append command "$suppress_output" - func_show_eval_locale "$command" \ - '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - func_show_eval '$MV "$output_obj" "$obj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - fi - - $opt_dry_run || { - func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - removelist=$lockfile - $RM "$lockfile" - fi - } - - exit $EXIT_SUCCESS -} - -$opt_help || { - test "$opt_mode" = compile && func_mode_compile ${1+"$@"} -} - -func_mode_help () -{ - # We need to display help for each of the modes. - case $opt_mode in - "") - # Generic help is extracted from the usage comments - # at the start of this file. - func_help - ;; - - clean) - $ECHO \ -"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - - compile) - $ECHO \ -"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -no-suppress do not suppress compiler output for multiple passes - -prefer-pic try to build PIC objects only - -prefer-non-pic try to build non-PIC objects only - -shared do not build a \`.o' file suitable for static linking - -static only build a \`.o' file suitable for static linking - -Wc,FLAG pass FLAG directly to the compiler - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - - execute) - $ECHO \ -"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - - finish) - $ECHO \ -"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - - install) - $ECHO \ -"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The following components of INSTALL-COMMAND are treated specially: - - -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - - link) - $ECHO \ -"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -bindir BINDIR specify path to binaries directory (for systems where - libraries must be found in the PATH setting at runtime) - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -shared only do dynamic linking of libtool libraries - -shrext SUFFIX override the standard shared library file extension - -static do not do any dynamic linking of uninstalled libtool libraries - -static-libtool-libs - do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -weak LIBNAME declare that the target provides the LIBNAME interface - -Wc,FLAG - -Xcompiler FLAG pass linker-specific FLAG directly to the compiler - -Wl,FLAG - -Xlinker FLAG pass linker-specific FLAG directly to the linker - -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - - uninstall) - $ECHO \ -"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - - *) - func_fatal_help "invalid operation mode \`$opt_mode'" - ;; - esac - - echo - $ECHO "Try \`$progname --help' for more information about other modes." -} - -# Now that we've collected a possible --mode arg, show help if necessary -if $opt_help; then - if test "$opt_help" = :; then - func_mode_help - else - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - func_mode_help - done - } | sed -n '1p; 2,$s/^Usage:/ or: /p' - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - echo - func_mode_help - done - } | - sed '1d - /^When reporting/,/^Report/{ - H - d - } - $x - /information about other modes/d - /more detailed .*MODE/d - s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' - fi - exit $? -fi - - -# func_mode_execute arg... -func_mode_execute () -{ - $opt_debug - # The first argument is the command name. - cmd="$nonopt" - test -z "$cmd" && \ - func_fatal_help "you must specify a COMMAND" - - # Handle -dlopen flags immediately. - for file in $opt_dlopen; do - test -f "$file" \ - || func_fatal_help "\`$file' is not a file" - - dir= - case $file in - *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$lib' is not a valid libtool archive" - - # Read the libtool library. - dlname= - library_names= - func_source "$file" - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && \ - func_warning "\`$file' was not linked with \`-export-dynamic'" - continue - fi - - func_dirname "$file" "" "." - dir="$func_dirname_result" - - if test -f "$dir/$objdir/$dlname"; then - func_append dir "/$objdir" - else - if test ! -f "$dir/$dlname"; then - func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" - fi - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - func_dirname "$file" "" "." - dir="$func_dirname_result" - ;; - - *) - func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -* | *.la | *.lo ) ;; - *) - # Do a test to see if this is really a libtool program. - if func_ltwrapper_script_p "$file"; then - func_source "$file" - # Transform arg to wrapped name. - file="$progdir/$program" - elif func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - func_source "$func_ltwrapper_scriptname_result" - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - func_append_quoted args "$file" - done - - if test "X$opt_dry_run" = Xfalse; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES - do - eval "if test \"\${save_$lt_var+set}\" = set; then - $lt_var=\$save_$lt_var; export $lt_var - else - $lt_unset $lt_var - fi" - done - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - echo "export $shlibpath_var" - fi - $ECHO "$cmd$args" - exit $EXIT_SUCCESS - fi -} - -test "$opt_mode" = execute && func_mode_execute ${1+"$@"} - - -# func_mode_finish arg... -func_mode_finish () -{ - $opt_debug - libs= - libdirs= - admincmds= - - for opt in "$nonopt" ${1+"$@"} - do - if test -d "$opt"; then - func_append libdirs " $opt" - - elif test -f "$opt"; then - if func_lalib_unsafe_p "$opt"; then - func_append libs " $opt" - else - func_warning "\`$opt' is not a valid libtool archive" - fi - - else - func_fatal_error "invalid argument \`$opt'" - fi - done - - if test -n "$libs"; then - if test -n "$lt_sysroot"; then - sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` - sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" - else - sysroot_cmd= - fi - - # Remove sysroot references - if $opt_dry_run; then - for lib in $libs; do - echo "removing references to $lt_sysroot and \`=' prefixes from $lib" - done - else - tmpdir=`func_mktempdir` - for lib in $libs; do - sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ - > $tmpdir/tmp-la - mv -f $tmpdir/tmp-la $lib - done - ${RM}r "$tmpdir" - fi - fi - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - func_execute_cmds "$finish_cmds" 'admincmds="$admincmds -'"$cmd"'"' - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || func_append admincmds " - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - $opt_silent && exit $EXIT_SUCCESS - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" - for libdir in $libdirs; do - $ECHO " $libdir" - done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" - fi - if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $ECHO " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $ECHO " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - echo - - echo "See any operating system documentation about shared libraries for" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" - echo "pages." - ;; - *) - echo "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - echo "----------------------------------------------------------------------" - fi - exit $EXIT_SUCCESS -} - -test "$opt_mode" = finish && func_mode_finish ${1+"$@"} - - -# func_mode_install arg... -func_mode_install () -{ - $opt_debug - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - case $nonopt in *shtool*) :;; *) false;; esac; then - # Aesthetically quote it. - func_quote_for_eval "$nonopt" - install_prog="$func_quote_for_eval_result " - arg=$1 - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - func_quote_for_eval "$arg" - func_append install_prog "$func_quote_for_eval_result" - install_shared_prog=$install_prog - case " $install_prog " in - *[\\\ /]cp\ *) install_cp=: ;; - *) install_cp=false ;; - esac - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - no_mode=: - for arg - do - arg2= - if test -n "$dest"; then - func_append files " $dest" - dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) - if $install_cp; then :; else - prev=$arg - fi - ;; - -g | -m | -o) - prev=$arg - ;; - -s) - stripme=" -s" - continue - ;; - -*) - ;; - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - if test "x$prev" = x-m && test -n "$install_override_mode"; then - arg2=$install_override_mode - no_mode=false - fi - prev= - else - dest=$arg - continue - fi - ;; - esac - - # Aesthetically quote the argument. - func_quote_for_eval "$arg" - func_append install_prog " $func_quote_for_eval_result" - if test -n "$arg2"; then - func_quote_for_eval "$arg2" - fi - func_append install_shared_prog " $func_quote_for_eval_result" - done - - test -z "$install_prog" && \ - func_fatal_help "you must specify an install program" - - test -n "$prev" && \ - func_fatal_help "the \`$prev' option requires an argument" - - if test -n "$install_override_mode" && $no_mode; then - if $install_cp; then :; else - func_quote_for_eval "$install_override_mode" - func_append install_shared_prog " -m $func_quote_for_eval_result" - fi - fi - - if test -z "$files"; then - if test -z "$dest"; then - func_fatal_help "no file or destination specified" - else - func_fatal_help "you must specify a destination" - fi - fi - - # Strip any trailing slash from the destination. - func_stripname '' '/' "$dest" - dest=$func_stripname_result - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - func_dirname_and_basename "$dest" "" "." - destdir="$func_dirname_result" - destname="$func_basename_result" - - # Not a directory, so check to see that there is only one file specified. - set dummy $files; shift - test "$#" -gt 1 && \ - func_fatal_help "\`$dest' is not a directory" - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - func_fatal_help "\`$destdir' must be an absolute directory name" - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - func_append staticlibs " $file" - ;; - - *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$file' is not a valid libtool archive" - - library_names= - old_library= - relink_command= - func_source "$file" - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) func_append current_libdirs " $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) func_append future_libdirs " $libdir" ;; - esac - fi - - func_dirname "$file" "/" "" - dir="$func_dirname_result" - func_append dir "$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - test "$inst_prefix_dir" = "$destdir" && \ - func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - func_warning "relinking \`$file'" - func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' - fi - - # See the names of the shared library. - set dummy $library_names; shift - if test -n "$1"; then - realname="$1" - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ - 'exit $?' - tstripme="$stripme" - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - case $realname in - *.dll.a) - tstripme="" - ;; - esac - ;; - esac - if test -n "$tstripme" && test -n "$striplib"; then - func_show_eval "$striplib $destdir/$realname" 'exit $?' - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on - # the symlink we replace! Solaris /bin/ln does not understand -f, - # so we also need to try rm && ln -s. - for linkname - do - test "$linkname" != "$realname" \ - && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - func_execute_cmds "$postinstall_cmds" 'exit $?' - fi - - # Install the pseudo-library for information purposes. - func_basename "$file" - name="$func_basename_result" - instname="$dir/$name"i - func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' - - # Maybe install the static library, too. - test -n "$old_library" && func_append staticlibs " $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - func_lo2o "$destfile" - staticdest=$func_lo2o_result - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - func_fatal_help "cannot copy a libtool object to \`$destfile'" - ;; - esac - - # Install the libtool object if requested. - test -n "$destfile" && \ - func_show_eval "$install_prog $file $destfile" 'exit $?' - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - func_lo2o "$file" - staticobj=$func_lo2o_result - func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - func_stripname '' '.exe' "$file" - file=$func_stripname_result - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin* | *mingw*) - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - wrapper=$func_ltwrapper_scriptname_result - else - func_stripname '' '.exe' "$file" - wrapper=$func_stripname_result - fi - ;; - *) - wrapper=$file - ;; - esac - if func_ltwrapper_script_p "$wrapper"; then - notinst_deplibs= - relink_command= - - func_source "$wrapper" - - # Check the variables that should have been set. - test -z "$generated_by_libtool_version" && \ - func_fatal_error "invalid libtool wrapper script \`$wrapper'" - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - func_source "$lib" - fi - libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - func_warning "\`$lib' has not been installed in \`$libdir'" - finalize=no - fi - done - - relink_command= - func_source "$wrapper" - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - $opt_dry_run || { - if test "$finalize" = yes; then - tmpdir=`func_mktempdir` - func_basename "$file$stripped_ext" - file="$func_basename_result" - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` - - $opt_silent || { - func_quote_for_expand "$relink_command" - eval "func_echo $func_quote_for_expand_result" - } - if eval "$relink_command"; then : - else - func_error "error: relink \`$file' with the above command before installing it" - $opt_dry_run || ${RM}r "$tmpdir" - continue - fi - file="$outputname" - else - func_warning "cannot relink \`$file'" - fi - } - else - # Install the binary that we compiled earlier. - file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyway - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - func_stripname '' '.exe' "$destfile" - destfile=$func_stripname_result - ;; - esac - ;; - esac - func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' - $opt_dry_run || if test -n "$outputname"; then - ${RM}r "$tmpdir" - fi - ;; - esac - done - - for file in $staticlibs; do - func_basename "$file" - name="$func_basename_result" - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - func_show_eval "$install_prog \$file \$oldlib" 'exit $?' - - if test -n "$stripme" && test -n "$old_striplib"; then - func_show_eval "$old_striplib $oldlib" 'exit $?' - fi - - # Do each command in the postinstall commands. - func_execute_cmds "$old_postinstall_cmds" 'exit $?' - done - - test -n "$future_libdirs" && \ - func_warning "remember to run \`$progname --finish$future_libdirs'" - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - $opt_dry_run && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi -} - -test "$opt_mode" = install && func_mode_install ${1+"$@"} - - -# func_generate_dlsyms outputname originator pic_p -# Extract symbols from dlprefiles and create ${outputname}S.o with -# a dlpreopen symbol table. -func_generate_dlsyms () -{ - $opt_debug - my_outputname="$1" - my_originator="$2" - my_pic_p="${3-no}" - my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` - my_dlsyms= - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - my_dlsyms="${my_outputname}S.c" - else - func_error "not configured to extract global symbols from dlpreopened files" - fi - fi - - if test -n "$my_dlsyms"; then - case $my_dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${my_outputname}.nm" - - func_show_eval "$RM $nlist ${nlist}S ${nlist}T" - - # Parse the name list into a source file. - func_verbose "creating $output_objdir/$my_dlsyms" - - $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ -/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ -/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) -#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" -#endif - -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - func_verbose "generating symbol list for \`$output'" - - $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` - for progfile in $progfiles; do - func_to_tool_file "$progfile" func_convert_file_msys_to_w32 - func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" - $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $opt_dry_run || { - eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - if test -n "$export_symbols_regex"; then - $opt_dry_run || { - eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $opt_dry_run || { - $RM $export_symbols - eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' - ;; - esac - } - else - $opt_dry_run || { - eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' - ;; - esac - } - fi - fi - - for dlprefile in $dlprefiles; do - func_verbose "extracting global C symbols from \`$dlprefile'" - func_basename "$dlprefile" - name="$func_basename_result" - case $host in - *cygwin* | *mingw* | *cegcc* ) - # if an import library, we need to obtain dlname - if func_win32_import_lib_p "$dlprefile"; then - func_tr_sh "$dlprefile" - eval "curr_lafile=\$libfile_$func_tr_sh_result" - dlprefile_dlbasename="" - if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then - # Use subshell, to avoid clobbering current variable values - dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` - if test -n "$dlprefile_dlname" ; then - func_basename "$dlprefile_dlname" - dlprefile_dlbasename="$func_basename_result" - else - # no lafile. user explicitly requested -dlpreopen . - $sharedlib_from_linklib_cmd "$dlprefile" - dlprefile_dlbasename=$sharedlib_from_linklib_result - fi - fi - $opt_dry_run || { - if test -n "$dlprefile_dlbasename" ; then - eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' - else - func_warning "Could not compute DLL name from $name" - eval '$ECHO ": $name " >> "$nlist"' - fi - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | - $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" - } - else # not an import lib - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - fi - ;; - *) - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - ;; - esac - done - - $opt_dry_run || { - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $MV "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if $GREP -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - $GREP -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' - else - echo '/* NONE */' >> "$output_objdir/$my_dlsyms" - fi - - echo >> "$output_objdir/$my_dlsyms" "\ - -/* The mapping between symbol names and symbols. */ -typedef struct { - const char *name; - void *address; -} lt_dlsymlist; -extern LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[]; -LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[] = -{\ - { \"$my_originator\", (void *) 0 }," - - case $need_lib_prefix in - no) - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - *) - eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - esac - echo >> "$output_objdir/$my_dlsyms" "\ - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_${my_prefix}_LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - } # !$opt_dry_run - - pic_flag_for_symtable= - case "$compile_command " in - *" -static "*) ;; - *) - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; - *-*-hpux*) - pic_flag_for_symtable=" $pic_flag" ;; - *) - if test "X$my_pic_p" != Xno; then - pic_flag_for_symtable=" $pic_flag" - fi - ;; - esac - ;; - esac - symtab_cflags= - for arg in $LTCFLAGS; do - case $arg in - -pie | -fpie | -fPIE) ;; - *) func_append symtab_cflags " $arg" ;; - esac - done - - # Now compile the dynamic symbol file. - func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' - - # Clean up the generated files. - func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' - - # Transform the symbol file into the correct name. - symfileobj="$output_objdir/${my_outputname}S.$objext" - case $host in - *cygwin* | *mingw* | *cegcc* ) - if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - else - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - fi - ;; - *) - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - ;; - esac - ;; - *) - func_fatal_error "unknown suffix for \`$my_dlsyms'" - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` - fi -} - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -# Despite the name, also deal with 64 bit binaries. -func_win32_libid () -{ - $opt_debug - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then - func_to_tool_file "$1" func_convert_file_msys_to_w32 - win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | - $SED -n -e ' - 1,100{ - / I /{ - s,.*,import, - p - q - } - }'` - case $win32_nmres in - import*) win32_libid_type="x86 archive import";; - *) win32_libid_type="x86 archive static";; - esac - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $ECHO "$win32_libid_type" -} - -# func_cygming_dll_for_implib ARG -# -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib () -{ - $opt_debug - sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` -} - -# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs -# -# The is the core of a fallback implementation of a -# platform-specific function to extract the name of the -# DLL associated with the specified import library LIBNAME. -# -# SECTION_NAME is either .idata$6 or .idata$7, depending -# on the platform and compiler that created the implib. -# -# Echos the name of the DLL associated with the -# specified import library. -func_cygming_dll_for_implib_fallback_core () -{ - $opt_debug - match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` - $OBJDUMP -s --section "$1" "$2" 2>/dev/null | - $SED '/^Contents of section '"$match_literal"':/{ - # Place marker at beginning of archive member dllname section - s/.*/====MARK====/ - p - d - } - # These lines can sometimes be longer than 43 characters, but - # are always uninteresting - /:[ ]*file format pe[i]\{,1\}-/d - /^In archive [^:]*:/d - # Ensure marker is printed - /^====MARK====/p - # Remove all lines with less than 43 characters - /^.\{43\}/!d - # From remaining lines, remove first 43 characters - s/^.\{43\}//' | - $SED -n ' - # Join marker and all lines until next marker into a single line - /^====MARK====/ b para - H - $ b para - b - :para - x - s/\n//g - # Remove the marker - s/^====MARK====// - # Remove trailing dots and whitespace - s/[\. \t]*$// - # Print - /./p' | - # we now have a list, one entry per line, of the stringified - # contents of the appropriate section of all members of the - # archive which possess that section. Heuristic: eliminate - # all those which have a first or second character that is - # a '.' (that is, objdump's representation of an unprintable - # character.) This should work for all archives with less than - # 0x302f exports -- but will fail for DLLs whose name actually - # begins with a literal '.' or a single character followed by - # a '.'. - # - # Of those that remain, print the first one. - $SED -e '/^\./d;/^.\./d;q' -} - -# func_cygming_gnu_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is a GNU/binutils-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_gnu_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` - test -n "$func_cygming_gnu_implib_tmp" -} - -# func_cygming_ms_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is an MS-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_ms_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` - test -n "$func_cygming_ms_implib_tmp" -} - -# func_cygming_dll_for_implib_fallback ARG -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# -# This fallback implementation is for use when $DLLTOOL -# does not support the --identify-strict option. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib_fallback () -{ - $opt_debug - if func_cygming_gnu_implib_p "$1" ; then - # binutils import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` - elif func_cygming_ms_implib_p "$1" ; then - # ms-generated import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` - else - # unknown - sharedlib_from_linklib_result="" - fi -} - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - $opt_debug - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - if test "$lock_old_archive_extraction" = yes; then - lockfile=$f_ex_an_ar_oldlib.lock - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - fi - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ - 'stat=$?; rm -f "$lockfile"; exit $stat' - if test "$lock_old_archive_extraction" = yes; then - $opt_dry_run || rm -f "$lockfile" - fi - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : - else - func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" - fi -} - - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - $opt_debug - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - func_basename "$my_xlib" - my_xlib="$func_basename_result" - my_xlib_u=$my_xlib - while :; do - case " $extracted_archives " in - *" $my_xlib_u "*) - func_arith $extracted_serial + 1 - extracted_serial=$func_arith_result - my_xlib_u=lt$extracted_serial-$my_xlib ;; - *) break ;; - esac - done - extracted_archives="$extracted_archives $my_xlib_u" - my_xdir="$my_gentop/$my_xlib_u" - - func_mkdir_p "$my_xdir" - - case $host in - *-darwin*) - func_verbose "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - $opt_dry_run || { - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`basename "$darwin_archive"` - darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` - if test -n "$darwin_arches"; then - darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we've a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` - $LIPO -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - $RM -rf unfat-$$ - cd "$darwin_orig_dir" - else - cd $darwin_orig_dir - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - } # !$opt_dry_run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` - done - - func_extract_archives_result="$my_oldobjs" -} - - -# func_emit_wrapper [arg=no] -# -# Emit a libtool wrapper script on stdout. -# Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw -# wrapper executable. Must ONLY be called from within -# func_mode_link because it depends on a number of variables -# set therein. -# -# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR -# variable will take. If 'yes', then the emitted script -# will assume that the directory in which it is stored is -# the $objdir directory. This is a cygwin/mingw-specific -# behavior. -func_emit_wrapper () -{ - func_emit_wrapper_arg1=${1-no} - - $ECHO "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='$sed_quote_subst' - -# 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+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: - generated_by_libtool_version='$macro_version' - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$ECHO are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - file=\"\$0\"" - - qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` - $ECHO "\ - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - ECHO=\"$qECHO\" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string "--lt-" -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's $0 value, followed by "$@". -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=\$0 - shift - for lt_opt - do - case \"\$lt_opt\" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` - test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. - lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` - cat \"\$lt_dump_D/\$lt_dump_F\" - exit 0 - ;; - --lt-*) - \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n \"\$lt_option_debug\"; then - echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" - lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from \$@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - for lt_wr_arg - do - case \$lt_wr_arg in - --lt-*) ;; - *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; - esac - shift - done - func_exec_program_core \${1+\"\$@\"} -} - - # Parse options - func_parse_lt_options \"\$0\" \${1+\"\$@\"} - - # Find the directory that this script lives in. - thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 - if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then - # special case for '.' - if test \"\$thisdir\" = \".\"; then - thisdir=\`pwd\` - fi - # remove .libs from thisdir - case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; - $objdir ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $ECHO "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $MKDIR \"\$progdir\" - else - $RM \"\$progdir/\$file\" - fi" - - $ECHO "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $ECHO \"\$relink_command_output\" >&2 - $RM \"\$progdir/\$file\" - exit 1 - fi - fi - - $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $RM \"\$progdir/\$program\"; - $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $RM \"\$progdir/\$file\" - fi" - else - $ECHO "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $ECHO "\ - - if test -f \"\$progdir/\$program\"; then" - - # fixup the dll searchpath if we need to. - # - # Fix the DLL searchpath if we need to. Do this before prepending - # to shlibpath, because on Windows, both are PATH and uninstalled - # libraries must come first. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $ECHO "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` - - export $shlibpath_var -" - fi - - $ECHO "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. - func_exec_program \${1+\"\$@\"} - fi - else - # The program doesn't exist. - \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 - \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" -} - - -# func_emit_cwrapperexe_src -# emit the source code for a wrapper executable on stdout -# Must ONLY be called from within func_mode_link because -# it depends on a number of variable set therein. -func_emit_cwrapperexe_src () -{ - cat < -#include -#ifdef _MSC_VER -# include -# include -# include -#else -# include -# include -# ifdef __CYGWIN__ -# include -# endif -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -/* declarations of non-ANSI functions */ -#if defined(__MINGW32__) -# ifdef __STRICT_ANSI__ -int _putenv (const char *); -# endif -#elif defined(__CYGWIN__) -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif -/* #elif defined (other platforms) ... */ -#endif - -/* portability defines, excluding path handling macros */ -#if defined(_MSC_VER) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -# define S_IXUSR _S_IEXEC -# ifndef _INTPTR_T_DEFINED -# define _INTPTR_T_DEFINED -# define intptr_t int -# endif -#elif defined(__MINGW32__) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -#elif defined(__CYGWIN__) -# define HAVE_SETENV -# define FOPEN_WB "wb" -/* #elif defined (other platforms) ... */ -#endif - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef S_IXOTH -# define S_IXOTH 0 -#endif -#ifndef S_IXGRP -# define S_IXGRP 0 -#endif - -/* path handling portability macros */ -#ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -# define PATH_SEPARATOR ':' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -# define HAVE_DOS_BASED_FILE_SYSTEM -# define FOPEN_WB "wb" -# ifndef DIR_SEPARATOR_2 -# define DIR_SEPARATOR_2 '\\' -# endif -# ifndef PATH_SEPARATOR_2 -# define PATH_SEPARATOR_2 ';' -# endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#ifndef PATH_SEPARATOR_2 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) -#else /* PATH_SEPARATOR_2 */ -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) -#endif /* PATH_SEPARATOR_2 */ - -#ifndef FOPEN_WB -# define FOPEN_WB "w" -#endif -#ifndef _O_BINARY -# define _O_BINARY 0 -#endif - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -#if defined(LT_DEBUGWRAPPER) -static int lt_debug = 1; -#else -static int lt_debug = 0; -#endif - -const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ - -void *xmalloc (size_t num); -char *xstrdup (const char *string); -const char *base_name (const char *name); -char *find_executable (const char *wrapper); -char *chase_symlinks (const char *pathspec); -int make_executable (const char *path); -int check_executable (const char *path); -char *strendzap (char *str, const char *pat); -void lt_debugprintf (const char *file, int line, const char *fmt, ...); -void lt_fatal (const char *file, int line, const char *message, ...); -static const char *nonnull (const char *s); -static const char *nonempty (const char *s); -void lt_setenv (const char *name, const char *value); -char *lt_extend_str (const char *orig_value, const char *add, int to_end); -void lt_update_exe_path (const char *name, const char *value); -void lt_update_lib_path (const char *name, const char *value); -char **prepare_spawn (char **argv); -void lt_dump_script (FILE *f); -EOF - - cat <= 0) - && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) - return 1; - else - return 0; -} - -int -make_executable (const char *path) -{ - int rval = 0; - struct stat st; - - lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", - nonempty (path)); - if ((!path) || (!*path)) - return 0; - - if (stat (path, &st) >= 0) - { - rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); - } - return rval; -} - -/* Searches for the full path of the wrapper. Returns - newly allocated full path name if found, NULL otherwise - Does not chase symlinks, even on platforms that support them. -*/ -char * -find_executable (const char *wrapper) -{ - int has_slash = 0; - const char *p; - const char *p_next; - /* static buffer for getcwd */ - char tmp[LT_PATHMAX + 1]; - int tmp_len; - char *concat_name; - - lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", - nonempty (wrapper)); - - if ((wrapper == NULL) || (*wrapper == '\0')) - return NULL; - - /* Absolute path? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - else - { -#endif - if (IS_DIR_SEPARATOR (wrapper[0])) - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - } -#endif - - for (p = wrapper; *p; p++) - if (*p == '/') - { - has_slash = 1; - break; - } - if (!has_slash) - { - /* no slashes; search PATH */ - const char *path = getenv ("PATH"); - if (path != NULL) - { - for (p = path; *p; p = p_next) - { - const char *q; - size_t p_len; - for (q = p; *q; q++) - if (IS_PATH_SEPARATOR (*q)) - break; - p_len = q - p; - p_next = (*q == '\0' ? q : q + 1); - if (p_len == 0) - { - /* empty path: current directory */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = - XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - } - else - { - concat_name = - XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, p, p_len); - concat_name[p_len] = '/'; - strcpy (concat_name + p_len + 1, wrapper); - } - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - } - /* not found in PATH; assume curdir */ - } - /* Relative path | not found in path: prepend cwd */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - return NULL; -} - -char * -chase_symlinks (const char *pathspec) -{ -#ifndef S_ISLNK - return xstrdup (pathspec); -#else - char buf[LT_PATHMAX]; - struct stat s; - char *tmp_pathspec = xstrdup (pathspec); - char *p; - int has_symlinks = 0; - while (strlen (tmp_pathspec) && !has_symlinks) - { - lt_debugprintf (__FILE__, __LINE__, - "checking path component for symlinks: %s\n", - tmp_pathspec); - if (lstat (tmp_pathspec, &s) == 0) - { - if (S_ISLNK (s.st_mode) != 0) - { - has_symlinks = 1; - break; - } - - /* search backwards for last DIR_SEPARATOR */ - p = tmp_pathspec + strlen (tmp_pathspec) - 1; - while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - p--; - if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - { - /* no more DIR_SEPARATORS left */ - break; - } - *p = '\0'; - } - else - { - lt_fatal (__FILE__, __LINE__, - "error accessing file \"%s\": %s", - tmp_pathspec, nonnull (strerror (errno))); - } - } - XFREE (tmp_pathspec); - - if (!has_symlinks) - { - return xstrdup (pathspec); - } - - tmp_pathspec = realpath (pathspec, buf); - if (tmp_pathspec == 0) - { - lt_fatal (__FILE__, __LINE__, - "could not follow symlinks for %s", pathspec); - } - return xstrdup (tmp_pathspec); -#endif -} - -char * -strendzap (char *str, const char *pat) -{ - size_t len, patlen; - - assert (str != NULL); - assert (pat != NULL); - - len = strlen (str); - patlen = strlen (pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp (str, pat) == 0) - *str = '\0'; - } - return str; -} - -void -lt_debugprintf (const char *file, int line, const char *fmt, ...) -{ - va_list args; - if (lt_debug) - { - (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); - } -} - -static void -lt_error_core (int exit_status, const char *file, - int line, const char *mode, - const char *message, va_list ap) -{ - fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *file, int line, const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); - va_end (ap); -} - -static const char * -nonnull (const char *s) -{ - return s ? s : "(null)"; -} - -static const char * -nonempty (const char *s) -{ - return (s && !*s) ? "(empty)" : nonnull (s); -} - -void -lt_setenv (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_setenv) setting '%s' to '%s'\n", - nonnull (name), nonnull (value)); - { -#ifdef HAVE_SETENV - /* always make a copy, for consistency with !HAVE_SETENV */ - char *str = xstrdup (value); - setenv (name, str, 1); -#else - int len = strlen (name) + 1 + strlen (value) + 1; - char *str = XMALLOC (char, len); - sprintf (str, "%s=%s", name, value); - if (putenv (str) != EXIT_SUCCESS) - { - XFREE (str); - } -#endif - } -} - -char * -lt_extend_str (const char *orig_value, const char *add, int to_end) -{ - char *new_value; - if (orig_value && *orig_value) - { - int orig_value_len = strlen (orig_value); - int add_len = strlen (add); - new_value = XMALLOC (char, add_len + orig_value_len + 1); - if (to_end) - { - strcpy (new_value, orig_value); - strcpy (new_value + orig_value_len, add); - } - else - { - strcpy (new_value, add); - strcpy (new_value + add_len, orig_value); - } - } - else - { - new_value = xstrdup (add); - } - return new_value; -} - -void -lt_update_exe_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - /* some systems can't cope with a ':'-terminated path #' */ - int len = strlen (new_value); - while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) - { - new_value[len-1] = '\0'; - } - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -void -lt_update_lib_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -EOF - case $host_os in - mingw*) - cat <<"EOF" - -/* Prepares an argument vector before calling spawn(). - Note that spawn() does not by itself call the command interpreter - (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : - ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&v); - v.dwPlatformId == VER_PLATFORM_WIN32_NT; - }) ? "cmd.exe" : "command.com"). - Instead it simply concatenates the arguments, separated by ' ', and calls - CreateProcess(). We must quote the arguments since Win32 CreateProcess() - interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a - special way: - - Space and tab are interpreted as delimiters. They are not treated as - delimiters if they are surrounded by double quotes: "...". - - Unescaped double quotes are removed from the input. Their only effect is - that within double quotes, space and tab are treated like normal - characters. - - Backslashes not followed by double quotes are not special. - - But 2*n+1 backslashes followed by a double quote become - n backslashes followed by a double quote (n >= 0): - \" -> " - \\\" -> \" - \\\\\" -> \\" - */ -#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -char ** -prepare_spawn (char **argv) -{ - size_t argc; - char **new_argv; - size_t i; - - /* Count number of arguments. */ - for (argc = 0; argv[argc] != NULL; argc++) - ; - - /* Allocate new argument vector. */ - new_argv = XMALLOC (char *, argc + 1); - - /* Put quoted arguments into the new argument vector. */ - for (i = 0; i < argc; i++) - { - const char *string = argv[i]; - - if (string[0] == '\0') - new_argv[i] = xstrdup ("\"\""); - else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) - { - int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); - size_t length; - unsigned int backslashes; - const char *s; - char *quoted_string; - char *p; - - length = 0; - backslashes = 0; - if (quote_around) - length++; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - length += backslashes + 1; - length++; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - length += backslashes + 1; - - quoted_string = XMALLOC (char, length + 1); - - p = quoted_string; - backslashes = 0; - if (quote_around) - *p++ = '"'; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - { - unsigned int j; - for (j = backslashes + 1; j > 0; j--) - *p++ = '\\'; - } - *p++ = c; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - { - unsigned int j; - for (j = backslashes; j > 0; j--) - *p++ = '\\'; - *p++ = '"'; - } - *p = '\0'; - - new_argv[i] = quoted_string; - } - else - new_argv[i] = (char *) string; - } - new_argv[argc] = NULL; - - return new_argv; -} -EOF - ;; - esac - - cat <<"EOF" -void lt_dump_script (FILE* f) -{ -EOF - func_emit_wrapper yes | - $SED -e 's/\([\\"]\)/\\\1/g' \ - -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' - - cat <<"EOF" -} -EOF -} -# end: func_emit_cwrapperexe_src - -# func_win32_import_lib_p ARG -# True if ARG is an import lib, as indicated by $file_magic_cmd -func_win32_import_lib_p () -{ - $opt_debug - case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in - *import*) : ;; - *) false ;; - esac -} - -# func_mode_link arg... -func_mode_link () -{ - $opt_debug - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - ;; - *) - allow_undefined=yes - ;; - esac - libtool_args=$nonopt - base_compile="$nonopt $@" - compile_command=$nonopt - finalize_command=$nonopt - - compile_rpath= - finalize_rpath= - compile_shlibpath= - finalize_shlibpath= - convenience= - old_convenience= - deplibs= - old_deplibs= - compiler_flags= - linker_flags= - dllsearchpath= - lib_search_path=`pwd` - inst_prefix_dir= - new_inherited_linker_flags= - - avoid_version=no - bindir= - dlfiles= - dlprefiles= - dlself=no - export_dynamic=no - export_symbols= - export_symbols_regex= - generated= - libobjs= - ltlibs= - module=no - no_install=no - objs= - non_pic_objects= - precious_files_regex= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - vinfo_number=no - weak_libs= - single_module="${wl}-single_module" - func_infer_tag $base_compile - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - break - ;; - -all-static | -static | -static-libtool-libs) - case $arg in - -all-static) - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - func_warning "complete static linking is impossible in this configuration" - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - -static) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=built - ;; - -static-libtool-libs) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - esac - build_libtool_libs=no - build_old_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - func_quote_for_eval "$arg" - qarg=$func_quote_for_eval_unquoted_result - func_append libtool_args " $func_quote_for_eval_result" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - func_append compile_command " @OUTPUT@" - func_append finalize_command " @OUTPUT@" - ;; - esac - - case $prev in - bindir) - bindir="$arg" - prev= - continue - ;; - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - func_append compile_command " @SYMFILE@" - func_append finalize_command " @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - func_append dlfiles " $arg" - else - func_append dlprefiles " $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - test -f "$arg" \ - || func_fatal_error "symbol file \`$arg' does not exist" - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - framework) - case $host in - *-*-darwin*) - case "$deplibs " in - *" $qarg.ltframework "*) ;; - *) func_append deplibs " $qarg.ltframework" # this is fixed later - ;; - esac - ;; - esac - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat "$save_arg"` - do -# func_append moreargs " $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - func_append dlfiles " $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - func_append dlprefiles " $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - done - else - func_fatal_error "link input file \`$arg' does not exist" - fi - arg=$save_arg - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) func_append rpath " $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) func_append xrpath " $arg" ;; - esac - fi - prev= - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - weak) - func_append weak_libs " $arg" - prev= - continue - ;; - xcclinker) - func_append linker_flags " $qarg" - func_append compiler_flags " $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xcompiler) - func_append compiler_flags " $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xlinker) - func_append linker_flags " $qarg" - func_append compiler_flags " $wl$qarg" - prev= - func_append compile_command " $wl$qarg" - func_append finalize_command " $wl$qarg" - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - # See comment for -static flag below, for more details. - func_append compile_command " $link_static_flag" - func_append finalize_command " $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - func_fatal_error "\`-allow-undefined' must not be used because it is the default" - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -bindir) - prev=bindir - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - func_fatal_error "more than one -exported-symbols argument is not allowed" - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -framework) - prev=framework - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - func_append compile_command " $arg" - func_append finalize_command " $arg" - ;; - esac - continue - ;; - - -L*) - func_stripname "-L" '' "$arg" - if test -z "$func_stripname_result"; then - if test "$#" -gt 0; then - func_fatal_error "require no space between \`-L' and \`$1'" - else - func_fatal_error "need path for \`-L' option" - fi - fi - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - test -z "$absdir" && \ - func_fatal_error "cannot determine absolute directory name of \`$dir'" - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "* | *" $arg "*) - # Will only happen for absolute or sysroot arguments - ;; - *) - # Preserve sysroot, but never include relative directories - case $dir in - [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; - *) func_append deplibs " -L$dir" ;; - esac - func_append lib_search_path " $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$dir:"*) ;; - ::) dllsearchpath=$dir;; - *) func_append dllsearchpath ":$dir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - func_append deplibs " System.ltframework" - continue - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - test "X$arg" = "X-lc" && continue - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - test "X$arg" = "X-lc" && continue - ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - func_append deplibs " $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot|--sysroot) - func_append compiler_flags " $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - func_append compiler_flags " $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - case "$new_inherited_linker_flags " in - *" $arg "*) ;; - * ) func_append new_inherited_linker_flags " $arg" ;; - esac - continue - ;; - - -multi_module) - single_module="${wl}-multi_module" - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) - # The PATH hackery in wrapper scripts is required on Windows - # and Darwin in order for the loader to find any dlls it needs. - func_warning "\`-no-install' is ignored for $host" - func_warning "assuming \`-no-fast-install' instead" - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - func_stripname '-R' '' "$arg" - dir=$func_stripname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - =*) - func_stripname '=' '' "$dir" - dir=$lt_sysroot$func_stripname_result - ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) func_append xrpath " $dir" ;; - esac - continue - ;; - - -shared) - # The effects of -shared are defined in a previous loop. - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -static | -static-libtool-libs) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -weak) - prev=weak - continue - ;; - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - func_append arg " $func_quote_for_eval_result" - func_append compiler_flags " $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Wl,*) - func_stripname '-Wl,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - func_append arg " $wl$func_quote_for_eval_result" - func_append compiler_flags " $wl$func_quote_for_eval_result" - func_append linker_flags " $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # -msg_* for osf cc - -msg_*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - # Flags to be passed through unchanged, with rationale: - # -64, -mips[0-9] enable 64-bit mode for the SGI compiler - # -r[0-9][0-9]* specify processor for the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler - # +DA*, +DD* enable 64-bit mode for the HP compiler - # -q* compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* architecture-specific flags for GCC - # -F/path path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* profiling flags for GCC - # @file GCC response files - # -tp=* Portland pgcc target processor selection - # --sysroot=* for sysroot support - # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-flto*|-fwhopr*|-fuse-linker-plugin) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - func_append compile_command " $arg" - func_append finalize_command " $arg" - func_append compiler_flags " $arg" - continue - ;; - - # Some other compiler flag. - -* | +*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - *.$objext) - # A standard object. - func_append objs " $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - func_append dlfiles " $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - func_append dlprefiles " $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - ;; - - *.$libext) - # An archive. - func_append deplibs " $arg" - func_append old_deplibs " $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - func_resolve_sysroot "$arg" - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - func_append dlfiles " $func_resolve_sysroot_result" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - func_append dlprefiles " $func_resolve_sysroot_result" - prev= - else - func_append deplibs " $func_resolve_sysroot_result" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - done # argument parsing loop - - test -n "$prev" && \ - func_fatal_help "the \`$prevarg' option requires an argument" - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - func_basename "$output" - outputname="$func_basename_result" - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - func_dirname "$output" "/" "" - output_objdir="$func_dirname_result$objdir" - func_to_tool_file "$output_objdir/" - tool_output_objdir=$func_to_tool_file_result - # Create the object directory. - func_mkdir_p "$output_objdir" - - # Determine the type of output - case $output in - "") - func_fatal_help "you must specify an output file" - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if $opt_preserve_dup_deps ; then - case "$libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append libs " $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if $opt_duplicate_compiler_generated_deps; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; - esac - func_append pre_post_deps " $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - - case $linkmode in - lib) - passes="conv dlpreopen link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - - for pass in $passes; do - # The preopen pass in lib mode reverses $deplibs; put it back here - # so that -L comes before libs that need it for instance... - if test "$linkmode,$pass" = "lib,link"; then - ## FIXME: Find the place where the list is rebuilt in the wrong - ## order, and fix it there properly - tmp_deplibs= - for deplib in $deplibs; do - tmp_deplibs="$deplib $tmp_deplibs" - done - deplibs="$tmp_deplibs" - fi - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) - libs="$deplibs %DEPLIBS%" - test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" - ;; - esac - fi - if test "$linkmode,$pass" = "lib,dlpreopen"; then - # Collect and forward deplibs of preopened libtool libs - for lib in $dlprefiles; do - # Ignore non-libtool-libs - dependency_libs= - func_resolve_sysroot "$lib" - case $lib in - *.la) func_source "$func_resolve_sysroot_result" ;; - esac - - # Collect preopened libtool deplibs, except any this library - # has declared as weak libs - for deplib in $dependency_libs; do - func_basename "$deplib" - deplib_base=$func_basename_result - case " $weak_libs " in - *" $deplib_base "*) ;; - *) func_append deplibs " $deplib" ;; - esac - done - done - libs="$dlprefiles" - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - func_append compiler_flags " $deplib" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) func_append new_inherited_linker_flags " $deplib" ;; - esac - fi - fi - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - func_warning "\`-l' is ignored for archives/objects" - continue - fi - func_stripname '-l' '' "$deplib" - name=$func_stripname_result - if test "$linkmode" = lib; then - searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" - else - searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" - fi - for searchdir in $searchdirs; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if func_lalib_p "$lib"; then - library_names= - old_library= - func_source "$lib" - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - *.ltframework) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) func_append new_inherited_linker_flags " $deplib" ;; - esac - fi - fi - continue - ;; - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - *) - func_warning "\`-L' is ignored for archives/objects" - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - func_stripname '-R' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) func_append xrpath " $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) - func_resolve_sysroot "$deplib" - lib=$func_resolve_sysroot_result - ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - # Linking convenience modules into shared libraries is allowed, - # but linking other static libraries is non-portable. - case " $dlpreconveniencelibs " in - *" $deplib "*) ;; - *) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - echo - $ECHO "*** Warning: Trying to link with static lib archive $deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because the file extensions .$libext of this argument makes me believe" - echo "*** that it is just a static archive that I should not use here." - else - echo - $ECHO "*** Warning: Linking the shared library $output against the" - $ECHO "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - ;; - esac - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - func_append newdlprefiles " $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - func_append newdlfiles " $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - - if test "$found" = yes || test -f "$lib"; then : - else - func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" - fi - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$lib" \ - || func_fatal_error "\`$lib' is not a valid libtool archive" - - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - inherited_linker_flags= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - avoidtemprpath= - - - # Read the .la file - func_source "$lib" - - # Convert "-framework foo" to "foo.ltframework" - if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` - for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do - case " $new_inherited_linker_flags " in - *" $tmp_inherited_linker_flag "*) ;; - *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; - esac - done - fi - dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && func_append dlfiles " $dlopen" - test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - # It is a libtool convenience library, so add in its objects. - func_append convenience " $ladir/$objdir/$old_library" - func_append old_convenience " $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append tmp_libs " $deplib" - done - elif test "$linkmode" != prog && test "$linkmode" != lib; then - func_fatal_error "\`$lib' is not a convenience library" - fi - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - if test -n "$old_library" && - { test "$prefer_static_libs" = yes || - test "$prefer_static_libs,$installed" = "built,no"; }; then - linklib=$old_library - else - for l in $old_library $library_names; do - linklib="$l" - done - fi - if test -z "$linklib"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - func_fatal_error "cannot -dlopen a convenience library: \`$lib'" - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - func_append dlprefiles " $lib $dependency_libs" - else - func_append newdlfiles " $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - func_warning "cannot determine absolute directory name of \`$ladir'" - func_warning "passing it literally to the linker, although it might fail" - abs_ladir="$ladir" - fi - ;; - esac - func_basename "$lib" - laname="$func_basename_result" - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - func_warning "library \`$lib' was moved." - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$lt_sysroot$libdir" - absdir="$lt_sysroot$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - func_append notinst_path " $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - func_append notinst_path " $abs_ladir" - fi - fi # $installed = yes - func_stripname 'lib' '.la' "$laname" - name=$func_stripname_result - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir" && test "$linkmode" = prog; then - func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" - fi - case "$host" in - # special handling for platforms with PE-DLLs. - *cygwin* | *mingw* | *cegcc* ) - # Linker will automatically link against shared library if both - # static and shared are present. Therefore, ensure we extract - # symbols from the import library if a shared library is present - # (otherwise, the dlopen module name will be incorrect). We do - # this by putting the import library name into $newdlprefiles. - # We recover the dlopen module name by 'saving' the la file - # name in a special purpose variable, and (later) extracting the - # dlname from the la file. - if test -n "$dlname"; then - func_tr_sh "$dir/$linklib" - eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" - func_append newdlprefiles " $dir/$linklib" - else - func_append newdlprefiles " $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - func_append dlpreconveniencelibs " $dir/$old_library" - fi - ;; - * ) - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - func_append newdlprefiles " $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - func_append dlpreconveniencelibs " $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - func_append newdlprefiles " $dir/$dlname" - else - func_append newdlprefiles " $dir/$linklib" - fi - ;; - esac - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - func_append newlib_search_path " $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append tmp_libs " $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { { test "$prefer_static_libs" = no || - test "$prefer_static_libs,$installed" = "built,yes"; } || - test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath:" in - *"$absdir:"*) ;; - *) func_append temp_rpath "$absdir:" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - use_static_libs=$prefer_static_libs - if test "$use_static_libs" = built && test "$installed" = yes; then - use_static_libs=no - fi - if test -n "$library_names" && - { test "$use_static_libs" = no || test -z "$old_library"; }; then - case $host in - *cygwin* | *mingw* | *cegcc*) - # No point in relinking DLLs because paths are not encoded - func_append notinst_deplibs " $lib" - need_relink=no - ;; - *) - if test "$installed" = no; then - func_append notinst_deplibs " $lib" - need_relink=yes - fi - ;; - esac - # This is a shared library - - # Warn about portability, can't link against -module's on some - # systems (darwin). Don't bleat about dlopened modules though! - dlopenmodule="" - for dlpremoduletest in $dlprefiles; do - if test "X$dlpremoduletest" = "X$lib"; then - dlopenmodule="$dlpremoduletest" - break - fi - done - if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - echo - if test "$linkmode" = prog; then - $ECHO "*** Warning: Linking the executable $output against the loadable module" - else - $ECHO "*** Warning: Linking the shared library $output against the loadable module" - fi - $ECHO "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - shift - realname="$1" - shift - libname=`eval "\\$ECHO \"$libname_spec\""` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw* | *cegcc*) - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - func_basename "$soroot" - soname="$func_basename_result" - func_stripname 'lib' '.dll' "$soname" - newlib=libimp-$func_stripname_result.a - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - func_verbose "extracting exported symbol list from \`$soname'" - func_execute_cmds "$extract_expsyms_cmds" 'exit $?' - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - func_verbose "generating import library for \`$soname'" - func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$opt_mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; - *-*-sysv4*uw2*) add_dir="-L$dir" ;; - *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ - *-*-unixware7*) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a (non-dlopened) module then we can not - # link against it, someone is ignoring the earlier warnings - if /usr/bin/file -L $add 2> /dev/null | - $GREP ": [^:]* bundle" >/dev/null ; then - if test "X$dlopenmodule" != "X$lib"; then - $ECHO "*** Warning: lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - echo - echo "*** And there doesn't seem to be a static archive available" - echo "*** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - elif test -n "$old_library"; then - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - func_append add_dir " -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - func_fatal_configuration "unsupported hardcode properties" - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) func_append compile_shlibpath "$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && - test "$hardcode_minus_L" != yes && - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$opt_mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - func_append add_dir " -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - echo - $ECHO "*** Warning: This system can not link to static lib archive $lib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - echo "*** But as you try to build a module library, libtool will still create " - echo "*** a static module, that should work as long as the dlopening application" - echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) func_stripname '-R' '' "$libdir" - temp_xrpath=$func_stripname_result - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) func_append xrpath " $temp_xrpath";; - esac;; - *) func_append temp_deplibs " $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - func_append newlib_search_path " $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result";; - *) func_resolve_sysroot "$deplib" ;; - esac - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $func_resolve_sysroot_result "*) - func_append specialdeplibs " $func_resolve_sysroot_result" ;; - esac - fi - func_append tmp_libs " $func_resolve_sysroot_result" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - path= - case $deplib in - -L*) path="$deplib" ;; - *.la) - func_resolve_sysroot "$deplib" - deplib=$func_resolve_sysroot_result - func_dirname "$deplib" "" "." - dir=$func_dirname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - func_warning "cannot determine absolute directory name of \`$dir'" - absdir="$dir" - fi - ;; - esac - if $GREP "^installed=no" $deplib > /dev/null; then - case $host in - *-*-darwin*) - depdepl= - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$absdir/$objdir/$depdepl" ; then - depdepl="$absdir/$objdir/$depdepl" - darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - if test -z "$darwin_install_name"; then - darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - fi - func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" - path= - fi - fi - ;; - *) - path="-L$absdir/$objdir" - ;; - esac - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - test "$absdir" != "$libdir" && \ - func_warning "\`$deplib' seems to be moved" - - path="-L$absdir" - fi - ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - if test "$pass" = link; then - if test "$linkmode" = "prog"; then - compile_deplibs="$new_inherited_linker_flags $compile_deplibs" - finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" - else - compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - fi - fi - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) func_append lib_search_path " $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) func_append tmp_libs " $deplib" ;; - esac - ;; - *) func_append tmp_libs " $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - func_append tmp_libs " $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - fi - if test "$linkmode" = prog || test "$linkmode" = lib; then - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for archives" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for archives" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for archives" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for archives" - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for archives" - - test -n "$release" && \ - func_warning "\`-release' is ignored for archives" - - test -n "$export_symbols$export_symbols_regex" && \ - func_warning "\`-export-symbols' is ignored for archives" - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - func_append objs "$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - func_stripname 'lib' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - test "$module" = no && \ - func_fatal_help "libtool library \`$output' must begin with \`lib'" - - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - func_stripname '' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - func_stripname '' '.la' "$outputname" - libname=$func_stripname_result - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" - else - echo - $ECHO "*** Warning: Linking the shared library $output against the non-libtool" - $ECHO "*** objects $objs is not portable!" - func_append libobjs " $objs" - fi - fi - - test "$dlself" != no && \ - func_warning "\`-dlopen self' is ignored for libtool libraries" - - set dummy $rpath - shift - test "$#" -gt 1 && \ - func_warning "ignoring multiple \`-rpath's for a libtool library" - - install_libdir="$1" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for convenience libraries" - - test -n "$release" && \ - func_warning "\`-release' is ignored for convenience libraries" - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - shift - IFS="$save_ifs" - - test -n "$7" && \ - func_fatal_help "too many parameters to \`-version-info'" - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$1" - number_minor="$2" - number_revision="$3" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows|none) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|qnx|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_minor" - lt_irix_increment=no - ;; - *) - func_fatal_configuration "$modename: unknown library version type \`$version_type'" - ;; - esac - ;; - no) - current="$1" - revision="$2" - age="$3" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "CURRENT \`$current' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "REVISION \`$revision' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "AGE \`$age' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - if test "$age" -gt "$current"; then - func_error "AGE \`$age' is greater than the current interface number \`$current'" - func_fatal_error "\`$vinfo' is not valid version information" - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - func_arith $current + 1 - minor_current=$func_arith_result - xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current" - ;; - - irix | nonstopux) - if test "X$lt_irix_increment" = "Xno"; then - func_arith $current - $age - else - func_arith $current - $age + 1 - fi - major=$func_arith_result - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - func_arith $revision - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - ;; - - osf) - func_arith $current - $age - major=.$func_arith_result - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - func_arith $current - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - func_append verstring ":${current}.0" - ;; - - qnx) - major=".$current" - versuffix=".$current" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - - *) - func_fatal_configuration "unknown library version type \`$version_type'" - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - func_warning "undefined symbols not allowed in $host shared libraries" - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - - fi - - func_generate_dlsyms "$libname" "$libname" "yes" - func_append libobjs " $symfileobj" - test "X$libobjs" = "X " && libobjs= - - if test "$opt_mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$ECHO "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext | *.gcno) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - func_append removelist " $p" - ;; - *) ;; - esac - done - test -n "$removelist" && \ - func_show_eval "${RM}r \$removelist" - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - func_append oldlibs " $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - #for path in $notinst_path; do - # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` - # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` - # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` - #done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - func_replace_sysroot "$libdir" - func_append temp_xrpath " -R$func_replace_sysroot_result" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) func_append dlfiles " $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) func_append dlprefiles " $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - func_append deplibs " System.ltframework" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - func_append deplibs " -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $opt_dry_run || $RM conftest.c - cat > conftest.c </dev/null` - $nocaseglob - else - potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` - fi - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null | - $GREP " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | - $SED -e 10q | - $EGREP "$file_magic_regex" > /dev/null; then - func_append newdeplibs " $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for file magic test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a file magic. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - func_append newdeplibs " $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - for a_deplib in $deplibs; do - case $a_deplib in - -l*) - func_stripname -l '' "$a_deplib" - name=$func_stripname_result - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - func_append newdeplibs " $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval "\\$ECHO \"$libname_spec\""` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ - $EGREP "$match_pattern_regex" > /dev/null; then - func_append newdeplibs " $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a regex pattern. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - func_append newdeplibs " $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` - done - fi - case $tmp_deplibs in - *[!\ \ ]*) - echo - if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." - else - echo "*** Warning: inter-library dependencies are not known to be supported." - fi - echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - ;; - esac - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - $ECHO "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - echo - echo "*** Since this library must not contain undefined symbols," - echo "*** because either the platform does not support them or" - echo "*** it was explicitly requested with -no-undefined," - echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - case $host in - *-*-darwin*) - newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $deplibs " in - *" -L$path/$objdir "*) - func_append new_libs " -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) func_append new_libs " $deplib" ;; - esac - ;; - *) func_append new_libs " $deplib" ;; - esac - done - deplibs="$new_libs" - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$opt_mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - func_replace_sysroot "$libdir" - libdir=$func_replace_sysroot_result - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append dep_rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) func_apped perm_rpath " $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - func_append rpath "$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - shift - realname="$1" - shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - linknames= - for link - do - func_append linknames " $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` - test "X$libobjs" = "X " && libobjs= - - delfiles= - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" - export_symbols="$output_objdir/$libname.uexp" - func_append delfiles " $export_symbols" - fi - - orig_export_symbols= - case $host_os in - cygwin* | mingw* | cegcc*) - if test -n "$export_symbols" && test -z "$export_symbols_regex"; then - # exporting using user supplied symfile - if test "x`$SED 1q $export_symbols`" != xEXPORTS; then - # and it's NOT already a .def file. Must figure out - # which of the given symbols are data symbols and tag - # them as such. So, trigger use of export_symbols_cmds. - # export_symbols gets reassigned inside the "prepare - # the list of exported symbols" if statement, so the - # include_expsyms logic still works. - orig_export_symbols="$export_symbols" - export_symbols= - always_export_symbols=yes - fi - fi - ;; - esac - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd1 in $cmds; do - IFS="$save_ifs" - # Take the normal branch if the nm_file_list_spec branch - # doesn't work or if tool conversion is not needed. - case $nm_file_list_spec~$to_tool_file_cmd in - *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) - try_normal_branch=yes - eval cmd=\"$cmd1\" - func_len " $cmd" - len=$func_len_result - ;; - *) - try_normal_branch=no - ;; - esac - if test "$try_normal_branch" = yes \ - && { test "$len" -lt "$max_cmd_len" \ - || test "$max_cmd_len" -le -1; } - then - func_show_eval "$cmd" 'exit $?' - skipped_export=false - elif test -n "$nm_file_list_spec"; then - func_basename "$output" - output_la=$func_basename_result - save_libobjs=$libobjs - save_output=$output - output=${output_objdir}/${output_la}.nm - func_to_tool_file "$output" - libobjs=$nm_file_list_spec$func_to_tool_file_result - func_append delfiles " $output" - func_verbose "creating $NM input file list: $output" - for obj in $save_libobjs; do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > "$output" - eval cmd=\"$cmd1\" - func_show_eval "$cmd" 'exit $?' - output=$save_output - libobjs=$save_libobjs - skipped_export=false - else - # The command line is too long to execute in one step. - func_verbose "using reloadable object file for export list..." - skipped_export=: - # Break out early, otherwise skipped_export may be - # set to false by a later but shorter cmd. - break - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - func_append delfiles " $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - func_append tmp_deplibs " $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec" && - test "$compiler_needs_object" = yes && - test -z "$libobjs"; then - # extract the archives, so we have objects to list. - # TODO: could optimize this to just extract one archive. - whole_archive_flag_spec= - fi - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - else - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $convenience - func_append libobjs " $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - func_append linker_flags " $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$opt_mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && - func_len " $test_cmds" && - len=$func_len_result && - test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise - # or, if using GNU ld and skipped_export is not :, use a linker - # script. - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - func_basename "$output" - output_la=$func_basename_result - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - last_robj= - k=1 - - if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then - output=${output_objdir}/${output_la}.lnkscript - func_verbose "creating GNU ld script: $output" - echo 'INPUT (' > $output - for obj in $save_libobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output - done - echo ')' >> $output - func_append delfiles " $output" - func_to_tool_file "$output" - output=$func_to_tool_file_result - elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then - output=${output_objdir}/${output_la}.lnk - func_verbose "creating linker input file list: $output" - : > $output - set x $save_libobjs - shift - firstobj= - if test "$compiler_needs_object" = yes; then - firstobj="$1 " - shift - fi - for obj - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output - done - func_append delfiles " $output" - func_to_tool_file "$output" - output=$firstobj\"$file_list_spec$func_to_tool_file_result\" - else - if test -n "$save_libobjs"; then - func_verbose "creating reloadable object files..." - output=$output_objdir/$output_la-${k}.$objext - eval test_cmds=\"$reload_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - if test "X$objlist" = X || - test "$len" -lt "$max_cmd_len"; then - func_append objlist " $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - reload_objs=$objlist - eval concat_cmds=\"$reload_cmds\" - else - # All subsequent reloadable object files will link in - # the last one created. - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" - fi - last_robj=$output_objdir/$output_la-${k}.$objext - func_arith $k + 1 - k=$func_arith_result - output=$output_objdir/$output_la-${k}.$objext - objlist=" $obj" - func_len " $last_robj" - func_arith $len0 + $func_len_result - len=$func_arith_result - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\${concat_cmds}$reload_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" - fi - func_append delfiles " $output" - - else - output= - fi - - if ${skipped_export-false}; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - libobjs=$output - # Append the command to create the export file. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" - fi - fi - - test -n "$save_libobjs" && - func_verbose "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - if test -n "$export_symbols_regex" && ${skipped_export-false}; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - - if ${skipped_export-false}; then - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - func_append delfiles " $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - fi - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - fi - - if test -n "$delfiles"; then - # Append the command to remove temporary files to $cmds. - eval cmds=\"\$cmds~\$RM $delfiles\" - fi - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $dlprefiles - func_append libobjs " $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? - - if test -n "$convenience"; then - if test -z "$whole_archive_flag_spec"; then - func_show_eval '${RM}r "$gentop"' - fi - fi - - exit $EXIT_SUCCESS - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for objects" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for objects" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for objects" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for objects" - - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for objects" - - test -n "$release" && \ - func_warning "\`-release' is ignored for objects" - - case $output in - *.lo) - test -n "$objs$old_deplibs" && \ - func_fatal_error "cannot build library object \`$output' from non-libtool objects" - - libobj=$output - func_lo2o "$libobj" - obj=$func_lo2o_result - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $opt_dry_run || $RM $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec and hope we can get by with - # turning comma into space.. - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` - else - gentop="$output_objdir/${obj}x" - func_append generated " $gentop" - - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - - # If we're not building shared, we need to use non_pic_objs - test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - func_execute_cmds "$reload_cmds" 'exit $?' - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - func_execute_cmds "$reload_cmds" 'exit $?' - fi - - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) func_stripname '' '.exe' "$output" - output=$func_stripname_result.exe;; - esac - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for programs" - - test -n "$release" && \ - func_warning "\`-release' is ignored for programs" - - test "$preload" = yes \ - && test "$dlopen_support" = unknown \ - && test "$dlopen_self" = unknown \ - && test "$dlopen_self_static" = unknown && \ - func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - case $host in - *-*-darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - # But is supposedly fixed on 10.4 or later (yay!). - if test "$tagname" = CXX ; then - case ${MACOSX_DEPLOYMENT_TARGET-10.0} in - 10.[0123]) - func_append compile_command " ${wl}-bind_at_load" - func_append finalize_command " ${wl}-bind_at_load" - ;; - esac - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $compile_deplibs " in - *" -L$path/$objdir "*) - func_append new_libs " -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $compile_deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) func_append new_libs " $deplib" ;; - esac - ;; - *) func_append new_libs " $deplib" ;; - esac - done - compile_deplibs="$new_libs" - - - func_append compile_command " $compile_deplibs" - func_append finalize_command " $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) func_append perm_rpath " $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$libdir:"*) ;; - ::) dllsearchpath=$libdir;; - *) func_append dllsearchpath ":$libdir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) func_append finalize_perm_rpath " $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - fi - - func_generate_dlsyms "$outputname" "@PROGRAM@" "no" - - # template prelinking step - if test -n "$prelink_cmds"; then - func_execute_cmds "$prelink_cmds" 'exit $?' - fi - - wrappers_required=yes - case $host in - *cegcc* | *mingw32ce*) - # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. - wrappers_required=no - ;; - *cygwin* | *mingw* ) - if test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - *) - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - esac - if test "$wrappers_required" = no; then - # Replace the output file specification. - compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - exit_status=0 - func_show_eval "$link_command" 'exit_status=$?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - # Delete the generated files. - if test -f "$output_objdir/${outputname}S.${objext}"; then - func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' - fi - - exit $exit_status - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - func_append rpath "$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - func_append rpath "$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $opt_dry_run || $RM $output - # Link the executable and exit - func_show_eval "$link_command" 'exit $?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - func_warning "this platform does not like uninstalled shared libraries" - func_warning "\`$output' will be relinked during installation" - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname - - func_show_eval "$link_command" 'exit $?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output_objdir/$outputname" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - # Now create the wrapper script. - func_verbose "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - fi - - # Only actually do things if not in dry run mode. - $opt_dry_run || { - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) func_stripname '' '.exe' "$output" - output=$func_stripname_result ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - func_stripname '' '.exe' "$outputname" - outputname=$func_stripname_result ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - func_dirname_and_basename "$output" "" "." - output_name=$func_basename_result - output_path=$func_dirname_result - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" - $RM $cwrappersource $cwrapper - trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - func_emit_cwrapperexe_src > $cwrappersource - - # The wrapper executable is built using the $host compiler, - # because it contains $host paths and files. If cross- - # compiling, it, like the target executable, must be - # executed on the $host or under an emulation environment. - $opt_dry_run || { - $LTCC $LTCFLAGS -o $cwrapper $cwrappersource - $STRIP $cwrapper - } - - # Now, create the wrapper script for func_source use: - func_ltwrapper_scriptname $cwrapper - $RM $func_ltwrapper_scriptname_result - trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 - $opt_dry_run || { - # note: this script will not be executed, so do not chmod. - if test "x$build" = "x$host" ; then - $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result - else - func_emit_wrapper no > $func_ltwrapper_scriptname_result - fi - } - ;; - * ) - $RM $output - trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 - - func_emit_wrapper no > $output - chmod +x $output - ;; - esac - } - exit $EXIT_SUCCESS - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save $symfileobj" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - if test "$preload" = yes && test -f "$symfileobj"; then - func_append oldobjs " $symfileobj" - fi - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $addlibs - func_append oldobjs " $func_extract_archives_result" - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds - else - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $dlprefiles - func_append oldobjs " $func_extract_archives_result" - fi - - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - func_basename "$obj" - $ECHO "$func_basename_result" - done | sort | sort -uc >/dev/null 2>&1); then - : - else - echo "copying selected object files to avoid basename conflicts..." - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - func_mkdir_p "$gentop" - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - func_basename "$obj" - objbase="$func_basename_result" - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - func_arith $counter + 1 - counter=$func_arith_result - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - func_append oldobjs " $gentop/$newobj" - ;; - *) func_append oldobjs " $obj" ;; - esac - done - fi - eval cmds=\"$old_archive_cmds\" - - func_len " $cmds" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - elif test -n "$archiver_list_spec"; then - func_verbose "using command file archive linking..." - for obj in $oldobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > $output_objdir/$libname.libcmd - func_to_tool_file "$output_objdir/$libname.libcmd" - oldobjs=" $archiver_list_spec$func_to_tool_file_result" - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - func_verbose "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - oldobjs= - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - eval test_cmds=\"$old_archive_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - for obj in $save_oldobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - func_append objlist " $obj" - if test "$len" -lt "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - len=$len0 - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" - fi - fi - fi - func_execute_cmds "$cmds" 'exit $?' - done - - test -n "$generated" && \ - func_show_eval "${RM}r$generated" - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - func_verbose "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - - # Only create the output if not a dry run. - $opt_dry_run || { - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - func_basename "$deplib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" - ;; - -L*) - func_stripname -L '' "$deplib" - func_replace_sysroot "$func_stripname_result" - func_append newdependency_libs " -L$func_replace_sysroot_result" - ;; - -R*) - func_stripname -R '' "$deplib" - func_replace_sysroot "$func_stripname_result" - func_append newdependency_libs " -R$func_replace_sysroot_result" - ;; - *) func_append newdependency_libs " $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - - for lib in $dlfiles; do - case $lib in - *.la) - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" - ;; - *) func_append newdlfiles " $lib" ;; - esac - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - *.la) - # Only pass preopened files to the pseudo-archive (for - # eventual linking with the app. that links it) if we - # didn't already link the preopened objects directly into - # the library: - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" - ;; - esac - done - dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - func_append newdlfiles " $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - func_append newdlprefiles " $abs" - done - dlprefiles="$newdlprefiles" - fi - $RM $output - # place dlname in correct position for cygwin - # In fact, it would be nice if we could use this code for all target - # systems that can't hard-code library paths into their executables - # and that have no shared library path variable independent of PATH, - # but it turns out we can't easily determine that from inspecting - # libtool variables, so we have to hard-code the OSs to which it - # applies here; at the moment, that means platforms that use the PE - # object format with DLL files. See the long comment at the top of - # tests/bindir.at for full details. - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) - # If a -bindir argument was supplied, place the dll there. - if test "x$bindir" != x ; - then - func_relative_path "$install_libdir" "$bindir" - tdlname=$func_relative_path_result$dlname - else - # Otherwise fall back on heuristic. - tdlname=../bin/$dlname - fi - ;; - esac - $ECHO > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags='$new_inherited_linker_flags' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Names of additional weak libraries provided by this library -weak_library_names='$weak_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $ECHO >> $output "\ -relink_command=\"$relink_command\"" - fi - done - } - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' - ;; - esac - exit $EXIT_SUCCESS -} - -{ test "$opt_mode" = link || test "$opt_mode" = relink; } && - func_mode_link ${1+"$@"} - - -# func_mode_uninstall arg... -func_mode_uninstall () -{ - $opt_debug - RM="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) func_append RM " $arg"; rmforce=yes ;; - -*) func_append RM " $arg" ;; - *) func_append files " $arg" ;; - esac - done - - test -z "$RM" && \ - func_fatal_help "you must specify an RM program" - - rmdirs= - - for file in $files; do - func_dirname "$file" "" "." - dir="$func_dirname_result" - if test "X$dir" = X.; then - odir="$objdir" - else - odir="$dir/$objdir" - fi - func_basename "$file" - name="$func_basename_result" - test "$opt_mode" = uninstall && odir="$dir" - - # Remember odir for removal later, being careful to avoid duplicates - if test "$opt_mode" = clean; then - case " $rmdirs " in - *" $odir "*) ;; - *) func_append rmdirs " $odir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if { test -L "$file"; } >/dev/null 2>&1 || - { test -h "$file"; } >/dev/null 2>&1 || - test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if func_lalib_p "$file"; then - func_source $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - func_append rmfiles " $odir/$n" - done - test -n "$old_library" && func_append rmfiles " $odir/$old_library" - - case "$opt_mode" in - clean) - case " $library_names " in - *" $dlname "*) ;; - *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; - esac - test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" - ;; - uninstall) - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - # FIXME: should reinstall the best remaining shared library. - ;; - esac - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if func_lalib_p "$file"; then - - # Read the .lo file - func_source $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" && - test "$pic_object" != none; then - func_append rmfiles " $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" && - test "$non_pic_object" != none; then - func_append rmfiles " $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$opt_mode" = clean ; then - noexename=$name - case $file in - *.exe) - func_stripname '' '.exe' "$file" - file=$func_stripname_result - func_stripname '' '.exe' "$name" - noexename=$func_stripname_result - # $file with .exe has already been added to rmfiles, - # add $file without .exe - func_append rmfiles " $file" - ;; - esac - # Do a test to see if this is a libtool program. - if func_ltwrapper_p "$file"; then - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - relink_command= - func_source $func_ltwrapper_scriptname_result - func_append rmfiles " $func_ltwrapper_scriptname_result" - else - relink_command= - func_source $dir/$noexename - fi - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - func_append rmfiles " $odir/$name $odir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - func_append rmfiles " $odir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - func_append rmfiles " $odir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - func_show_eval "$RM $rmfiles" 'exit_status=1' - done - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - func_show_eval "rmdir $dir >/dev/null 2>&1" - fi - done - - exit $exit_status -} - -{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && - func_mode_uninstall ${1+"$@"} - -test -z "$opt_mode" && { - help="$generic_help" - func_fatal_help "you must specify a MODE" -} - -test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$opt_mode'" - -if test -n "$exec_cmd"; then - eval exec "$exec_cmd" - exit $EXIT_FAILURE -fi - -exit $exit_status - - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: -# vi:sw=2 - diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/mkinstalldirs b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/mkinstalldirs deleted file mode 100644 index 879e5292..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/conftools/mkinstalldirs +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain - -# $Id: mkinstalldirs,v 1.1 2012/06/15 13:38:49 dromagod Exp $ - -errstatus=0 - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/expat.png b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/expat.png deleted file mode 100644 index 5bc0726c..00000000 Binary files a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/expat.png and /dev/null differ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/reference.html b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/reference.html deleted file mode 100644 index 8811a339..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/reference.html +++ /dev/null @@ -1,2390 +0,0 @@ - - - - - - Expat XML Parser - - - - - - - - - - - - - - -
(Expat logo)
Release 2.0.1
-
- -

Expat is a library, written in C, for parsing XML documents. It's -the underlying XML parser for the open source Mozilla project, Perl's -XML::Parser, Python's xml.parsers.expat, and -other open-source XML parsers.

- -

This library is the creation of James Clark, who's also given us -groff (an nroff look-alike), Jade (an implemention of ISO's DSSSL -stylesheet language for SGML), XP (a Java XML parser package), XT (a -Java XSL engine). James was also the technical lead on the XML -Working Group at W3C that produced the XML specification.

- -

This is free software, licensed under the MIT/X Consortium license. You may download it -from the Expat home page. -

- -

The bulk of this document was originally commissioned as an article -by XML.com. They graciously allowed -Clark Cooper to retain copyright and to distribute it with Expat. -This version has been substantially extended to include documentation -on features which have been added since the original article was -published, and additional information on using the original -interface.

- -
-

Table of Contents

- - -
-

Overview

- -

Expat is a stream-oriented parser. You register callback (or -handler) functions with the parser and then start feeding it the -document. As the parser recognizes parts of the document, it will -call the appropriate handler for that part (if you've registered one.) -The document is fed to the parser in pieces, so you can start parsing -before you have all the document. This also allows you to parse really -huge documents that won't fit into memory.

- -

Expat can be intimidating due to the many kinds of handlers and -options you can set. But you only need to learn four functions in -order to do 90% of what you'll want to do with it:

- -
- -
XML_ParserCreate
-
Create a new parser object.
- -
XML_SetElementHandler
-
Set handlers for start and end tags.
- -
XML_SetCharacterDataHandler
-
Set handler for text.
- -
XML_Parse
-
Pass a buffer full of document to the parser
-
- -

These functions and others are described in the reference part of this document. The reference -section also describes in detail the parameters passed to the -different types of handlers.

- -

Let's look at a very simple example program that only uses 3 of the -above functions (it doesn't need to set a character handler.) The -program outline.c prints an -element outline, indenting child elements to distinguish them from the -parent element that contains them. The start handler does all the -work. It prints two indenting spaces for every level of ancestor -elements, then it prints the element and attribute -information. Finally it increments the global Depth -variable.

- -
-int Depth;
-
-void XMLCALL
-start(void *data, const char *el, const char **attr) {
-  int i;
-
-  for (i = 0; i < Depth; i++)
-    printf("  ");
-
-  printf("%s", el);
-
-  for (i = 0; attr[i]; i += 2) {
-    printf(" %s='%s'", attr[i], attr[i + 1]);
-  }
-
-  printf("\n");
-  Depth++;
-}  /* End of start handler */
-
- -

The end tag simply does the bookkeeping work of decrementing -Depth.

-
-void XMLCALL
-end(void *data, const char *el) {
-  Depth--;
-}  /* End of end handler */
-
- -

Note the XMLCALL annotation used for the callbacks. -This is used to ensure that the Expat and the callbacks are using the -same calling convention in case the compiler options used for Expat -itself and the client code are different. Expat tries not to care -what the default calling convention is, though it may require that it -be compiled with a default convention of "cdecl" on some platforms. -For code which uses Expat, however, the calling convention is -specified by the XMLCALL annotation on most platforms; -callbacks should be defined using this annotation.

- -

The XMLCALL annotation was added in Expat 1.95.7, but -existing working Expat applications don't need to add it (since they -are already using the "cdecl" calling convention, or they wouldn't be -working). The annotation is only needed if the default calling -convention may be something other than "cdecl". To use the annotation -safely with older versions of Expat, you can conditionally define it -after including Expat's header file:

- -
-#include <expat.h>
-
-#ifndef XMLCALL
-#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
-#define XMLCALL __cdecl
-#elif defined(__GNUC__)
-#define XMLCALL __attribute__((cdecl))
-#else
-#define XMLCALL
-#endif
-#endif
-
- -

After creating the parser, the main program just has the job of -shoveling the document to the parser so that it can do its work.

- -
-

Building and Installing Expat

- -

The Expat distribution comes as a compressed (with GNU gzip) tar -file. You may download the latest version from Source Forge. After -unpacking this, cd into the directory. Then follow either the Win32 -directions or Unix directions below.

- -

Building under Win32

- -

If you're using the GNU compiler under cygwin, follow the Unix -directions in the next section. Otherwise if you have Microsoft's -Developer Studio installed, then from Windows Explorer double-click on -"expat.dsp" in the lib directory and build and install in the usual -manner.

- -

Alternatively, you may download the Win32 binary package that -contains the "expat.h" include file and a pre-built DLL.

- -

Building under Unix (or GNU)

- -

First you'll need to run the configure shell script in order to -configure the Makefiles and headers for your system.

- -

If you're happy with all the defaults that configure picks for you, -and you have permission on your system to install into /usr/local, you -can install Expat with this sequence of commands:

- -
-./configure
-make
-make install
-
- -

There are some options that you can provide to this script, but the -only one we'll mention here is the --prefix option. You -can find out all the options available by running configure with just -the --help option.

- -

By default, the configure script sets things up so that the library -gets installed in /usr/local/lib and the associated -header file in /usr/local/include. But if you were to -give the option, --prefix=/home/me/mystuff, then the -library and header would get installed in -/home/me/mystuff/lib and -/home/me/mystuff/include respectively.

- -

Configuring Expat Using the Pre-Processor

- -

Expat's feature set can be configured using a small number of -pre-processor definitions. The definition of this symbols does not -affect the set of entry points for Expat, only the behavior of the API -and the definition of character types in the case of -XML_UNICODE_WCHAR_T. The symbols are:

- -
-
XML_DTD
-
Include support for using and reporting DTD-based content. If -this is defined, default attribute values from an external DTD subset -are reported and attribute value normalization occurs based on the -type of attributes defined in the external subset. Without -this, Expat has a smaller memory footprint and can be faster, but will -not load external entities or process conditional sections. This does -not affect the set of functions available in the API.
- -
XML_NS
-
When defined, support for the Namespaces in XML -specification is included.
- -
XML_UNICODE
-
When defined, character data reported to the application is -encoded in UTF-16 using wide characters of the type -XML_Char. This is implied if -XML_UNICODE_WCHAR_T is defined.
- -
XML_UNICODE_WCHAR_T
-
If defined, causes the XML_Char character type to be -defined using the wchar_t type; otherwise, unsigned -short is used. Defining this implies -XML_UNICODE.
- -
XML_LARGE_SIZE
-
If defined, causes the XML_Size and XML_Index -integer types to be at least 64 bits in size. This is intended to support -processing of very large input streams, where the return values of -XML_GetCurrentByteIndex, -XML_GetCurrentLineNumber and -XML_GetCurrentColumnNumber -could overflow. It may not be supported by all compilers, and is turned -off by default.
- -
XML_CONTEXT_BYTES
-
The number of input bytes of markup context which the parser will -ensure are available for reporting via XML_GetInputContext. This is -normally set to 1024, and must be set to a positive interger. If this -is not defined, the input context will not be available and XML_GetInputContext will -always report NULL. Without this, Expat has a smaller memory -footprint and can be faster.
- -
XML_STATIC
-
On Windows, this should be set if Expat is going to be linked -statically with the code that calls it; this is required to get all -the right MSVC magic annotations correct. This is ignored on other -platforms.
- -
XML_ATTR_INFO
-
If defined, makes the the additional function XML_GetAttributeInfo available -for reporting attribute byte offsets.
-
- -
-

Using Expat

- -

Compiling and Linking Against Expat

- -

Unless you installed Expat in a location not expected by your -compiler and linker, all you have to do to use Expat in your programs -is to include the Expat header (#include <expat.h>) -in your files that make calls to it and to tell the linker that it -needs to link against the Expat library. On Unix systems, this would -usually be done with the -lexpat argument. Otherwise, -you'll need to tell the compiler where to look for the Expat header -and the linker where to find the Expat library. You may also need to -take steps to tell the operating system where to find this library at -run time.

- -

On a Unix-based system, here's what a Makefile might look like when -Expat is installed in a standard location:

- -
-CC=cc
-LDFLAGS=
-LIBS= -lexpat
-xmlapp: xmlapp.o
-        $(CC) $(LDFLAGS) -o xmlapp xmlapp.o $(LIBS)
-
- -

If you installed Expat in, say, /home/me/mystuff, then -the Makefile would look like this:

- -
-CC=cc
-CFLAGS= -I/home/me/mystuff/include
-LDFLAGS=
-LIBS= -L/home/me/mystuff/lib -lexpat
-xmlapp: xmlapp.o
-        $(CC) $(LDFLAGS) -o xmlapp xmlapp.o $(LIBS)
-
- -

You'd also have to set the environment variable -LD_LIBRARY_PATH to /home/me/mystuff/lib (or -to ${LD_LIBRARY_PATH}:/home/me/mystuff/lib if -LD_LIBRARY_PATH already has some directories in it) in order to run -your application.

- -

Expat Basics

- -

As we saw in the example in the overview, the first step in parsing -an XML document with Expat is to create a parser object. There are three functions in the Expat API for creating a -parser object. However, only two of these (XML_ParserCreate and XML_ParserCreateNS) can be used for -constructing a parser for a top-level document. The object returned -by these functions is an opaque pointer (i.e. "expat.h" declares it as -void *) to data with further internal structure. In order to free the -memory associated with this object you must call XML_ParserFree. Note that if you have -provided any user data that gets stored in the -parser, then your application is responsible for freeing it prior to -calling XML_ParserFree.

- -

The objects returned by the parser creation functions are good for -parsing only one XML document or external parsed entity. If your -application needs to parse many XML documents, then it needs to create -a parser object for each one. The best way to deal with this is to -create a higher level object that contains all the default -initialization you want for your parser objects.

- -

Walking through a document hierarchy with a stream oriented parser -will require a good stack mechanism in order to keep track of current -context. For instance, to answer the simple question, "What element -does this text belong to?" requires a stack, since the parser may have -descended into other elements that are children of the current one and -has encountered this text on the way out.

- -

The things you're likely to want to keep on a stack are the -currently opened element and it's attributes. You push this -information onto the stack in the start handler and you pop it off in -the end handler.

- -

For some tasks, it is sufficient to just keep information on what -the depth of the stack is (or would be if you had one.) The outline -program shown above presents one example. Another such task would be -skipping over a complete element. When you see the start tag for the -element you want to skip, you set a skip flag and record the depth at -which the element started. When the end tag handler encounters the -same depth, the skipped element has ended and the flag may be -cleared. If you follow the convention that the root element starts at -1, then you can use the same variable for skip flag and skip -depth.

- -
-void
-init_info(Parseinfo *info) {
-  info->skip = 0;
-  info->depth = 1;
-  /* Other initializations here */
-}  /* End of init_info */
-
-void XMLCALL
-rawstart(void *data, const char *el, const char **attr) {
-  Parseinfo *inf = (Parseinfo *) data;
-
-  if (! inf->skip) {
-    if (should_skip(inf, el, attr)) {
-      inf->skip = inf->depth;
-    }
-    else
-      start(inf, el, attr);     /* This does rest of start handling */
-  }
-
-  inf->depth++;
-}  /* End of rawstart */
-
-void XMLCALL
-rawend(void *data, const char *el) {
-  Parseinfo *inf = (Parseinfo *) data;
-
-  inf->depth--;
-
-  if (! inf->skip)
-    end(inf, el);              /* This does rest of end handling */
-
-  if (inf->skip == inf->depth)
-    inf->skip = 0;
-}  /* End rawend */
-
- -

Notice in the above example the difference in how depth is -manipulated in the start and end handlers. The end tag handler should -be the mirror image of the start tag handler. This is necessary to -properly model containment. Since, in the start tag handler, we -incremented depth after the main body of start tag code, then -in the end handler, we need to manipulate it before the main -body. If we'd decided to increment it first thing in the start -handler, then we'd have had to decrement it last thing in the end -handler.

- -

Communicating between handlers

- -

In order to be able to pass information between different handlers -without using globals, you'll need to define a data structure to hold -the shared variables. You can then tell Expat (with the XML_SetUserData function) to pass a -pointer to this structure to the handlers. This is the first -argument received by most handlers. In the reference section, an argument to a callback function is named -userData and have type void * if the user -data is passed; it will have the type XML_Parser if the -parser itself is passed. When the parser is passed, the user data may -be retrieved using XML_GetUserData.

- -

One common case where multiple calls to a single handler may need -to communicate using an application data structure is the case when -content passed to the character data handler (set by XML_SetCharacterDataHandler) needs to be accumulated. A -common first-time mistake with any of the event-oriented interfaces to -an XML parser is to expect all the text contained in an element to be -reported by a single call to the character data handler. Expat, like -many other XML parsers, reports such data as a sequence of calls; -there's no way to know when the end of the sequence is reached until a -different callback is made. A buffer referenced by the user data -structure proves both an effective and convenient place to accumulate -character data.

- - - - -

XML Version

- -

Expat is an XML 1.0 parser, and as such never complains based on -the value of the version pseudo-attribute in the XML -declaration, if present.

- -

If an application needs to check the version number (to support -alternate processing), it should use the XML_SetXmlDeclHandler function to -set a handler that uses the information in the XML declaration to -determine what to do. This example shows how to check that only a -version number of "1.0" is accepted:

- -
-static int wrong_version;
-static XML_Parser parser;
-
-static void XMLCALL
-xmldecl_handler(void            *userData,
-                const XML_Char  *version,
-                const XML_Char  *encoding,
-                int              standalone)
-{
-  static const XML_Char Version_1_0[] = {'1', '.', '0', 0};
-
-  int i;
-
-  for (i = 0; i < (sizeof(Version_1_0) / sizeof(Version_1_0[0])); ++i) {
-    if (version[i] != Version_1_0[i]) {
-      wrong_version = 1;
-      /* also clear all other handlers: */
-      XML_SetCharacterDataHandler(parser, NULL);
-      ...
-      return;
-    }
-  }
-  ...
-}
-
- -

Namespace Processing

- -

When the parser is created using the XML_ParserCreateNS, function, Expat -performs namespace processing. Under namespace processing, Expat -consumes xmlns and xmlns:... attributes, -which declare namespaces for the scope of the element in which they -occur. This means that your start handler will not see these -attributes. Your application can still be informed of these -declarations by setting namespace declaration handlers with XML_SetNamespaceDeclHandler.

- -

Element type and attribute names that belong to a given namespace -are passed to the appropriate handler in expanded form. By default -this expanded form is a concatenation of the namespace URI, the -separator character (which is the 2nd argument to XML_ParserCreateNS), and the local -name (i.e. the part after the colon). Names with undeclared prefixes -are not well-formed when namespace processing is enabled, and will -trigger an error. Unprefixed attribute names are never expanded, -and unprefixed element names are only expanded when they are in the -scope of a default namespace.

- -

However if XML_SetReturnNSTriplet has been called with a non-zero -do_nst parameter, then the expanded form for names with -an explicit prefix is a concatenation of: URI, separator, local name, -separator, prefix.

- -

You can set handlers for the start of a namespace declaration and -for the end of a scope of a declaration with the XML_SetNamespaceDeclHandler -function. The StartNamespaceDeclHandler is called prior to the start -tag handler and the EndNamespaceDeclHandler is called after the -corresponding end tag that ends the namespace's scope. The namespace -start handler gets passed the prefix and URI for the namespace. For a -default namespace declaration (xmlns='...'), the prefix will be null. -The URI will be null for the case where the default namespace is being -unset. The namespace end handler just gets the prefix for the closing -scope.

- -

These handlers are called for each declaration. So if, for -instance, a start tag had three namespace declarations, then the -StartNamespaceDeclHandler would be called three times before the start -tag handler is called, once for each declaration.

- -

Character Encodings

- -

While XML is based on Unicode, and every XML processor is required -to recognized UTF-8 and UTF-16 (1 and 2 byte encodings of Unicode), -other encodings may be declared in XML documents or entities. For the -main document, an XML declaration may contain an encoding -declaration:

-
-<?xml version="1.0" encoding="ISO-8859-2"?>
-
- -

External parsed entities may begin with a text declaration, which -looks like an XML declaration with just an encoding declaration:

-
-<?xml encoding="Big5"?>
-
- -

With Expat, you may also specify an encoding at the time of -creating a parser. This is useful when the encoding information may -come from a source outside the document itself (like a higher level -protocol.)

- -

There are four built-in encodings -in Expat:

-
    -
  • UTF-8
  • -
  • UTF-16
  • -
  • ISO-8859-1
  • -
  • US-ASCII
  • -
- -

Anything else discovered in an encoding declaration or in the -protocol encoding specified in the parser constructor, triggers a call -to the UnknownEncodingHandler. This handler gets passed -the encoding name and a pointer to an XML_Encoding data -structure. Your handler must fill in this structure and return -XML_STATUS_OK if it knows how to deal with the -encoding. Otherwise the handler should return -XML_STATUS_ERROR. The handler also gets passed a pointer -to an optional application data structure that you may indicate when -you set the handler.

- -

Expat places restrictions on character encodings that it can -support by filling in the XML_Encoding structure. -include file:

-
    -
  1. Every ASCII character that can appear in a well-formed XML document -must be represented by a single byte, and that byte must correspond to -it's ASCII encoding (except for the characters $@\^'{}~)
  2. -
  3. Characters must be encoded in 4 bytes or less.
  4. -
  5. All characters encoded must have Unicode scalar values less than or -equal to 65535 (0xFFFF)This does not apply to the built-in support -for UTF-16 and UTF-8
  6. -
  7. No character may be encoded by more that one distinct sequence of -bytes
  8. -
- -

XML_Encoding contains an array of integers that -correspond to the 1st byte of an encoding sequence. If the value in -the array for a byte is zero or positive, then the byte is a single -byte encoding that encodes the Unicode scalar value contained in the -array. A -1 in this array indicates a malformed byte. If the value is --2, -3, or -4, then the byte is the beginning of a 2, 3, or 4 byte -sequence respectively. Multi-byte sequences are sent to the convert -function pointed at in the XML_Encoding structure. This -function should return the Unicode scalar value for the sequence or -1 -if the sequence is malformed.

- -

One pitfall that novice Expat users are likely to fall into is that -although Expat may accept input in various encodings, the strings that -it passes to the handlers are always encoded in UTF-8 or UTF-16 -(depending on how Expat was compiled). Your application is responsible -for any translation of these strings into other encodings.

- -

Handling External Entity References

- -

Expat does not read or parse external entities directly. Note that -any external DTD is a special case of an external entity. If you've -set no ExternalEntityRefHandler, then external entity -references are silently ignored. Otherwise, it calls your handler with -the information needed to read and parse the external entity.

- -

Your handler isn't actually responsible for parsing the entity, but -it is responsible for creating a subsidiary parser with XML_ExternalEntityParserCreate that will do the job. This -returns an instance of XML_Parser that has handlers and -other data structures initialized from the parent parser. You may then -use XML_Parse or XML_ParseBuffer calls against this -parser. Since external entities my refer to other external entities, -your handler should be prepared to be called recursively.

- -

Parsing DTDs

- -

In order to parse parameter entities, before starting the parse, -you must call XML_SetParamEntityParsing with one of the following -arguments:

-
-
XML_PARAM_ENTITY_PARSING_NEVER
-
Don't parse parameter entities or the external subset
-
XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE
-
Parse parameter entites and the external subset unless -standalone was set to "yes" in the XML declaration.
-
XML_PARAM_ENTITY_PARSING_ALWAYS
-
Always parse parameter entities and the external subset
-
- -

In order to read an external DTD, you also have to set an external -entity reference handler as described above.

- -

Temporarily Stopping Parsing

- -

Expat 1.95.8 introduces a new feature: its now possible to stop -parsing temporarily from within a handler function, even if more data -has already been passed into the parser. Applications for this -include

- -
    -
  • Supporting the XInclude specification.
  • - -
  • Delaying further processing until additional information is - available from some other source.
  • - -
  • Adjusting processor load as task priorities shift within an - application.
  • - -
  • Stopping parsing completely (simply free or reset the parser - instead of resuming in the outer parsing loop). This can be useful - if a application-domain error is found in the XML being parsed or if - the result of the parse is determined not to be useful after - all.
  • -
- -

To take advantage of this feature, the main parsing loop of an -application needs to support this specifically. It cannot be -supported with a parsing loop compatible with Expat 1.95.7 or -earlier (though existing loops will continue to work without -supporting the stop/resume feature).

- -

An application that uses this feature for a single parser will have -the rough structure (in pseudo-code):

- -
-fd = open_input()
-p = create_parser()
-
-if parse_xml(p, fd) {
-  /* suspended */
-
-  int suspended = 1;
-
-  while (suspended) {
-    do_something_else()
-    if ready_to_resume() {
-      suspended = continue_parsing(p, fd);
-    }
-  }
-}
-
- -

An application that may resume any of several parsers based on -input (either from the XML being parsed or some other source) will -certainly have more interesting control structures.

- -

This C function could be used for the parse_xml -function mentioned in the pseudo-code above:

- -
-#define BUFF_SIZE 10240
-
-/* Parse a document from the open file descriptor 'fd' until the parse
-   is complete (the document has been completely parsed, or there's
-   been an error), or the parse is stopped.  Return non-zero when
-   the parse is merely suspended.
-*/
-int
-parse_xml(XML_Parser p, int fd)
-{
-  for (;;) {
-    int last_chunk;
-    int bytes_read;
-    enum XML_Status status;
-
-    void *buff = XML_GetBuffer(p, BUFF_SIZE);
-    if (buff == NULL) {
-      /* handle error... */
-      return 0;
-    }
-    bytes_read = read(fd, buff, BUFF_SIZE);
-    if (bytes_read < 0) {
-      /* handle error... */
-      return 0;
-    }
-    status = XML_ParseBuffer(p, bytes_read, bytes_read == 0);
-    switch (status) {
-      case XML_STATUS_ERROR:
-        /* handle error... */
-        return 0;
-      case XML_STATUS_SUSPENDED:
-        return 1;
-    }
-    if (bytes_read == 0)
-      return 0;
-  }
-}
-
- -

The corresponding continue_parsing function is -somewhat simpler, since it only need deal with the return code from -XML_ResumeParser; it can -delegate the input handling to the parse_xml -function:

- -
-/* Continue parsing a document which had been suspended.  The 'p' and
-   'fd' arguments are the same as passed to parse_xml().  Return
-   non-zero when the parse is suspended.
-*/
-int
-continue_parsing(XML_Parser p, int fd)
-{
-  enum XML_Status status = XML_ResumeParser(p);
-  switch (status) {
-    case XML_STATUS_ERROR:
-      /* handle error... */
-      return 0;
-    case XML_ERROR_NOT_SUSPENDED:
-      /* handle error... */
-      return 0;.
-    case XML_STATUS_SUSPENDED:
-      return 1;
-  }
-  return parse_xml(p, fd);
-}
-
- -

Now that we've seen what a mess the top-level parsing loop can -become, what have we gained? Very simply, we can now use the XML_StopParser function to stop -parsing, without having to go to great lengths to avoid additional -processing that we're expecting to ignore. As a bonus, we get to stop -parsing temporarily, and come back to it when we're -ready.

- -

To stop parsing from a handler function, use the XML_StopParser function. This function -takes two arguments; the parser being stopped and a flag indicating -whether the parse can be resumed in the future.

- - - - -
- - -

Expat Reference

- -

Parser Creation

- -
-XML_Parser XMLCALL
-XML_ParserCreate(const XML_Char *encoding);
-
-
-Construct a new parser. If encoding is non-null, it specifies a -character encoding to use for the document. This overrides the document -encoding declaration. There are four built-in encodings: -
    -
  • US-ASCII
  • -
  • UTF-8
  • -
  • UTF-16
  • -
  • ISO-8859-1
  • -
-Any other value will invoke a call to the UnknownEncodingHandler. -
- -
-XML_Parser XMLCALL
-XML_ParserCreateNS(const XML_Char *encoding,
-                   XML_Char sep);
-
-
-Constructs a new parser that has namespace processing in effect. Namespace -expanded element names and attribute names are returned as a concatenation -of the namespace URI, sep, and the local part of the name. This -means that you should pick a character for sep that can't be part -of an URI. Since Expat does not check namespace URIs for conformance, the -only safe choice for a namespace separator is a character that is illegal -in XML. For instance, '\xFF' is not legal in UTF-8, and -'\xFFFF' is not legal in UTF-16. There is a special case when -sep is the null character '\0': the namespace URI and -the local part will be concatenated without any separator - this is intended -to support RDF processors. It is a programming error to use the null separator -with namespace triplets.
- -
-XML_Parser XMLCALL
-XML_ParserCreate_MM(const XML_Char *encoding,
-                    const XML_Memory_Handling_Suite *ms,
-		    const XML_Char *sep);
-
-
-typedef struct {
-  void *(XMLCALL *malloc_fcn)(size_t size);
-  void *(XMLCALL *realloc_fcn)(void *ptr, size_t size);
-  void (XMLCALL *free_fcn)(void *ptr);
-} XML_Memory_Handling_Suite;
-
-
-

Construct a new parser using the suite of memory handling functions -specified in ms. If ms is NULL, then use the -standard set of memory management functions. If sep is -non NULL, then namespace processing is enabled in the created parser -and the character pointed at by sep is used as the separator between -the namespace URI and the local part of the name.

-
- -
-XML_Parser XMLCALL
-XML_ExternalEntityParserCreate(XML_Parser p,
-                               const XML_Char *context,
-                               const XML_Char *encoding);
-
-
-Construct a new XML_Parser object for parsing an external -general entity. Context is the context argument passed in a call to a -ExternalEntityRefHandler. Other state information such as handlers, -user data, namespace processing is inherited from the parser passed as -the 1st argument. So you shouldn't need to call any of the behavior -changing functions on this parser (unless you want it to act -differently than the parent parser). -
- -
-void XMLCALL
-XML_ParserFree(XML_Parser p);
-
-
-Free memory used by the parser. Your application is responsible for -freeing any memory associated with user data. -
- -
-XML_Bool XMLCALL
-XML_ParserReset(XML_Parser p,
-                const XML_Char *encoding);
-
-
-Clean up the memory structures maintained by the parser so that it may -be used again. After this has been called, parser is -ready to start parsing a new document. All handlers are cleared from -the parser, except for the unknownEncodingHandler. The parser's external -state is re-initialized except for the values of ns and ns_triplets. -This function may not be used on a parser created using XML_ExternalEntityParserCreate; it will return XML_FALSE in that case. Returns -XML_TRUE on success. Your application is responsible for -dealing with any memory associated with user data. -
- -

Parsing

- -

To state the obvious: the three parsing functions XML_Parse, -XML_ParseBuffer and -XML_GetBuffer must not be called from within a handler -unless they operate on a separate parser instance, that is, one that -did not call the handler. For example, it is OK to call the parsing -functions from within an XML_ExternalEntityRefHandler, -if they apply to the parser created by -XML_ExternalEntityParserCreate.

- -

Note: the len argument passed to these functions -should be considerably less than the maximum value for an integer, -as it could create an integer overflow situation if the added -lengths of a buffer and the unprocessed portion of the previous buffer -exceed the maximum integer value. Input data at the end of a buffer -will remain unprocessed if it is part of an XML token for which the -end is not part of that buffer.

- -
-enum XML_Status XMLCALL
-XML_Parse(XML_Parser p,
-          const char *s,
-          int len,
-          int isFinal);
-
-
-enum XML_Status {
-  XML_STATUS_ERROR = 0,
-  XML_STATUS_OK = 1
-};
-
-
-Parse some more of the document. The string s is a buffer -containing part (or perhaps all) of the document. The number of bytes of s -that are part of the document is indicated by len. This means -that s doesn't have to be null terminated. It also means that -if len is larger than the number of bytes in the block of -memory that s points at, then a memory fault is likely. The -isFinal parameter informs the parser that this is the last -piece of the document. Frequently, the last piece is empty (i.e. -len is zero.) -If a parse error occurred, it returns XML_STATUS_ERROR. -Otherwise it returns XML_STATUS_OK value. -
- -
-enum XML_Status XMLCALL
-XML_ParseBuffer(XML_Parser p,
-                int len,
-                int isFinal);
-
-
-This is just like XML_Parse, -except in this case Expat provides the buffer. By obtaining the -buffer from Expat with the XML_GetBuffer function, the application can avoid double -copying of the input. -
- -
-void * XMLCALL
-XML_GetBuffer(XML_Parser p,
-              int len);
-
-
-Obtain a buffer of size len to read a piece of the document -into. A NULL value is returned if Expat can't allocate enough memory for -this buffer. This has to be called prior to every call to -XML_ParseBuffer. A -typical use would look like this: - -
-for (;;) {
-  int bytes_read;
-  void *buff = XML_GetBuffer(p, BUFF_SIZE);
-  if (buff == NULL) {
-    /* handle error */
-  }
-
-  bytes_read = read(docfd, buff, BUFF_SIZE);
-  if (bytes_read < 0) {
-    /* handle error */
-  }
-
-  if (! XML_ParseBuffer(p, bytes_read, bytes_read == 0)) {
-    /* handle parse error */
-  }
-
-  if (bytes_read == 0)
-    break;
-}
-
-
- -
-enum XML_Status XMLCALL
-XML_StopParser(XML_Parser p,
-               XML_Bool resumable);
-
-
- -

Stops parsing, causing XML_Parse or XML_ParseBuffer to return. Must be called from within a -call-back handler, except when aborting (when resumable -is XML_FALSE) an already suspended parser. Some -call-backs may still follow because they would otherwise get -lost, including -

    -
  • the end element handler for empty elements when stopped in the - start element handler,
  • -
  • the end namespace declaration handler when stopped in the end - element handler,
  • -
  • the character data handler when stopped in the character data handler - while making multiple call-backs on a contiguous chunk of characters,
  • -
-and possibly others.

- -

This can be called from most handlers, including DTD related -call-backs, except when parsing an external parameter entity and -resumable is XML_TRUE. Returns -XML_STATUS_OK when successful, -XML_STATUS_ERROR otherwise. The possible error codes -are:

-
-
XML_ERROR_SUSPENDED
-
when suspending an already suspended parser.
-
XML_ERROR_FINISHED
-
when the parser has already finished.
-
XML_ERROR_SUSPEND_PE
-
when suspending while parsing an external PE.
-
- -

Since the stop/resume feature requires application support in the -outer parsing loop, it is an error to call this function for a parser -not being handled appropriately; see Temporarily Stopping Parsing for more information.

- -

When resumable is XML_TRUE then parsing -is suspended, that is, XML_Parse and XML_ParseBuffer return XML_STATUS_SUSPENDED. -Otherwise, parsing is aborted, that is, XML_Parse and XML_ParseBuffer return -XML_STATUS_ERROR with error code -XML_ERROR_ABORTED.

- -

Note: -This will be applied to the current parser instance only, that is, if -there is a parent parser then it will continue parsing when the -external entity reference handler returns. It is up to the -implementation of that handler to call XML_StopParser on the parent parser -(recursively), if one wants to stop parsing altogether.

- -

When suspended, parsing can be resumed by calling XML_ResumeParser.

- -

New in Expat 1.95.8.

-
- -
-enum XML_Status XMLCALL
-XML_ResumeParser(XML_Parser p);
-
-
-

Resumes parsing after it has been suspended with XML_StopParser. Must not be called from -within a handler call-back. Returns same status codes as XML_Parse or XML_ParseBuffer. An additional error -code, XML_ERROR_NOT_SUSPENDED, will be returned if the -parser was not currently suspended.

- -

Note: -This must be called on the most deeply nested child parser instance -first, and on its parent parser only after the child parser has -finished, to be applied recursively until the document entity's parser -is restarted. That is, the parent parser will not resume by itself -and it is up to the application to call XML_ResumeParser on it at the -appropriate moment.

- -

New in Expat 1.95.8.

-
- -
-void XMLCALL
-XML_GetParsingStatus(XML_Parser p,
-                     XML_ParsingStatus *status);
-
-
-enum XML_Parsing {
-  XML_INITIALIZED,
-  XML_PARSING,
-  XML_FINISHED,
-  XML_SUSPENDED
-};
-
-typedef struct {
-  enum XML_Parsing parsing;
-  XML_Bool finalBuffer;
-} XML_ParsingStatus;
-
-
-

Returns status of parser with respect to being initialized, -parsing, finished, or suspended, and whether the final buffer is being -processed. The status parameter must not be -NULL.

- -

New in Expat 1.95.8.

-
- - -

Handler Setting

- -

Although handlers are typically set prior to parsing and left alone, an -application may choose to set or change the handler for a parsing event -while the parse is in progress. For instance, your application may choose -to ignore all text not descended from a para element. One -way it could do this is to set the character handler when a para start tag -is seen, and unset it for the corresponding end tag.

- -

A handler may be unset by providing a NULL pointer to the -appropriate handler setter. None of the handler setting functions have -a return value.

- -

Your handlers will be receiving strings in arrays of type -XML_Char. This type is conditionally defined in expat.h as -either char, wchar_t or unsigned short. -The former implies UTF-8 encoding, the latter two imply UTF-16 encoding. -Note that you'll receive them in this form independent of the original -encoding of the document.

- -
-
-void XMLCALL
-XML_SetStartElementHandler(XML_Parser p,
-                           XML_StartElementHandler start);
-
-
-typedef void
-(XMLCALL *XML_StartElementHandler)(void *userData,
-                                   const XML_Char *name,
-                                   const XML_Char **atts);
-
-

Set handler for start (and empty) tags. Attributes are passed to the start -handler as a pointer to a vector of char pointers. Each attribute seen in -a start (or empty) tag occupies 2 consecutive places in this vector: the -attribute name followed by the attribute value. These pairs are terminated -by a null pointer.

-

Note that an empty tag generates a call to both start and end handlers -(in that order).

-
- -
-
-void XMLCALL
-XML_SetEndElementHandler(XML_Parser p,
-                         XML_EndElementHandler);
-
-
-typedef void
-(XMLCALL *XML_EndElementHandler)(void *userData,
-                                 const XML_Char *name);
-
-

Set handler for end (and empty) tags. As noted above, an empty tag -generates a call to both start and end handlers.

-
- -
-
-void XMLCALL
-XML_SetElementHandler(XML_Parser p,
-                      XML_StartElementHandler start,
-                      XML_EndElementHandler end);
-
-

Set handlers for start and end tags with one call.

-
- -
-
-void XMLCALL
-XML_SetCharacterDataHandler(XML_Parser p,
-                            XML_CharacterDataHandler charhndl)
-
-
-typedef void
-(XMLCALL *XML_CharacterDataHandler)(void *userData,
-                                    const XML_Char *s,
-                                    int len);
-
-

Set a text handler. The string your handler receives -is NOT nul-terminated. You have to use the length argument -to deal with the end of the string. A single block of contiguous text -free of markup may still result in a sequence of calls to this handler. -In other words, if you're searching for a pattern in the text, it may -be split across calls to this handler. Note: Setting this handler to NULL -may NOT immediately terminate call-backs if the parser is currently -processing such a single block of contiguous markup-free text, as the parser -will continue calling back until the end of the block is reached.

-
- -
-
-void XMLCALL
-XML_SetProcessingInstructionHandler(XML_Parser p,
-                                    XML_ProcessingInstructionHandler proc)
-
-
-typedef void
-(XMLCALL *XML_ProcessingInstructionHandler)(void *userData,
-                                            const XML_Char *target,
-                                            const XML_Char *data);
-
-
-

Set a handler for processing instructions. The target is the first word -in the processing instruction. The data is the rest of the characters in -it after skipping all whitespace after the initial word.

-
- -
-
-void XMLCALL
-XML_SetCommentHandler(XML_Parser p,
-                      XML_CommentHandler cmnt)
-
-
-typedef void
-(XMLCALL *XML_CommentHandler)(void *userData,
-                              const XML_Char *data);
-
-

Set a handler for comments. The data is all text inside the comment -delimiters.

-
- -
-
-void XMLCALL
-XML_SetStartCdataSectionHandler(XML_Parser p,
-                                XML_StartCdataSectionHandler start);
-
-
-typedef void
-(XMLCALL *XML_StartCdataSectionHandler)(void *userData);
-
-

Set a handler that gets called at the beginning of a CDATA section.

-
- -
-
-void XMLCALL
-XML_SetEndCdataSectionHandler(XML_Parser p,
-                              XML_EndCdataSectionHandler end);
-
-
-typedef void
-(XMLCALL *XML_EndCdataSectionHandler)(void *userData);
-
-

Set a handler that gets called at the end of a CDATA section.

-
- -
-
-void XMLCALL
-XML_SetCdataSectionHandler(XML_Parser p,
-                           XML_StartCdataSectionHandler start,
-                           XML_EndCdataSectionHandler end)
-
-

Sets both CDATA section handlers with one call.

-
- -
-
-void XMLCALL
-XML_SetDefaultHandler(XML_Parser p,
-                      XML_DefaultHandler hndl)
-
-
-typedef void
-(XMLCALL *XML_DefaultHandler)(void *userData,
-                              const XML_Char *s,
-                              int len);
-
- -

Sets a handler for any characters in the document which wouldn't -otherwise be handled. This includes both data for which no handlers -can be set (like some kinds of DTD declarations) and data which could -be reported but which currently has no handler set. The characters -are passed exactly as they were present in the XML document except -that they will be encoded in UTF-8 or UTF-16. Line boundaries are not -normalized. Note that a byte order mark character is not passed to the -default handler. There are no guarantees about how characters are -divided between calls to the default handler: for example, a comment -might be split between multiple calls. Setting the handler with -this call has the side effect of turning off expansion of references -to internally defined general entities. Instead these references are -passed to the default handler.

- -

See also XML_DefaultCurrent.

-
- -
-
-void XMLCALL
-XML_SetDefaultHandlerExpand(XML_Parser p,
-                            XML_DefaultHandler hndl)
-
-
-typedef void
-(XMLCALL *XML_DefaultHandler)(void *userData,
-                              const XML_Char *s,
-                              int len);
-
-

This sets a default handler, but doesn't inhibit the expansion of -internal entity references. The entity reference will not be passed -to the default handler.

- -

See also XML_DefaultCurrent.

-
- -
-
-void XMLCALL
-XML_SetExternalEntityRefHandler(XML_Parser p,
-                                XML_ExternalEntityRefHandler hndl)
-
-
-typedef int
-(XMLCALL *XML_ExternalEntityRefHandler)(XML_Parser p,
-                                        const XML_Char *context,
-                                        const XML_Char *base,
-                                        const XML_Char *systemId,
-                                        const XML_Char *publicId);
-
-

Set an external entity reference handler. This handler is also -called for processing an external DTD subset if parameter entity parsing -is in effect. (See -XML_SetParamEntityParsing.)

- -

The context parameter specifies the parsing context in -the format expected by the context argument to XML_ExternalEntityParserCreate. code is -valid only until the handler returns, so if the referenced entity is -to be parsed later, it must be copied. context is NULL -only when the entity is a parameter entity, which is how one can -differentiate between general and parameter entities.

- -

The base parameter is the base to use for relative -system identifiers. It is set by XML_SetBase and may be NULL. The -publicId parameter is the public id given in the entity -declaration and may be NULL. systemId is the system -identifier specified in the entity declaration and is never NULL.

- -

There are a couple of ways in which this handler differs from -others. First, this handler returns a status indicator (an -integer). XML_STATUS_OK should be returned for successful -handling of the external entity reference. Returning -XML_STATUS_ERROR indicates failure, and causes the -calling parser to return an -XML_ERROR_EXTERNAL_ENTITY_HANDLING error.

- -

Second, instead of having the user data as its first argument, it -receives the parser that encountered the entity reference. This, along -with the context parameter, may be used as arguments to a call to -XML_ExternalEntityParserCreate. Using the returned -parser, the body of the external entity can be recursively parsed.

- -

Since this handler may be called recursively, it should not be saving -information into global or static variables.

-
- -
-void XMLCALL
-XML_SetExternalEntityRefHandlerArg(XML_Parser p,
-                                   void *arg)
-
-
-

Set the argument passed to the ExternalEntityRefHandler. If -arg is not NULL, it is the new value passed to the -handler set using XML_SetExternalEntityRefHandler; if arg is -NULL, the argument passed to the handler function will be the parser -object itself.

- -

Note: -The type of arg and the type of the first argument to the -ExternalEntityRefHandler do not match. This function takes a -void * to be passed to the handler, while the handler -accepts an XML_Parser. This is a historical accident, -but will not be corrected before Expat 2.0 (at the earliest) to avoid -causing compiler warnings for code that's known to work with this -API. It is the responsibility of the application code to know the -actual type of the argument passed to the handler and to manage it -properly.

-
- -
-
-void XMLCALL
-XML_SetSkippedEntityHandler(XML_Parser p,
-                            XML_SkippedEntityHandler handler)
-
-
-typedef void
-(XMLCALL *XML_SkippedEntityHandler)(void *userData,
-                                    const XML_Char *entityName,
-                                    int is_parameter_entity);
-
-

Set a skipped entity handler. This is called in two situations:

-
    -
  1. An entity reference is encountered for which no declaration - has been read and this is not an error.
  2. -
  3. An internal entity reference is read, but not expanded, because - XML_SetDefaultHandler - has been called.
  4. -
-

The is_parameter_entity argument will be non-zero for -a parameter entity and zero for a general entity.

Note: skipped -parameter entities in declarations and skipped general entities in -attribute values cannot be reported, because the event would be out of -sync with the reporting of the declarations or attribute values

-
- -
-
-void XMLCALL
-XML_SetUnknownEncodingHandler(XML_Parser p,
-                              XML_UnknownEncodingHandler enchandler,
-			      void *encodingHandlerData)
-
-
-typedef int
-(XMLCALL *XML_UnknownEncodingHandler)(void *encodingHandlerData,
-                                      const XML_Char *name,
-                                      XML_Encoding *info);
-
-typedef struct {
-  int map[256];
-  void *data;
-  int (XMLCALL *convert)(void *data, const char *s);
-  void (XMLCALL *release)(void *data);
-} XML_Encoding;
-
-

Set a handler to deal with encodings other than the built in set. This should be done before -XML_Parse or XML_ParseBuffer have been called on the -given parser.

If the handler knows how to deal with an encoding -with the given name, it should fill in the info data -structure and return XML_STATUS_OK. Otherwise it -should return XML_STATUS_ERROR. The handler will be called -at most once per parsed (external) entity. The optional application -data pointer encodingHandlerData will be passed back to -the handler.

- -

The map array contains information for every possible possible leading -byte in a byte sequence. If the corresponding value is >= 0, then it's -a single byte sequence and the byte encodes that Unicode value. If the -value is -1, then that byte is invalid as the initial byte in a sequence. -If the value is -n, where n is an integer > 1, then n is the number of -bytes in the sequence and the actual conversion is accomplished by a -call to the function pointed at by convert. This function may return -1 -if the sequence itself is invalid. The convert pointer may be null if -there are only single byte codes. The data parameter passed to the convert -function is the data pointer from XML_Encoding. The -string s is NOT nul-terminated and points at the sequence of -bytes to be converted.

- -

The function pointed at by release is called by the -parser when it is finished with the encoding. It may be NULL.

-
- -
-
-void XMLCALL
-XML_SetStartNamespaceDeclHandler(XML_Parser p,
-			         XML_StartNamespaceDeclHandler start);
-
-
-typedef void
-(XMLCALL *XML_StartNamespaceDeclHandler)(void *userData,
-                                         const XML_Char *prefix,
-                                         const XML_Char *uri);
-
-

Set a handler to be called when a namespace is declared. Namespace -declarations occur inside start tags. But the namespace declaration start -handler is called before the start tag handler for each namespace declared -in that start tag.

-
- -
-
-void XMLCALL
-XML_SetEndNamespaceDeclHandler(XML_Parser p,
-			       XML_EndNamespaceDeclHandler end);
-
-
-typedef void
-(XMLCALL *XML_EndNamespaceDeclHandler)(void *userData,
-                                       const XML_Char *prefix);
-
-

Set a handler to be called when leaving the scope of a namespace -declaration. This will be called, for each namespace declaration, -after the handler for the end tag of the element in which the -namespace was declared.

-
- -
-
-void XMLCALL
-XML_SetNamespaceDeclHandler(XML_Parser p,
-                            XML_StartNamespaceDeclHandler start,
-                            XML_EndNamespaceDeclHandler end)
-
-

Sets both namespace declaration handlers with a single call.

-
- -
-
-void XMLCALL
-XML_SetXmlDeclHandler(XML_Parser p,
-		      XML_XmlDeclHandler xmldecl);
-
-
-typedef void
-(XMLCALL *XML_XmlDeclHandler)(void            *userData,
-                              const XML_Char  *version,
-                              const XML_Char  *encoding,
-                              int             standalone);
-
-

Sets a handler that is called for XML declarations and also for -text declarations discovered in external entities. The way to -distinguish is that the version parameter will be NULL -for text declarations. The encoding parameter may be NULL -for an XML declaration. The standalone argument will -contain -1, 0, or 1 indicating respectively that there was no -standalone parameter in the declaration, that it was given as no, or -that it was given as yes.

-
- -
-
-void XMLCALL
-XML_SetStartDoctypeDeclHandler(XML_Parser p,
-			       XML_StartDoctypeDeclHandler start);
-
-
-typedef void
-(XMLCALL *XML_StartDoctypeDeclHandler)(void           *userData,
-                                       const XML_Char *doctypeName,
-                                       const XML_Char *sysid,
-                                       const XML_Char *pubid,
-                                       int            has_internal_subset);
-
-

Set a handler that is called at the start of a DOCTYPE declaration, -before any external or internal subset is parsed. Both sysid -and pubid may be NULL. The has_internal_subset -will be non-zero if the DOCTYPE declaration has an internal subset.

-
- -
-
-void XMLCALL
-XML_SetEndDoctypeDeclHandler(XML_Parser p,
-			     XML_EndDoctypeDeclHandler end);
-
-
-typedef void
-(XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);
-
-

Set a handler that is called at the end of a DOCTYPE declaration, -after parsing any external subset.

-
- -
-
-void XMLCALL
-XML_SetDoctypeDeclHandler(XML_Parser p,
-			  XML_StartDoctypeDeclHandler start,
-			  XML_EndDoctypeDeclHandler end);
-
-

Set both doctype handlers with one call.

-
- -
-
-void XMLCALL
-XML_SetElementDeclHandler(XML_Parser p,
-			  XML_ElementDeclHandler eldecl);
-
-
-typedef void
-(XMLCALL *XML_ElementDeclHandler)(void *userData,
-                                  const XML_Char *name,
-                                  XML_Content *model);
-
-
-enum XML_Content_Type {
-  XML_CTYPE_EMPTY = 1,
-  XML_CTYPE_ANY,
-  XML_CTYPE_MIXED,
-  XML_CTYPE_NAME,
-  XML_CTYPE_CHOICE,
-  XML_CTYPE_SEQ
-};
-
-enum XML_Content_Quant {
-  XML_CQUANT_NONE,
-  XML_CQUANT_OPT,
-  XML_CQUANT_REP,
-  XML_CQUANT_PLUS
-};
-
-typedef struct XML_cp XML_Content;
-
-struct XML_cp {
-  enum XML_Content_Type		type;
-  enum XML_Content_Quant	quant;
-  const XML_Char *		name;
-  unsigned int			numchildren;
-  XML_Content *			children;
-};
-
-

Sets a handler for element declarations in a DTD. The handler gets -called with the name of the element in the declaration and a pointer -to a structure that contains the element model. It is the -application's responsibility to free this data structure using -XML_FreeContentModel.

- -

The model argument is the root of a tree of -XML_Content nodes. If type equals -XML_CTYPE_EMPTY or XML_CTYPE_ANY, then -quant will be XML_CQUANT_NONE, and the other -fields will be zero or NULL. If type is -XML_CTYPE_MIXED, then quant will be -XML_CQUANT_NONE or XML_CQUANT_REP and -numchildren will contain the number of elements that are -allowed to be mixed in and children points to an array of -XML_Content structures that will all have type -XML_CTYPE_NAME with no quantification. Only the root node can be type -XML_CTYPE_EMPTY, XML_CTYPE_ANY, or -XML_CTYPE_MIXED.

- -

For type XML_CTYPE_NAME, the name field -points to the name and the numchildren and -children fields will be zero and NULL. The -quant field will indicate any quantifiers placed on the -name.

- -

Types XML_CTYPE_CHOICE and XML_CTYPE_SEQ -indicate a choice or sequence respectively. The -numchildren field indicates how many nodes in the choice -or sequence and children points to the nodes.

-
- -
-
-void XMLCALL
-XML_SetAttlistDeclHandler(XML_Parser p,
-                          XML_AttlistDeclHandler attdecl);
-
-
-typedef void
-(XMLCALL *XML_AttlistDeclHandler)(void           *userData,
-                                  const XML_Char *elname,
-                                  const XML_Char *attname,
-                                  const XML_Char *att_type,
-                                  const XML_Char *dflt,
-                                  int            isrequired);
-
-

Set a handler for attlist declarations in the DTD. This handler is -called for each attribute. So a single attlist declaration -with multiple attributes declared will generate multiple calls to this -handler. The elname parameter returns the name of the -element for which the attribute is being declared. The attribute name -is in the attname parameter. The attribute type is in the -att_type parameter. It is the string representing the -type in the declaration with whitespace removed.

- -

The dflt parameter holds the default value. It will be -NULL in the case of "#IMPLIED" or "#REQUIRED" attributes. You can -distinguish these two cases by checking the isrequired -parameter, which will be true in the case of "#REQUIRED" attributes. -Attributes which are "#FIXED" will have also have a true -isrequired, but they will have the non-NULL fixed value -in the dflt parameter.

-
- -
-
-void XMLCALL
-XML_SetEntityDeclHandler(XML_Parser p,
-			 XML_EntityDeclHandler handler);
-
-
-typedef void
-(XMLCALL *XML_EntityDeclHandler)(void           *userData,
-                                 const XML_Char *entityName,
-                                 int            is_parameter_entity,
-                                 const XML_Char *value,
-                                 int            value_length, 
-                                 const XML_Char *base,
-                                 const XML_Char *systemId,
-                                 const XML_Char *publicId,
-                                 const XML_Char *notationName);
-
-

Sets a handler that will be called for all entity declarations. -The is_parameter_entity argument will be non-zero in the -case of parameter entities and zero otherwise.

- -

For internal entities (<!ENTITY foo "bar">), -value will be non-NULL and systemId, -publicId, and notationName will all be NULL. -The value string is not NULL terminated; the length is -provided in the value_length parameter. Do not use -value_length to test for internal entities, since it is -legal to have zero-length values. Instead check for whether or not -value is NULL.

The notationName -argument will have a non-NULL value only for unparsed entity -declarations.

-
- -
-
-void XMLCALL
-XML_SetUnparsedEntityDeclHandler(XML_Parser p,
-                                 XML_UnparsedEntityDeclHandler h)
-
-
-typedef void
-(XMLCALL *XML_UnparsedEntityDeclHandler)(void *userData,
-                                         const XML_Char *entityName, 
-                                         const XML_Char *base,
-                                         const XML_Char *systemId,
-                                         const XML_Char *publicId,
-                                         const XML_Char *notationName);
-
-

Set a handler that receives declarations of unparsed entities. These -are entity declarations that have a notation (NDATA) field:

- -
-<!ENTITY logo SYSTEM "images/logo.gif" NDATA gif>
-
-

This handler is obsolete and is provided for backwards -compatibility. Use instead XML_SetEntityDeclHandler.

-
- -
-
-void XMLCALL
-XML_SetNotationDeclHandler(XML_Parser p,
-                           XML_NotationDeclHandler h)
-
-
-typedef void
-(XMLCALL *XML_NotationDeclHandler)(void *userData, 
-                                   const XML_Char *notationName,
-                                   const XML_Char *base,
-                                   const XML_Char *systemId,
-                                   const XML_Char *publicId);
-
-

Set a handler that receives notation declarations.

-
- -
-
-void XMLCALL
-XML_SetNotStandaloneHandler(XML_Parser p,
-                            XML_NotStandaloneHandler h)
-
-
-typedef int 
-(XMLCALL *XML_NotStandaloneHandler)(void *userData);
-
-

Set a handler that is called if the document is not "standalone". -This happens when there is an external subset or a reference to a -parameter entity, but does not have standalone set to "yes" in an XML -declaration. If this handler returns XML_STATUS_ERROR, -then the parser will throw an XML_ERROR_NOT_STANDALONE -error.

-
- -

Parse position and error reporting functions

- -

These are the functions you'll want to call when the parse -functions return XML_STATUS_ERROR (a parse error has -occurred), although the position reporting functions are useful outside -of errors. The position reported is the byte position (in the original -document or entity encoding) of the first of the sequence of -characters that generated the current event (or the error that caused -the parse functions to return XML_STATUS_ERROR.) The -exceptions are callbacks trigged by declarations in the document -prologue, in which case they exact position reported is somewhere in the -relevant markup, but not necessarily as meaningful as for other -events.

- -

The position reporting functions are accurate only outside of the -DTD. In other words, they usually return bogus information when -called from within a DTD declaration handler.

- -
-enum XML_Error XMLCALL
-XML_GetErrorCode(XML_Parser p);
-
-
-Return what type of error has occurred. -
- -
-const XML_LChar * XMLCALL
-XML_ErrorString(enum XML_Error code);
-
-
-Return a string describing the error corresponding to code. -The code should be one of the enums that can be returned from -XML_GetErrorCode. -
- -
-XML_Index XMLCALL
-XML_GetCurrentByteIndex(XML_Parser p);
-
-
-Return the byte offset of the position. This always corresponds to -the values returned by XML_GetCurrentLineNumber and XML_GetCurrentColumnNumber. -
- -
-XML_Size XMLCALL
-XML_GetCurrentLineNumber(XML_Parser p);
-
-
-Return the line number of the position. The first line is reported as -1. -
- -
-XML_Size XMLCALL
-XML_GetCurrentColumnNumber(XML_Parser p);
-
-
-Return the offset, from the beginning of the current line, of -the position. -
- -
-int XMLCALL
-XML_GetCurrentByteCount(XML_Parser p);
-
-
-Return the number of bytes in the current event. Returns -0 if the event is inside a reference to an internal -entity and for the end-tag event for empty element tags (the later can -be used to distinguish empty-element tags from empty elements using -separate start and end tags). -
- -
-const char * XMLCALL
-XML_GetInputContext(XML_Parser p,
-                    int *offset,
-                    int *size);
-
-
- -

Returns the parser's input buffer, sets the integer pointed at by -offset to the offset within this buffer of the current -parse position, and set the integer pointed at by size to -the size of the returned buffer.

- -

This should only be called from within a handler during an active -parse and the returned buffer should only be referred to from within -the handler that made the call. This input buffer contains the -untranslated bytes of the input.

- -

Only a limited amount of context is kept, so if the event -triggering a call spans over a very large amount of input, the actual -parse position may be before the beginning of the buffer.

- -

If XML_CONTEXT_BYTES is not defined, this will always -return NULL.

-
- -

Miscellaneous functions

- -

The functions in this section either obtain state information from -the parser or can be used to dynamicly set parser options.

- -
-void XMLCALL
-XML_SetUserData(XML_Parser p,
-                void *userData);
-
-
-This sets the user data pointer that gets passed to handlers. It -overwrites any previous value for this pointer. Note that the -application is responsible for freeing the memory associated with -userData when it is finished with the parser. So if you -call this when there's already a pointer there, and you haven't freed -the memory associated with it, then you've probably just leaked -memory. -
- -
-void * XMLCALL
-XML_GetUserData(XML_Parser p);
-
-
-This returns the user data pointer that gets passed to handlers. -It is actually implemented as a macro. -
- -
-void XMLCALL
-XML_UseParserAsHandlerArg(XML_Parser p);
-
-
-After this is called, handlers receive the parser in their -userData arguments. The user data can still be obtained -using the XML_GetUserData function. -
- -
-enum XML_Status XMLCALL
-XML_SetBase(XML_Parser p,
-            const XML_Char *base);
-
-
-Set the base to be used for resolving relative URIs in system -identifiers. The return value is XML_STATUS_ERROR if -there's no memory to store base, otherwise it's -XML_STATUS_OK. -
- -
-const XML_Char * XMLCALL
-XML_GetBase(XML_Parser p);
-
-
-Return the base for resolving relative URIs. -
- -
-int XMLCALL
-XML_GetSpecifiedAttributeCount(XML_Parser p);
-
-
-When attributes are reported to the start handler in the atts vector, -attributes that were explicitly set in the element occur before any -attributes that receive their value from default information in an -ATTLIST declaration. This function returns the number of attributes -that were explicitly set times two, thus giving the offset in the -atts array passed to the start tag handler of the first -attribute set due to defaults. It supplies information for the last -call to a start handler. If called inside a start handler, then that -means the current call. -
- -
-int XMLCALL
-XML_GetIdAttributeIndex(XML_Parser p);
-
-
-Returns the index of the ID attribute passed in the atts array in the -last call to XML_StartElementHandler, or -1 if there is no ID -attribute. If called inside a start handler, then that means the -current call. -
- -
-const XML_AttrInfo * XMLCALL
-XML_GetAttributeInfo(XML_Parser parser);
-
-
-typedef struct {
-  XML_Index  nameStart;  /* Offset to beginning of the attribute name. */
-  XML_Index  nameEnd;    /* Offset after the attribute name's last byte. */
-  XML_Index  valueStart; /* Offset to beginning of the attribute value. */
-  XML_Index  valueEnd;   /* Offset after the attribute value's last byte. */
-} XML_AttrInfo;
-
-
-Returns an array of XML_AttrInfo structures for the -attribute/value pairs passed in the last call to the -XML_StartElementHandler that were specified -in the start-tag rather than defaulted. Each attribute/value pair counts -as 1; thus the number of entries in the array is -XML_GetSpecifiedAttributeCount(parser) / 2. -
- -
-enum XML_Status XMLCALL
-XML_SetEncoding(XML_Parser p,
-                const XML_Char *encoding);
-
-
-Set the encoding to be used by the parser. It is equivalent to -passing a non-null encoding argument to the parser creation functions. -It must not be called after XML_Parse or XML_ParseBuffer have been called on the given parser. -Returns XML_STATUS_OK on success or -XML_STATUS_ERROR on error. -
- -
-int XMLCALL
-XML_SetParamEntityParsing(XML_Parser p,
-                          enum XML_ParamEntityParsing code);
-
-
-This enables parsing of parameter entities, including the external -parameter entity that is the external DTD subset, according to -code. -The choices for code are: -
    -
  • XML_PARAM_ENTITY_PARSING_NEVER
  • -
  • XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE
  • -
  • XML_PARAM_ENTITY_PARSING_ALWAYS
  • -
-Note: If XML_SetParamEntityParsing is called after -XML_Parse or XML_ParseBuffer, then it has -no effect and will always return 0. -
- -
-int XMLCALL
-XML_SetHashSalt(XML_Parser p,
-                unsigned long hash_salt);
-
-
-Sets the hash salt to use for internal hash calculations. -Helps in preventing DoS attacks based on predicting hash -function behavior. In order to have an effect this must be called -before parsing has started. Returns 1 if successful, 0 when called -after XML_Parse or XML_ParseBuffer. -

Note: This call is optional, as the parser will auto-generate a new -random salt value if no value has been set at the start of parsing.

-
- -
-enum XML_Error XMLCALL
-XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
-
-
-

This function allows an application to provide an external subset -for the document type declaration for documents which do not specify -an external subset of their own. For documents which specify an -external subset in their DOCTYPE declaration, the application-provided -subset will be ignored. If the document does not contain a DOCTYPE -declaration at all and useDTD is true, the -application-provided subset will be parsed, but the -startDoctypeDeclHandler and -endDoctypeDeclHandler functions, if set, will not be -called. The setting of parameter entity parsing, controlled using -XML_SetParamEntityParsing, will be honored.

- -

The application-provided external subset is read by calling the -external entity reference handler set via XML_SetExternalEntityRefHandler with both -publicId and systemId set to NULL.

- -

If this function is called after parsing has begun, it returns -XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING and ignores -useDTD. If called when Expat has been compiled without -DTD support, it returns -XML_ERROR_FEATURE_REQUIRES_XML_DTD. Otherwise, it -returns XML_ERROR_NONE.

- -

Note: For the purpose of checking WFC: Entity Declared, passing -useDTD == XML_TRUE will make the parser behave as if -the document had a DTD with an external subset. This holds true even if -the external entity reference handler returns without action.

-
- -
-void XMLCALL
-XML_SetReturnNSTriplet(XML_Parser parser,
-                       int        do_nst);
-
-
-

-This function only has an effect when using a parser created with -XML_ParserCreateNS, -i.e. when namespace processing is in effect. The do_nst -sets whether or not prefixes are returned with names qualified with a -namespace prefix. If this function is called with do_nst -non-zero, then afterwards namespace qualified names (that is qualified -with a prefix as opposed to belonging to a default namespace) are -returned as a triplet with the three parts separated by the namespace -separator specified when the parser was created. The order of -returned parts is URI, local name, and prefix.

If -do_nst is zero, then namespaces are reported in the -default manner, URI then local_name separated by the namespace -separator.

-
- -
-void XMLCALL
-XML_DefaultCurrent(XML_Parser parser);
-
-
-This can be called within a handler for a start element, end element, -processing instruction or character data. It causes the corresponding -markup to be passed to the default handler set by XML_SetDefaultHandler or -XML_SetDefaultHandlerExpand. It does nothing if there is -not a default handler. -
- -
-XML_LChar * XMLCALL
-XML_ExpatVersion();
-
-
-Return the library version as a string (e.g. "expat_1.95.1"). -
- -
-struct XML_Expat_Version XMLCALL
-XML_ExpatVersionInfo();
-
-
-typedef struct {
-  int major;
-  int minor;
-  int micro;
-} XML_Expat_Version;
-
-
-Return the library version information as a structure. -Some macros are also defined that support compile-time tests of the -library version: -
    -
  • XML_MAJOR_VERSION
  • -
  • XML_MINOR_VERSION
  • -
  • XML_MICRO_VERSION
  • -
-Testing these constants is currently the best way to determine if -particular parts of the Expat API are available. -
- -
-const XML_Feature * XMLCALL
-XML_GetFeatureList();
-
-
-enum XML_FeatureEnum {
-  XML_FEATURE_END = 0,
-  XML_FEATURE_UNICODE,
-  XML_FEATURE_UNICODE_WCHAR_T,
-  XML_FEATURE_DTD,
-  XML_FEATURE_CONTEXT_BYTES,
-  XML_FEATURE_MIN_SIZE,
-  XML_FEATURE_SIZEOF_XML_CHAR,
-  XML_FEATURE_SIZEOF_XML_LCHAR,
-  XML_FEATURE_NS,
-  XML_FEATURE_LARGE_SIZE
-};
-
-typedef struct {
-  enum XML_FeatureEnum  feature;
-  XML_LChar            *name;
-  long int              value;
-} XML_Feature;
-
-
-

Returns a list of "feature" records, providing details on how -Expat was configured at compile time. Most applications should not -need to worry about this, but this information is otherwise not -available from Expat. This function allows code that does need to -check these features to do so at runtime.

- -

The return value is an array of XML_Feature, -terminated by a record with a feature of -XML_FEATURE_END and name of NULL, -identifying the feature-test macros Expat was compiled with. Since an -application that requires this kind of information needs to determine -the type of character the name points to, records for the -XML_FEATURE_SIZEOF_XML_CHAR and -XML_FEATURE_SIZEOF_XML_LCHAR will be located at the -beginning of the list, followed by XML_FEATURE_UNICODE -and XML_FEATURE_UNICODE_WCHAR_T, if they are present at -all.

- -

Some features have an associated value. If there isn't an -associated value, the value field is set to 0. At this -time, the following features have been defined to have values:

- -
-
XML_FEATURE_SIZEOF_XML_CHAR
-
The number of bytes occupied by one XML_Char - character.
-
XML_FEATURE_SIZEOF_XML_LCHAR
-
The number of bytes occupied by one XML_LChar - character.
-
XML_FEATURE_CONTEXT_BYTES
-
The maximum number of characters of context which can be - reported by XML_GetInputContext.
-
-
- -
-void XMLCALL
-XML_FreeContentModel(XML_Parser parser, XML_Content *model);
-
-
-Function to deallocate the model argument passed to the -XML_ElementDeclHandler callback set using XML_ElementDeclHandler. -This function should not be used for any other purpose. -
- -

The following functions allow external code to share the memory -allocator an XML_Parser has been configured to use. This -is especially useful for third-party libraries that interact with a -parser object created by application code, or heavily layered -applications. This can be essential when using dynamically loaded -libraries which use different C standard libraries (this can happen on -Windows, at least).

- -
-void * XMLCALL
-XML_MemMalloc(XML_Parser parser, size_t size);
-
-
-Allocate size bytes of memory using the allocator the -parser object has been configured to use. Returns a -pointer to the memory or NULL on failure. Memory allocated in this -way must be freed using XML_MemFree. -
- -
-void * XMLCALL
-XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
-
-
-Allocate size bytes of memory using the allocator the -parser object has been configured to use. -ptr must point to a block of memory allocated by XML_MemMalloc or -XML_MemRealloc, or be NULL. This function tries to -expand the block pointed to by ptr if possible. Returns -a pointer to the memory or NULL on failure. On success, the original -block has either been expanded or freed. On failure, the original -block has not been freed; the caller is responsible for freeing the -original block. Memory allocated in this way must be freed using -XML_MemFree. -
- -
-void XMLCALL
-XML_MemFree(XML_Parser parser, void *ptr);
-
-
-Free a block of memory pointed to by ptr. The block must -have been allocated by XML_MemMalloc or XML_MemRealloc, or be NULL. -
- -
-

Valid XHTML 1.0!

-
- - diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/style.css b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/style.css deleted file mode 100644 index 69df30bc..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/style.css +++ /dev/null @@ -1,101 +0,0 @@ -body { - background-color: white; - border: 0px; - margin: 0px; - padding: 0px; -} - -.corner { - width: 200px; - height: 80px; - text-align: center; -} - -.banner { - background-color: rgb(110,139,61); - color: rgb(255,236,176); - padding-left: 2em; -} - -.banner h1 { - font-size: 200%; -} - -.content { - padding: 0em 2em 1em 2em; -} - -.releaseno { - background-color: rgb(110,139,61); - color: rgb(255,236,176); - padding-bottom: 0.3em; - padding-top: 0.5em; - text-align: center; - font-weight: bold; -} - -.noborder { - border-width: 0px; -} - -.eg { - padding-left: 1em; - padding-top: .5em; - padding-bottom: .5em; - border: solid thin; - margin: 1em 0; - background-color: tan; - margin-left: 2em; - margin-right: 10%; -} - -.pseudocode { - padding-left: 1em; - padding-top: .5em; - padding-bottom: .5em; - border: solid thin; - margin: 1em 0; - background-color: rgb(250,220,180); - margin-left: 2em; - margin-right: 10%; -} - -.handler { - width: 100%; - border-top-width: thin; - margin-bottom: 1em; -} - -.handler p { - margin-left: 2em; -} - -.setter { - font-weight: bold; -} - -.signature { - color: navy; -} - -.fcndec { - width: 100%; - border-top-width: thin; - font-weight: bold; -} - -.fcndef { - margin-left: 2em; - margin-bottom: 2em; -} - -dd { - margin-bottom: 2em; -} - -.cpp-symbols dt { - font-family: monospace; -} -.cpp-symbols dd { - margin-bottom: 1em; -} diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/valid-xhtml10.png b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/valid-xhtml10.png deleted file mode 100644 index 4c23f48f..00000000 Binary files a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/valid-xhtml10.png and /dev/null differ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/xmlwf.1 b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/xmlwf.1 deleted file mode 100644 index 174719a7..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/xmlwf.1 +++ /dev/null @@ -1,251 +0,0 @@ -.\" This manpage has been automatically generated by docbook2man -.\" from a DocBook document. This tool can be found at: -.\" -.\" Please send any bug reports, improvements, comments, patches, -.\" etc. to Steve Cheng . -.TH "XMLWF" "1" "24 January 2003" "" "" -.SH NAME -xmlwf \- Determines if an XML document is well-formed -.SH SYNOPSIS - -\fBxmlwf\fR [ \fB-s\fR] [ \fB-n\fR] [ \fB-p\fR] [ \fB-x\fR] [ \fB-e \fIencoding\fB\fR] [ \fB-w\fR] [ \fB-d \fIoutput-dir\fB\fR] [ \fB-c\fR] [ \fB-m\fR] [ \fB-r\fR] [ \fB-t\fR] [ \fB-v\fR] [ \fBfile ...\fR] - -.SH "DESCRIPTION" -.PP -\fBxmlwf\fR uses the Expat library to -determine if an XML document is well-formed. It is -non-validating. -.PP -If you do not specify any files on the command-line, and you -have a recent version of \fBxmlwf\fR, the -input file will be read from standard input. -.SH "WELL-FORMED DOCUMENTS" -.PP -A well-formed document must adhere to the -following rules: -.TP 0.2i -\(bu -The file begins with an XML declaration. For instance, -. -\fBNOTE:\fR -\fBxmlwf\fR does not currently -check for a valid XML declaration. -.TP 0.2i -\(bu -Every start tag is either empty () -or has a corresponding end tag. -.TP 0.2i -\(bu -There is exactly one root element. This element must contain -all other elements in the document. Only comments, white -space, and processing instructions may come after the close -of the root element. -.TP 0.2i -\(bu -All elements nest properly. -.TP 0.2i -\(bu -All attribute values are enclosed in quotes (either single -or double). -.PP -If the document has a DTD, and it strictly complies with that -DTD, then the document is also considered \fBvalid\fR. -\fBxmlwf\fR is a non-validating parser -- -it does not check the DTD. However, it does support -external entities (see the \fB-x\fR option). -.SH "OPTIONS" -.PP -When an option includes an argument, you may specify the argument either -separately ("\fB-d\fR output") or concatenated with the -option ("\fB-d\fRoutput"). \fBxmlwf\fR -supports both. -.TP -\fB-c\fR -If the input file is well-formed and \fBxmlwf\fR -doesn't encounter any errors, the input file is simply copied to -the output directory unchanged. -This implies no namespaces (turns off \fB-n\fR) and -requires \fB-d\fR to specify an output file. -.TP -\fB-d output-dir\fR -Specifies a directory to contain transformed -representations of the input files. -By default, \fB-d\fR outputs a canonical representation -(described below). -You can select different output formats using \fB-c\fR -and \fB-m\fR. - -The output filenames will -be exactly the same as the input filenames or "STDIN" if the input is -coming from standard input. Therefore, you must be careful that the -output file does not go into the same directory as the input -file. Otherwise, \fBxmlwf\fR will delete the -input file before it generates the output file (just like running -cat < file > file in most shells). - -Two structurally equivalent XML documents have a byte-for-byte -identical canonical XML representation. -Note that ignorable white space is considered significant and -is treated equivalently to data. -More on canonical XML can be found at -http://www.jclark.com/xml/canonxml.html . -.TP -\fB-e encoding\fR -Specifies the character encoding for the document, overriding -any document encoding declaration. \fBxmlwf\fR -supports four built-in encodings: -US-ASCII, -UTF-8, -UTF-16, and -ISO-8859-1. -Also see the \fB-w\fR option. -.TP -\fB-m\fR -Outputs some strange sort of XML file that completely -describes the input file, including character positions. -Requires \fB-d\fR to specify an output file. -.TP -\fB-n\fR -Turns on namespace processing. (describe namespaces) -\fB-c\fR disables namespaces. -.TP -\fB-p\fR -Tells xmlwf to process external DTDs and parameter -entities. - -Normally \fBxmlwf\fR never parses parameter -entities. \fB-p\fR tells it to always parse them. -\fB-p\fR implies \fB-x\fR. -.TP -\fB-r\fR -Normally \fBxmlwf\fR memory-maps the XML file -before parsing; this can result in faster parsing on many -platforms. -\fB-r\fR turns off memory-mapping and uses normal file -IO calls instead. -Of course, memory-mapping is automatically turned off -when reading from standard input. - -Use of memory-mapping can cause some platforms to report -substantially higher memory usage for -\fBxmlwf\fR, but this appears to be a matter of -the operating system reporting memory in a strange way; there is -not a leak in \fBxmlwf\fR. -.TP -\fB-s\fR -Prints an error if the document is not standalone. -A document is standalone if it has no external subset and no -references to parameter entities. -.TP -\fB-t\fR -Turns on timings. This tells Expat to parse the entire file, -but not perform any processing. -This gives a fairly accurate idea of the raw speed of Expat itself -without client overhead. -\fB-t\fR turns off most of the output options -(\fB-d\fR, \fB-m\fR, \fB-c\fR, -\&...). -.TP -\fB-v\fR -Prints the version of the Expat library being used, including some -information on the compile-time configuration of the library, and -then exits. -.TP -\fB-w\fR -Enables support for Windows code pages. -Normally, \fBxmlwf\fR will throw an error if it -runs across an encoding that it is not equipped to handle itself. With -\fB-w\fR, xmlwf will try to use a Windows code -page. See also \fB-e\fR. -.TP -\fB-x\fR -Turns on parsing external entities. - -Non-validating parsers are not required to resolve external -entities, or even expand entities at all. -Expat always expands internal entities (?), -but external entity parsing must be enabled explicitly. - -External entities are simply entities that obtain their -data from outside the XML file currently being parsed. - -This is an example of an internal entity: - -.nf - -.fi - -And here are some examples of external entities: - -.nf - (parsed) - (unparsed) -.fi -.TP -\fB--\fR -(Two hyphens.) -Terminates the list of options. This is only needed if a filename -starts with a hyphen. For example: - -.nf -xmlwf -- -myfile.xml -.fi - -will run \fBxmlwf\fR on the file -\fI-myfile.xml\fR. -.PP -Older versions of \fBxmlwf\fR do not support -reading from standard input. -.SH "OUTPUT" -.PP -If an input file is not well-formed, -\fBxmlwf\fR prints a single line describing -the problem to standard output. If a file is well formed, -\fBxmlwf\fR outputs nothing. -Note that the result code is \fBnot\fR set. -.SH "BUGS" -.PP -According to the W3C standard, an XML file without a -declaration at the beginning is not considered well-formed. -However, \fBxmlwf\fR allows this to pass. -.PP -\fBxmlwf\fR returns a 0 - noerr result, -even if the file is not well-formed. There is no good way for -a program to use \fBxmlwf\fR to quickly -check a file -- it must parse \fBxmlwf\fR's -standard output. -.PP -The errors should go to standard error, not standard output. -.PP -There should be a way to get \fB-d\fR to send its -output to standard output rather than forcing the user to send -it to a file. -.PP -I have no idea why anyone would want to use the -\fB-d\fR, \fB-c\fR, and -\fB-m\fR options. If someone could explain it to -me, I'd like to add this information to this manpage. -.SH "ALTERNATIVES" -.PP -Here are some XML validators on the web: - -.nf -http://www.hcrc.ed.ac.uk/~richard/xml-check.html -http://www.stg.brown.edu/service/xmlvalid/ -http://www.scripting.com/frontier5/xml/code/xmlValidator.html -http://www.xml.com/pub/a/tools/ruwf/check.html -.fi -.SH "SEE ALSO" -.PP - -.nf -The Expat home page: http://www.libexpat.org/ -The W3 XML specification: http://www.w3.org/TR/REC-xml -.fi -.SH "AUTHOR" -.PP -This manual page was written by Scott Bronson for -the Debian GNU/Linux system (but may be used by others). Permission is -granted to copy, distribute and/or modify this document under -the terms of the GNU Free Documentation -License, Version 1.1. diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/xmlwf.sgml b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/xmlwf.sgml deleted file mode 100644 index 313cfbcb..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/doc/xmlwf.sgml +++ /dev/null @@ -1,468 +0,0 @@ - manpage.1'. You may view - the manual page with: `docbook-to-man manpage.sgml | nroff -man | - less'. A typical entry in a Makefile or Makefile.am is: - -manpage.1: manpage.sgml - docbook-to-man $< > $@ - --> - - - Scott"> - Bronson"> - - December 5, 2001"> - - 1"> - bronson@rinspin.com"> - - XMLWF"> - - - Debian GNU/Linux"> - GNU"> -]> - - - -
- &dhemail; -
- - &dhfirstname; - &dhsurname; - - - 2001 - &dhusername; - - &dhdate; -
- - &dhucpackage; - - &dhsection; - - - &dhpackage; - - Determines if an XML document is well-formed - - - - &dhpackage; - - - - - - - - - - - - - - - - - - file ... - - - - - DESCRIPTION - - - &dhpackage; uses the Expat library to - determine if an XML document is well-formed. It is - non-validating. - - - - If you do not specify any files on the command-line, and you - have a recent version of &dhpackage;, the - input file will be read from standard input. - - - - - - WELL-FORMED DOCUMENTS - - - A well-formed document must adhere to the - following rules: - - - - - The file begins with an XML declaration. For instance, - <?xml version="1.0" standalone="yes"?>. - NOTE: - &dhpackage; does not currently - check for a valid XML declaration. - - - Every start tag is either empty (<tag/>) - or has a corresponding end tag. - - - There is exactly one root element. This element must contain - all other elements in the document. Only comments, white - space, and processing instructions may come after the close - of the root element. - - - All elements nest properly. - - - All attribute values are enclosed in quotes (either single - or double). - - - - - If the document has a DTD, and it strictly complies with that - DTD, then the document is also considered valid. - &dhpackage; is a non-validating parser -- - it does not check the DTD. However, it does support - external entities (see the option). - - - - - OPTIONS - - -When an option includes an argument, you may specify the argument either -separately (" output") or concatenated with the -option ("output"). &dhpackage; -supports both. - - - - - - - - - If the input file is well-formed and &dhpackage; - doesn't encounter any errors, the input file is simply copied to - the output directory unchanged. - This implies no namespaces (turns off ) and - requires to specify an output file. - - - - - - - - - Specifies a directory to contain transformed - representations of the input files. - By default, outputs a canonical representation - (described below). - You can select different output formats using - and . - - - The output filenames will - be exactly the same as the input filenames or "STDIN" if the input is - coming from standard input. Therefore, you must be careful that the - output file does not go into the same directory as the input - file. Otherwise, &dhpackage; will delete the - input file before it generates the output file (just like running - cat < file > file in most shells). - - - Two structurally equivalent XML documents have a byte-for-byte - identical canonical XML representation. - Note that ignorable white space is considered significant and - is treated equivalently to data. - More on canonical XML can be found at - http://www.jclark.com/xml/canonxml.html . - - - - - - - - - Specifies the character encoding for the document, overriding - any document encoding declaration. &dhpackage; - supports four built-in encodings: - US-ASCII, - UTF-8, - UTF-16, and - ISO-8859-1. - Also see the option. - - - - - - - - - Outputs some strange sort of XML file that completely - describes the the input file, including character postitions. - Requires to specify an output file. - - - - - - - - - Turns on namespace processing. (describe namespaces) - disables namespaces. - - - - - - - - - Tells xmlwf to process external DTDs and parameter - entities. - - - Normally &dhpackage; never parses parameter - entities. tells it to always parse them. - implies . - - - - - - - - - Normally &dhpackage; memory-maps the XML file - before parsing; this can result in faster parsing on many - platforms. - turns off memory-mapping and uses normal file - IO calls instead. - Of course, memory-mapping is automatically turned off - when reading from standard input. - - - Use of memory-mapping can cause some platforms to report - substantially higher memory usage for - &dhpackage;, but this appears to be a matter of - the operating system reporting memory in a strange way; there is - not a leak in &dhpackage;. - - - - - - - - - Prints an error if the document is not standalone. - A document is standalone if it has no external subset and no - references to parameter entities. - - - - - - - - - Turns on timings. This tells Expat to parse the entire file, - but not perform any processing. - This gives a fairly accurate idea of the raw speed of Expat itself - without client overhead. - turns off most of the output options - (, , , - ...). - - - - - - - - - Prints the version of the Expat library being used, including some - information on the compile-time configuration of the library, and - then exits. - - - - - - - - - Enables support for Windows code pages. - Normally, &dhpackage; will throw an error if it - runs across an encoding that it is not equipped to handle itself. With - , &dhpackage; will try to use a Windows code - page. See also . - - - - - - - - - Turns on parsing external entities. - - - Non-validating parsers are not required to resolve external - entities, or even expand entities at all. - Expat always expands internal entities (?), - but external entity parsing must be enabled explicitly. - - - External entities are simply entities that obtain their - data from outside the XML file currently being parsed. - - - This is an example of an internal entity: - -<!ENTITY vers '1.0.2'> - - - - And here are some examples of external entities: - - -<!ENTITY header SYSTEM "header-&vers;.xml"> (parsed) -<!ENTITY logo SYSTEM "logo.png" PNG> (unparsed) - - - - - - - - - - - (Two hyphens.) - Terminates the list of options. This is only needed if a filename - starts with a hyphen. For example: - - -&dhpackage; -- -myfile.xml - - - will run &dhpackage; on the file - -myfile.xml. - - - - - - - Older versions of &dhpackage; do not support - reading from standard input. - - - - - OUTPUT - - If an input file is not well-formed, - &dhpackage; prints a single line describing - the problem to standard output. If a file is well formed, - &dhpackage; outputs nothing. - Note that the result code is not set. - - - - - BUGS - - &dhpackage; returns a 0 - noerr result, - even if the file is not well-formed. There is no good way for - a program to use &dhpackage; to quickly - check a file -- it must parse &dhpackage;'s - standard output. - - - The errors should go to standard error, not standard output. - - - There should be a way to get to send its - output to standard output rather than forcing the user to send - it to a file. - - - I have no idea why anyone would want to use the - , , and - options. If someone could explain it to - me, I'd like to add this information to this manpage. - - - - - ALTERNATIVES - - Here are some XML validators on the web: - - -http://www.hcrc.ed.ac.uk/~richard/xml-check.html -http://www.stg.brown.edu/service/xmlvalid/ -http://www.scripting.com/frontier5/xml/code/xmlValidator.html -http://www.xml.com/pub/a/tools/ruwf/check.html - - - - - - - SEE ALSO - - - -The Expat home page: http://www.libexpat.org/ -The W3 XML specification: http://www.w3.org/TR/REC-xml - - - - - - - AUTHOR - - This manual page was written by &dhusername; &dhemail; 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 Free Documentation - License, Version 1.1. - - -
- - diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/expat.dsw b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/expat.dsw deleted file mode 100644 index 2d62eec5..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/expat.dsw +++ /dev/null @@ -1,110 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "elements"=.\examples\elements.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name expat_static - End Project Dependency -}}} - -############################################################################### - -Project: "expat"=.\lib\expat.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "expat_static"=.\lib\expat_static.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "expatw"=.\lib\expatw.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "expatw_static"=.\lib\expatw_static.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "outline"=.\examples\outline.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name expat - End Project Dependency -}}} - -############################################################################### - -Project: "xmlwf"=.\xmlwf\xmlwf.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name expat - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/expat.pc.in b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/expat.pc.in deleted file mode 100644 index 5207e3e1..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/expat.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: expat -Version: @PACKAGE_VERSION@ -Description: expat XML parser -URL: http://www.libexpat.org -Libs: -L${libdir} -lexpat -Cflags: -I${includedir} diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/expat_config.h.cmake b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/expat_config.h.cmake deleted file mode 100644 index 25d79a6d..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/expat_config.h.cmake +++ /dev/null @@ -1,91 +0,0 @@ -/* expat_config.h.in. Generated from configure.in by autoheader. */ - -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -#cmakedefine BYTEORDER @BYTEORDER@ - -/* Define to 1 if you have the `bcopy' function. */ -#cmakedefine HAVE_BCOPY - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_FCNTL_H - -/* Define to 1 if you have the `getpagesize' function. */ -#cmakedefine HAVE_GETPAGESIZE - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_INTTYPES_H - -/* Define to 1 if you have the `memmove' function. */ -#cmakedefine HAVE_MEMMOVE - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_MEMORY_H - -/* Define to 1 if you have a working `mmap' system call. */ -#cmakedefine HAVE_MMAP - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_UNISTD_H - -/* Define to the address where bug reports for this package should be sent. */ -#cmakedefine PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#cmakedefine PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#cmakedefine PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#cmakedefine PACKAGE_TARNAME - -/* Define to the version of this package. */ -#cmakedefine PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#cmakedefine STDC_HEADERS - -/* whether byteorder is bigendian */ -#cmakedefine WORDS_BIGENDIAN - -/* Define to specify how much context to retain around the current parse - point. */ -#cmakedefine XML_CONTEXT_BYTES @XML_CONTEXT_BYTES@ - -/* Define to make parameter entity parsing functionality available. */ -#cmakedefine XML_DTD - -/* Define to make XML Namespaces functionality available. */ -#cmakedefine XML_NS - -/* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */ -#ifdef _MSC_VER -# define __func__ __FUNCTION__ -#endif - -/* Define to `long' if does not define. */ -#cmakedefine off_t @OFF_T@ - -/* Define to `unsigned' if does not define. */ -#cmakedefine size_t @SIZE_T@ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/expat_config.h.in b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/expat_config.h.in deleted file mode 100644 index 8c6e5140..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/expat_config.h.in +++ /dev/null @@ -1,102 +0,0 @@ -/* expat_config.h.in. Generated from configure.in by autoheader. */ - -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -#undef BYTEORDER - -/* Define to 1 if you have the `bcopy' function. */ -#undef HAVE_BCOPY - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `getpagesize' function. */ -#undef HAVE_GETPAGESIZE - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `memmove' function. */ -#undef HAVE_MEMMOVE - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* whether byteorder is bigendian */ -#undef WORDS_BIGENDIAN - -/* Define to specify how much context to retain around the current parse - point. */ -#undef XML_CONTEXT_BYTES - -/* Define to make parameter entity parsing functionality available. */ -#undef XML_DTD - -/* Define to make XML Namespaces functionality available. */ -#undef XML_NS - -/* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */ -#undef __func__ - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `long int' if does not define. */ -#undef off_t - -/* Define to `unsigned int' if does not define. */ -#undef size_t diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/Makefile.MPW b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/Makefile.MPW deleted file mode 100644 index 046af005..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/Makefile.MPW +++ /dev/null @@ -1,206 +0,0 @@ -# File: Makefile.MPW -# Targets: All, Dynamic, Static (and Clean, Clean-All) -# Created: Tuesday, July 02, 2002 -# -# MPW Makefile for building expat under the "classic" (i.e. pre-X) Mac OS -# Copyright © 2002 Daryle Walker -# Portions Copyright © 2002 Thomas Wegner -# See the COPYING file for distribution information -# -# Description: -# This Makefile lets you build static, dynamic (i.e. shared) and stub -# versions of the expat library as well as the elements.c and outline.c -# examples (built as tools for MPW). This is for PPC only; it should be -# no problem to build a 68K version of the expat library, though. -# -# Usage: -# Buildprogram All -# or Buildprogram Dynamic -# or Buildprogram Static -# -# Note: You first have to rename this file to "Makefile", or the Buildprogram -# commando will not recognize it. -# - -MAKEFILE = Makefile -¥MondoBuild¥ = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified - -ObjDir = : -SrcDir = : -HdrDir = : - -ToolDir = ::examples: - -Includes = -i {HdrDir} - -Sym-PPC = -sym off - -Defines = -d MACOS_CLASSIC - -PPCCOptions = {Includes} {Sym-PPC} -w 35 {Defines} - -FragName = libexpat - - -### Source Files ### - -SrcFiles = ¶ - "{SrcDir}xmlparse.c" ¶ - "{SrcDir}xmlrole.c" ¶ - "{SrcDir}xmltok.c" - -ToolSrcFiles = ¶ - "{ToolDir}elements.c" ¶ - "{ToolDir}outline.c" - - -### Object Files ### - -ObjFiles-PPC = ¶ - "{ObjDir}xmlparse.c.o" ¶ - "{ObjDir}xmlrole.c.o" ¶ - "{ObjDir}xmltok.c.o" - -ElementToolObjFile = "{ObjDir}elements.c.o" - -OutlineToolObjFile = "{ObjDir}outline.c.o" - - -### Libraries ### - -StLibFiles-PPC = ¶ - "{PPCLibraries}StdCRuntime.o" ¶ - "{PPCLibraries}PPCCRuntime.o" ¶ - "{PPCLibraries}PPCToolLibs.o" - -ShLibFiles-PPC = ¶ - "{SharedLibraries}InterfaceLib" ¶ - "{SharedLibraries}StdCLib" ¶ - "{SharedLibraries}MathLib" - -LibFiles-PPC = ¶ - {StLibFiles-PPC} ¶ - {ShLibFiles-PPC} - - -### Special Files ### - -ExportFile = "{ObjDir}{FragName}.exp" - -StLibFile = "{ObjDir}{FragName}.MrC.o" - -ShLibFile = "{ObjDir}{FragName}" - -StubFile = "{ObjDir}{FragName}.stub" - -ElementsTool = "{ToolDir}elements" - -OutlineTool = "{ToolDir}outline" - - -### Default Rules ### - -.c.o Ä .c {¥MondoBuild¥} - {PPCC} {depDir}{default}.c -o {targDir}{default}.c.o {PPCCOptions} - - -### Build Rules ### - -All Ä Dynamic {ElementsTool} {OutlineTool} - -Static Ä {StLibFile} - -Dynamic Ä Static {ShLibFile} {StubFile} - -{StLibFile} ÄÄ {ObjFiles-PPC} {StLibFiles-PPC} {¥MondoBuild¥} - PPCLink ¶ - -o {Targ} ¶ - {ObjFiles-PPC} ¶ - {StLibFiles-PPC} ¶ - {Sym-PPC} ¶ - -mf -d ¶ - -t 'XCOF' ¶ - -c 'MPS ' ¶ - -xm l - -{ShLibFile} ÄÄ {StLibFile} {ShLibFiles-PPC} {ExportFile} {¥MondoBuild¥} - PPCLink ¶ - -o {Targ} ¶ - {StLibFile} ¶ - {ShLibFiles-PPC} ¶ - {Sym-PPC} ¶ - -@export {ExportFile} ¶ - -fragname {FragName} ¶ - -mf -d ¶ - -t 'shlb' ¶ - -c '????' ¶ - -xm s - -{StubFile} ÄÄ {ShLibFile} {¥MondoBuild¥} - shlb2stub -o {Targ} {ShLibFile} - -{ElementsTool} ÄÄ {ElementToolObjFile} {StubFile} {LibFiles-PPC} {¥MondoBuild¥} - PPCLink ¶ - -o {Targ} ¶ - {ElementToolObjFile} ¶ - {StLibFile} ¶ - {LibFiles-PPC} ¶ - {Sym-PPC} ¶ - -mf -d ¶ - -t 'MPST' ¶ - -c 'MPS ' - -{OutlineTool} ÄÄ {OutlineToolObjFile} {StubFile} {LibFiles-PPC} {¥MondoBuild¥} - PPCLink ¶ - -o {Targ} ¶ - {OutlineToolObjFile} ¶ - {StLibFile} ¶ - {LibFiles-PPC} ¶ - {Sym-PPC} ¶ - -mf -d ¶ - -t 'MPST' ¶ - -c 'MPS ' - - -### Special Rules ### - -{ExportFile} ÄÄ "{HdrDir}expat.h" {¥MondoBuild¥} - StreamEdit -d ¶ - -e "/¥('XMLPARSEAPI('Å') ')Ç0,1È'XML_'([A-Za-z0-9_]+)¨1'('/ Print 'XML_' ¨1" ¶ - "{HdrDir}expat.h" > {Targ} - - -### Required Dependencies ### - -"{ObjDir}xmlparse.c.o" Ä "{SrcDir}xmlparse.c" -"{ObjDir}xmlrole.c.o" Ä "{SrcDir}xmlrole.c" -"{ObjDir}xmltok.c.o" Ä "{SrcDir}xmltok.c" - -"{ObjDir}elements.c.o" Ä "{ToolDir}elements.c" -"{ObjDir}outline.c.o" Ä "{ToolDir}outline.c" - - -### Optional Dependencies ### -### Build this target to clean out generated intermediate files. ### - -Clean Ä - Delete {ObjFiles-PPC} {ExportFile} {ElementToolObjFile} {OutlineToolObjFile} - -### Build this target to clean out all generated files. ### - -Clean-All Ä Clean - Delete {StLibFile} {ShLibFile} {StubFile} {ElementsTool} {OutlineTool} - -### Build this target to generate "include file" dependencies. ### - -Dependencies Ä $OutOfDate - MakeDepend ¶ - -append {MAKEFILE} ¶ - -ignore "{CIncludes}" ¶ - -objdir "{ObjDir}" ¶ - -objext .o ¶ - {Defines} ¶ - {Includes} ¶ - {SrcFiles} - - diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/amigaconfig.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/amigaconfig.h deleted file mode 100644 index 86c61150..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/amigaconfig.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef AMIGACONFIG_H -#define AMIGACONFIG_H - -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -#define BYTEORDER 4321 - -/* Define to 1 if you have the `bcopy' function. */ -#define HAVE_BCOPY 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_CHECK_H - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* whether byteorder is bigendian */ -#define WORDS_BIGENDIAN - -/* Define to specify how much context to retain around the current parse - point. */ -#define XML_CONTEXT_BYTES 1024 - -/* Define to make parameter entity parsing functionality available. */ -#define XML_DTD - -/* Define to make XML Namespaces functionality available. */ -#define XML_NS - -#endif /* AMIGACONFIG_H */ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/ascii.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/ascii.h deleted file mode 100644 index d10530b0..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/ascii.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#define ASCII_A 0x41 -#define ASCII_B 0x42 -#define ASCII_C 0x43 -#define ASCII_D 0x44 -#define ASCII_E 0x45 -#define ASCII_F 0x46 -#define ASCII_G 0x47 -#define ASCII_H 0x48 -#define ASCII_I 0x49 -#define ASCII_J 0x4A -#define ASCII_K 0x4B -#define ASCII_L 0x4C -#define ASCII_M 0x4D -#define ASCII_N 0x4E -#define ASCII_O 0x4F -#define ASCII_P 0x50 -#define ASCII_Q 0x51 -#define ASCII_R 0x52 -#define ASCII_S 0x53 -#define ASCII_T 0x54 -#define ASCII_U 0x55 -#define ASCII_V 0x56 -#define ASCII_W 0x57 -#define ASCII_X 0x58 -#define ASCII_Y 0x59 -#define ASCII_Z 0x5A - -#define ASCII_a 0x61 -#define ASCII_b 0x62 -#define ASCII_c 0x63 -#define ASCII_d 0x64 -#define ASCII_e 0x65 -#define ASCII_f 0x66 -#define ASCII_g 0x67 -#define ASCII_h 0x68 -#define ASCII_i 0x69 -#define ASCII_j 0x6A -#define ASCII_k 0x6B -#define ASCII_l 0x6C -#define ASCII_m 0x6D -#define ASCII_n 0x6E -#define ASCII_o 0x6F -#define ASCII_p 0x70 -#define ASCII_q 0x71 -#define ASCII_r 0x72 -#define ASCII_s 0x73 -#define ASCII_t 0x74 -#define ASCII_u 0x75 -#define ASCII_v 0x76 -#define ASCII_w 0x77 -#define ASCII_x 0x78 -#define ASCII_y 0x79 -#define ASCII_z 0x7A - -#define ASCII_0 0x30 -#define ASCII_1 0x31 -#define ASCII_2 0x32 -#define ASCII_3 0x33 -#define ASCII_4 0x34 -#define ASCII_5 0x35 -#define ASCII_6 0x36 -#define ASCII_7 0x37 -#define ASCII_8 0x38 -#define ASCII_9 0x39 - -#define ASCII_TAB 0x09 -#define ASCII_SPACE 0x20 -#define ASCII_EXCL 0x21 -#define ASCII_QUOT 0x22 -#define ASCII_AMP 0x26 -#define ASCII_APOS 0x27 -#define ASCII_MINUS 0x2D -#define ASCII_PERIOD 0x2E -#define ASCII_COLON 0x3A -#define ASCII_SEMI 0x3B -#define ASCII_LT 0x3C -#define ASCII_EQUALS 0x3D -#define ASCII_GT 0x3E -#define ASCII_LSQB 0x5B -#define ASCII_RSQB 0x5D -#define ASCII_UNDERSCORE 0x5F -#define ASCII_LPAREN 0x28 -#define ASCII_RPAREN 0x29 -#define ASCII_FF 0x0C -#define ASCII_SLASH 0x2F -#define ASCII_HASH 0x23 -#define ASCII_PIPE 0x7C -#define ASCII_COMMA 0x2C diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/asciitab.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/asciitab.h deleted file mode 100644 index 79a15c28..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/asciitab.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, -/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, -/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, -/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, -/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, -/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, -/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, -/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, -/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, -/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, -/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat.dsp b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat.dsp deleted file mode 100644 index bf728da0..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat.dsp +++ /dev/null @@ -1,185 +0,0 @@ -# Microsoft Developer Studio Project File - Name="expat" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=expat - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "expat.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "expat.mak" CFG="expat - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "expat - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "expat - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "expat - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\win32\bin\Release" -# PROP Intermediate_Dir "..\win32\tmp\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILED_FROM_DSP" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /dll /machine:I386 -# ADD LINK32 /nologo /dll /pdb:none /machine:I386 /out:"..\win32\bin\Release\libexpat.dll" - -!ELSEIF "$(CFG)" == "expat - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\win32\bin\Debug" -# PROP Intermediate_Dir "..\win32\tmp\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "COMPILED_FROM_DSP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /dll /pdb:none /debug /machine:I386 /out:"..\win32\bin\Debug\libexpat.dll" - -!ENDIF - -# Begin Target - -# Name "expat - Win32 Release" -# Name "expat - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\libexpat.def -# End Source File -# Begin Source File - -SOURCE=.\xmlparse.c - -!IF "$(CFG)" == "expat - Win32 Release" - -!ELSEIF "$(CFG)" == "expat - Win32 Debug" - -# ADD CPP /GX- /Od - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_ns.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\ascii.h -# End Source File -# Begin Source File - -SOURCE=.\asciitab.h -# End Source File -# Begin Source File - -SOURCE=.\expat.h -# End Source File -# Begin Source File - -SOURCE=.\expat_external.h -# End Source File -# Begin Source File - -SOURCE=.\iasciitab.h -# End Source File -# Begin Source File - -SOURCE=.\internal.h -# End Source File -# Begin Source File - -SOURCE=.\latin1tab.h -# End Source File -# Begin Source File - -SOURCE=.\nametab.h -# End Source File -# Begin Source File - -SOURCE=.\utf8tab.h -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat.h deleted file mode 100644 index 9a21680b..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat.h +++ /dev/null @@ -1,1047 +0,0 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef Expat_INCLUDED -#define Expat_INCLUDED 1 - -#ifdef __VMS -/* 0 1 2 3 0 1 2 3 - 1234567890123456789012345678901 1234567890123456789012345678901 */ -#define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler -#define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler -#define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler -#define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg -#endif - -#include -#include "expat_external.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct XML_ParserStruct; -typedef struct XML_ParserStruct *XML_Parser; - -/* Should this be defined using stdbool.h when C99 is available? */ -typedef unsigned char XML_Bool; -#define XML_TRUE ((XML_Bool) 1) -#define XML_FALSE ((XML_Bool) 0) - -/* The XML_Status enum gives the possible return values for several - API functions. The preprocessor #defines are included so this - stanza can be added to code that still needs to support older - versions of Expat 1.95.x: - - #ifndef XML_STATUS_OK - #define XML_STATUS_OK 1 - #define XML_STATUS_ERROR 0 - #endif - - Otherwise, the #define hackery is quite ugly and would have been - dropped. -*/ -enum XML_Status { - XML_STATUS_ERROR = 0, -#define XML_STATUS_ERROR XML_STATUS_ERROR - XML_STATUS_OK = 1, -#define XML_STATUS_OK XML_STATUS_OK - XML_STATUS_SUSPENDED = 2 -#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED -}; - -enum XML_Error { - XML_ERROR_NONE, - XML_ERROR_NO_MEMORY, - XML_ERROR_SYNTAX, - XML_ERROR_NO_ELEMENTS, - XML_ERROR_INVALID_TOKEN, - XML_ERROR_UNCLOSED_TOKEN, - XML_ERROR_PARTIAL_CHAR, - XML_ERROR_TAG_MISMATCH, - XML_ERROR_DUPLICATE_ATTRIBUTE, - XML_ERROR_JUNK_AFTER_DOC_ELEMENT, - XML_ERROR_PARAM_ENTITY_REF, - XML_ERROR_UNDEFINED_ENTITY, - XML_ERROR_RECURSIVE_ENTITY_REF, - XML_ERROR_ASYNC_ENTITY, - XML_ERROR_BAD_CHAR_REF, - XML_ERROR_BINARY_ENTITY_REF, - XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, - XML_ERROR_MISPLACED_XML_PI, - XML_ERROR_UNKNOWN_ENCODING, - XML_ERROR_INCORRECT_ENCODING, - XML_ERROR_UNCLOSED_CDATA_SECTION, - XML_ERROR_EXTERNAL_ENTITY_HANDLING, - XML_ERROR_NOT_STANDALONE, - XML_ERROR_UNEXPECTED_STATE, - XML_ERROR_ENTITY_DECLARED_IN_PE, - XML_ERROR_FEATURE_REQUIRES_XML_DTD, - XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, - /* Added in 1.95.7. */ - XML_ERROR_UNBOUND_PREFIX, - /* Added in 1.95.8. */ - XML_ERROR_UNDECLARING_PREFIX, - XML_ERROR_INCOMPLETE_PE, - XML_ERROR_XML_DECL, - XML_ERROR_TEXT_DECL, - XML_ERROR_PUBLICID, - XML_ERROR_SUSPENDED, - XML_ERROR_NOT_SUSPENDED, - XML_ERROR_ABORTED, - XML_ERROR_FINISHED, - XML_ERROR_SUSPEND_PE, - /* Added in 2.0. */ - XML_ERROR_RESERVED_PREFIX_XML, - XML_ERROR_RESERVED_PREFIX_XMLNS, - XML_ERROR_RESERVED_NAMESPACE_URI -}; - -enum XML_Content_Type { - XML_CTYPE_EMPTY = 1, - XML_CTYPE_ANY, - XML_CTYPE_MIXED, - XML_CTYPE_NAME, - XML_CTYPE_CHOICE, - XML_CTYPE_SEQ -}; - -enum XML_Content_Quant { - XML_CQUANT_NONE, - XML_CQUANT_OPT, - XML_CQUANT_REP, - XML_CQUANT_PLUS -}; - -/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be - XML_CQUANT_NONE, and the other fields will be zero or NULL. - If type == XML_CTYPE_MIXED, then quant will be NONE or REP and - numchildren will contain number of elements that may be mixed in - and children point to an array of XML_Content cells that will be - all of XML_CTYPE_NAME type with no quantification. - - If type == XML_CTYPE_NAME, then the name points to the name, and - the numchildren field will be zero and children will be NULL. The - quant fields indicates any quantifiers placed on the name. - - CHOICE and SEQ will have name NULL, the number of children in - numchildren and children will point, recursively, to an array - of XML_Content cells. - - The EMPTY, ANY, and MIXED types will only occur at top level. -*/ - -typedef struct XML_cp XML_Content; - -struct XML_cp { - enum XML_Content_Type type; - enum XML_Content_Quant quant; - XML_Char * name; - unsigned int numchildren; - XML_Content * children; -}; - - -/* This is called for an element declaration. See above for - description of the model argument. It's the caller's responsibility - to free model when finished with it. -*/ -typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData, - const XML_Char *name, - XML_Content *model); - -XMLPARSEAPI(void) -XML_SetElementDeclHandler(XML_Parser parser, - XML_ElementDeclHandler eldecl); - -/* The Attlist declaration handler is called for *each* attribute. So - a single Attlist declaration with multiple attributes declared will - generate multiple calls to this handler. The "default" parameter - may be NULL in the case of the "#IMPLIED" or "#REQUIRED" - keyword. The "isrequired" parameter will be true and the default - value will be NULL in the case of "#REQUIRED". If "isrequired" is - true and default is non-NULL, then this is a "#FIXED" default. -*/ -typedef void (XMLCALL *XML_AttlistDeclHandler) ( - void *userData, - const XML_Char *elname, - const XML_Char *attname, - const XML_Char *att_type, - const XML_Char *dflt, - int isrequired); - -XMLPARSEAPI(void) -XML_SetAttlistDeclHandler(XML_Parser parser, - XML_AttlistDeclHandler attdecl); - -/* The XML declaration handler is called for *both* XML declarations - and text declarations. The way to distinguish is that the version - parameter will be NULL for text declarations. The encoding - parameter may be NULL for XML declarations. The standalone - parameter will be -1, 0, or 1 indicating respectively that there - was no standalone parameter in the declaration, that it was given - as no, or that it was given as yes. -*/ -typedef void (XMLCALL *XML_XmlDeclHandler) (void *userData, - const XML_Char *version, - const XML_Char *encoding, - int standalone); - -XMLPARSEAPI(void) -XML_SetXmlDeclHandler(XML_Parser parser, - XML_XmlDeclHandler xmldecl); - - -typedef struct { - void *(*malloc_fcn)(size_t size); - void *(*realloc_fcn)(void *ptr, size_t size); - void (*free_fcn)(void *ptr); -} XML_Memory_Handling_Suite; - -/* Constructs a new parser; encoding is the encoding specified by the - external protocol or NULL if there is none specified. -*/ -XMLPARSEAPI(XML_Parser) -XML_ParserCreate(const XML_Char *encoding); - -/* Constructs a new parser and namespace processor. Element type - names and attribute names that belong to a namespace will be - expanded; unprefixed attribute names are never expanded; unprefixed - element type names are expanded only if there is a default - namespace. The expanded name is the concatenation of the namespace - URI, the namespace separator character, and the local part of the - name. If the namespace separator is '\0' then the namespace URI - and the local part will be concatenated without any separator. - It is a programming error to use the separator '\0' with namespace - triplets (see XML_SetReturnNSTriplet). -*/ -XMLPARSEAPI(XML_Parser) -XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); - - -/* Constructs a new parser using the memory management suite referred to - by memsuite. If memsuite is NULL, then use the standard library memory - suite. If namespaceSeparator is non-NULL it creates a parser with - namespace processing as described above. The character pointed at - will serve as the namespace separator. - - All further memory operations used for the created parser will come from - the given suite. -*/ -XMLPARSEAPI(XML_Parser) -XML_ParserCreate_MM(const XML_Char *encoding, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *namespaceSeparator); - -/* Prepare a parser object to be re-used. This is particularly - valuable when memory allocation overhead is disproportionatly high, - such as when a large number of small documnents need to be parsed. - All handlers are cleared from the parser, except for the - unknownEncodingHandler. The parser's external state is re-initialized - except for the values of ns and ns_triplets. - - Added in Expat 1.95.3. -*/ -XMLPARSEAPI(XML_Bool) -XML_ParserReset(XML_Parser parser, const XML_Char *encoding); - -/* atts is array of name/value pairs, terminated by 0; - names and values are 0 terminated. -*/ -typedef void (XMLCALL *XML_StartElementHandler) (void *userData, - const XML_Char *name, - const XML_Char **atts); - -typedef void (XMLCALL *XML_EndElementHandler) (void *userData, - const XML_Char *name); - - -/* s is not 0 terminated. */ -typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData, - const XML_Char *s, - int len); - -/* target and data are 0 terminated */ -typedef void (XMLCALL *XML_ProcessingInstructionHandler) ( - void *userData, - const XML_Char *target, - const XML_Char *data); - -/* data is 0 terminated */ -typedef void (XMLCALL *XML_CommentHandler) (void *userData, - const XML_Char *data); - -typedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData); -typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData); - -/* This is called for any characters in the XML document for which - there is no applicable handler. This includes both characters that - are part of markup which is of a kind that is not reported - (comments, markup declarations), or characters that are part of a - construct which could be reported but for which no handler has been - supplied. The characters are passed exactly as they were in the XML - document except that they will be encoded in UTF-8 or UTF-16. - Line boundaries are not normalized. Note that a byte order mark - character is not passed to the default handler. There are no - guarantees about how characters are divided between calls to the - default handler: for example, a comment might be split between - multiple calls. -*/ -typedef void (XMLCALL *XML_DefaultHandler) (void *userData, - const XML_Char *s, - int len); - -/* This is called for the start of the DOCTYPE declaration, before - any DTD or internal subset is parsed. -*/ -typedef void (XMLCALL *XML_StartDoctypeDeclHandler) ( - void *userData, - const XML_Char *doctypeName, - const XML_Char *sysid, - const XML_Char *pubid, - int has_internal_subset); - -/* This is called for the start of the DOCTYPE declaration when the - closing > is encountered, but after processing any external - subset. -*/ -typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData); - -/* This is called for entity declarations. The is_parameter_entity - argument will be non-zero if the entity is a parameter entity, zero - otherwise. - - For internal entities (), value will - be non-NULL and systemId, publicID, and notationName will be NULL. - The value string is NOT nul-terminated; the length is provided in - the value_length argument. Since it is legal to have zero-length - values, do not use this argument to test for internal entities. - - For external entities, value will be NULL and systemId will be - non-NULL. The publicId argument will be NULL unless a public - identifier was provided. The notationName argument will have a - non-NULL value only for unparsed entity declarations. - - Note that is_parameter_entity can't be changed to XML_Bool, since - that would break binary compatibility. -*/ -typedef void (XMLCALL *XML_EntityDeclHandler) ( - void *userData, - const XML_Char *entityName, - int is_parameter_entity, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); - -XMLPARSEAPI(void) -XML_SetEntityDeclHandler(XML_Parser parser, - XML_EntityDeclHandler handler); - -/* OBSOLETE -- OBSOLETE -- OBSOLETE - This handler has been superceded by the EntityDeclHandler above. - It is provided here for backward compatibility. - - This is called for a declaration of an unparsed (NDATA) entity. - The base argument is whatever was set by XML_SetBase. The - entityName, systemId and notationName arguments will never be - NULL. The other arguments may be. -*/ -typedef void (XMLCALL *XML_UnparsedEntityDeclHandler) ( - void *userData, - const XML_Char *entityName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); - -/* This is called for a declaration of notation. The base argument is - whatever was set by XML_SetBase. The notationName will never be - NULL. The other arguments can be. -*/ -typedef void (XMLCALL *XML_NotationDeclHandler) ( - void *userData, - const XML_Char *notationName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); - -/* When namespace processing is enabled, these are called once for - each namespace declaration. The call to the start and end element - handlers occur between the calls to the start and end namespace - declaration handlers. For an xmlns attribute, prefix will be - NULL. For an xmlns="" attribute, uri will be NULL. -*/ -typedef void (XMLCALL *XML_StartNamespaceDeclHandler) ( - void *userData, - const XML_Char *prefix, - const XML_Char *uri); - -typedef void (XMLCALL *XML_EndNamespaceDeclHandler) ( - void *userData, - const XML_Char *prefix); - -/* This is called if the document is not standalone, that is, it has an - external subset or a reference to a parameter entity, but does not - have standalone="yes". If this handler returns XML_STATUS_ERROR, - then processing will not continue, and the parser will return a - XML_ERROR_NOT_STANDALONE error. - If parameter entity parsing is enabled, then in addition to the - conditions above this handler will only be called if the referenced - entity was actually read. -*/ -typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData); - -/* This is called for a reference to an external parsed general - entity. The referenced entity is not automatically parsed. The - application can parse it immediately or later using - XML_ExternalEntityParserCreate. - - The parser argument is the parser parsing the entity containing the - reference; it can be passed as the parser argument to - XML_ExternalEntityParserCreate. The systemId argument is the - system identifier as specified in the entity declaration; it will - not be NULL. - - The base argument is the system identifier that should be used as - the base for resolving systemId if systemId was relative; this is - set by XML_SetBase; it may be NULL. - - The publicId argument is the public identifier as specified in the - entity declaration, or NULL if none was specified; the whitespace - in the public identifier will have been normalized as required by - the XML spec. - - The context argument specifies the parsing context in the format - expected by the context argument to XML_ExternalEntityParserCreate; - context is valid only until the handler returns, so if the - referenced entity is to be parsed later, it must be copied. - context is NULL only when the entity is a parameter entity. - - The handler should return XML_STATUS_ERROR if processing should not - continue because of a fatal error in the handling of the external - entity. In this case the calling parser will return an - XML_ERROR_EXTERNAL_ENTITY_HANDLING error. - - Note that unlike other handlers the first argument is the parser, - not userData. -*/ -typedef int (XMLCALL *XML_ExternalEntityRefHandler) ( - XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); - -/* This is called in two situations: - 1) An entity reference is encountered for which no declaration - has been read *and* this is not an error. - 2) An internal entity reference is read, but not expanded, because - XML_SetDefaultHandler has been called. - Note: skipped parameter entities in declarations and skipped general - entities in attribute values cannot be reported, because - the event would be out of sync with the reporting of the - declarations or attribute values -*/ -typedef void (XMLCALL *XML_SkippedEntityHandler) ( - void *userData, - const XML_Char *entityName, - int is_parameter_entity); - -/* This structure is filled in by the XML_UnknownEncodingHandler to - provide information to the parser about encodings that are unknown - to the parser. - - The map[b] member gives information about byte sequences whose - first byte is b. - - If map[b] is c where c is >= 0, then b by itself encodes the - Unicode scalar value c. - - If map[b] is -1, then the byte sequence is malformed. - - If map[b] is -n, where n >= 2, then b is the first byte of an - n-byte sequence that encodes a single Unicode scalar value. - - The data member will be passed as the first argument to the convert - function. - - The convert function is used to convert multibyte sequences; s will - point to a n-byte sequence where map[(unsigned char)*s] == -n. The - convert function must return the Unicode scalar value represented - by this byte sequence or -1 if the byte sequence is malformed. - - The convert function may be NULL if the encoding is a single-byte - encoding, that is if map[b] >= -1 for all bytes b. - - When the parser is finished with the encoding, then if release is - not NULL, it will call release passing it the data member; once - release has been called, the convert function will not be called - again. - - Expat places certain restrictions on the encodings that are supported - using this mechanism. - - 1. Every ASCII character that can appear in a well-formed XML document, - other than the characters - - $@\^`{}~ - - must be represented by a single byte, and that byte must be the - same byte that represents that character in ASCII. - - 2. No character may require more than 4 bytes to encode. - - 3. All characters encoded must have Unicode scalar values <= - 0xFFFF, (i.e., characters that would be encoded by surrogates in - UTF-16 are not allowed). Note that this restriction doesn't - apply to the built-in support for UTF-8 and UTF-16. - - 4. No Unicode character may be encoded by more than one distinct - sequence of bytes. -*/ -typedef struct { - int map[256]; - void *data; - int (XMLCALL *convert)(void *data, const char *s); - void (XMLCALL *release)(void *data); -} XML_Encoding; - -/* This is called for an encoding that is unknown to the parser. - - The encodingHandlerData argument is that which was passed as the - second argument to XML_SetUnknownEncodingHandler. - - The name argument gives the name of the encoding as specified in - the encoding declaration. - - If the callback can provide information about the encoding, it must - fill in the XML_Encoding structure, and return XML_STATUS_OK. - Otherwise it must return XML_STATUS_ERROR. - - If info does not describe a suitable encoding, then the parser will - return an XML_UNKNOWN_ENCODING error. -*/ -typedef int (XMLCALL *XML_UnknownEncodingHandler) ( - void *encodingHandlerData, - const XML_Char *name, - XML_Encoding *info); - -XMLPARSEAPI(void) -XML_SetElementHandler(XML_Parser parser, - XML_StartElementHandler start, - XML_EndElementHandler end); - -XMLPARSEAPI(void) -XML_SetStartElementHandler(XML_Parser parser, - XML_StartElementHandler handler); - -XMLPARSEAPI(void) -XML_SetEndElementHandler(XML_Parser parser, - XML_EndElementHandler handler); - -XMLPARSEAPI(void) -XML_SetCharacterDataHandler(XML_Parser parser, - XML_CharacterDataHandler handler); - -XMLPARSEAPI(void) -XML_SetProcessingInstructionHandler(XML_Parser parser, - XML_ProcessingInstructionHandler handler); -XMLPARSEAPI(void) -XML_SetCommentHandler(XML_Parser parser, - XML_CommentHandler handler); - -XMLPARSEAPI(void) -XML_SetCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start, - XML_EndCdataSectionHandler end); - -XMLPARSEAPI(void) -XML_SetStartCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start); - -XMLPARSEAPI(void) -XML_SetEndCdataSectionHandler(XML_Parser parser, - XML_EndCdataSectionHandler end); - -/* This sets the default handler and also inhibits expansion of - internal entities. These entity references will be passed to the - default handler, or to the skipped entity handler, if one is set. -*/ -XMLPARSEAPI(void) -XML_SetDefaultHandler(XML_Parser parser, - XML_DefaultHandler handler); - -/* This sets the default handler but does not inhibit expansion of - internal entities. The entity reference will not be passed to the - default handler. -*/ -XMLPARSEAPI(void) -XML_SetDefaultHandlerExpand(XML_Parser parser, - XML_DefaultHandler handler); - -XMLPARSEAPI(void) -XML_SetDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start, - XML_EndDoctypeDeclHandler end); - -XMLPARSEAPI(void) -XML_SetStartDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start); - -XMLPARSEAPI(void) -XML_SetEndDoctypeDeclHandler(XML_Parser parser, - XML_EndDoctypeDeclHandler end); - -XMLPARSEAPI(void) -XML_SetUnparsedEntityDeclHandler(XML_Parser parser, - XML_UnparsedEntityDeclHandler handler); - -XMLPARSEAPI(void) -XML_SetNotationDeclHandler(XML_Parser parser, - XML_NotationDeclHandler handler); - -XMLPARSEAPI(void) -XML_SetNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start, - XML_EndNamespaceDeclHandler end); - -XMLPARSEAPI(void) -XML_SetStartNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start); - -XMLPARSEAPI(void) -XML_SetEndNamespaceDeclHandler(XML_Parser parser, - XML_EndNamespaceDeclHandler end); - -XMLPARSEAPI(void) -XML_SetNotStandaloneHandler(XML_Parser parser, - XML_NotStandaloneHandler handler); - -XMLPARSEAPI(void) -XML_SetExternalEntityRefHandler(XML_Parser parser, - XML_ExternalEntityRefHandler handler); - -/* If a non-NULL value for arg is specified here, then it will be - passed as the first argument to the external entity ref handler - instead of the parser object. -*/ -XMLPARSEAPI(void) -XML_SetExternalEntityRefHandlerArg(XML_Parser parser, - void *arg); - -XMLPARSEAPI(void) -XML_SetSkippedEntityHandler(XML_Parser parser, - XML_SkippedEntityHandler handler); - -XMLPARSEAPI(void) -XML_SetUnknownEncodingHandler(XML_Parser parser, - XML_UnknownEncodingHandler handler, - void *encodingHandlerData); - -/* This can be called within a handler for a start element, end - element, processing instruction or character data. It causes the - corresponding markup to be passed to the default handler. -*/ -XMLPARSEAPI(void) -XML_DefaultCurrent(XML_Parser parser); - -/* If do_nst is non-zero, and namespace processing is in effect, and - a name has a prefix (i.e. an explicit namespace qualifier) then - that name is returned as a triplet in a single string separated by - the separator character specified when the parser was created: URI - + sep + local_name + sep + prefix. - - If do_nst is zero, then namespace information is returned in the - default manner (URI + sep + local_name) whether or not the name - has a prefix. - - Note: Calling XML_SetReturnNSTriplet after XML_Parse or - XML_ParseBuffer has no effect. -*/ - -XMLPARSEAPI(void) -XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); - -/* This value is passed as the userData argument to callbacks. */ -XMLPARSEAPI(void) -XML_SetUserData(XML_Parser parser, void *userData); - -/* Returns the last value set by XML_SetUserData or NULL. */ -#define XML_GetUserData(parser) (*(void **)(parser)) - -/* This is equivalent to supplying an encoding argument to - XML_ParserCreate. On success XML_SetEncoding returns non-zero, - zero otherwise. - Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer - has no effect and returns XML_STATUS_ERROR. -*/ -XMLPARSEAPI(enum XML_Status) -XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); - -/* If this function is called, then the parser will be passed as the - first argument to callbacks instead of userData. The userData will - still be accessible using XML_GetUserData. -*/ -XMLPARSEAPI(void) -XML_UseParserAsHandlerArg(XML_Parser parser); - -/* If useDTD == XML_TRUE is passed to this function, then the parser - will assume that there is an external subset, even if none is - specified in the document. In such a case the parser will call the - externalEntityRefHandler with a value of NULL for the systemId - argument (the publicId and context arguments will be NULL as well). - Note: For the purpose of checking WFC: Entity Declared, passing - useDTD == XML_TRUE will make the parser behave as if the document - had a DTD with an external subset. - Note: If this function is called, then this must be done before - the first call to XML_Parse or XML_ParseBuffer, since it will - have no effect after that. Returns - XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING. - Note: If the document does not have a DOCTYPE declaration at all, - then startDoctypeDeclHandler and endDoctypeDeclHandler will not - be called, despite an external subset being parsed. - Note: If XML_DTD is not defined when Expat is compiled, returns - XML_ERROR_FEATURE_REQUIRES_XML_DTD. -*/ -XMLPARSEAPI(enum XML_Error) -XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); - - -/* Sets the base to be used for resolving relative URIs in system - identifiers in declarations. Resolving relative identifiers is - left to the application: this value will be passed through as the - base argument to the XML_ExternalEntityRefHandler, - XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base - argument will be copied. Returns XML_STATUS_ERROR if out of memory, - XML_STATUS_OK otherwise. -*/ -XMLPARSEAPI(enum XML_Status) -XML_SetBase(XML_Parser parser, const XML_Char *base); - -XMLPARSEAPI(const XML_Char *) -XML_GetBase(XML_Parser parser); - -/* Returns the number of the attribute/value pairs passed in last call - to the XML_StartElementHandler that were specified in the start-tag - rather than defaulted. Each attribute/value pair counts as 2; thus - this correspondds to an index into the atts array passed to the - XML_StartElementHandler. -*/ -XMLPARSEAPI(int) -XML_GetSpecifiedAttributeCount(XML_Parser parser); - -/* Returns the index of the ID attribute passed in the last call to - XML_StartElementHandler, or -1 if there is no ID attribute. Each - attribute/value pair counts as 2; thus this correspondds to an - index into the atts array passed to the XML_StartElementHandler. -*/ -XMLPARSEAPI(int) -XML_GetIdAttributeIndex(XML_Parser parser); - -#ifdef XML_ATTR_INFO -/* Source file byte offsets for the start and end of attribute names and values. - The value indices are exclusive of surrounding quotes; thus in a UTF-8 source - file an attribute value of "blah" will yield: - info->valueEnd - info->valueStart = 4 bytes. -*/ -typedef struct { - XML_Index nameStart; /* Offset to beginning of the attribute name. */ - XML_Index nameEnd; /* Offset after the attribute name's last byte. */ - XML_Index valueStart; /* Offset to beginning of the attribute value. */ - XML_Index valueEnd; /* Offset after the attribute value's last byte. */ -} XML_AttrInfo; - -/* Returns an array of XML_AttrInfo structures for the attribute/value pairs - passed in last call to the XML_StartElementHandler that were specified - in the start-tag rather than defaulted. Each attribute/value pair counts - as 1; thus the number of entries in the array is - XML_GetSpecifiedAttributeCount(parser) / 2. -*/ -XMLPARSEAPI(const XML_AttrInfo *) -XML_GetAttributeInfo(XML_Parser parser); -#endif - -/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is - detected. The last call to XML_Parse must have isFinal true; len - may be zero for this call (or any other). - - Though the return values for these functions has always been - described as a Boolean value, the implementation, at least for the - 1.95.x series, has always returned exactly one of the XML_Status - values. -*/ -XMLPARSEAPI(enum XML_Status) -XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); - -XMLPARSEAPI(void *) -XML_GetBuffer(XML_Parser parser, int len); - -XMLPARSEAPI(enum XML_Status) -XML_ParseBuffer(XML_Parser parser, int len, int isFinal); - -/* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return. - Must be called from within a call-back handler, except when aborting - (resumable = 0) an already suspended parser. Some call-backs may - still follow because they would otherwise get lost. Examples: - - endElementHandler() for empty elements when stopped in - startElementHandler(), - - endNameSpaceDeclHandler() when stopped in endElementHandler(), - and possibly others. - - Can be called from most handlers, including DTD related call-backs, - except when parsing an external parameter entity and resumable != 0. - Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise. - Possible error codes: - - XML_ERROR_SUSPENDED: when suspending an already suspended parser. - - XML_ERROR_FINISHED: when the parser has already finished. - - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE. - - When resumable != 0 (true) then parsing is suspended, that is, - XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED. - Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer() - return XML_STATUS_ERROR with error code XML_ERROR_ABORTED. - - *Note*: - This will be applied to the current parser instance only, that is, if - there is a parent parser then it will continue parsing when the - externalEntityRefHandler() returns. It is up to the implementation of - the externalEntityRefHandler() to call XML_StopParser() on the parent - parser (recursively), if one wants to stop parsing altogether. - - When suspended, parsing can be resumed by calling XML_ResumeParser(). -*/ -XMLPARSEAPI(enum XML_Status) -XML_StopParser(XML_Parser parser, XML_Bool resumable); - -/* Resumes parsing after it has been suspended with XML_StopParser(). - Must not be called from within a handler call-back. Returns same - status codes as XML_Parse() or XML_ParseBuffer(). - Additional error code XML_ERROR_NOT_SUSPENDED possible. - - *Note*: - This must be called on the most deeply nested child parser instance - first, and on its parent parser only after the child parser has finished, - to be applied recursively until the document entity's parser is restarted. - That is, the parent parser will not resume by itself and it is up to the - application to call XML_ResumeParser() on it at the appropriate moment. -*/ -XMLPARSEAPI(enum XML_Status) -XML_ResumeParser(XML_Parser parser); - -enum XML_Parsing { - XML_INITIALIZED, - XML_PARSING, - XML_FINISHED, - XML_SUSPENDED -}; - -typedef struct { - enum XML_Parsing parsing; - XML_Bool finalBuffer; -} XML_ParsingStatus; - -/* Returns status of parser with respect to being initialized, parsing, - finished, or suspended and processing the final buffer. - XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus, - XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED -*/ -XMLPARSEAPI(void) -XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status); - -/* Creates an XML_Parser object that can parse an external general - entity; context is a '\0'-terminated string specifying the parse - context; encoding is a '\0'-terminated string giving the name of - the externally specified encoding, or NULL if there is no - externally specified encoding. The context string consists of a - sequence of tokens separated by formfeeds (\f); a token consisting - of a name specifies that the general entity of the name is open; a - token of the form prefix=uri specifies the namespace for a - particular prefix; a token of the form =uri specifies the default - namespace. This can be called at any point after the first call to - an ExternalEntityRefHandler so longer as the parser has not yet - been freed. The new parser is completely independent and may - safely be used in a separate thread. The handlers and userData are - initialized from the parser argument. Returns NULL if out of memory. - Otherwise returns a new XML_Parser object. -*/ -XMLPARSEAPI(XML_Parser) -XML_ExternalEntityParserCreate(XML_Parser parser, - const XML_Char *context, - const XML_Char *encoding); - -enum XML_ParamEntityParsing { - XML_PARAM_ENTITY_PARSING_NEVER, - XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, - XML_PARAM_ENTITY_PARSING_ALWAYS -}; - -/* Controls parsing of parameter entities (including the external DTD - subset). If parsing of parameter entities is enabled, then - references to external parameter entities (including the external - DTD subset) will be passed to the handler set with - XML_SetExternalEntityRefHandler. The context passed will be 0. - - Unlike external general entities, external parameter entities can - only be parsed synchronously. If the external parameter entity is - to be parsed, it must be parsed during the call to the external - entity ref handler: the complete sequence of - XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and - XML_ParserFree calls must be made during this call. After - XML_ExternalEntityParserCreate has been called to create the parser - for the external parameter entity (context must be 0 for this - call), it is illegal to make any calls on the old parser until - XML_ParserFree has been called on the newly created parser. - If the library has been compiled without support for parameter - entity parsing (ie without XML_DTD being defined), then - XML_SetParamEntityParsing will return 0 if parsing of parameter - entities is requested; otherwise it will return non-zero. - Note: If XML_SetParamEntityParsing is called after XML_Parse or - XML_ParseBuffer, then it has no effect and will always return 0. -*/ -XMLPARSEAPI(int) -XML_SetParamEntityParsing(XML_Parser parser, - enum XML_ParamEntityParsing parsing); - -/* Sets the hash salt to use for internal hash calculations. - Helps in preventing DoS attacks based on predicting hash - function behavior. This must be called before parsing is started. - Returns 1 if successful, 0 when called after parsing has started. -*/ -XMLPARSEAPI(int) -XML_SetHashSalt(XML_Parser parser, - unsigned long hash_salt); - -/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then - XML_GetErrorCode returns information about the error. -*/ -XMLPARSEAPI(enum XML_Error) -XML_GetErrorCode(XML_Parser parser); - -/* These functions return information about the current parse - location. They may be called from any callback called to report - some parse event; in this case the location is the location of the - first of the sequence of characters that generated the event. When - called from callbacks generated by declarations in the document - prologue, the location identified isn't as neatly defined, but will - be within the relevant markup. When called outside of the callback - functions, the position indicated will be just past the last parse - event (regardless of whether there was an associated callback). - - They may also be called after returning from a call to XML_Parse - or XML_ParseBuffer. If the return value is XML_STATUS_ERROR then - the location is the location of the character at which the error - was detected; otherwise the location is the location of the last - parse event, as described above. -*/ -XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser); -XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser); -XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser); - -/* Return the number of bytes in the current event. - Returns 0 if the event is in an internal entity. -*/ -XMLPARSEAPI(int) -XML_GetCurrentByteCount(XML_Parser parser); - -/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets - the integer pointed to by offset to the offset within this buffer - of the current parse position, and sets the integer pointed to by size - to the size of this buffer (the number of input bytes). Otherwise - returns a NULL pointer. Also returns a NULL pointer if a parse isn't - active. - - NOTE: The character pointer returned should not be used outside - the handler that makes the call. -*/ -XMLPARSEAPI(const char *) -XML_GetInputContext(XML_Parser parser, - int *offset, - int *size); - -/* For backwards compatibility with previous versions. */ -#define XML_GetErrorLineNumber XML_GetCurrentLineNumber -#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber -#define XML_GetErrorByteIndex XML_GetCurrentByteIndex - -/* Frees the content model passed to the element declaration handler */ -XMLPARSEAPI(void) -XML_FreeContentModel(XML_Parser parser, XML_Content *model); - -/* Exposing the memory handling functions used in Expat */ -XMLPARSEAPI(void *) -XML_MemMalloc(XML_Parser parser, size_t size); - -XMLPARSEAPI(void *) -XML_MemRealloc(XML_Parser parser, void *ptr, size_t size); - -XMLPARSEAPI(void) -XML_MemFree(XML_Parser parser, void *ptr); - -/* Frees memory used by the parser. */ -XMLPARSEAPI(void) -XML_ParserFree(XML_Parser parser); - -/* Returns a string describing the error. */ -XMLPARSEAPI(const XML_LChar *) -XML_ErrorString(enum XML_Error code); - -/* Return a string containing the version number of this expat */ -XMLPARSEAPI(const XML_LChar *) -XML_ExpatVersion(void); - -typedef struct { - int major; - int minor; - int micro; -} XML_Expat_Version; - -/* Return an XML_Expat_Version structure containing numeric version - number information for this version of expat. -*/ -XMLPARSEAPI(XML_Expat_Version) -XML_ExpatVersionInfo(void); - -/* Added in Expat 1.95.5. */ -enum XML_FeatureEnum { - XML_FEATURE_END = 0, - XML_FEATURE_UNICODE, - XML_FEATURE_UNICODE_WCHAR_T, - XML_FEATURE_DTD, - XML_FEATURE_CONTEXT_BYTES, - XML_FEATURE_MIN_SIZE, - XML_FEATURE_SIZEOF_XML_CHAR, - XML_FEATURE_SIZEOF_XML_LCHAR, - XML_FEATURE_NS, - XML_FEATURE_LARGE_SIZE, - XML_FEATURE_ATTR_INFO - /* Additional features must be added to the end of this enum. */ -}; - -typedef struct { - enum XML_FeatureEnum feature; - const XML_LChar *name; - long int value; -} XML_Feature; - -XMLPARSEAPI(const XML_Feature *) -XML_GetFeatureList(void); - - -/* Expat follows the GNU/Linux convention of odd number minor version for - beta/development releases and even number minor version for stable - releases. Micro is bumped with each release, and set to 0 with each - change to major or minor version. -*/ -#define XML_MAJOR_VERSION 2 -#define XML_MINOR_VERSION 1 -#define XML_MICRO_VERSION 0 - -#ifdef __cplusplus -} -#endif - -#endif /* not Expat_INCLUDED */ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat_external.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat_external.h deleted file mode 100644 index 2c03284e..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat_external.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef Expat_External_INCLUDED -#define Expat_External_INCLUDED 1 - -/* External API definitions */ - -#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) -#define XML_USE_MSC_EXTENSIONS 1 -#endif - -/* Expat tries very hard to make the API boundary very specifically - defined. There are two macros defined to control this boundary; - each of these can be defined before including this header to - achieve some different behavior, but doing so it not recommended or - tested frequently. - - XMLCALL - The calling convention to use for all calls across the - "library boundary." This will default to cdecl, and - try really hard to tell the compiler that's what we - want. - - XMLIMPORT - Whatever magic is needed to note that a function is - to be imported from a dynamically loaded library - (.dll, .so, or .sl, depending on your platform). - - The XMLCALL macro was added in Expat 1.95.7. The only one which is - expected to be directly useful in client code is XMLCALL. - - Note that on at least some Unix versions, the Expat library must be - compiled with the cdecl calling convention as the default since - system headers may assume the cdecl convention. -*/ -#ifndef XMLCALL -#if defined(_MSC_VER) -#define XMLCALL __cdecl -#elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER) -#define XMLCALL __attribute__((cdecl)) -#else -/* For any platform which uses this definition and supports more than - one calling convention, we need to extend this definition to - declare the convention used on that platform, if it's possible to - do so. - - If this is the case for your platform, please file a bug report - with information on how to identify your platform via the C - pre-processor and how to specify the same calling convention as the - platform's malloc() implementation. -*/ -#define XMLCALL -#endif -#endif /* not defined XMLCALL */ - - -#if !defined(XML_STATIC) && !defined(XMLIMPORT) -#ifndef XML_BUILDING_EXPAT -/* using Expat from an application */ - -#ifdef XML_USE_MSC_EXTENSIONS -#define XMLIMPORT __declspec(dllimport) -#endif - -#endif -#endif /* not defined XML_STATIC */ - - -/* If we didn't define it above, define it away: */ -#ifndef XMLIMPORT -#define XMLIMPORT -#endif - - -#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef XML_UNICODE_WCHAR_T -#define XML_UNICODE -#endif - -#ifdef XML_UNICODE /* Information is UTF-16 encoded. */ -#ifdef XML_UNICODE_WCHAR_T -typedef wchar_t XML_Char; -typedef wchar_t XML_LChar; -#else -typedef unsigned short XML_Char; -typedef char XML_LChar; -#endif /* XML_UNICODE_WCHAR_T */ -#else /* Information is UTF-8 encoded. */ -typedef char XML_Char; -typedef char XML_LChar; -#endif /* XML_UNICODE */ - -#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */ -#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 -typedef __int64 XML_Index; -typedef unsigned __int64 XML_Size; -#else -typedef long long XML_Index; -typedef unsigned long long XML_Size; -#endif -#else -typedef long XML_Index; -typedef unsigned long XML_Size; -#endif /* XML_LARGE_SIZE */ - -#ifdef __cplusplus -} -#endif - -#endif /* not Expat_External_INCLUDED */ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat_static.dsp b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat_static.dsp deleted file mode 100644 index 180f0dc6..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat_static.dsp +++ /dev/null @@ -1,162 +0,0 @@ -# Microsoft Developer Studio Project File - Name="expat_static" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=expat_static - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "expat_static.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "expat_static.mak" CFG="expat_static - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "expat_static - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "expat_static - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "expat_static - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "expat_static___Win32_Release" -# PROP BASE Intermediate_Dir "expat_static___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\win32\bin\Release" -# PROP Intermediate_Dir "..\win32\tmp\Release_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "COMPILED_FROM_DSP" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x1009 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\win32\bin\Release\libexpatMT.lib" - -!ELSEIF "$(CFG)" == "expat_static - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "expat_static___Win32_Debug" -# PROP BASE Intermediate_Dir "expat_static___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\win32\bin\Debug" -# PROP Intermediate_Dir "..\win32\tmp\Debug_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "COMPILED_FROM_DSP" /D "_MBCS" /D "_LIB" /FR /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x1009 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\win32\bin\Debug\libexpatMT.lib" - -!ENDIF - -# Begin Target - -# Name "expat_static - Win32 Release" -# Name "expat_static - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\xmlparse.c -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_ns.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\ascii.h -# End Source File -# Begin Source File - -SOURCE=.\asciitab.h -# End Source File -# Begin Source File - -SOURCE=.\expat.h -# End Source File -# Begin Source File - -SOURCE=.\expat_external.h -# End Source File -# Begin Source File - -SOURCE=.\iasciitab.h -# End Source File -# Begin Source File - -SOURCE=.\internal.h -# End Source File -# Begin Source File - -SOURCE=.\latin1tab.h -# End Source File -# Begin Source File - -SOURCE=.\nametab.h -# End Source File -# Begin Source File - -SOURCE=.\utf8tab.h -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.h -# End Source File -# End Group -# End Target -# End Project diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat_static.sln b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat_static.sln deleted file mode 100644 index 6325342a..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat_static.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "expat", "expat_static.vcproj", "{60AF91BC-74EB-47E7-9C71-646D525591C5}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {60AF91BC-74EB-47E7-9C71-646D525591C5}.Debug|Win32.ActiveCfg = Debug|Win32 - {60AF91BC-74EB-47E7-9C71-646D525591C5}.Debug|Win32.Build.0 = Debug|Win32 - {60AF91BC-74EB-47E7-9C71-646D525591C5}.Debug|x64.ActiveCfg = Debug|x64 - {60AF91BC-74EB-47E7-9C71-646D525591C5}.Debug|x64.Build.0 = Debug|x64 - {60AF91BC-74EB-47E7-9C71-646D525591C5}.Release|Win32.ActiveCfg = Release|Win32 - {60AF91BC-74EB-47E7-9C71-646D525591C5}.Release|Win32.Build.0 = Release|Win32 - {60AF91BC-74EB-47E7-9C71-646D525591C5}.Release|x64.ActiveCfg = Release|x64 - {60AF91BC-74EB-47E7-9C71-646D525591C5}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat_static.vcproj b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat_static.vcproj deleted file mode 100644 index 73b3a757..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expat_static.vcproj +++ /dev/null @@ -1,549 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expatw.dsp b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expatw.dsp deleted file mode 100644 index b91a117c..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expatw.dsp +++ /dev/null @@ -1,185 +0,0 @@ -# Microsoft Developer Studio Project File - Name="expatw" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=expatw - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "expatw.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "expatw.mak" CFG="expatw - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "expatw - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "expatw - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "expatw - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\win32\bin\Release" -# PROP Intermediate_Dir "..\win32\tmp\Release-w" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "COMPILED_FROM_DSP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_UNICODE_WCHAR_T" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /dll /machine:I386 -# ADD LINK32 /nologo /dll /pdb:none /machine:I386 /out:"..\win32\bin\Release\libexpatw.dll" - -!ELSEIF "$(CFG)" == "expatw - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\win32\bin\Debug" -# PROP Intermediate_Dir "..\win32\tmp\Debug-w" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "COMPILED_FROM_DSP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_UNICODE_WCHAR_T" /FR /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /dll /pdb:none /debug /machine:I386 /out:"..\win32\bin\Debug\libexpatw.dll" - -!ENDIF - -# Begin Target - -# Name "expatw - Win32 Release" -# Name "expatw - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\libexpatw.def -# End Source File -# Begin Source File - -SOURCE=.\xmlparse.c - -!IF "$(CFG)" == "expatw - Win32 Release" - -!ELSEIF "$(CFG)" == "expatw - Win32 Debug" - -# ADD CPP /GX- /Od - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_ns.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\ascii.h -# End Source File -# Begin Source File - -SOURCE=.\asciitab.h -# End Source File -# Begin Source File - -SOURCE=.\expat.h -# End Source File -# Begin Source File - -SOURCE=.\expat_external.h -# End Source File -# Begin Source File - -SOURCE=.\iasciitab.h -# End Source File -# Begin Source File - -SOURCE=.\internal.h -# End Source File -# Begin Source File - -SOURCE=.\latin1tab.h -# End Source File -# Begin Source File - -SOURCE=.\nametab.h -# End Source File -# Begin Source File - -SOURCE=.\utf8tab.h -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expatw_static.dsp b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expatw_static.dsp deleted file mode 100644 index d28632cf..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/expatw_static.dsp +++ /dev/null @@ -1,162 +0,0 @@ -# Microsoft Developer Studio Project File - Name="expatw_static" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=expatw_static - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "expatw_static.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "expatw_static.mak" CFG="expatw_static - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "expatw_static - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "expatw_static - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "expatw_static - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "expatw_static___Win32_Release" -# PROP BASE Intermediate_Dir "expatw_static___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\win32\bin\Release" -# PROP Intermediate_Dir "..\win32\tmp\Release-w_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "COMPILED_FROM_DSP" /D "XML_UNICODE_WCHAR_T" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x1009 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\win32\bin\Release\libexpatwMT.lib" - -!ELSEIF "$(CFG)" == "expatw_static - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "expatw_static___Win32_Debug" -# PROP BASE Intermediate_Dir "expatw_static___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\win32\bin\Debug" -# PROP Intermediate_Dir "..\win32\tmp\Debug-w_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_LIB" /D "COMPILED_FROM_DSP" /D "XML_UNICODE_WCHAR_T" /FR /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x1009 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\win32\bin\Debug\libexpatwMT.lib" - -!ENDIF - -# Begin Target - -# Name "expatw_static - Win32 Release" -# Name "expatw_static - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\xmlparse.c -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_ns.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\ascii.h -# End Source File -# Begin Source File - -SOURCE=.\asciitab.h -# End Source File -# Begin Source File - -SOURCE=.\expat.h -# End Source File -# Begin Source File - -SOURCE=.\expat_external.h -# End Source File -# Begin Source File - -SOURCE=.\iasciitab.h -# End Source File -# Begin Source File - -SOURCE=.\internal.h -# End Source File -# Begin Source File - -SOURCE=.\latin1tab.h -# End Source File -# Begin Source File - -SOURCE=.\nametab.h -# End Source File -# Begin Source File - -SOURCE=.\utf8tab.h -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.h -# End Source File -# End Group -# End Target -# End Project diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/iasciitab.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/iasciitab.h deleted file mode 100644 index 24a1d5cc..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/iasciitab.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ -/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, -/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, -/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, -/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, -/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, -/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, -/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, -/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, -/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, -/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, -/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/internal.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/internal.h deleted file mode 100644 index dd545483..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/internal.h +++ /dev/null @@ -1,73 +0,0 @@ -/* internal.h - - Internal definitions used by Expat. This is not needed to compile - client code. - - The following calling convention macros are defined for frequently - called functions: - - FASTCALL - Used for those internal functions that have a simple - body and a low number of arguments and local variables. - - PTRCALL - Used for functions called though function pointers. - - PTRFASTCALL - Like PTRCALL, but for low number of arguments. - - inline - Used for selected internal functions for which inlining - may improve performance on some platforms. - - Note: Use of these macros is based on judgement, not hard rules, - and therefore subject to change. -*/ - -#if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__) -/* We'll use this version by default only where we know it helps. - - regparm() generates warnings on Solaris boxes. See SF bug #692878. - - Instability reported with egcs on a RedHat Linux 7.3. - Let's comment out: - #define FASTCALL __attribute__((stdcall, regparm(3))) - and let's try this: -*/ -#define FASTCALL __attribute__((regparm(3))) -#define PTRFASTCALL __attribute__((regparm(3))) -#endif - -/* Using __fastcall seems to have an unexpected negative effect under - MS VC++, especially for function pointers, so we won't use it for - now on that platform. It may be reconsidered for a future release - if it can be made more effective. - Likely reason: __fastcall on Windows is like stdcall, therefore - the compiler cannot perform stack optimizations for call clusters. -*/ - -/* Make sure all of these are defined if they aren't already. */ - -#ifndef FASTCALL -#define FASTCALL -#endif - -#ifndef PTRCALL -#define PTRCALL -#endif - -#ifndef PTRFASTCALL -#define PTRFASTCALL -#endif - -#ifndef XML_MIN_SIZE -#if !defined(__cplusplus) && !defined(inline) -#ifdef __GNUC__ -#define inline __inline -#endif /* __GNUC__ */ -#endif -#endif /* XML_MIN_SIZE */ - -#ifdef __cplusplus -#define inline inline -#else -#ifndef inline -#define inline -#endif -#endif diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/latin1tab.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/latin1tab.h deleted file mode 100644 index 53c25d76..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/latin1tab.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, -/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, -/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, -/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/libexpat.def b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/libexpat.def deleted file mode 100644 index 3920bbcf..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/libexpat.def +++ /dev/null @@ -1,73 +0,0 @@ -; DEF file for MS VC++ - -LIBRARY -EXPORTS - XML_DefaultCurrent @1 - XML_ErrorString @2 - XML_ExpatVersion @3 - XML_ExpatVersionInfo @4 - XML_ExternalEntityParserCreate @5 - XML_GetBase @6 - XML_GetBuffer @7 - XML_GetCurrentByteCount @8 - XML_GetCurrentByteIndex @9 - XML_GetCurrentColumnNumber @10 - XML_GetCurrentLineNumber @11 - XML_GetErrorCode @12 - XML_GetIdAttributeIndex @13 - XML_GetInputContext @14 - XML_GetSpecifiedAttributeCount @15 - XML_Parse @16 - XML_ParseBuffer @17 - XML_ParserCreate @18 - XML_ParserCreateNS @19 - XML_ParserCreate_MM @20 - XML_ParserFree @21 - XML_SetAttlistDeclHandler @22 - XML_SetBase @23 - XML_SetCdataSectionHandler @24 - XML_SetCharacterDataHandler @25 - XML_SetCommentHandler @26 - XML_SetDefaultHandler @27 - XML_SetDefaultHandlerExpand @28 - XML_SetDoctypeDeclHandler @29 - XML_SetElementDeclHandler @30 - XML_SetElementHandler @31 - XML_SetEncoding @32 - XML_SetEndCdataSectionHandler @33 - XML_SetEndDoctypeDeclHandler @34 - XML_SetEndElementHandler @35 - XML_SetEndNamespaceDeclHandler @36 - XML_SetEntityDeclHandler @37 - XML_SetExternalEntityRefHandler @38 - XML_SetExternalEntityRefHandlerArg @39 - XML_SetNamespaceDeclHandler @40 - XML_SetNotStandaloneHandler @41 - XML_SetNotationDeclHandler @42 - XML_SetParamEntityParsing @43 - XML_SetProcessingInstructionHandler @44 - XML_SetReturnNSTriplet @45 - XML_SetStartCdataSectionHandler @46 - XML_SetStartDoctypeDeclHandler @47 - XML_SetStartElementHandler @48 - XML_SetStartNamespaceDeclHandler @49 - XML_SetUnknownEncodingHandler @50 - XML_SetUnparsedEntityDeclHandler @51 - XML_SetUserData @52 - XML_SetXmlDeclHandler @53 - XML_UseParserAsHandlerArg @54 -; added with version 1.95.3 - XML_ParserReset @55 - XML_SetSkippedEntityHandler @56 -; added with version 1.95.5 - XML_GetFeatureList @57 - XML_UseForeignDTD @58 -; added with version 1.95.6 - XML_FreeContentModel @59 - XML_MemMalloc @60 - XML_MemRealloc @61 - XML_MemFree @62 -; added with version 1.95.8 - XML_StopParser @63 - XML_ResumeParser @64 - XML_GetParsingStatus @65 diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/libexpatw.def b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/libexpatw.def deleted file mode 100644 index 3920bbcf..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/libexpatw.def +++ /dev/null @@ -1,73 +0,0 @@ -; DEF file for MS VC++ - -LIBRARY -EXPORTS - XML_DefaultCurrent @1 - XML_ErrorString @2 - XML_ExpatVersion @3 - XML_ExpatVersionInfo @4 - XML_ExternalEntityParserCreate @5 - XML_GetBase @6 - XML_GetBuffer @7 - XML_GetCurrentByteCount @8 - XML_GetCurrentByteIndex @9 - XML_GetCurrentColumnNumber @10 - XML_GetCurrentLineNumber @11 - XML_GetErrorCode @12 - XML_GetIdAttributeIndex @13 - XML_GetInputContext @14 - XML_GetSpecifiedAttributeCount @15 - XML_Parse @16 - XML_ParseBuffer @17 - XML_ParserCreate @18 - XML_ParserCreateNS @19 - XML_ParserCreate_MM @20 - XML_ParserFree @21 - XML_SetAttlistDeclHandler @22 - XML_SetBase @23 - XML_SetCdataSectionHandler @24 - XML_SetCharacterDataHandler @25 - XML_SetCommentHandler @26 - XML_SetDefaultHandler @27 - XML_SetDefaultHandlerExpand @28 - XML_SetDoctypeDeclHandler @29 - XML_SetElementDeclHandler @30 - XML_SetElementHandler @31 - XML_SetEncoding @32 - XML_SetEndCdataSectionHandler @33 - XML_SetEndDoctypeDeclHandler @34 - XML_SetEndElementHandler @35 - XML_SetEndNamespaceDeclHandler @36 - XML_SetEntityDeclHandler @37 - XML_SetExternalEntityRefHandler @38 - XML_SetExternalEntityRefHandlerArg @39 - XML_SetNamespaceDeclHandler @40 - XML_SetNotStandaloneHandler @41 - XML_SetNotationDeclHandler @42 - XML_SetParamEntityParsing @43 - XML_SetProcessingInstructionHandler @44 - XML_SetReturnNSTriplet @45 - XML_SetStartCdataSectionHandler @46 - XML_SetStartDoctypeDeclHandler @47 - XML_SetStartElementHandler @48 - XML_SetStartNamespaceDeclHandler @49 - XML_SetUnknownEncodingHandler @50 - XML_SetUnparsedEntityDeclHandler @51 - XML_SetUserData @52 - XML_SetXmlDeclHandler @53 - XML_UseParserAsHandlerArg @54 -; added with version 1.95.3 - XML_ParserReset @55 - XML_SetSkippedEntityHandler @56 -; added with version 1.95.5 - XML_GetFeatureList @57 - XML_UseForeignDTD @58 -; added with version 1.95.6 - XML_FreeContentModel @59 - XML_MemMalloc @60 - XML_MemRealloc @61 - XML_MemFree @62 -; added with version 1.95.8 - XML_StopParser @63 - XML_ResumeParser @64 - XML_GetParsingStatus @65 diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/macconfig.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/macconfig.h deleted file mode 100644 index 2725caaf..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/macconfig.h +++ /dev/null @@ -1,53 +0,0 @@ -/*================================================================ -** Copyright 2000, Clark Cooper -** All rights reserved. -** -** This is free software. You are permitted to copy, distribute, or modify -** it under the terms of the MIT/X license (contained in the COPYING file -** with this distribution.) -** -*/ - -#ifndef MACCONFIG_H -#define MACCONFIG_H - - -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -#define BYTEORDER 4321 - -/* Define to 1 if you have the `bcopy' function. */ -#undef HAVE_BCOPY - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE - -/* Define to 1 if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* whether byteorder is bigendian */ -#define WORDS_BIGENDIAN - -/* Define to specify how much context to retain around the current parse - point. */ -#undef XML_CONTEXT_BYTES - -/* Define to make parameter entity parsing functionality available. */ -#define XML_DTD - -/* Define to make XML Namespaces functionality available. */ -#define XML_NS - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `long' if does not define. */ -#define off_t long - -/* Define to `unsigned' if does not define. */ -#undef size_t - - -#endif /* ifndef MACCONFIG_H */ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/nametab.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/nametab.h deleted file mode 100644 index b05e62c7..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/nametab.h +++ /dev/null @@ -1,150 +0,0 @@ -static const unsigned namingBitmap[] = { -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE, -0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF, -0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF, -0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, -0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, -0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, -0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, -0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, -0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, -0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000, -0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060, -0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, -0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003, -0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000, -0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, -0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003, -0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000, -0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, -0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003, -0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000, -0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000, -0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, -0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB, -0x40000000, 0xF580C900, 0x00000007, 0x02010800, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF, -0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF, -0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, -0x00000000, 0x00004C40, 0x00000000, 0x00000000, -0x00000007, 0x00000000, 0x00000000, 0x00000000, -0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, -0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF, -0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000, -0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE, -0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, -0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, -0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, -0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, -0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, -0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, -0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, -0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF, -0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, -0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF, -0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF, -0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, -0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0, -0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1, -0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, -0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80, -0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3, -0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, -0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, -0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000, -0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF, -0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x1FFF0000, 0x00000002, -0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, -0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF, -}; -static const unsigned char nmstrtPages[] = { -0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, -0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, -0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, -0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -static const unsigned char namePages[] = { -0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, -0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, -0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, -0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/utf8tab.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/utf8tab.h deleted file mode 100644 index 7bb3e776..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/utf8tab.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - - -/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4, -/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM, diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/winconfig.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/winconfig.h deleted file mode 100644 index c1b791d6..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/winconfig.h +++ /dev/null @@ -1,30 +0,0 @@ -/*================================================================ -** Copyright 2000, Clark Cooper -** All rights reserved. -** -** This is free software. You are permitted to copy, distribute, or modify -** it under the terms of the MIT/X license (contained in the COPYING file -** with this distribution.) -*/ - -#ifndef WINCONFIG_H -#define WINCONFIG_H - -#define WIN32_LEAN_AND_MEAN -#include -#undef WIN32_LEAN_AND_MEAN - -#include -#include - -#define XML_NS 1 -#define XML_DTD 1 -#define XML_CONTEXT_BYTES 1024 - -/* we will assume all Windows platforms are little endian */ -#define BYTEORDER 1234 - -/* Windows has memmove() available. */ -#define HAVE_MEMMOVE - -#endif /* ndef WINCONFIG_H */ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmlparse.c b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmlparse.c deleted file mode 100644 index f35aa36b..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmlparse.c +++ /dev/null @@ -1,6403 +0,0 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include -#include /* memset(), memcpy() */ -#include -#include /* UINT_MAX */ -#include /* time() */ - -#define XML_BUILDING_EXPAT 1 - -#ifdef COMPILED_FROM_DSP -#include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" -#elif defined(HAVE_EXPAT_CONFIG_H) -#include -#endif /* ndef COMPILED_FROM_DSP */ - -#include "ascii.h" -#include "expat.h" - -#ifdef XML_UNICODE -#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX -#define XmlConvert XmlUtf16Convert -#define XmlGetInternalEncoding XmlGetUtf16InternalEncoding -#define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS -#define XmlEncode XmlUtf16Encode -/* Using pointer subtraction to convert to integer type. */ -#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((char *)(s) - (char *)NULL) & 1)) -typedef unsigned short ICHAR; -#else -#define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX -#define XmlConvert XmlUtf8Convert -#define XmlGetInternalEncoding XmlGetUtf8InternalEncoding -#define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS -#define XmlEncode XmlUtf8Encode -#define MUST_CONVERT(enc, s) (!(enc)->isUtf8) -typedef char ICHAR; -#endif - - -#ifndef XML_NS - -#define XmlInitEncodingNS XmlInitEncoding -#define XmlInitUnknownEncodingNS XmlInitUnknownEncoding -#undef XmlGetInternalEncodingNS -#define XmlGetInternalEncodingNS XmlGetInternalEncoding -#define XmlParseXmlDeclNS XmlParseXmlDecl - -#endif - -#ifdef XML_UNICODE - -#ifdef XML_UNICODE_WCHAR_T -#define XML_T(x) (const wchar_t)x -#define XML_L(x) L ## x -#else -#define XML_T(x) (const unsigned short)x -#define XML_L(x) x -#endif - -#else - -#define XML_T(x) x -#define XML_L(x) x - -#endif - -/* Round up n to be a multiple of sz, where sz is a power of 2. */ -#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) - -/* Handle the case where memmove() doesn't exist. */ -#ifndef HAVE_MEMMOVE -#ifdef HAVE_BCOPY -#define memmove(d,s,l) bcopy((s),(d),(l)) -#else -#error memmove does not exist on this platform, nor is a substitute available -#endif /* HAVE_BCOPY */ -#endif /* HAVE_MEMMOVE */ - -#include "internal.h" -#include "xmltok.h" -#include "xmlrole.h" - -typedef const XML_Char *KEY; - -typedef struct { - KEY name; -} NAMED; - -typedef struct { - NAMED **v; - unsigned char power; - size_t size; - size_t used; - const XML_Memory_Handling_Suite *mem; -} HASH_TABLE; - -/* Basic character hash algorithm, taken from Python's string hash: - h = h * 1000003 ^ character, the constant being a prime number. - -*/ -#ifdef XML_UNICODE -#define CHAR_HASH(h, c) \ - (((h) * 0xF4243) ^ (unsigned short)(c)) -#else -#define CHAR_HASH(h, c) \ - (((h) * 0xF4243) ^ (unsigned char)(c)) -#endif - -/* For probing (after a collision) we need a step size relative prime - to the hash table size, which is a power of 2. We use double-hashing, - since we can calculate a second hash value cheaply by taking those bits - of the first hash value that were discarded (masked out) when the table - index was calculated: index = hash & mask, where mask = table->size - 1. - We limit the maximum step size to table->size / 4 (mask >> 2) and make - it odd, since odd numbers are always relative prime to a power of 2. -*/ -#define SECOND_HASH(hash, mask, power) \ - ((((hash) & ~(mask)) >> ((power) - 1)) & ((mask) >> 2)) -#define PROBE_STEP(hash, mask, power) \ - ((unsigned char)((SECOND_HASH(hash, mask, power)) | 1)) - -typedef struct { - NAMED **p; - NAMED **end; -} HASH_TABLE_ITER; - -#define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */ -#define INIT_DATA_BUF_SIZE 1024 -#define INIT_ATTS_SIZE 16 -#define INIT_ATTS_VERSION 0xFFFFFFFF -#define INIT_BLOCK_SIZE 1024 -#define INIT_BUFFER_SIZE 1024 - -#define EXPAND_SPARE 24 - -typedef struct binding { - struct prefix *prefix; - struct binding *nextTagBinding; - struct binding *prevPrefixBinding; - const struct attribute_id *attId; - XML_Char *uri; - int uriLen; - int uriAlloc; -} BINDING; - -typedef struct prefix { - const XML_Char *name; - BINDING *binding; -} PREFIX; - -typedef struct { - const XML_Char *str; - const XML_Char *localPart; - const XML_Char *prefix; - int strLen; - int uriLen; - int prefixLen; -} TAG_NAME; - -/* TAG represents an open element. - The name of the element is stored in both the document and API - encodings. The memory buffer 'buf' is a separately-allocated - memory area which stores the name. During the XML_Parse()/ - XMLParseBuffer() when the element is open, the memory for the 'raw' - version of the name (in the document encoding) is shared with the - document buffer. If the element is open across calls to - XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to - contain the 'raw' name as well. - - A parser re-uses these structures, maintaining a list of allocated - TAG objects in a free list. -*/ -typedef struct tag { - struct tag *parent; /* parent of this element */ - const char *rawName; /* tagName in the original encoding */ - int rawNameLength; - TAG_NAME name; /* tagName in the API encoding */ - char *buf; /* buffer for name components */ - char *bufEnd; /* end of the buffer */ - BINDING *bindings; -} TAG; - -typedef struct { - const XML_Char *name; - const XML_Char *textPtr; - int textLen; /* length in XML_Chars */ - int processed; /* # of processed bytes - when suspended */ - const XML_Char *systemId; - const XML_Char *base; - const XML_Char *publicId; - const XML_Char *notation; - XML_Bool open; - XML_Bool is_param; - XML_Bool is_internal; /* true if declared in internal subset outside PE */ -} ENTITY; - -typedef struct { - enum XML_Content_Type type; - enum XML_Content_Quant quant; - const XML_Char * name; - int firstchild; - int lastchild; - int childcnt; - int nextsib; -} CONTENT_SCAFFOLD; - -#define INIT_SCAFFOLD_ELEMENTS 32 - -typedef struct block { - struct block *next; - int size; - XML_Char s[1]; -} BLOCK; - -typedef struct { - BLOCK *blocks; - BLOCK *freeBlocks; - const XML_Char *end; - XML_Char *ptr; - XML_Char *start; - const XML_Memory_Handling_Suite *mem; -} STRING_POOL; - -/* The XML_Char before the name is used to determine whether - an attribute has been specified. */ -typedef struct attribute_id { - XML_Char *name; - PREFIX *prefix; - XML_Bool maybeTokenized; - XML_Bool xmlns; -} ATTRIBUTE_ID; - -typedef struct { - const ATTRIBUTE_ID *id; - XML_Bool isCdata; - const XML_Char *value; -} DEFAULT_ATTRIBUTE; - -typedef struct { - unsigned long version; - unsigned long hash; - const XML_Char *uriName; -} NS_ATT; - -typedef struct { - const XML_Char *name; - PREFIX *prefix; - const ATTRIBUTE_ID *idAtt; - int nDefaultAtts; - int allocDefaultAtts; - DEFAULT_ATTRIBUTE *defaultAtts; -} ELEMENT_TYPE; - -typedef struct { - HASH_TABLE generalEntities; - HASH_TABLE elementTypes; - HASH_TABLE attributeIds; - HASH_TABLE prefixes; - STRING_POOL pool; - STRING_POOL entityValuePool; - /* false once a parameter entity reference has been skipped */ - XML_Bool keepProcessing; - /* true once an internal or external PE reference has been encountered; - this includes the reference to an external subset */ - XML_Bool hasParamEntityRefs; - XML_Bool standalone; -#ifdef XML_DTD - /* indicates if external PE has been read */ - XML_Bool paramEntityRead; - HASH_TABLE paramEntities; -#endif /* XML_DTD */ - PREFIX defaultPrefix; - /* === scaffolding for building content model === */ - XML_Bool in_eldecl; - CONTENT_SCAFFOLD *scaffold; - unsigned contentStringLen; - unsigned scaffSize; - unsigned scaffCount; - int scaffLevel; - int *scaffIndex; -} DTD; - -typedef struct open_internal_entity { - const char *internalEventPtr; - const char *internalEventEndPtr; - struct open_internal_entity *next; - ENTITY *entity; - int startTagLevel; - XML_Bool betweenDecl; /* WFC: PE Between Declarations */ -} OPEN_INTERNAL_ENTITY; - -typedef enum XML_Error PTRCALL Processor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr); - -static Processor prologProcessor; -static Processor prologInitProcessor; -static Processor contentProcessor; -static Processor cdataSectionProcessor; -#ifdef XML_DTD -static Processor ignoreSectionProcessor; -static Processor externalParEntProcessor; -static Processor externalParEntInitProcessor; -static Processor entityValueProcessor; -static Processor entityValueInitProcessor; -#endif /* XML_DTD */ -static Processor epilogProcessor; -static Processor errorProcessor; -static Processor externalEntityInitProcessor; -static Processor externalEntityInitProcessor2; -static Processor externalEntityInitProcessor3; -static Processor externalEntityContentProcessor; -static Processor internalEntityProcessor; - -static enum XML_Error -handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName); -static enum XML_Error -processXmlDecl(XML_Parser parser, int isGeneralTextEntity, - const char *s, const char *next); -static enum XML_Error -initializeEncoding(XML_Parser parser); -static enum XML_Error -doProlog(XML_Parser parser, const ENCODING *enc, const char *s, - const char *end, int tok, const char *next, const char **nextPtr, - XML_Bool haveMore); -static enum XML_Error -processInternalEntity(XML_Parser parser, ENTITY *entity, - XML_Bool betweenDecl); -static enum XML_Error -doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc, - const char *start, const char *end, const char **endPtr, - XML_Bool haveMore); -static enum XML_Error -doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, - const char *end, const char **nextPtr, XML_Bool haveMore); -#ifdef XML_DTD -static enum XML_Error -doIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr, - const char *end, const char **nextPtr, XML_Bool haveMore); -#endif /* XML_DTD */ - -static enum XML_Error -storeAtts(XML_Parser parser, const ENCODING *, const char *s, - TAG_NAME *tagNamePtr, BINDING **bindingsPtr); -static enum XML_Error -addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, - const XML_Char *uri, BINDING **bindingsPtr); -static int -defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata, - XML_Bool isId, const XML_Char *dfltValue, XML_Parser parser); -static enum XML_Error -storeAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, - const char *, const char *, STRING_POOL *); -static enum XML_Error -appendAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, - const char *, const char *, STRING_POOL *); -static ATTRIBUTE_ID * -getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); -static int -setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *); -static enum XML_Error -storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); -static int -reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end); -static int -reportComment(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); -static void -reportDefault(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); - -static const XML_Char * getContext(XML_Parser parser); -static XML_Bool -setContext(XML_Parser parser, const XML_Char *context); - -static void FASTCALL normalizePublicId(XML_Char *s); - -static DTD * dtdCreate(const XML_Memory_Handling_Suite *ms); -/* do not call if parentParser != NULL */ -static void dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms); -static void -dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms); -static int -dtdCopy(XML_Parser oldParser, - DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms); -static int -copyEntityTable(XML_Parser oldParser, - HASH_TABLE *, STRING_POOL *, const HASH_TABLE *); -static NAMED * -lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize); -static void FASTCALL -hashTableInit(HASH_TABLE *, const XML_Memory_Handling_Suite *ms); -static void FASTCALL hashTableClear(HASH_TABLE *); -static void FASTCALL hashTableDestroy(HASH_TABLE *); -static void FASTCALL -hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *); -static NAMED * FASTCALL hashTableIterNext(HASH_TABLE_ITER *); - -static void FASTCALL -poolInit(STRING_POOL *, const XML_Memory_Handling_Suite *ms); -static void FASTCALL poolClear(STRING_POOL *); -static void FASTCALL poolDestroy(STRING_POOL *); -static XML_Char * -poolAppend(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end); -static XML_Char * -poolStoreString(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end); -static XML_Bool FASTCALL poolGrow(STRING_POOL *pool); -static const XML_Char * FASTCALL -poolCopyString(STRING_POOL *pool, const XML_Char *s); -static const XML_Char * -poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n); -static const XML_Char * FASTCALL -poolAppendString(STRING_POOL *pool, const XML_Char *s); - -static int FASTCALL nextScaffoldPart(XML_Parser parser); -static XML_Content * build_model(XML_Parser parser); -static ELEMENT_TYPE * -getElementType(XML_Parser parser, const ENCODING *enc, - const char *ptr, const char *end); - -static unsigned long generate_hash_secret_salt(void); -static XML_Bool startParsing(XML_Parser parser); - -static XML_Parser -parserCreate(const XML_Char *encodingName, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *nameSep, - DTD *dtd); - -static void -parserInit(XML_Parser parser, const XML_Char *encodingName); - -#define poolStart(pool) ((pool)->start) -#define poolEnd(pool) ((pool)->ptr) -#define poolLength(pool) ((pool)->ptr - (pool)->start) -#define poolChop(pool) ((void)--(pool->ptr)) -#define poolLastChar(pool) (((pool)->ptr)[-1]) -#define poolDiscard(pool) ((pool)->ptr = (pool)->start) -#define poolFinish(pool) ((pool)->start = (pool)->ptr) -#define poolAppendChar(pool, c) \ - (((pool)->ptr == (pool)->end && !poolGrow(pool)) \ - ? 0 \ - : ((*((pool)->ptr)++ = c), 1)) - -struct XML_ParserStruct { - /* The first member must be userData so that the XML_GetUserData - macro works. */ - void *m_userData; - void *m_handlerArg; - char *m_buffer; - const XML_Memory_Handling_Suite m_mem; - /* first character to be parsed */ - const char *m_bufferPtr; - /* past last character to be parsed */ - char *m_bufferEnd; - /* allocated end of buffer */ - const char *m_bufferLim; - XML_Index m_parseEndByteIndex; - const char *m_parseEndPtr; - XML_Char *m_dataBuf; - XML_Char *m_dataBufEnd; - XML_StartElementHandler m_startElementHandler; - XML_EndElementHandler m_endElementHandler; - XML_CharacterDataHandler m_characterDataHandler; - XML_ProcessingInstructionHandler m_processingInstructionHandler; - XML_CommentHandler m_commentHandler; - XML_StartCdataSectionHandler m_startCdataSectionHandler; - XML_EndCdataSectionHandler m_endCdataSectionHandler; - XML_DefaultHandler m_defaultHandler; - XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler; - XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler; - XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler; - XML_NotationDeclHandler m_notationDeclHandler; - XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler; - XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler; - XML_NotStandaloneHandler m_notStandaloneHandler; - XML_ExternalEntityRefHandler m_externalEntityRefHandler; - XML_Parser m_externalEntityRefHandlerArg; - XML_SkippedEntityHandler m_skippedEntityHandler; - XML_UnknownEncodingHandler m_unknownEncodingHandler; - XML_ElementDeclHandler m_elementDeclHandler; - XML_AttlistDeclHandler m_attlistDeclHandler; - XML_EntityDeclHandler m_entityDeclHandler; - XML_XmlDeclHandler m_xmlDeclHandler; - const ENCODING *m_encoding; - INIT_ENCODING m_initEncoding; - const ENCODING *m_internalEncoding; - const XML_Char *m_protocolEncodingName; - XML_Bool m_ns; - XML_Bool m_ns_triplets; - void *m_unknownEncodingMem; - void *m_unknownEncodingData; - void *m_unknownEncodingHandlerData; - void (XMLCALL *m_unknownEncodingRelease)(void *); - PROLOG_STATE m_prologState; - Processor *m_processor; - enum XML_Error m_errorCode; - const char *m_eventPtr; - const char *m_eventEndPtr; - const char *m_positionPtr; - OPEN_INTERNAL_ENTITY *m_openInternalEntities; - OPEN_INTERNAL_ENTITY *m_freeInternalEntities; - XML_Bool m_defaultExpandInternalEntities; - int m_tagLevel; - ENTITY *m_declEntity; - const XML_Char *m_doctypeName; - const XML_Char *m_doctypeSysid; - const XML_Char *m_doctypePubid; - const XML_Char *m_declAttributeType; - const XML_Char *m_declNotationName; - const XML_Char *m_declNotationPublicId; - ELEMENT_TYPE *m_declElementType; - ATTRIBUTE_ID *m_declAttributeId; - XML_Bool m_declAttributeIsCdata; - XML_Bool m_declAttributeIsId; - DTD *m_dtd; - const XML_Char *m_curBase; - TAG *m_tagStack; - TAG *m_freeTagList; - BINDING *m_inheritedBindings; - BINDING *m_freeBindingList; - int m_attsSize; - int m_nSpecifiedAtts; - int m_idAttIndex; - ATTRIBUTE *m_atts; - NS_ATT *m_nsAtts; - unsigned long m_nsAttsVersion; - unsigned char m_nsAttsPower; -#ifdef XML_ATTR_INFO - XML_AttrInfo *m_attInfo; -#endif - POSITION m_position; - STRING_POOL m_tempPool; - STRING_POOL m_temp2Pool; - char *m_groupConnector; - unsigned int m_groupSize; - XML_Char m_namespaceSeparator; - XML_Parser m_parentParser; - XML_ParsingStatus m_parsingStatus; -#ifdef XML_DTD - XML_Bool m_isParamEntity; - XML_Bool m_useForeignDTD; - enum XML_ParamEntityParsing m_paramEntityParsing; -#endif - unsigned long m_hash_secret_salt; -}; - -#define MALLOC(s) (parser->m_mem.malloc_fcn((s))) -#define REALLOC(p,s) (parser->m_mem.realloc_fcn((p),(s))) -#define FREE(p) (parser->m_mem.free_fcn((p))) - -#define userData (parser->m_userData) -#define handlerArg (parser->m_handlerArg) -#define startElementHandler (parser->m_startElementHandler) -#define endElementHandler (parser->m_endElementHandler) -#define characterDataHandler (parser->m_characterDataHandler) -#define processingInstructionHandler \ - (parser->m_processingInstructionHandler) -#define commentHandler (parser->m_commentHandler) -#define startCdataSectionHandler \ - (parser->m_startCdataSectionHandler) -#define endCdataSectionHandler (parser->m_endCdataSectionHandler) -#define defaultHandler (parser->m_defaultHandler) -#define startDoctypeDeclHandler (parser->m_startDoctypeDeclHandler) -#define endDoctypeDeclHandler (parser->m_endDoctypeDeclHandler) -#define unparsedEntityDeclHandler \ - (parser->m_unparsedEntityDeclHandler) -#define notationDeclHandler (parser->m_notationDeclHandler) -#define startNamespaceDeclHandler \ - (parser->m_startNamespaceDeclHandler) -#define endNamespaceDeclHandler (parser->m_endNamespaceDeclHandler) -#define notStandaloneHandler (parser->m_notStandaloneHandler) -#define externalEntityRefHandler \ - (parser->m_externalEntityRefHandler) -#define externalEntityRefHandlerArg \ - (parser->m_externalEntityRefHandlerArg) -#define internalEntityRefHandler \ - (parser->m_internalEntityRefHandler) -#define skippedEntityHandler (parser->m_skippedEntityHandler) -#define unknownEncodingHandler (parser->m_unknownEncodingHandler) -#define elementDeclHandler (parser->m_elementDeclHandler) -#define attlistDeclHandler (parser->m_attlistDeclHandler) -#define entityDeclHandler (parser->m_entityDeclHandler) -#define xmlDeclHandler (parser->m_xmlDeclHandler) -#define encoding (parser->m_encoding) -#define initEncoding (parser->m_initEncoding) -#define internalEncoding (parser->m_internalEncoding) -#define unknownEncodingMem (parser->m_unknownEncodingMem) -#define unknownEncodingData (parser->m_unknownEncodingData) -#define unknownEncodingHandlerData \ - (parser->m_unknownEncodingHandlerData) -#define unknownEncodingRelease (parser->m_unknownEncodingRelease) -#define protocolEncodingName (parser->m_protocolEncodingName) -#define ns (parser->m_ns) -#define ns_triplets (parser->m_ns_triplets) -#define prologState (parser->m_prologState) -#define processor (parser->m_processor) -#define errorCode (parser->m_errorCode) -#define eventPtr (parser->m_eventPtr) -#define eventEndPtr (parser->m_eventEndPtr) -#define positionPtr (parser->m_positionPtr) -#define position (parser->m_position) -#define openInternalEntities (parser->m_openInternalEntities) -#define freeInternalEntities (parser->m_freeInternalEntities) -#define defaultExpandInternalEntities \ - (parser->m_defaultExpandInternalEntities) -#define tagLevel (parser->m_tagLevel) -#define buffer (parser->m_buffer) -#define bufferPtr (parser->m_bufferPtr) -#define bufferEnd (parser->m_bufferEnd) -#define parseEndByteIndex (parser->m_parseEndByteIndex) -#define parseEndPtr (parser->m_parseEndPtr) -#define bufferLim (parser->m_bufferLim) -#define dataBuf (parser->m_dataBuf) -#define dataBufEnd (parser->m_dataBufEnd) -#define _dtd (parser->m_dtd) -#define curBase (parser->m_curBase) -#define declEntity (parser->m_declEntity) -#define doctypeName (parser->m_doctypeName) -#define doctypeSysid (parser->m_doctypeSysid) -#define doctypePubid (parser->m_doctypePubid) -#define declAttributeType (parser->m_declAttributeType) -#define declNotationName (parser->m_declNotationName) -#define declNotationPublicId (parser->m_declNotationPublicId) -#define declElementType (parser->m_declElementType) -#define declAttributeId (parser->m_declAttributeId) -#define declAttributeIsCdata (parser->m_declAttributeIsCdata) -#define declAttributeIsId (parser->m_declAttributeIsId) -#define freeTagList (parser->m_freeTagList) -#define freeBindingList (parser->m_freeBindingList) -#define inheritedBindings (parser->m_inheritedBindings) -#define tagStack (parser->m_tagStack) -#define atts (parser->m_atts) -#define attsSize (parser->m_attsSize) -#define nSpecifiedAtts (parser->m_nSpecifiedAtts) -#define idAttIndex (parser->m_idAttIndex) -#define nsAtts (parser->m_nsAtts) -#define nsAttsVersion (parser->m_nsAttsVersion) -#define nsAttsPower (parser->m_nsAttsPower) -#define attInfo (parser->m_attInfo) -#define tempPool (parser->m_tempPool) -#define temp2Pool (parser->m_temp2Pool) -#define groupConnector (parser->m_groupConnector) -#define groupSize (parser->m_groupSize) -#define namespaceSeparator (parser->m_namespaceSeparator) -#define parentParser (parser->m_parentParser) -#define ps_parsing (parser->m_parsingStatus.parsing) -#define ps_finalBuffer (parser->m_parsingStatus.finalBuffer) -#ifdef XML_DTD -#define isParamEntity (parser->m_isParamEntity) -#define useForeignDTD (parser->m_useForeignDTD) -#define paramEntityParsing (parser->m_paramEntityParsing) -#endif /* XML_DTD */ -#define hash_secret_salt (parser->m_hash_secret_salt) - -XML_Parser XMLCALL -XML_ParserCreate(const XML_Char *encodingName) -{ - return XML_ParserCreate_MM(encodingName, NULL, NULL); -} - -XML_Parser XMLCALL -XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep) -{ - XML_Char tmp[2]; - *tmp = nsSep; - return XML_ParserCreate_MM(encodingName, NULL, tmp); -} - -static const XML_Char implicitContext[] = { - ASCII_x, ASCII_m, ASCII_l, ASCII_EQUALS, ASCII_h, ASCII_t, ASCII_t, ASCII_p, - ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w, - ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g, - ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, ASCII_SLASH, ASCII_1, ASCII_9, - ASCII_9, ASCII_8, ASCII_SLASH, ASCII_n, ASCII_a, ASCII_m, ASCII_e, - ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e, '\0' -}; - -static unsigned long -generate_hash_secret_salt(void) -{ - unsigned int seed = time(NULL) % UINT_MAX; - srand(seed); - return rand(); -} - -static XML_Bool /* only valid for root parser */ -startParsing(XML_Parser parser) -{ - /* hash functions must be initialized before setContext() is called */ - if (hash_secret_salt == 0) - hash_secret_salt = generate_hash_secret_salt(); - if (ns) { - /* implicit context only set for root parser, since child - parsers (i.e. external entity parsers) will inherit it - */ - return setContext(parser, implicitContext); - } - return XML_TRUE; -} - -XML_Parser XMLCALL -XML_ParserCreate_MM(const XML_Char *encodingName, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *nameSep) -{ - return parserCreate(encodingName, memsuite, nameSep, NULL); -} - -static XML_Parser -parserCreate(const XML_Char *encodingName, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *nameSep, - DTD *dtd) -{ - XML_Parser parser; - - if (memsuite) { - XML_Memory_Handling_Suite *mtemp; - parser = (XML_Parser) - memsuite->malloc_fcn(sizeof(struct XML_ParserStruct)); - if (parser != NULL) { - mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem); - mtemp->malloc_fcn = memsuite->malloc_fcn; - mtemp->realloc_fcn = memsuite->realloc_fcn; - mtemp->free_fcn = memsuite->free_fcn; - } - } - else { - XML_Memory_Handling_Suite *mtemp; - parser = (XML_Parser)malloc(sizeof(struct XML_ParserStruct)); - if (parser != NULL) { - mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem); - mtemp->malloc_fcn = malloc; - mtemp->realloc_fcn = realloc; - mtemp->free_fcn = free; - } - } - - if (!parser) - return parser; - - buffer = NULL; - bufferLim = NULL; - - attsSize = INIT_ATTS_SIZE; - atts = (ATTRIBUTE *)MALLOC(attsSize * sizeof(ATTRIBUTE)); - if (atts == NULL) { - FREE(parser); - return NULL; - } -#ifdef XML_ATTR_INFO - attInfo = (XML_AttrInfo*)MALLOC(attsSize * sizeof(XML_AttrInfo)); - if (attInfo == NULL) { - FREE(atts); - FREE(parser); - return NULL; - } -#endif - dataBuf = (XML_Char *)MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char)); - if (dataBuf == NULL) { - FREE(atts); -#ifdef XML_ATTR_INFO - FREE(attInfo); -#endif - FREE(parser); - return NULL; - } - dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE; - - if (dtd) - _dtd = dtd; - else { - _dtd = dtdCreate(&parser->m_mem); - if (_dtd == NULL) { - FREE(dataBuf); - FREE(atts); -#ifdef XML_ATTR_INFO - FREE(attInfo); -#endif - FREE(parser); - return NULL; - } - } - - freeBindingList = NULL; - freeTagList = NULL; - freeInternalEntities = NULL; - - groupSize = 0; - groupConnector = NULL; - - unknownEncodingHandler = NULL; - unknownEncodingHandlerData = NULL; - - namespaceSeparator = ASCII_EXCL; - ns = XML_FALSE; - ns_triplets = XML_FALSE; - - nsAtts = NULL; - nsAttsVersion = 0; - nsAttsPower = 0; - - poolInit(&tempPool, &(parser->m_mem)); - poolInit(&temp2Pool, &(parser->m_mem)); - parserInit(parser, encodingName); - - if (encodingName && !protocolEncodingName) { - XML_ParserFree(parser); - return NULL; - } - - if (nameSep) { - ns = XML_TRUE; - internalEncoding = XmlGetInternalEncodingNS(); - namespaceSeparator = *nameSep; - } - else { - internalEncoding = XmlGetInternalEncoding(); - } - - return parser; -} - -static void -parserInit(XML_Parser parser, const XML_Char *encodingName) -{ - processor = prologInitProcessor; - XmlPrologStateInit(&prologState); - protocolEncodingName = (encodingName != NULL - ? poolCopyString(&tempPool, encodingName) - : NULL); - curBase = NULL; - XmlInitEncoding(&initEncoding, &encoding, 0); - userData = NULL; - handlerArg = NULL; - startElementHandler = NULL; - endElementHandler = NULL; - characterDataHandler = NULL; - processingInstructionHandler = NULL; - commentHandler = NULL; - startCdataSectionHandler = NULL; - endCdataSectionHandler = NULL; - defaultHandler = NULL; - startDoctypeDeclHandler = NULL; - endDoctypeDeclHandler = NULL; - unparsedEntityDeclHandler = NULL; - notationDeclHandler = NULL; - startNamespaceDeclHandler = NULL; - endNamespaceDeclHandler = NULL; - notStandaloneHandler = NULL; - externalEntityRefHandler = NULL; - externalEntityRefHandlerArg = parser; - skippedEntityHandler = NULL; - elementDeclHandler = NULL; - attlistDeclHandler = NULL; - entityDeclHandler = NULL; - xmlDeclHandler = NULL; - bufferPtr = buffer; - bufferEnd = buffer; - parseEndByteIndex = 0; - parseEndPtr = NULL; - declElementType = NULL; - declAttributeId = NULL; - declEntity = NULL; - doctypeName = NULL; - doctypeSysid = NULL; - doctypePubid = NULL; - declAttributeType = NULL; - declNotationName = NULL; - declNotationPublicId = NULL; - declAttributeIsCdata = XML_FALSE; - declAttributeIsId = XML_FALSE; - memset(&position, 0, sizeof(POSITION)); - errorCode = XML_ERROR_NONE; - eventPtr = NULL; - eventEndPtr = NULL; - positionPtr = NULL; - openInternalEntities = NULL; - defaultExpandInternalEntities = XML_TRUE; - tagLevel = 0; - tagStack = NULL; - inheritedBindings = NULL; - nSpecifiedAtts = 0; - unknownEncodingMem = NULL; - unknownEncodingRelease = NULL; - unknownEncodingData = NULL; - parentParser = NULL; - ps_parsing = XML_INITIALIZED; -#ifdef XML_DTD - isParamEntity = XML_FALSE; - useForeignDTD = XML_FALSE; - paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; -#endif - hash_secret_salt = 0; -} - -/* moves list of bindings to freeBindingList */ -static void FASTCALL -moveToFreeBindingList(XML_Parser parser, BINDING *bindings) -{ - while (bindings) { - BINDING *b = bindings; - bindings = bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - } -} - -XML_Bool XMLCALL -XML_ParserReset(XML_Parser parser, const XML_Char *encodingName) -{ - TAG *tStk; - OPEN_INTERNAL_ENTITY *openEntityList; - if (parentParser) - return XML_FALSE; - /* move tagStack to freeTagList */ - tStk = tagStack; - while (tStk) { - TAG *tag = tStk; - tStk = tStk->parent; - tag->parent = freeTagList; - moveToFreeBindingList(parser, tag->bindings); - tag->bindings = NULL; - freeTagList = tag; - } - /* move openInternalEntities to freeInternalEntities */ - openEntityList = openInternalEntities; - while (openEntityList) { - OPEN_INTERNAL_ENTITY *openEntity = openEntityList; - openEntityList = openEntity->next; - openEntity->next = freeInternalEntities; - freeInternalEntities = openEntity; - } - moveToFreeBindingList(parser, inheritedBindings); - FREE(unknownEncodingMem); - if (unknownEncodingRelease) - unknownEncodingRelease(unknownEncodingData); - poolClear(&tempPool); - poolClear(&temp2Pool); - parserInit(parser, encodingName); - dtdReset(_dtd, &parser->m_mem); - return XML_TRUE; -} - -enum XML_Status XMLCALL -XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) -{ - /* Block after XML_Parse()/XML_ParseBuffer() has been called. - XXX There's no way for the caller to determine which of the - XXX possible error cases caused the XML_STATUS_ERROR return. - */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) - return XML_STATUS_ERROR; - if (encodingName == NULL) - protocolEncodingName = NULL; - else { - protocolEncodingName = poolCopyString(&tempPool, encodingName); - if (!protocolEncodingName) - return XML_STATUS_ERROR; - } - return XML_STATUS_OK; -} - -XML_Parser XMLCALL -XML_ExternalEntityParserCreate(XML_Parser oldParser, - const XML_Char *context, - const XML_Char *encodingName) -{ - XML_Parser parser = oldParser; - DTD *newDtd = NULL; - DTD *oldDtd = _dtd; - XML_StartElementHandler oldStartElementHandler = startElementHandler; - XML_EndElementHandler oldEndElementHandler = endElementHandler; - XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler; - XML_ProcessingInstructionHandler oldProcessingInstructionHandler - = processingInstructionHandler; - XML_CommentHandler oldCommentHandler = commentHandler; - XML_StartCdataSectionHandler oldStartCdataSectionHandler - = startCdataSectionHandler; - XML_EndCdataSectionHandler oldEndCdataSectionHandler - = endCdataSectionHandler; - XML_DefaultHandler oldDefaultHandler = defaultHandler; - XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler - = unparsedEntityDeclHandler; - XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler; - XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler - = startNamespaceDeclHandler; - XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler - = endNamespaceDeclHandler; - XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler; - XML_ExternalEntityRefHandler oldExternalEntityRefHandler - = externalEntityRefHandler; - XML_SkippedEntityHandler oldSkippedEntityHandler = skippedEntityHandler; - XML_UnknownEncodingHandler oldUnknownEncodingHandler - = unknownEncodingHandler; - XML_ElementDeclHandler oldElementDeclHandler = elementDeclHandler; - XML_AttlistDeclHandler oldAttlistDeclHandler = attlistDeclHandler; - XML_EntityDeclHandler oldEntityDeclHandler = entityDeclHandler; - XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler; - ELEMENT_TYPE * oldDeclElementType = declElementType; - - void *oldUserData = userData; - void *oldHandlerArg = handlerArg; - XML_Bool oldDefaultExpandInternalEntities = defaultExpandInternalEntities; - XML_Parser oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg; -#ifdef XML_DTD - enum XML_ParamEntityParsing oldParamEntityParsing = paramEntityParsing; - int oldInEntityValue = prologState.inEntityValue; -#endif - XML_Bool oldns_triplets = ns_triplets; - /* Note that the new parser shares the same hash secret as the old - parser, so that dtdCopy and copyEntityTable can lookup values - from hash tables associated with either parser without us having - to worry which hash secrets each table has. - */ - unsigned long oldhash_secret_salt = hash_secret_salt; - -#ifdef XML_DTD - if (!context) - newDtd = oldDtd; -#endif /* XML_DTD */ - - /* Note that the magical uses of the pre-processor to make field - access look more like C++ require that `parser' be overwritten - here. This makes this function more painful to follow than it - would be otherwise. - */ - if (ns) { - XML_Char tmp[2]; - *tmp = namespaceSeparator; - parser = parserCreate(encodingName, &parser->m_mem, tmp, newDtd); - } - else { - parser = parserCreate(encodingName, &parser->m_mem, NULL, newDtd); - } - - if (!parser) - return NULL; - - startElementHandler = oldStartElementHandler; - endElementHandler = oldEndElementHandler; - characterDataHandler = oldCharacterDataHandler; - processingInstructionHandler = oldProcessingInstructionHandler; - commentHandler = oldCommentHandler; - startCdataSectionHandler = oldStartCdataSectionHandler; - endCdataSectionHandler = oldEndCdataSectionHandler; - defaultHandler = oldDefaultHandler; - unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler; - notationDeclHandler = oldNotationDeclHandler; - startNamespaceDeclHandler = oldStartNamespaceDeclHandler; - endNamespaceDeclHandler = oldEndNamespaceDeclHandler; - notStandaloneHandler = oldNotStandaloneHandler; - externalEntityRefHandler = oldExternalEntityRefHandler; - skippedEntityHandler = oldSkippedEntityHandler; - unknownEncodingHandler = oldUnknownEncodingHandler; - elementDeclHandler = oldElementDeclHandler; - attlistDeclHandler = oldAttlistDeclHandler; - entityDeclHandler = oldEntityDeclHandler; - xmlDeclHandler = oldXmlDeclHandler; - declElementType = oldDeclElementType; - userData = oldUserData; - if (oldUserData == oldHandlerArg) - handlerArg = userData; - else - handlerArg = parser; - if (oldExternalEntityRefHandlerArg != oldParser) - externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg; - defaultExpandInternalEntities = oldDefaultExpandInternalEntities; - ns_triplets = oldns_triplets; - hash_secret_salt = oldhash_secret_salt; - parentParser = oldParser; -#ifdef XML_DTD - paramEntityParsing = oldParamEntityParsing; - prologState.inEntityValue = oldInEntityValue; - if (context) { -#endif /* XML_DTD */ - if (!dtdCopy(oldParser, _dtd, oldDtd, &parser->m_mem) - || !setContext(parser, context)) { - XML_ParserFree(parser); - return NULL; - } - processor = externalEntityInitProcessor; -#ifdef XML_DTD - } - else { - /* The DTD instance referenced by _dtd is shared between the document's - root parser and external PE parsers, therefore one does not need to - call setContext. In addition, one also *must* not call setContext, - because this would overwrite existing prefix->binding pointers in - _dtd with ones that get destroyed with the external PE parser. - This would leave those prefixes with dangling pointers. - */ - isParamEntity = XML_TRUE; - XmlPrologStateInitExternalEntity(&prologState); - processor = externalParEntInitProcessor; - } -#endif /* XML_DTD */ - return parser; -} - -static void FASTCALL -destroyBindings(BINDING *bindings, XML_Parser parser) -{ - for (;;) { - BINDING *b = bindings; - if (!b) - break; - bindings = b->nextTagBinding; - FREE(b->uri); - FREE(b); - } -} - -void XMLCALL -XML_ParserFree(XML_Parser parser) -{ - TAG *tagList; - OPEN_INTERNAL_ENTITY *entityList; - if (parser == NULL) - return; - /* free tagStack and freeTagList */ - tagList = tagStack; - for (;;) { - TAG *p; - if (tagList == NULL) { - if (freeTagList == NULL) - break; - tagList = freeTagList; - freeTagList = NULL; - } - p = tagList; - tagList = tagList->parent; - FREE(p->buf); - destroyBindings(p->bindings, parser); - FREE(p); - } - /* free openInternalEntities and freeInternalEntities */ - entityList = openInternalEntities; - for (;;) { - OPEN_INTERNAL_ENTITY *openEntity; - if (entityList == NULL) { - if (freeInternalEntities == NULL) - break; - entityList = freeInternalEntities; - freeInternalEntities = NULL; - } - openEntity = entityList; - entityList = entityList->next; - FREE(openEntity); - } - - destroyBindings(freeBindingList, parser); - destroyBindings(inheritedBindings, parser); - poolDestroy(&tempPool); - poolDestroy(&temp2Pool); -#ifdef XML_DTD - /* external parameter entity parsers share the DTD structure - parser->m_dtd with the root parser, so we must not destroy it - */ - if (!isParamEntity && _dtd) -#else - if (_dtd) -#endif /* XML_DTD */ - dtdDestroy(_dtd, (XML_Bool)!parentParser, &parser->m_mem); - FREE((void *)atts); -#ifdef XML_ATTR_INFO - FREE((void *)attInfo); -#endif - FREE(groupConnector); - FREE(buffer); - FREE(dataBuf); - FREE(nsAtts); - FREE(unknownEncodingMem); - if (unknownEncodingRelease) - unknownEncodingRelease(unknownEncodingData); - FREE(parser); -} - -void XMLCALL -XML_UseParserAsHandlerArg(XML_Parser parser) -{ - handlerArg = parser; -} - -enum XML_Error XMLCALL -XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) -{ -#ifdef XML_DTD - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) - return XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING; - useForeignDTD = useDTD; - return XML_ERROR_NONE; -#else - return XML_ERROR_FEATURE_REQUIRES_XML_DTD; -#endif -} - -void XMLCALL -XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) -{ - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) - return; - ns_triplets = do_nst ? XML_TRUE : XML_FALSE; -} - -void XMLCALL -XML_SetUserData(XML_Parser parser, void *p) -{ - if (handlerArg == userData) - handlerArg = userData = p; - else - userData = p; -} - -enum XML_Status XMLCALL -XML_SetBase(XML_Parser parser, const XML_Char *p) -{ - if (p) { - p = poolCopyString(&_dtd->pool, p); - if (!p) - return XML_STATUS_ERROR; - curBase = p; - } - else - curBase = NULL; - return XML_STATUS_OK; -} - -const XML_Char * XMLCALL -XML_GetBase(XML_Parser parser) -{ - return curBase; -} - -int XMLCALL -XML_GetSpecifiedAttributeCount(XML_Parser parser) -{ - return nSpecifiedAtts; -} - -int XMLCALL -XML_GetIdAttributeIndex(XML_Parser parser) -{ - return idAttIndex; -} - -#ifdef XML_ATTR_INFO -const XML_AttrInfo * XMLCALL -XML_GetAttributeInfo(XML_Parser parser) -{ - return attInfo; -} -#endif - -void XMLCALL -XML_SetElementHandler(XML_Parser parser, - XML_StartElementHandler start, - XML_EndElementHandler end) -{ - startElementHandler = start; - endElementHandler = end; -} - -void XMLCALL -XML_SetStartElementHandler(XML_Parser parser, - XML_StartElementHandler start) { - startElementHandler = start; -} - -void XMLCALL -XML_SetEndElementHandler(XML_Parser parser, - XML_EndElementHandler end) { - endElementHandler = end; -} - -void XMLCALL -XML_SetCharacterDataHandler(XML_Parser parser, - XML_CharacterDataHandler handler) -{ - characterDataHandler = handler; -} - -void XMLCALL -XML_SetProcessingInstructionHandler(XML_Parser parser, - XML_ProcessingInstructionHandler handler) -{ - processingInstructionHandler = handler; -} - -void XMLCALL -XML_SetCommentHandler(XML_Parser parser, - XML_CommentHandler handler) -{ - commentHandler = handler; -} - -void XMLCALL -XML_SetCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start, - XML_EndCdataSectionHandler end) -{ - startCdataSectionHandler = start; - endCdataSectionHandler = end; -} - -void XMLCALL -XML_SetStartCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start) { - startCdataSectionHandler = start; -} - -void XMLCALL -XML_SetEndCdataSectionHandler(XML_Parser parser, - XML_EndCdataSectionHandler end) { - endCdataSectionHandler = end; -} - -void XMLCALL -XML_SetDefaultHandler(XML_Parser parser, - XML_DefaultHandler handler) -{ - defaultHandler = handler; - defaultExpandInternalEntities = XML_FALSE; -} - -void XMLCALL -XML_SetDefaultHandlerExpand(XML_Parser parser, - XML_DefaultHandler handler) -{ - defaultHandler = handler; - defaultExpandInternalEntities = XML_TRUE; -} - -void XMLCALL -XML_SetDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start, - XML_EndDoctypeDeclHandler end) -{ - startDoctypeDeclHandler = start; - endDoctypeDeclHandler = end; -} - -void XMLCALL -XML_SetStartDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start) { - startDoctypeDeclHandler = start; -} - -void XMLCALL -XML_SetEndDoctypeDeclHandler(XML_Parser parser, - XML_EndDoctypeDeclHandler end) { - endDoctypeDeclHandler = end; -} - -void XMLCALL -XML_SetUnparsedEntityDeclHandler(XML_Parser parser, - XML_UnparsedEntityDeclHandler handler) -{ - unparsedEntityDeclHandler = handler; -} - -void XMLCALL -XML_SetNotationDeclHandler(XML_Parser parser, - XML_NotationDeclHandler handler) -{ - notationDeclHandler = handler; -} - -void XMLCALL -XML_SetNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start, - XML_EndNamespaceDeclHandler end) -{ - startNamespaceDeclHandler = start; - endNamespaceDeclHandler = end; -} - -void XMLCALL -XML_SetStartNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start) { - startNamespaceDeclHandler = start; -} - -void XMLCALL -XML_SetEndNamespaceDeclHandler(XML_Parser parser, - XML_EndNamespaceDeclHandler end) { - endNamespaceDeclHandler = end; -} - -void XMLCALL -XML_SetNotStandaloneHandler(XML_Parser parser, - XML_NotStandaloneHandler handler) -{ - notStandaloneHandler = handler; -} - -void XMLCALL -XML_SetExternalEntityRefHandler(XML_Parser parser, - XML_ExternalEntityRefHandler handler) -{ - externalEntityRefHandler = handler; -} - -void XMLCALL -XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) -{ - if (arg) - externalEntityRefHandlerArg = (XML_Parser)arg; - else - externalEntityRefHandlerArg = parser; -} - -void XMLCALL -XML_SetSkippedEntityHandler(XML_Parser parser, - XML_SkippedEntityHandler handler) -{ - skippedEntityHandler = handler; -} - -void XMLCALL -XML_SetUnknownEncodingHandler(XML_Parser parser, - XML_UnknownEncodingHandler handler, - void *data) -{ - unknownEncodingHandler = handler; - unknownEncodingHandlerData = data; -} - -void XMLCALL -XML_SetElementDeclHandler(XML_Parser parser, - XML_ElementDeclHandler eldecl) -{ - elementDeclHandler = eldecl; -} - -void XMLCALL -XML_SetAttlistDeclHandler(XML_Parser parser, - XML_AttlistDeclHandler attdecl) -{ - attlistDeclHandler = attdecl; -} - -void XMLCALL -XML_SetEntityDeclHandler(XML_Parser parser, - XML_EntityDeclHandler handler) -{ - entityDeclHandler = handler; -} - -void XMLCALL -XML_SetXmlDeclHandler(XML_Parser parser, - XML_XmlDeclHandler handler) { - xmlDeclHandler = handler; -} - -int XMLCALL -XML_SetParamEntityParsing(XML_Parser parser, - enum XML_ParamEntityParsing peParsing) -{ - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) - return 0; -#ifdef XML_DTD - paramEntityParsing = peParsing; - return 1; -#else - return peParsing == XML_PARAM_ENTITY_PARSING_NEVER; -#endif -} - -int XMLCALL -XML_SetHashSalt(XML_Parser parser, - unsigned long hash_salt) -{ - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) - return 0; - hash_secret_salt = hash_salt; - return 1; -} - -enum XML_Status XMLCALL -XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) -{ - switch (ps_parsing) { - case XML_SUSPENDED: - errorCode = XML_ERROR_SUSPENDED; - return XML_STATUS_ERROR; - case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; - return XML_STATUS_ERROR; - case XML_INITIALIZED: - if (parentParser == NULL && !startParsing(parser)) { - errorCode = XML_ERROR_NO_MEMORY; - return XML_STATUS_ERROR; - } - default: - ps_parsing = XML_PARSING; - } - - if (len == 0) { - ps_finalBuffer = (XML_Bool)isFinal; - if (!isFinal) - return XML_STATUS_OK; - positionPtr = bufferPtr; - parseEndPtr = bufferEnd; - - /* If data are left over from last buffer, and we now know that these - data are the final chunk of input, then we have to check them again - to detect errors based on that fact. - */ - errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr); - - if (errorCode == XML_ERROR_NONE) { - switch (ps_parsing) { - case XML_SUSPENDED: - XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); - positionPtr = bufferPtr; - return XML_STATUS_SUSPENDED; - case XML_INITIALIZED: - case XML_PARSING: - ps_parsing = XML_FINISHED; - /* fall through */ - default: - return XML_STATUS_OK; - } - } - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } -#ifndef XML_CONTEXT_BYTES - else if (bufferPtr == bufferEnd) { - const char *end; - int nLeftOver; - enum XML_Error result; - parseEndByteIndex += len; - positionPtr = s; - ps_finalBuffer = (XML_Bool)isFinal; - - errorCode = processor(parser, s, parseEndPtr = s + len, &end); - - if (errorCode != XML_ERROR_NONE) { - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } - else { - switch (ps_parsing) { - case XML_SUSPENDED: - result = XML_STATUS_SUSPENDED; - break; - case XML_INITIALIZED: - case XML_PARSING: - if (isFinal) { - ps_parsing = XML_FINISHED; - return XML_STATUS_OK; - } - /* fall through */ - default: - result = XML_STATUS_OK; - } - } - - XmlUpdatePosition(encoding, positionPtr, end, &position); - nLeftOver = s + len - end; - if (nLeftOver) { - if (buffer == NULL || nLeftOver > bufferLim - buffer) { - /* FIXME avoid integer overflow */ - char *temp; - temp = (buffer == NULL - ? (char *)MALLOC(len * 2) - : (char *)REALLOC(buffer, len * 2)); - if (temp == NULL) { - errorCode = XML_ERROR_NO_MEMORY; - eventPtr = eventEndPtr = NULL; - processor = errorProcessor; - return XML_STATUS_ERROR; - } - buffer = temp; - bufferLim = buffer + len * 2; - } - memcpy(buffer, end, nLeftOver); - } - bufferPtr = buffer; - bufferEnd = buffer + nLeftOver; - positionPtr = bufferPtr; - parseEndPtr = bufferEnd; - eventPtr = bufferPtr; - eventEndPtr = bufferPtr; - return result; - } -#endif /* not defined XML_CONTEXT_BYTES */ - else { - void *buff = XML_GetBuffer(parser, len); - if (buff == NULL) - return XML_STATUS_ERROR; - else { - memcpy(buff, s, len); - return XML_ParseBuffer(parser, len, isFinal); - } - } -} - -enum XML_Status XMLCALL -XML_ParseBuffer(XML_Parser parser, int len, int isFinal) -{ - const char *start; - enum XML_Status result = XML_STATUS_OK; - - switch (ps_parsing) { - case XML_SUSPENDED: - errorCode = XML_ERROR_SUSPENDED; - return XML_STATUS_ERROR; - case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; - return XML_STATUS_ERROR; - case XML_INITIALIZED: - if (parentParser == NULL && !startParsing(parser)) { - errorCode = XML_ERROR_NO_MEMORY; - return XML_STATUS_ERROR; - } - default: - ps_parsing = XML_PARSING; - } - - start = bufferPtr; - positionPtr = start; - bufferEnd += len; - parseEndPtr = bufferEnd; - parseEndByteIndex += len; - ps_finalBuffer = (XML_Bool)isFinal; - - errorCode = processor(parser, start, parseEndPtr, &bufferPtr); - - if (errorCode != XML_ERROR_NONE) { - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } - else { - switch (ps_parsing) { - case XML_SUSPENDED: - result = XML_STATUS_SUSPENDED; - break; - case XML_INITIALIZED: - case XML_PARSING: - if (isFinal) { - ps_parsing = XML_FINISHED; - return result; - } - default: ; /* should not happen */ - } - } - - XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); - positionPtr = bufferPtr; - return result; -} - -void * XMLCALL -XML_GetBuffer(XML_Parser parser, int len) -{ - switch (ps_parsing) { - case XML_SUSPENDED: - errorCode = XML_ERROR_SUSPENDED; - return NULL; - case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; - return NULL; - default: ; - } - - if (len > bufferLim - bufferEnd) { - /* FIXME avoid integer overflow */ - int neededSize = len + (int)(bufferEnd - bufferPtr); -#ifdef XML_CONTEXT_BYTES - int keep = (int)(bufferPtr - buffer); - - if (keep > XML_CONTEXT_BYTES) - keep = XML_CONTEXT_BYTES; - neededSize += keep; -#endif /* defined XML_CONTEXT_BYTES */ - if (neededSize <= bufferLim - buffer) { -#ifdef XML_CONTEXT_BYTES - if (keep < bufferPtr - buffer) { - int offset = (int)(bufferPtr - buffer) - keep; - memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep); - bufferEnd -= offset; - bufferPtr -= offset; - } -#else - memmove(buffer, bufferPtr, bufferEnd - bufferPtr); - bufferEnd = buffer + (bufferEnd - bufferPtr); - bufferPtr = buffer; -#endif /* not defined XML_CONTEXT_BYTES */ - } - else { - char *newBuf; - int bufferSize = (int)(bufferLim - bufferPtr); - if (bufferSize == 0) - bufferSize = INIT_BUFFER_SIZE; - do { - bufferSize *= 2; - } while (bufferSize < neededSize); - newBuf = (char *)MALLOC(bufferSize); - if (newBuf == 0) { - errorCode = XML_ERROR_NO_MEMORY; - return NULL; - } - bufferLim = newBuf + bufferSize; -#ifdef XML_CONTEXT_BYTES - if (bufferPtr) { - int keep = (int)(bufferPtr - buffer); - if (keep > XML_CONTEXT_BYTES) - keep = XML_CONTEXT_BYTES; - memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep); - FREE(buffer); - buffer = newBuf; - bufferEnd = buffer + (bufferEnd - bufferPtr) + keep; - bufferPtr = buffer + keep; - } - else { - bufferEnd = newBuf + (bufferEnd - bufferPtr); - bufferPtr = buffer = newBuf; - } -#else - if (bufferPtr) { - memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr); - FREE(buffer); - } - bufferEnd = newBuf + (bufferEnd - bufferPtr); - bufferPtr = buffer = newBuf; -#endif /* not defined XML_CONTEXT_BYTES */ - } - eventPtr = eventEndPtr = NULL; - positionPtr = NULL; - } - return bufferEnd; -} - -enum XML_Status XMLCALL -XML_StopParser(XML_Parser parser, XML_Bool resumable) -{ - switch (ps_parsing) { - case XML_SUSPENDED: - if (resumable) { - errorCode = XML_ERROR_SUSPENDED; - return XML_STATUS_ERROR; - } - ps_parsing = XML_FINISHED; - break; - case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; - return XML_STATUS_ERROR; - default: - if (resumable) { -#ifdef XML_DTD - if (isParamEntity) { - errorCode = XML_ERROR_SUSPEND_PE; - return XML_STATUS_ERROR; - } -#endif - ps_parsing = XML_SUSPENDED; - } - else - ps_parsing = XML_FINISHED; - } - return XML_STATUS_OK; -} - -enum XML_Status XMLCALL -XML_ResumeParser(XML_Parser parser) -{ - enum XML_Status result = XML_STATUS_OK; - - if (ps_parsing != XML_SUSPENDED) { - errorCode = XML_ERROR_NOT_SUSPENDED; - return XML_STATUS_ERROR; - } - ps_parsing = XML_PARSING; - - errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr); - - if (errorCode != XML_ERROR_NONE) { - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } - else { - switch (ps_parsing) { - case XML_SUSPENDED: - result = XML_STATUS_SUSPENDED; - break; - case XML_INITIALIZED: - case XML_PARSING: - if (ps_finalBuffer) { - ps_parsing = XML_FINISHED; - return result; - } - default: ; - } - } - - XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); - positionPtr = bufferPtr; - return result; -} - -void XMLCALL -XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status) -{ - assert(status != NULL); - *status = parser->m_parsingStatus; -} - -enum XML_Error XMLCALL -XML_GetErrorCode(XML_Parser parser) -{ - return errorCode; -} - -XML_Index XMLCALL -XML_GetCurrentByteIndex(XML_Parser parser) -{ - if (eventPtr) - return parseEndByteIndex - (parseEndPtr - eventPtr); - return -1; -} - -int XMLCALL -XML_GetCurrentByteCount(XML_Parser parser) -{ - if (eventEndPtr && eventPtr) - return (int)(eventEndPtr - eventPtr); - return 0; -} - -const char * XMLCALL -XML_GetInputContext(XML_Parser parser, int *offset, int *size) -{ -#ifdef XML_CONTEXT_BYTES - if (eventPtr && buffer) { - *offset = (int)(eventPtr - buffer); - *size = (int)(bufferEnd - buffer); - return buffer; - } -#endif /* defined XML_CONTEXT_BYTES */ - return (char *) 0; -} - -XML_Size XMLCALL -XML_GetCurrentLineNumber(XML_Parser parser) -{ - if (eventPtr && eventPtr >= positionPtr) { - XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); - positionPtr = eventPtr; - } - return position.lineNumber + 1; -} - -XML_Size XMLCALL -XML_GetCurrentColumnNumber(XML_Parser parser) -{ - if (eventPtr && eventPtr >= positionPtr) { - XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); - positionPtr = eventPtr; - } - return position.columnNumber; -} - -void XMLCALL -XML_FreeContentModel(XML_Parser parser, XML_Content *model) -{ - FREE(model); -} - -void * XMLCALL -XML_MemMalloc(XML_Parser parser, size_t size) -{ - return MALLOC(size); -} - -void * XMLCALL -XML_MemRealloc(XML_Parser parser, void *ptr, size_t size) -{ - return REALLOC(ptr, size); -} - -void XMLCALL -XML_MemFree(XML_Parser parser, void *ptr) -{ - FREE(ptr); -} - -void XMLCALL -XML_DefaultCurrent(XML_Parser parser) -{ - if (defaultHandler) { - if (openInternalEntities) - reportDefault(parser, - internalEncoding, - openInternalEntities->internalEventPtr, - openInternalEntities->internalEventEndPtr); - else - reportDefault(parser, encoding, eventPtr, eventEndPtr); - } -} - -const XML_LChar * XMLCALL -XML_ErrorString(enum XML_Error code) -{ - static const XML_LChar* const message[] = { - 0, - XML_L("out of memory"), - XML_L("syntax error"), - XML_L("no element found"), - XML_L("not well-formed (invalid token)"), - XML_L("unclosed token"), - XML_L("partial character"), - XML_L("mismatched tag"), - XML_L("duplicate attribute"), - XML_L("junk after document element"), - XML_L("illegal parameter entity reference"), - XML_L("undefined entity"), - XML_L("recursive entity reference"), - XML_L("asynchronous entity"), - XML_L("reference to invalid character number"), - XML_L("reference to binary entity"), - XML_L("reference to external entity in attribute"), - XML_L("XML or text declaration not at start of entity"), - XML_L("unknown encoding"), - XML_L("encoding specified in XML declaration is incorrect"), - XML_L("unclosed CDATA section"), - XML_L("error in processing external entity reference"), - XML_L("document is not standalone"), - XML_L("unexpected parser state - please send a bug report"), - XML_L("entity declared in parameter entity"), - XML_L("requested feature requires XML_DTD support in Expat"), - XML_L("cannot change setting once parsing has begun"), - XML_L("unbound prefix"), - XML_L("must not undeclare prefix"), - XML_L("incomplete markup in parameter entity"), - XML_L("XML declaration not well-formed"), - XML_L("text declaration not well-formed"), - XML_L("illegal character(s) in public id"), - XML_L("parser suspended"), - XML_L("parser not suspended"), - XML_L("parsing aborted"), - XML_L("parsing finished"), - XML_L("cannot suspend in external parameter entity"), - XML_L("reserved prefix (xml) must not be undeclared or bound to another namespace name"), - XML_L("reserved prefix (xmlns) must not be declared or undeclared"), - XML_L("prefix must not be bound to one of the reserved namespace names") - }; - if (code > 0 && code < sizeof(message)/sizeof(message[0])) - return message[code]; - return NULL; -} - -const XML_LChar * XMLCALL -XML_ExpatVersion(void) { - - /* V1 is used to string-ize the version number. However, it would - string-ize the actual version macro *names* unless we get them - substituted before being passed to V1. CPP is defined to expand - a macro, then rescan for more expansions. Thus, we use V2 to expand - the version macros, then CPP will expand the resulting V1() macro - with the correct numerals. */ - /* ### I'm assuming cpp is portable in this respect... */ - -#define V1(a,b,c) XML_L(#a)XML_L(".")XML_L(#b)XML_L(".")XML_L(#c) -#define V2(a,b,c) XML_L("expat_")V1(a,b,c) - - return V2(XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION); - -#undef V1 -#undef V2 -} - -XML_Expat_Version XMLCALL -XML_ExpatVersionInfo(void) -{ - XML_Expat_Version version; - - version.major = XML_MAJOR_VERSION; - version.minor = XML_MINOR_VERSION; - version.micro = XML_MICRO_VERSION; - - return version; -} - -const XML_Feature * XMLCALL -XML_GetFeatureList(void) -{ - static const XML_Feature features[] = { - {XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)"), - sizeof(XML_Char)}, - {XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)"), - sizeof(XML_LChar)}, -#ifdef XML_UNICODE - {XML_FEATURE_UNICODE, XML_L("XML_UNICODE"), 0}, -#endif -#ifdef XML_UNICODE_WCHAR_T - {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T"), 0}, -#endif -#ifdef XML_DTD - {XML_FEATURE_DTD, XML_L("XML_DTD"), 0}, -#endif -#ifdef XML_CONTEXT_BYTES - {XML_FEATURE_CONTEXT_BYTES, XML_L("XML_CONTEXT_BYTES"), - XML_CONTEXT_BYTES}, -#endif -#ifdef XML_MIN_SIZE - {XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE"), 0}, -#endif -#ifdef XML_NS - {XML_FEATURE_NS, XML_L("XML_NS"), 0}, -#endif -#ifdef XML_LARGE_SIZE - {XML_FEATURE_LARGE_SIZE, XML_L("XML_LARGE_SIZE"), 0}, -#endif -#ifdef XML_ATTR_INFO - {XML_FEATURE_ATTR_INFO, XML_L("XML_ATTR_INFO"), 0}, -#endif - {XML_FEATURE_END, NULL, 0} - }; - - return features; -} - -/* Initially tag->rawName always points into the parse buffer; - for those TAG instances opened while the current parse buffer was - processed, and not yet closed, we need to store tag->rawName in a more - permanent location, since the parse buffer is about to be discarded. -*/ -static XML_Bool -storeRawNames(XML_Parser parser) -{ - TAG *tag = tagStack; - while (tag) { - int bufSize; - int nameLen = sizeof(XML_Char) * (tag->name.strLen + 1); - char *rawNameBuf = tag->buf + nameLen; - /* Stop if already stored. Since tagStack is a stack, we can stop - at the first entry that has already been copied; everything - below it in the stack is already been accounted for in a - previous call to this function. - */ - if (tag->rawName == rawNameBuf) - break; - /* For re-use purposes we need to ensure that the - size of tag->buf is a multiple of sizeof(XML_Char). - */ - bufSize = nameLen + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)); - if (bufSize > tag->bufEnd - tag->buf) { - char *temp = (char *)REALLOC(tag->buf, bufSize); - if (temp == NULL) - return XML_FALSE; - /* if tag->name.str points to tag->buf (only when namespace - processing is off) then we have to update it - */ - if (tag->name.str == (XML_Char *)tag->buf) - tag->name.str = (XML_Char *)temp; - /* if tag->name.localPart is set (when namespace processing is on) - then update it as well, since it will always point into tag->buf - */ - if (tag->name.localPart) - tag->name.localPart = (XML_Char *)temp + (tag->name.localPart - - (XML_Char *)tag->buf); - tag->buf = temp; - tag->bufEnd = temp + bufSize; - rawNameBuf = temp + nameLen; - } - memcpy(rawNameBuf, tag->rawName, tag->rawNameLength); - tag->rawName = rawNameBuf; - tag = tag->parent; - } - return XML_TRUE; -} - -static enum XML_Error PTRCALL -contentProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doContent(parser, 0, encoding, start, end, - endPtr, (XML_Bool)!ps_finalBuffer); - if (result == XML_ERROR_NONE) { - if (!storeRawNames(parser)) - return XML_ERROR_NO_MEMORY; - } - return result; -} - -static enum XML_Error PTRCALL -externalEntityInitProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = initializeEncoding(parser); - if (result != XML_ERROR_NONE) - return result; - processor = externalEntityInitProcessor2; - return externalEntityInitProcessor2(parser, start, end, endPtr); -} - -static enum XML_Error PTRCALL -externalEntityInitProcessor2(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - const char *next = start; /* XmlContentTok doesn't always set the last arg */ - int tok = XmlContentTok(encoding, start, end, &next); - switch (tok) { - case XML_TOK_BOM: - /* If we are at the end of the buffer, this would cause the next stage, - i.e. externalEntityInitProcessor3, to pass control directly to - doContent (by detecting XML_TOK_NONE) without processing any xml text - declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent. - */ - if (next == end && !ps_finalBuffer) { - *endPtr = next; - return XML_ERROR_NONE; - } - start = next; - break; - case XML_TOK_PARTIAL: - if (!ps_finalBuffer) { - *endPtr = start; - return XML_ERROR_NONE; - } - eventPtr = start; - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (!ps_finalBuffer) { - *endPtr = start; - return XML_ERROR_NONE; - } - eventPtr = start; - return XML_ERROR_PARTIAL_CHAR; - } - processor = externalEntityInitProcessor3; - return externalEntityInitProcessor3(parser, start, end, endPtr); -} - -static enum XML_Error PTRCALL -externalEntityInitProcessor3(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - int tok; - const char *next = start; /* XmlContentTok doesn't always set the last arg */ - eventPtr = start; - tok = XmlContentTok(encoding, start, end, &next); - eventEndPtr = next; - - switch (tok) { - case XML_TOK_XML_DECL: - { - enum XML_Error result; - result = processXmlDecl(parser, 1, start, next); - if (result != XML_ERROR_NONE) - return result; - switch (ps_parsing) { - case XML_SUSPENDED: - *endPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: - start = next; - } - } - break; - case XML_TOK_PARTIAL: - if (!ps_finalBuffer) { - *endPtr = start; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (!ps_finalBuffer) { - *endPtr = start; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - } - processor = externalEntityContentProcessor; - tagLevel = 1; - return externalEntityContentProcessor(parser, start, end, endPtr); -} - -static enum XML_Error PTRCALL -externalEntityContentProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doContent(parser, 1, encoding, start, end, - endPtr, (XML_Bool)!ps_finalBuffer); - if (result == XML_ERROR_NONE) { - if (!storeRawNames(parser)) - return XML_ERROR_NO_MEMORY; - } - return result; -} - -static enum XML_Error -doContent(XML_Parser parser, - int startTagLevel, - const ENCODING *enc, - const char *s, - const char *end, - const char **nextPtr, - XML_Bool haveMore) -{ - /* save one level of indirection */ - DTD * const dtd = _dtd; - - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - *eventPP = s; - - for (;;) { - const char *next = s; /* XmlContentTok doesn't always set the last arg */ - int tok = XmlContentTok(enc, s, end, &next); - *eventEndPP = next; - switch (tok) { - case XML_TOK_TRAILING_CR: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - *eventEndPP = end; - if (characterDataHandler) { - XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) - reportDefault(parser, enc, s, end); - /* We are at the end of the final buffer, should we check for - XML_SUSPENDED, XML_FINISHED? - */ - if (startTagLevel == 0) - return XML_ERROR_NO_ELEMENTS; - if (tagLevel != startTagLevel) - return XML_ERROR_ASYNC_ENTITY; - *nextPtr = end; - return XML_ERROR_NONE; - case XML_TOK_NONE: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - if (startTagLevel > 0) { - if (tagLevel != startTagLevel) - return XML_ERROR_ASYNC_ENTITY; - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_NO_ELEMENTS; - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_ENTITY_REF: - { - const XML_Char *name; - ENTITY *entity; - XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (ch) { - if (characterDataHandler) - characterDataHandler(handlerArg, &ch, 1); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - name = poolStoreString(&dtd->pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0); - poolDiscard(&dtd->pool); - /* First, determine if a check for an existing declaration is needed; - if yes, check that the entity exists, and that it is internal, - otherwise call the skipped entity or default handler. - */ - if (!dtd->hasParamEntityRefs || dtd->standalone) { - if (!entity) - return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; - } - else if (!entity) { - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, name, 0); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - if (entity->open) - return XML_ERROR_RECURSIVE_ENTITY_REF; - if (entity->notation) - return XML_ERROR_BINARY_ENTITY_REF; - if (entity->textPtr) { - enum XML_Error result; - if (!defaultExpandInternalEntities) { - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, entity->name, 0); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - result = processInternalEntity(parser, entity, XML_FALSE); - if (result != XML_ERROR_NONE) - return result; - } - else if (externalEntityRefHandler) { - const XML_Char *context; - entity->open = XML_TRUE; - context = getContext(parser); - entity->open = XML_FALSE; - if (!context) - return XML_ERROR_NO_MEMORY; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - context, - entity->base, - entity->systemId, - entity->publicId)) - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - poolDiscard(&tempPool); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - case XML_TOK_START_TAG_NO_ATTS: - /* fall through */ - case XML_TOK_START_TAG_WITH_ATTS: - { - TAG *tag; - enum XML_Error result; - XML_Char *toPtr; - if (freeTagList) { - tag = freeTagList; - freeTagList = freeTagList->parent; - } - else { - tag = (TAG *)MALLOC(sizeof(TAG)); - if (!tag) - return XML_ERROR_NO_MEMORY; - tag->buf = (char *)MALLOC(INIT_TAG_BUF_SIZE); - if (!tag->buf) { - FREE(tag); - return XML_ERROR_NO_MEMORY; - } - tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE; - } - tag->bindings = NULL; - tag->parent = tagStack; - tagStack = tag; - tag->name.localPart = NULL; - tag->name.prefix = NULL; - tag->rawName = s + enc->minBytesPerChar; - tag->rawNameLength = XmlNameLength(enc, tag->rawName); - ++tagLevel; - { - const char *rawNameEnd = tag->rawName + tag->rawNameLength; - const char *fromPtr = tag->rawName; - toPtr = (XML_Char *)tag->buf; - for (;;) { - int bufSize; - int convLen; - XmlConvert(enc, - &fromPtr, rawNameEnd, - (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1); - convLen = (int)(toPtr - (XML_Char *)tag->buf); - if (fromPtr == rawNameEnd) { - tag->name.strLen = convLen; - break; - } - bufSize = (int)(tag->bufEnd - tag->buf) << 1; - { - char *temp = (char *)REALLOC(tag->buf, bufSize); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - tag->buf = temp; - tag->bufEnd = temp + bufSize; - toPtr = (XML_Char *)temp + convLen; - } - } - } - tag->name.str = (XML_Char *)tag->buf; - *toPtr = XML_T('\0'); - result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings)); - if (result) - return result; - if (startElementHandler) - startElementHandler(handlerArg, tag->name.str, - (const XML_Char **)atts); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - poolClear(&tempPool); - break; - } - case XML_TOK_EMPTY_ELEMENT_NO_ATTS: - /* fall through */ - case XML_TOK_EMPTY_ELEMENT_WITH_ATTS: - { - const char *rawName = s + enc->minBytesPerChar; - enum XML_Error result; - BINDING *bindings = NULL; - XML_Bool noElmHandlers = XML_TRUE; - TAG_NAME name; - name.str = poolStoreString(&tempPool, enc, rawName, - rawName + XmlNameLength(enc, rawName)); - if (!name.str) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - result = storeAtts(parser, enc, s, &name, &bindings); - if (result) - return result; - poolFinish(&tempPool); - if (startElementHandler) { - startElementHandler(handlerArg, name.str, (const XML_Char **)atts); - noElmHandlers = XML_FALSE; - } - if (endElementHandler) { - if (startElementHandler) - *eventPP = *eventEndPP; - endElementHandler(handlerArg, name.str); - noElmHandlers = XML_FALSE; - } - if (noElmHandlers && defaultHandler) - reportDefault(parser, enc, s, next); - poolClear(&tempPool); - while (bindings) { - BINDING *b = bindings; - if (endNamespaceDeclHandler) - endNamespaceDeclHandler(handlerArg, b->prefix->name); - bindings = bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - b->prefix->binding = b->prevPrefixBinding; - } - } - if (tagLevel == 0) - return epilogProcessor(parser, next, end, nextPtr); - break; - case XML_TOK_END_TAG: - if (tagLevel == startTagLevel) - return XML_ERROR_ASYNC_ENTITY; - else { - int len; - const char *rawName; - TAG *tag = tagStack; - tagStack = tag->parent; - tag->parent = freeTagList; - freeTagList = tag; - rawName = s + enc->minBytesPerChar*2; - len = XmlNameLength(enc, rawName); - if (len != tag->rawNameLength - || memcmp(tag->rawName, rawName, len) != 0) { - *eventPP = rawName; - return XML_ERROR_TAG_MISMATCH; - } - --tagLevel; - if (endElementHandler) { - const XML_Char *localPart; - const XML_Char *prefix; - XML_Char *uri; - localPart = tag->name.localPart; - if (ns && localPart) { - /* localPart and prefix may have been overwritten in - tag->name.str, since this points to the binding->uri - buffer which gets re-used; so we have to add them again - */ - uri = (XML_Char *)tag->name.str + tag->name.uriLen; - /* don't need to check for space - already done in storeAtts() */ - while (*localPart) *uri++ = *localPart++; - prefix = (XML_Char *)tag->name.prefix; - if (ns_triplets && prefix) { - *uri++ = namespaceSeparator; - while (*prefix) *uri++ = *prefix++; - } - *uri = XML_T('\0'); - } - endElementHandler(handlerArg, tag->name.str); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - while (tag->bindings) { - BINDING *b = tag->bindings; - if (endNamespaceDeclHandler) - endNamespaceDeclHandler(handlerArg, b->prefix->name); - tag->bindings = tag->bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - b->prefix->binding = b->prevPrefixBinding; - } - if (tagLevel == 0) - return epilogProcessor(parser, next, end, nextPtr); - } - break; - case XML_TOK_CHAR_REF: - { - int n = XmlCharRefNumber(enc, s); - if (n < 0) - return XML_ERROR_BAD_CHAR_REF; - if (characterDataHandler) { - XML_Char buf[XML_ENCODE_MAX]; - characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - } - break; - case XML_TOK_XML_DECL: - return XML_ERROR_MISPLACED_XML_PI; - case XML_TOK_DATA_NEWLINE: - if (characterDataHandler) { - XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - case XML_TOK_CDATA_SECT_OPEN: - { - enum XML_Error result; - if (startCdataSectionHandler) - startCdataSectionHandler(handlerArg); -#if 0 - /* Suppose you doing a transformation on a document that involves - changing only the character data. You set up a defaultHandler - and a characterDataHandler. The defaultHandler simply copies - characters through. The characterDataHandler does the - transformation and writes the characters out escaping them as - necessary. This case will fail to work if we leave out the - following two lines (because & and < inside CDATA sections will - be incorrectly escaped). - - However, now we have a start/endCdataSectionHandler, so it seems - easier to let the user deal with this. - */ - else if (characterDataHandler) - characterDataHandler(handlerArg, dataBuf, 0); -#endif - else if (defaultHandler) - reportDefault(parser, enc, s, next); - result = doCdataSection(parser, enc, &next, end, nextPtr, haveMore); - if (result != XML_ERROR_NONE) - return result; - else if (!next) { - processor = cdataSectionProcessor; - return result; - } - } - break; - case XML_TOK_TRAILING_RSQB: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - if (characterDataHandler) { - if (MUST_CONVERT(enc, s)) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); - characterDataHandler(handlerArg, dataBuf, - (int)(dataPtr - (ICHAR *)dataBuf)); - } - else - characterDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)end - (XML_Char *)s)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, end); - /* We are at the end of the final buffer, should we check for - XML_SUSPENDED, XML_FINISHED? - */ - if (startTagLevel == 0) { - *eventPP = end; - return XML_ERROR_NO_ELEMENTS; - } - if (tagLevel != startTagLevel) { - *eventPP = end; - return XML_ERROR_ASYNC_ENTITY; - } - *nextPtr = end; - return XML_ERROR_NONE; - case XML_TOK_DATA_CHARS: - { - XML_CharacterDataHandler charDataHandler = characterDataHandler; - if (charDataHandler) { - if (MUST_CONVERT(enc, s)) { - for (;;) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = s; - charDataHandler(handlerArg, dataBuf, - (int)(dataPtr - (ICHAR *)dataBuf)); - if (s == next) - break; - *eventPP = s; - } - } - else - charDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)next - (XML_Char *)s)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - } - break; - case XML_TOK_PI: - if (!reportProcessingInstruction(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_COMMENT: - if (!reportComment(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - break; - default: - if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - *eventPP = s = next; - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: ; - } - } - /* not reached */ -} - -/* Precondition: all arguments must be non-NULL; - Purpose: - - normalize attributes - - check attributes for well-formedness - - generate namespace aware attribute names (URI, prefix) - - build list of attributes for startElementHandler - - default attributes - - process namespace declarations (check and report them) - - generate namespace aware element name (URI, prefix) -*/ -static enum XML_Error -storeAtts(XML_Parser parser, const ENCODING *enc, - const char *attStr, TAG_NAME *tagNamePtr, - BINDING **bindingsPtr) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - ELEMENT_TYPE *elementType; - int nDefaultAtts; - const XML_Char **appAtts; /* the attribute list for the application */ - int attIndex = 0; - int prefixLen; - int i; - int n; - XML_Char *uri; - int nPrefixes = 0; - BINDING *binding; - const XML_Char *localPart; - - /* lookup the element type name */ - elementType = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, tagNamePtr->str,0); - if (!elementType) { - const XML_Char *name = poolCopyString(&dtd->pool, tagNamePtr->str); - if (!name) - return XML_ERROR_NO_MEMORY; - elementType = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, name, - sizeof(ELEMENT_TYPE)); - if (!elementType) - return XML_ERROR_NO_MEMORY; - if (ns && !setElementTypePrefix(parser, elementType)) - return XML_ERROR_NO_MEMORY; - } - nDefaultAtts = elementType->nDefaultAtts; - - /* get the attributes from the tokenizer */ - n = XmlGetAttributes(enc, attStr, attsSize, atts); - if (n + nDefaultAtts > attsSize) { - int oldAttsSize = attsSize; - ATTRIBUTE *temp; -#ifdef XML_ATTR_INFO - XML_AttrInfo *temp2; -#endif - attsSize = n + nDefaultAtts + INIT_ATTS_SIZE; - temp = (ATTRIBUTE *)REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE)); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - atts = temp; -#ifdef XML_ATTR_INFO - temp2 = (XML_AttrInfo *)REALLOC((void *)attInfo, attsSize * sizeof(XML_AttrInfo)); - if (temp2 == NULL) - return XML_ERROR_NO_MEMORY; - attInfo = temp2; -#endif - if (n > oldAttsSize) - XmlGetAttributes(enc, attStr, n, atts); - } - - appAtts = (const XML_Char **)atts; - for (i = 0; i < n; i++) { - ATTRIBUTE *currAtt = &atts[i]; -#ifdef XML_ATTR_INFO - XML_AttrInfo *currAttInfo = &attInfo[i]; -#endif - /* add the name and value to the attribute list */ - ATTRIBUTE_ID *attId = getAttributeId(parser, enc, currAtt->name, - currAtt->name - + XmlNameLength(enc, currAtt->name)); - if (!attId) - return XML_ERROR_NO_MEMORY; -#ifdef XML_ATTR_INFO - currAttInfo->nameStart = parseEndByteIndex - (parseEndPtr - currAtt->name); - currAttInfo->nameEnd = currAttInfo->nameStart + - XmlNameLength(enc, currAtt->name); - currAttInfo->valueStart = parseEndByteIndex - - (parseEndPtr - currAtt->valuePtr); - currAttInfo->valueEnd = parseEndByteIndex - (parseEndPtr - currAtt->valueEnd); -#endif - /* Detect duplicate attributes by their QNames. This does not work when - namespace processing is turned on and different prefixes for the same - namespace are used. For this case we have a check further down. - */ - if ((attId->name)[-1]) { - if (enc == encoding) - eventPtr = atts[i].name; - return XML_ERROR_DUPLICATE_ATTRIBUTE; - } - (attId->name)[-1] = 1; - appAtts[attIndex++] = attId->name; - if (!atts[i].normalized) { - enum XML_Error result; - XML_Bool isCdata = XML_TRUE; - - /* figure out whether declared as other than CDATA */ - if (attId->maybeTokenized) { - int j; - for (j = 0; j < nDefaultAtts; j++) { - if (attId == elementType->defaultAtts[j].id) { - isCdata = elementType->defaultAtts[j].isCdata; - break; - } - } - } - - /* normalize the attribute value */ - result = storeAttributeValue(parser, enc, isCdata, - atts[i].valuePtr, atts[i].valueEnd, - &tempPool); - if (result) - return result; - appAtts[attIndex] = poolStart(&tempPool); - poolFinish(&tempPool); - } - else { - /* the value did not need normalizing */ - appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr, - atts[i].valueEnd); - if (appAtts[attIndex] == 0) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - } - /* handle prefixed attribute names */ - if (attId->prefix) { - if (attId->xmlns) { - /* deal with namespace declarations here */ - enum XML_Error result = addBinding(parser, attId->prefix, attId, - appAtts[attIndex], bindingsPtr); - if (result) - return result; - --attIndex; - } - else { - /* deal with other prefixed names later */ - attIndex++; - nPrefixes++; - (attId->name)[-1] = 2; - } - } - else - attIndex++; - } - - /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */ - nSpecifiedAtts = attIndex; - if (elementType->idAtt && (elementType->idAtt->name)[-1]) { - for (i = 0; i < attIndex; i += 2) - if (appAtts[i] == elementType->idAtt->name) { - idAttIndex = i; - break; - } - } - else - idAttIndex = -1; - - /* do attribute defaulting */ - for (i = 0; i < nDefaultAtts; i++) { - const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + i; - if (!(da->id->name)[-1] && da->value) { - if (da->id->prefix) { - if (da->id->xmlns) { - enum XML_Error result = addBinding(parser, da->id->prefix, da->id, - da->value, bindingsPtr); - if (result) - return result; - } - else { - (da->id->name)[-1] = 2; - nPrefixes++; - appAtts[attIndex++] = da->id->name; - appAtts[attIndex++] = da->value; - } - } - else { - (da->id->name)[-1] = 1; - appAtts[attIndex++] = da->id->name; - appAtts[attIndex++] = da->value; - } - } - } - appAtts[attIndex] = 0; - - /* expand prefixed attribute names, check for duplicates, - and clear flags that say whether attributes were specified */ - i = 0; - if (nPrefixes) { - int j; /* hash table index */ - unsigned long version = nsAttsVersion; - int nsAttsSize = (int)1 << nsAttsPower; - /* size of hash table must be at least 2 * (# of prefixed attributes) */ - if ((nPrefixes << 1) >> nsAttsPower) { /* true for nsAttsPower = 0 */ - NS_ATT *temp; - /* hash table size must also be a power of 2 and >= 8 */ - while (nPrefixes >> nsAttsPower++); - if (nsAttsPower < 3) - nsAttsPower = 3; - nsAttsSize = (int)1 << nsAttsPower; - temp = (NS_ATT *)REALLOC(nsAtts, nsAttsSize * sizeof(NS_ATT)); - if (!temp) - return XML_ERROR_NO_MEMORY; - nsAtts = temp; - version = 0; /* force re-initialization of nsAtts hash table */ - } - /* using a version flag saves us from initializing nsAtts every time */ - if (!version) { /* initialize version flags when version wraps around */ - version = INIT_ATTS_VERSION; - for (j = nsAttsSize; j != 0; ) - nsAtts[--j].version = version; - } - nsAttsVersion = --version; - - /* expand prefixed names and check for duplicates */ - for (; i < attIndex; i += 2) { - const XML_Char *s = appAtts[i]; - if (s[-1] == 2) { /* prefixed */ - ATTRIBUTE_ID *id; - const BINDING *b; - unsigned long uriHash = hash_secret_salt; - ((XML_Char *)s)[-1] = 0; /* clear flag */ - id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0); - b = id->prefix->binding; - if (!b) - return XML_ERROR_UNBOUND_PREFIX; - - /* as we expand the name we also calculate its hash value */ - for (j = 0; j < b->uriLen; j++) { - const XML_Char c = b->uri[j]; - if (!poolAppendChar(&tempPool, c)) - return XML_ERROR_NO_MEMORY; - uriHash = CHAR_HASH(uriHash, c); - } - while (*s++ != XML_T(ASCII_COLON)) - ; - do { /* copies null terminator */ - const XML_Char c = *s; - if (!poolAppendChar(&tempPool, *s)) - return XML_ERROR_NO_MEMORY; - uriHash = CHAR_HASH(uriHash, c); - } while (*s++); - - { /* Check hash table for duplicate of expanded name (uriName). - Derived from code in lookup(parser, HASH_TABLE *table, ...). - */ - unsigned char step = 0; - unsigned long mask = nsAttsSize - 1; - j = uriHash & mask; /* index into hash table */ - while (nsAtts[j].version == version) { - /* for speed we compare stored hash values first */ - if (uriHash == nsAtts[j].hash) { - const XML_Char *s1 = poolStart(&tempPool); - const XML_Char *s2 = nsAtts[j].uriName; - /* s1 is null terminated, but not s2 */ - for (; *s1 == *s2 && *s1 != 0; s1++, s2++); - if (*s1 == 0) - return XML_ERROR_DUPLICATE_ATTRIBUTE; - } - if (!step) - step = PROBE_STEP(uriHash, mask, nsAttsPower); - j < step ? (j += nsAttsSize - step) : (j -= step); - } - } - - if (ns_triplets) { /* append namespace separator and prefix */ - tempPool.ptr[-1] = namespaceSeparator; - s = b->prefix->name; - do { - if (!poolAppendChar(&tempPool, *s)) - return XML_ERROR_NO_MEMORY; - } while (*s++); - } - - /* store expanded name in attribute list */ - s = poolStart(&tempPool); - poolFinish(&tempPool); - appAtts[i] = s; - - /* fill empty slot with new version, uriName and hash value */ - nsAtts[j].version = version; - nsAtts[j].hash = uriHash; - nsAtts[j].uriName = s; - - if (!--nPrefixes) { - i += 2; - break; - } - } - else /* not prefixed */ - ((XML_Char *)s)[-1] = 0; /* clear flag */ - } - } - /* clear flags for the remaining attributes */ - for (; i < attIndex; i += 2) - ((XML_Char *)(appAtts[i]))[-1] = 0; - for (binding = *bindingsPtr; binding; binding = binding->nextTagBinding) - binding->attId->name[-1] = 0; - - if (!ns) - return XML_ERROR_NONE; - - /* expand the element type name */ - if (elementType->prefix) { - binding = elementType->prefix->binding; - if (!binding) - return XML_ERROR_UNBOUND_PREFIX; - localPart = tagNamePtr->str; - while (*localPart++ != XML_T(ASCII_COLON)) - ; - } - else if (dtd->defaultPrefix.binding) { - binding = dtd->defaultPrefix.binding; - localPart = tagNamePtr->str; - } - else - return XML_ERROR_NONE; - prefixLen = 0; - if (ns_triplets && binding->prefix->name) { - for (; binding->prefix->name[prefixLen++];) - ; /* prefixLen includes null terminator */ - } - tagNamePtr->localPart = localPart; - tagNamePtr->uriLen = binding->uriLen; - tagNamePtr->prefix = binding->prefix->name; - tagNamePtr->prefixLen = prefixLen; - for (i = 0; localPart[i++];) - ; /* i includes null terminator */ - n = i + binding->uriLen + prefixLen; - if (n > binding->uriAlloc) { - TAG *p; - uri = (XML_Char *)MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char)); - if (!uri) - return XML_ERROR_NO_MEMORY; - binding->uriAlloc = n + EXPAND_SPARE; - memcpy(uri, binding->uri, binding->uriLen * sizeof(XML_Char)); - for (p = tagStack; p; p = p->parent) - if (p->name.str == binding->uri) - p->name.str = uri; - FREE(binding->uri); - binding->uri = uri; - } - /* if namespaceSeparator != '\0' then uri includes it already */ - uri = binding->uri + binding->uriLen; - memcpy(uri, localPart, i * sizeof(XML_Char)); - /* we always have a namespace separator between localPart and prefix */ - if (prefixLen) { - uri += i - 1; - *uri = namespaceSeparator; /* replace null terminator */ - memcpy(uri + 1, binding->prefix->name, prefixLen * sizeof(XML_Char)); - } - tagNamePtr->str = binding->uri; - return XML_ERROR_NONE; -} - -/* addBinding() overwrites the value of prefix->binding without checking. - Therefore one must keep track of the old value outside of addBinding(). -*/ -static enum XML_Error -addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, - const XML_Char *uri, BINDING **bindingsPtr) -{ - static const XML_Char xmlNamespace[] = { - ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH, - ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, - ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, - ASCII_SLASH, ASCII_1, ASCII_9, ASCII_9, ASCII_8, ASCII_SLASH, - ASCII_n, ASCII_a, ASCII_m, ASCII_e, ASCII_s, ASCII_p, ASCII_a, ASCII_c, - ASCII_e, '\0' - }; - static const int xmlLen = - (int)sizeof(xmlNamespace)/sizeof(XML_Char) - 1; - static const XML_Char xmlnsNamespace[] = { - ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH, - ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, - ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_2, ASCII_0, ASCII_0, - ASCII_0, ASCII_SLASH, ASCII_x, ASCII_m, ASCII_l, ASCII_n, ASCII_s, - ASCII_SLASH, '\0' - }; - static const int xmlnsLen = - (int)sizeof(xmlnsNamespace)/sizeof(XML_Char) - 1; - - XML_Bool mustBeXML = XML_FALSE; - XML_Bool isXML = XML_TRUE; - XML_Bool isXMLNS = XML_TRUE; - - BINDING *b; - int len; - - /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */ - if (*uri == XML_T('\0') && prefix->name) - return XML_ERROR_UNDECLARING_PREFIX; - - if (prefix->name - && prefix->name[0] == XML_T(ASCII_x) - && prefix->name[1] == XML_T(ASCII_m) - && prefix->name[2] == XML_T(ASCII_l)) { - - /* Not allowed to bind xmlns */ - if (prefix->name[3] == XML_T(ASCII_n) - && prefix->name[4] == XML_T(ASCII_s) - && prefix->name[5] == XML_T('\0')) - return XML_ERROR_RESERVED_PREFIX_XMLNS; - - if (prefix->name[3] == XML_T('\0')) - mustBeXML = XML_TRUE; - } - - for (len = 0; uri[len]; len++) { - if (isXML && (len > xmlLen || uri[len] != xmlNamespace[len])) - isXML = XML_FALSE; - - if (!mustBeXML && isXMLNS - && (len > xmlnsLen || uri[len] != xmlnsNamespace[len])) - isXMLNS = XML_FALSE; - } - isXML = isXML && len == xmlLen; - isXMLNS = isXMLNS && len == xmlnsLen; - - if (mustBeXML != isXML) - return mustBeXML ? XML_ERROR_RESERVED_PREFIX_XML - : XML_ERROR_RESERVED_NAMESPACE_URI; - - if (isXMLNS) - return XML_ERROR_RESERVED_NAMESPACE_URI; - - if (namespaceSeparator) - len++; - if (freeBindingList) { - b = freeBindingList; - if (len > b->uriAlloc) { - XML_Char *temp = (XML_Char *)REALLOC(b->uri, - sizeof(XML_Char) * (len + EXPAND_SPARE)); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - b->uri = temp; - b->uriAlloc = len + EXPAND_SPARE; - } - freeBindingList = b->nextTagBinding; - } - else { - b = (BINDING *)MALLOC(sizeof(BINDING)); - if (!b) - return XML_ERROR_NO_MEMORY; - b->uri = (XML_Char *)MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE)); - if (!b->uri) { - FREE(b); - return XML_ERROR_NO_MEMORY; - } - b->uriAlloc = len + EXPAND_SPARE; - } - b->uriLen = len; - memcpy(b->uri, uri, len * sizeof(XML_Char)); - if (namespaceSeparator) - b->uri[len - 1] = namespaceSeparator; - b->prefix = prefix; - b->attId = attId; - b->prevPrefixBinding = prefix->binding; - /* NULL binding when default namespace undeclared */ - if (*uri == XML_T('\0') && prefix == &_dtd->defaultPrefix) - prefix->binding = NULL; - else - prefix->binding = b; - b->nextTagBinding = *bindingsPtr; - *bindingsPtr = b; - /* if attId == NULL then we are not starting a namespace scope */ - if (attId && startNamespaceDeclHandler) - startNamespaceDeclHandler(handlerArg, prefix->name, - prefix->binding ? uri : 0); - return XML_ERROR_NONE; -} - -/* The idea here is to avoid using stack for each CDATA section when - the whole file is parsed with one call. -*/ -static enum XML_Error PTRCALL -cdataSectionProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doCdataSection(parser, encoding, &start, end, - endPtr, (XML_Bool)!ps_finalBuffer); - if (result != XML_ERROR_NONE) - return result; - if (start) { - if (parentParser) { /* we are parsing an external entity */ - processor = externalEntityContentProcessor; - return externalEntityContentProcessor(parser, start, end, endPtr); - } - else { - processor = contentProcessor; - return contentProcessor(parser, start, end, endPtr); - } - } - return result; -} - -/* startPtr gets set to non-null if the section is closed, and to null if - the section is not yet closed. -*/ -static enum XML_Error -doCdataSection(XML_Parser parser, - const ENCODING *enc, - const char **startPtr, - const char *end, - const char **nextPtr, - XML_Bool haveMore) -{ - const char *s = *startPtr; - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - *eventPP = s; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - *eventPP = s; - *startPtr = NULL; - - for (;;) { - const char *next; - int tok = XmlCdataSectionTok(enc, s, end, &next); - *eventEndPP = next; - switch (tok) { - case XML_TOK_CDATA_SECT_CLOSE: - if (endCdataSectionHandler) - endCdataSectionHandler(handlerArg); -#if 0 - /* see comment under XML_TOK_CDATA_SECT_OPEN */ - else if (characterDataHandler) - characterDataHandler(handlerArg, dataBuf, 0); -#endif - else if (defaultHandler) - reportDefault(parser, enc, s, next); - *startPtr = next; - *nextPtr = next; - if (ps_parsing == XML_FINISHED) - return XML_ERROR_ABORTED; - else - return XML_ERROR_NONE; - case XML_TOK_DATA_NEWLINE: - if (characterDataHandler) { - XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - case XML_TOK_DATA_CHARS: - { - XML_CharacterDataHandler charDataHandler = characterDataHandler; - if (charDataHandler) { - if (MUST_CONVERT(enc, s)) { - for (;;) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = next; - charDataHandler(handlerArg, dataBuf, - (int)(dataPtr - (ICHAR *)dataBuf)); - if (s == next) - break; - *eventPP = s; - } - } - else - charDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)next - (XML_Char *)s)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - } - break; - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_PARTIAL: - case XML_TOK_NONE: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_CDATA_SECTION; - default: - *eventPP = next; - return XML_ERROR_UNEXPECTED_STATE; - } - - *eventPP = s = next; - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: ; - } - } - /* not reached */ -} - -#ifdef XML_DTD - -/* The idea here is to avoid using stack for each IGNORE section when - the whole file is parsed with one call. -*/ -static enum XML_Error PTRCALL -ignoreSectionProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doIgnoreSection(parser, encoding, &start, end, - endPtr, (XML_Bool)!ps_finalBuffer); - if (result != XML_ERROR_NONE) - return result; - if (start) { - processor = prologProcessor; - return prologProcessor(parser, start, end, endPtr); - } - return result; -} - -/* startPtr gets set to non-null is the section is closed, and to null - if the section is not yet closed. -*/ -static enum XML_Error -doIgnoreSection(XML_Parser parser, - const ENCODING *enc, - const char **startPtr, - const char *end, - const char **nextPtr, - XML_Bool haveMore) -{ - const char *next; - int tok; - const char *s = *startPtr; - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - *eventPP = s; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - *eventPP = s; - *startPtr = NULL; - tok = XmlIgnoreSectionTok(enc, s, end, &next); - *eventEndPP = next; - switch (tok) { - case XML_TOK_IGNORE_SECT: - if (defaultHandler) - reportDefault(parser, enc, s, next); - *startPtr = next; - *nextPtr = next; - if (ps_parsing == XML_FINISHED) - return XML_ERROR_ABORTED; - else - return XML_ERROR_NONE; - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_PARTIAL: - case XML_TOK_NONE: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */ - default: - *eventPP = next; - return XML_ERROR_UNEXPECTED_STATE; - } - /* not reached */ -} - -#endif /* XML_DTD */ - -static enum XML_Error -initializeEncoding(XML_Parser parser) -{ - const char *s; -#ifdef XML_UNICODE - char encodingBuf[128]; - if (!protocolEncodingName) - s = NULL; - else { - int i; - for (i = 0; protocolEncodingName[i]; i++) { - if (i == sizeof(encodingBuf) - 1 - || (protocolEncodingName[i] & ~0x7f) != 0) { - encodingBuf[0] = '\0'; - break; - } - encodingBuf[i] = (char)protocolEncodingName[i]; - } - encodingBuf[i] = '\0'; - s = encodingBuf; - } -#else - s = protocolEncodingName; -#endif - if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s)) - return XML_ERROR_NONE; - return handleUnknownEncoding(parser, protocolEncodingName); -} - -static enum XML_Error -processXmlDecl(XML_Parser parser, int isGeneralTextEntity, - const char *s, const char *next) -{ - const char *encodingName = NULL; - const XML_Char *storedEncName = NULL; - const ENCODING *newEncoding = NULL; - const char *version = NULL; - const char *versionend; - const XML_Char *storedversion = NULL; - int standalone = -1; - if (!(ns - ? XmlParseXmlDeclNS - : XmlParseXmlDecl)(isGeneralTextEntity, - encoding, - s, - next, - &eventPtr, - &version, - &versionend, - &encodingName, - &newEncoding, - &standalone)) { - if (isGeneralTextEntity) - return XML_ERROR_TEXT_DECL; - else - return XML_ERROR_XML_DECL; - } - if (!isGeneralTextEntity && standalone == 1) { - _dtd->standalone = XML_TRUE; -#ifdef XML_DTD - if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) - paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; -#endif /* XML_DTD */ - } - if (xmlDeclHandler) { - if (encodingName != NULL) { - storedEncName = poolStoreString(&temp2Pool, - encoding, - encodingName, - encodingName - + XmlNameLength(encoding, encodingName)); - if (!storedEncName) - return XML_ERROR_NO_MEMORY; - poolFinish(&temp2Pool); - } - if (version) { - storedversion = poolStoreString(&temp2Pool, - encoding, - version, - versionend - encoding->minBytesPerChar); - if (!storedversion) - return XML_ERROR_NO_MEMORY; - } - xmlDeclHandler(handlerArg, storedversion, storedEncName, standalone); - } - else if (defaultHandler) - reportDefault(parser, encoding, s, next); - if (protocolEncodingName == NULL) { - if (newEncoding) { - if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) { - eventPtr = encodingName; - return XML_ERROR_INCORRECT_ENCODING; - } - encoding = newEncoding; - } - else if (encodingName) { - enum XML_Error result; - if (!storedEncName) { - storedEncName = poolStoreString( - &temp2Pool, encoding, encodingName, - encodingName + XmlNameLength(encoding, encodingName)); - if (!storedEncName) - return XML_ERROR_NO_MEMORY; - } - result = handleUnknownEncoding(parser, storedEncName); - poolClear(&temp2Pool); - if (result == XML_ERROR_UNKNOWN_ENCODING) - eventPtr = encodingName; - return result; - } - } - - if (storedEncName || storedversion) - poolClear(&temp2Pool); - - return XML_ERROR_NONE; -} - -static enum XML_Error -handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) -{ - if (unknownEncodingHandler) { - XML_Encoding info; - int i; - for (i = 0; i < 256; i++) - info.map[i] = -1; - info.convert = NULL; - info.data = NULL; - info.release = NULL; - if (unknownEncodingHandler(unknownEncodingHandlerData, encodingName, - &info)) { - ENCODING *enc; - unknownEncodingMem = MALLOC(XmlSizeOfUnknownEncoding()); - if (!unknownEncodingMem) { - if (info.release) - info.release(info.data); - return XML_ERROR_NO_MEMORY; - } - enc = (ns - ? XmlInitUnknownEncodingNS - : XmlInitUnknownEncoding)(unknownEncodingMem, - info.map, - info.convert, - info.data); - if (enc) { - unknownEncodingData = info.data; - unknownEncodingRelease = info.release; - encoding = enc; - return XML_ERROR_NONE; - } - } - if (info.release != NULL) - info.release(info.data); - } - return XML_ERROR_UNKNOWN_ENCODING; -} - -static enum XML_Error PTRCALL -prologInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - enum XML_Error result = initializeEncoding(parser); - if (result != XML_ERROR_NONE) - return result; - processor = prologProcessor; - return prologProcessor(parser, s, end, nextPtr); -} - -#ifdef XML_DTD - -static enum XML_Error PTRCALL -externalParEntInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - enum XML_Error result = initializeEncoding(parser); - if (result != XML_ERROR_NONE) - return result; - - /* we know now that XML_Parse(Buffer) has been called, - so we consider the external parameter entity read */ - _dtd->paramEntityRead = XML_TRUE; - - if (prologState.inEntityValue) { - processor = entityValueInitProcessor; - return entityValueInitProcessor(parser, s, end, nextPtr); - } - else { - processor = externalParEntProcessor; - return externalParEntProcessor(parser, s, end, nextPtr); - } -} - -static enum XML_Error PTRCALL -entityValueInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - int tok; - const char *start = s; - const char *next = start; - eventPtr = start; - - for (;;) { - tok = XmlPrologTok(encoding, start, end, &next); - eventEndPtr = next; - if (tok <= 0) { - if (!ps_finalBuffer && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: /* start == end */ - default: - break; - } - /* found end of entity value - can store it now */ - return storeEntityValue(parser, encoding, s, end); - } - else if (tok == XML_TOK_XML_DECL) { - enum XML_Error result; - result = processXmlDecl(parser, 0, start, next); - if (result != XML_ERROR_NONE) - return result; - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: - *nextPtr = next; - } - /* stop scanning for text declaration - we found one */ - processor = entityValueProcessor; - return entityValueProcessor(parser, next, end, nextPtr); - } - /* If we are at the end of the buffer, this would cause XmlPrologTok to - return XML_TOK_NONE on the next call, which would then cause the - function to exit with *nextPtr set to s - that is what we want for other - tokens, but not for the BOM - we would rather like to skip it; - then, when this routine is entered the next time, XmlPrologTok will - return XML_TOK_INVALID, since the BOM is still in the buffer - */ - else if (tok == XML_TOK_BOM && next == end && !ps_finalBuffer) { - *nextPtr = next; - return XML_ERROR_NONE; - } - start = next; - eventPtr = start; - } -} - -static enum XML_Error PTRCALL -externalParEntProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - const char *next = s; - int tok; - - tok = XmlPrologTok(encoding, s, end, &next); - if (tok <= 0) { - if (!ps_finalBuffer && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: /* start == end */ - default: - break; - } - } - /* This would cause the next stage, i.e. doProlog to be passed XML_TOK_BOM. - However, when parsing an external subset, doProlog will not accept a BOM - as valid, and report a syntax error, so we have to skip the BOM - */ - else if (tok == XML_TOK_BOM) { - s = next; - tok = XmlPrologTok(encoding, s, end, &next); - } - - processor = prologProcessor; - return doProlog(parser, encoding, s, end, tok, next, - nextPtr, (XML_Bool)!ps_finalBuffer); -} - -static enum XML_Error PTRCALL -entityValueProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - const char *start = s; - const char *next = s; - const ENCODING *enc = encoding; - int tok; - - for (;;) { - tok = XmlPrologTok(enc, start, end, &next); - if (tok <= 0) { - if (!ps_finalBuffer && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: /* start == end */ - default: - break; - } - /* found end of entity value - can store it now */ - return storeEntityValue(parser, enc, s, end); - } - start = next; - } -} - -#endif /* XML_DTD */ - -static enum XML_Error PTRCALL -prologProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - const char *next = s; - int tok = XmlPrologTok(encoding, s, end, &next); - return doProlog(parser, encoding, s, end, tok, next, - nextPtr, (XML_Bool)!ps_finalBuffer); -} - -static enum XML_Error -doProlog(XML_Parser parser, - const ENCODING *enc, - const char *s, - const char *end, - int tok, - const char *next, - const char **nextPtr, - XML_Bool haveMore) -{ -#ifdef XML_DTD - static const XML_Char externalSubsetName[] = { ASCII_HASH , '\0' }; -#endif /* XML_DTD */ - static const XML_Char atypeCDATA[] = - { ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; - static const XML_Char atypeID[] = { ASCII_I, ASCII_D, '\0' }; - static const XML_Char atypeIDREF[] = - { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' }; - static const XML_Char atypeIDREFS[] = - { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' }; - static const XML_Char atypeENTITY[] = - { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' }; - static const XML_Char atypeENTITIES[] = { ASCII_E, ASCII_N, - ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, '\0' }; - static const XML_Char atypeNMTOKEN[] = { - ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' }; - static const XML_Char atypeNMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T, - ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, '\0' }; - static const XML_Char notationPrefix[] = { ASCII_N, ASCII_O, ASCII_T, - ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, ASCII_LPAREN, '\0' }; - static const XML_Char enumValueSep[] = { ASCII_PIPE, '\0' }; - static const XML_Char enumValueStart[] = { ASCII_LPAREN, '\0' }; - - /* save one level of indirection */ - DTD * const dtd = _dtd; - - const char **eventPP; - const char **eventEndPP; - enum XML_Content_Quant quant; - - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - - for (;;) { - int role; - XML_Bool handleDefault = XML_TRUE; - *eventPP = s; - *eventEndPP = next; - if (tok <= 0) { - if (haveMore && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case -XML_TOK_PROLOG_S: - tok = -tok; - break; - case XML_TOK_NONE: -#ifdef XML_DTD - /* for internal PE NOT referenced between declarations */ - if (enc != encoding && !openInternalEntities->betweenDecl) { - *nextPtr = s; - return XML_ERROR_NONE; - } - /* WFC: PE Between Declarations - must check that PE contains - complete markup, not only for external PEs, but also for - internal PEs if the reference occurs between declarations. - */ - if (isParamEntity || enc != encoding) { - if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc) - == XML_ROLE_ERROR) - return XML_ERROR_INCOMPLETE_PE; - *nextPtr = s; - return XML_ERROR_NONE; - } -#endif /* XML_DTD */ - return XML_ERROR_NO_ELEMENTS; - default: - tok = -tok; - next = end; - break; - } - } - role = XmlTokenRole(&prologState, tok, s, next, enc); - switch (role) { - case XML_ROLE_XML_DECL: - { - enum XML_Error result = processXmlDecl(parser, 0, s, next); - if (result != XML_ERROR_NONE) - return result; - enc = encoding; - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_DOCTYPE_NAME: - if (startDoctypeDeclHandler) { - doctypeName = poolStoreString(&tempPool, enc, s, next); - if (!doctypeName) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - doctypePubid = NULL; - handleDefault = XML_FALSE; - } - doctypeSysid = NULL; /* always initialize to NULL */ - break; - case XML_ROLE_DOCTYPE_INTERNAL_SUBSET: - if (startDoctypeDeclHandler) { - startDoctypeDeclHandler(handlerArg, doctypeName, doctypeSysid, - doctypePubid, 1); - doctypeName = NULL; - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - break; -#ifdef XML_DTD - case XML_ROLE_TEXT_DECL: - { - enum XML_Error result = processXmlDecl(parser, 1, s, next); - if (result != XML_ERROR_NONE) - return result; - enc = encoding; - handleDefault = XML_FALSE; - } - break; -#endif /* XML_DTD */ - case XML_ROLE_DOCTYPE_PUBLIC_ID: -#ifdef XML_DTD - useForeignDTD = XML_FALSE; - declEntity = (ENTITY *)lookup(parser, - &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; -#endif /* XML_DTD */ - dtd->hasParamEntityRefs = XML_TRUE; - if (startDoctypeDeclHandler) { - XML_Char *pubId; - if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_PUBLICID; - pubId = poolStoreString(&tempPool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!pubId) - return XML_ERROR_NO_MEMORY; - normalizePublicId(pubId); - poolFinish(&tempPool); - doctypePubid = pubId; - handleDefault = XML_FALSE; - goto alreadyChecked; - } - /* fall through */ - case XML_ROLE_ENTITY_PUBLIC_ID: - if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_PUBLICID; - alreadyChecked: - if (dtd->keepProcessing && declEntity) { - XML_Char *tem = poolStoreString(&dtd->pool, - enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!tem) - return XML_ERROR_NO_MEMORY; - normalizePublicId(tem); - declEntity->publicId = tem; - poolFinish(&dtd->pool); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_DOCTYPE_CLOSE: - if (doctypeName) { - startDoctypeDeclHandler(handlerArg, doctypeName, - doctypeSysid, doctypePubid, 0); - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - /* doctypeSysid will be non-NULL in the case of a previous - XML_ROLE_DOCTYPE_SYSTEM_ID, even if startDoctypeDeclHandler - was not set, indicating an external subset - */ -#ifdef XML_DTD - if (doctypeSysid || useForeignDTD) { - XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs; - dtd->hasParamEntityRefs = XML_TRUE; - if (paramEntityParsing && externalEntityRefHandler) { - ENTITY *entity = (ENTITY *)lookup(parser, - &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!entity) - return XML_ERROR_NO_MEMORY; - if (useForeignDTD) - entity->base = curBase; - dtd->paramEntityRead = XML_FALSE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - if (dtd->paramEntityRead) { - if (!dtd->standalone && - notStandaloneHandler && - !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; - } - /* if we didn't read the foreign DTD then this means that there - is no external subset and we must reset dtd->hasParamEntityRefs - */ - else if (!doctypeSysid) - dtd->hasParamEntityRefs = hadParamEntityRefs; - /* end of DTD - no need to update dtd->keepProcessing */ - } - useForeignDTD = XML_FALSE; - } -#endif /* XML_DTD */ - if (endDoctypeDeclHandler) { - endDoctypeDeclHandler(handlerArg); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_INSTANCE_START: -#ifdef XML_DTD - /* if there is no DOCTYPE declaration then now is the - last chance to read the foreign DTD - */ - if (useForeignDTD) { - XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs; - dtd->hasParamEntityRefs = XML_TRUE; - if (paramEntityParsing && externalEntityRefHandler) { - ENTITY *entity = (ENTITY *)lookup(parser, &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!entity) - return XML_ERROR_NO_MEMORY; - entity->base = curBase; - dtd->paramEntityRead = XML_FALSE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - if (dtd->paramEntityRead) { - if (!dtd->standalone && - notStandaloneHandler && - !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; - } - /* if we didn't read the foreign DTD then this means that there - is no external subset and we must reset dtd->hasParamEntityRefs - */ - else - dtd->hasParamEntityRefs = hadParamEntityRefs; - /* end of DTD - no need to update dtd->keepProcessing */ - } - } -#endif /* XML_DTD */ - processor = contentProcessor; - return contentProcessor(parser, s, end, nextPtr); - case XML_ROLE_ATTLIST_ELEMENT_NAME: - declElementType = getElementType(parser, enc, s, next); - if (!declElementType) - return XML_ERROR_NO_MEMORY; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_NAME: - declAttributeId = getAttributeId(parser, enc, s, next); - if (!declAttributeId) - return XML_ERROR_NO_MEMORY; - declAttributeIsCdata = XML_FALSE; - declAttributeType = NULL; - declAttributeIsId = XML_FALSE; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_CDATA: - declAttributeIsCdata = XML_TRUE; - declAttributeType = atypeCDATA; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_ID: - declAttributeIsId = XML_TRUE; - declAttributeType = atypeID; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_IDREF: - declAttributeType = atypeIDREF; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_IDREFS: - declAttributeType = atypeIDREFS; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_ENTITY: - declAttributeType = atypeENTITY; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_ENTITIES: - declAttributeType = atypeENTITIES; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN: - declAttributeType = atypeNMTOKEN; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS: - declAttributeType = atypeNMTOKENS; - checkAttListDeclHandler: - if (dtd->keepProcessing && attlistDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ATTRIBUTE_ENUM_VALUE: - case XML_ROLE_ATTRIBUTE_NOTATION_VALUE: - if (dtd->keepProcessing && attlistDeclHandler) { - const XML_Char *prefix; - if (declAttributeType) { - prefix = enumValueSep; - } - else { - prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE - ? notationPrefix - : enumValueStart); - } - if (!poolAppendString(&tempPool, prefix)) - return XML_ERROR_NO_MEMORY; - if (!poolAppend(&tempPool, enc, s, next)) - return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE: - case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE: - if (dtd->keepProcessing) { - if (!defineAttribute(declElementType, declAttributeId, - declAttributeIsCdata, declAttributeIsId, - 0, parser)) - return XML_ERROR_NO_MEMORY; - if (attlistDeclHandler && declAttributeType) { - if (*declAttributeType == XML_T(ASCII_LPAREN) - || (*declAttributeType == XML_T(ASCII_N) - && declAttributeType[1] == XML_T(ASCII_O))) { - /* Enumerated or Notation type */ - if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN)) - || !poolAppendChar(&tempPool, XML_T('\0'))) - return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - poolFinish(&tempPool); - } - *eventEndPP = s; - attlistDeclHandler(handlerArg, declElementType->name, - declAttributeId->name, declAttributeType, - 0, role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE); - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - } - break; - case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE: - case XML_ROLE_FIXED_ATTRIBUTE_VALUE: - if (dtd->keepProcessing) { - const XML_Char *attVal; - enum XML_Error result = - storeAttributeValue(parser, enc, declAttributeIsCdata, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar, - &dtd->pool); - if (result) - return result; - attVal = poolStart(&dtd->pool); - poolFinish(&dtd->pool); - /* ID attributes aren't allowed to have a default */ - if (!defineAttribute(declElementType, declAttributeId, - declAttributeIsCdata, XML_FALSE, attVal, parser)) - return XML_ERROR_NO_MEMORY; - if (attlistDeclHandler && declAttributeType) { - if (*declAttributeType == XML_T(ASCII_LPAREN) - || (*declAttributeType == XML_T(ASCII_N) - && declAttributeType[1] == XML_T(ASCII_O))) { - /* Enumerated or Notation type */ - if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN)) - || !poolAppendChar(&tempPool, XML_T('\0'))) - return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - poolFinish(&tempPool); - } - *eventEndPP = s; - attlistDeclHandler(handlerArg, declElementType->name, - declAttributeId->name, declAttributeType, - attVal, - role == XML_ROLE_FIXED_ATTRIBUTE_VALUE); - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - } - break; - case XML_ROLE_ENTITY_VALUE: - if (dtd->keepProcessing) { - enum XML_Error result = storeEntityValue(parser, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (declEntity) { - declEntity->textPtr = poolStart(&dtd->entityValuePool); - declEntity->textLen = (int)(poolLength(&dtd->entityValuePool)); - poolFinish(&dtd->entityValuePool); - if (entityDeclHandler) { - *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - declEntity->is_param, - declEntity->textPtr, - declEntity->textLen, - curBase, 0, 0, 0); - handleDefault = XML_FALSE; - } - } - else - poolDiscard(&dtd->entityValuePool); - if (result != XML_ERROR_NONE) - return result; - } - break; - case XML_ROLE_DOCTYPE_SYSTEM_ID: -#ifdef XML_DTD - useForeignDTD = XML_FALSE; -#endif /* XML_DTD */ - dtd->hasParamEntityRefs = XML_TRUE; - if (startDoctypeDeclHandler) { - doctypeSysid = poolStoreString(&tempPool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (doctypeSysid == NULL) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - handleDefault = XML_FALSE; - } -#ifdef XML_DTD - else - /* use externalSubsetName to make doctypeSysid non-NULL - for the case where no startDoctypeDeclHandler is set */ - doctypeSysid = externalSubsetName; -#endif /* XML_DTD */ - if (!dtd->standalone -#ifdef XML_DTD - && !paramEntityParsing -#endif /* XML_DTD */ - && notStandaloneHandler - && !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; -#ifndef XML_DTD - break; -#else /* XML_DTD */ - if (!declEntity) { - declEntity = (ENTITY *)lookup(parser, - &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; - declEntity->publicId = NULL; - } - /* fall through */ -#endif /* XML_DTD */ - case XML_ROLE_ENTITY_SYSTEM_ID: - if (dtd->keepProcessing && declEntity) { - declEntity->systemId = poolStoreString(&dtd->pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!declEntity->systemId) - return XML_ERROR_NO_MEMORY; - declEntity->base = curBase; - poolFinish(&dtd->pool); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_ENTITY_COMPLETE: - if (dtd->keepProcessing && declEntity && entityDeclHandler) { - *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - declEntity->is_param, - 0,0, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - 0); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_ENTITY_NOTATION_NAME: - if (dtd->keepProcessing && declEntity) { - declEntity->notation = poolStoreString(&dtd->pool, enc, s, next); - if (!declEntity->notation) - return XML_ERROR_NO_MEMORY; - poolFinish(&dtd->pool); - if (unparsedEntityDeclHandler) { - *eventEndPP = s; - unparsedEntityDeclHandler(handlerArg, - declEntity->name, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - declEntity->notation); - handleDefault = XML_FALSE; - } - else if (entityDeclHandler) { - *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - 0,0,0, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - declEntity->notation); - handleDefault = XML_FALSE; - } - } - break; - case XML_ROLE_GENERAL_ENTITY_NAME: - { - if (XmlPredefinedEntityName(enc, s, next)) { - declEntity = NULL; - break; - } - if (dtd->keepProcessing) { - const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next); - if (!name) - return XML_ERROR_NO_MEMORY; - declEntity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, - sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; - if (declEntity->name != name) { - poolDiscard(&dtd->pool); - declEntity = NULL; - } - else { - poolFinish(&dtd->pool); - declEntity->publicId = NULL; - declEntity->is_param = XML_FALSE; - /* if we have a parent parser or are reading an internal parameter - entity, then the entity declaration is not considered "internal" - */ - declEntity->is_internal = !(parentParser || openInternalEntities); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - } - else { - poolDiscard(&dtd->pool); - declEntity = NULL; - } - } - break; - case XML_ROLE_PARAM_ENTITY_NAME: -#ifdef XML_DTD - if (dtd->keepProcessing) { - const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next); - if (!name) - return XML_ERROR_NO_MEMORY; - declEntity = (ENTITY *)lookup(parser, &dtd->paramEntities, - name, sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; - if (declEntity->name != name) { - poolDiscard(&dtd->pool); - declEntity = NULL; - } - else { - poolFinish(&dtd->pool); - declEntity->publicId = NULL; - declEntity->is_param = XML_TRUE; - /* if we have a parent parser or are reading an internal parameter - entity, then the entity declaration is not considered "internal" - */ - declEntity->is_internal = !(parentParser || openInternalEntities); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - } - else { - poolDiscard(&dtd->pool); - declEntity = NULL; - } -#else /* not XML_DTD */ - declEntity = NULL; -#endif /* XML_DTD */ - break; - case XML_ROLE_NOTATION_NAME: - declNotationPublicId = NULL; - declNotationName = NULL; - if (notationDeclHandler) { - declNotationName = poolStoreString(&tempPool, enc, s, next); - if (!declNotationName) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_NOTATION_PUBLIC_ID: - if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_PUBLICID; - if (declNotationName) { /* means notationDeclHandler != NULL */ - XML_Char *tem = poolStoreString(&tempPool, - enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!tem) - return XML_ERROR_NO_MEMORY; - normalizePublicId(tem); - declNotationPublicId = tem; - poolFinish(&tempPool); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_NOTATION_SYSTEM_ID: - if (declNotationName && notationDeclHandler) { - const XML_Char *systemId - = poolStoreString(&tempPool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!systemId) - return XML_ERROR_NO_MEMORY; - *eventEndPP = s; - notationDeclHandler(handlerArg, - declNotationName, - curBase, - systemId, - declNotationPublicId); - handleDefault = XML_FALSE; - } - poolClear(&tempPool); - break; - case XML_ROLE_NOTATION_NO_SYSTEM_ID: - if (declNotationPublicId && notationDeclHandler) { - *eventEndPP = s; - notationDeclHandler(handlerArg, - declNotationName, - curBase, - 0, - declNotationPublicId); - handleDefault = XML_FALSE; - } - poolClear(&tempPool); - break; - case XML_ROLE_ERROR: - switch (tok) { - case XML_TOK_PARAM_ENTITY_REF: - /* PE references in internal subset are - not allowed within declarations. */ - return XML_ERROR_PARAM_ENTITY_REF; - case XML_TOK_XML_DECL: - return XML_ERROR_MISPLACED_XML_PI; - default: - return XML_ERROR_SYNTAX; - } -#ifdef XML_DTD - case XML_ROLE_IGNORE_SECT: - { - enum XML_Error result; - if (defaultHandler) - reportDefault(parser, enc, s, next); - handleDefault = XML_FALSE; - result = doIgnoreSection(parser, enc, &next, end, nextPtr, haveMore); - if (result != XML_ERROR_NONE) - return result; - else if (!next) { - processor = ignoreSectionProcessor; - return result; - } - } - break; -#endif /* XML_DTD */ - case XML_ROLE_GROUP_OPEN: - if (prologState.level >= groupSize) { - if (groupSize) { - char *temp = (char *)REALLOC(groupConnector, groupSize *= 2); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - groupConnector = temp; - if (dtd->scaffIndex) { - int *temp = (int *)REALLOC(dtd->scaffIndex, - groupSize * sizeof(int)); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - dtd->scaffIndex = temp; - } - } - else { - groupConnector = (char *)MALLOC(groupSize = 32); - if (!groupConnector) - return XML_ERROR_NO_MEMORY; - } - } - groupConnector[prologState.level] = 0; - if (dtd->in_eldecl) { - int myindex = nextScaffoldPart(parser); - if (myindex < 0) - return XML_ERROR_NO_MEMORY; - dtd->scaffIndex[dtd->scaffLevel] = myindex; - dtd->scaffLevel++; - dtd->scaffold[myindex].type = XML_CTYPE_SEQ; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_GROUP_SEQUENCE: - if (groupConnector[prologState.level] == ASCII_PIPE) - return XML_ERROR_SYNTAX; - groupConnector[prologState.level] = ASCII_COMMA; - if (dtd->in_eldecl && elementDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_GROUP_CHOICE: - if (groupConnector[prologState.level] == ASCII_COMMA) - return XML_ERROR_SYNTAX; - if (dtd->in_eldecl - && !groupConnector[prologState.level] - && (dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type - != XML_CTYPE_MIXED) - ) { - dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type - = XML_CTYPE_CHOICE; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - groupConnector[prologState.level] = ASCII_PIPE; - break; - case XML_ROLE_PARAM_ENTITY_REF: -#ifdef XML_DTD - case XML_ROLE_INNER_PARAM_ENTITY_REF: - dtd->hasParamEntityRefs = XML_TRUE; - if (!paramEntityParsing) - dtd->keepProcessing = dtd->standalone; - else { - const XML_Char *name; - ENTITY *entity; - name = poolStoreString(&dtd->pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(parser, &dtd->paramEntities, name, 0); - poolDiscard(&dtd->pool); - /* first, determine if a check for an existing declaration is needed; - if yes, check that the entity exists, and that it is internal, - otherwise call the skipped entity handler - */ - if (prologState.documentEntity && - (dtd->standalone - ? !openInternalEntities - : !dtd->hasParamEntityRefs)) { - if (!entity) - return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; - } - else if (!entity) { - dtd->keepProcessing = dtd->standalone; - /* cannot report skipped entities in declarations */ - if ((role == XML_ROLE_PARAM_ENTITY_REF) && skippedEntityHandler) { - skippedEntityHandler(handlerArg, name, 1); - handleDefault = XML_FALSE; - } - break; - } - if (entity->open) - return XML_ERROR_RECURSIVE_ENTITY_REF; - if (entity->textPtr) { - enum XML_Error result; - XML_Bool betweenDecl = - (role == XML_ROLE_PARAM_ENTITY_REF ? XML_TRUE : XML_FALSE); - result = processInternalEntity(parser, entity, betweenDecl); - if (result != XML_ERROR_NONE) - return result; - handleDefault = XML_FALSE; - break; - } - if (externalEntityRefHandler) { - dtd->paramEntityRead = XML_FALSE; - entity->open = XML_TRUE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) { - entity->open = XML_FALSE; - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - } - entity->open = XML_FALSE; - handleDefault = XML_FALSE; - if (!dtd->paramEntityRead) { - dtd->keepProcessing = dtd->standalone; - break; - } - } - else { - dtd->keepProcessing = dtd->standalone; - break; - } - } -#endif /* XML_DTD */ - if (!dtd->standalone && - notStandaloneHandler && - !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; - break; - - /* Element declaration stuff */ - - case XML_ROLE_ELEMENT_NAME: - if (elementDeclHandler) { - declElementType = getElementType(parser, enc, s, next); - if (!declElementType) - return XML_ERROR_NO_MEMORY; - dtd->scaffLevel = 0; - dtd->scaffCount = 0; - dtd->in_eldecl = XML_TRUE; - handleDefault = XML_FALSE; - } - break; - - case XML_ROLE_CONTENT_ANY: - case XML_ROLE_CONTENT_EMPTY: - if (dtd->in_eldecl) { - if (elementDeclHandler) { - XML_Content * content = (XML_Content *) MALLOC(sizeof(XML_Content)); - if (!content) - return XML_ERROR_NO_MEMORY; - content->quant = XML_CQUANT_NONE; - content->name = NULL; - content->numchildren = 0; - content->children = NULL; - content->type = ((role == XML_ROLE_CONTENT_ANY) ? - XML_CTYPE_ANY : - XML_CTYPE_EMPTY); - *eventEndPP = s; - elementDeclHandler(handlerArg, declElementType->name, content); - handleDefault = XML_FALSE; - } - dtd->in_eldecl = XML_FALSE; - } - break; - - case XML_ROLE_CONTENT_PCDATA: - if (dtd->in_eldecl) { - dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type - = XML_CTYPE_MIXED; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - break; - - case XML_ROLE_CONTENT_ELEMENT: - quant = XML_CQUANT_NONE; - goto elementContent; - case XML_ROLE_CONTENT_ELEMENT_OPT: - quant = XML_CQUANT_OPT; - goto elementContent; - case XML_ROLE_CONTENT_ELEMENT_REP: - quant = XML_CQUANT_REP; - goto elementContent; - case XML_ROLE_CONTENT_ELEMENT_PLUS: - quant = XML_CQUANT_PLUS; - elementContent: - if (dtd->in_eldecl) { - ELEMENT_TYPE *el; - const XML_Char *name; - int nameLen; - const char *nxt = (quant == XML_CQUANT_NONE - ? next - : next - enc->minBytesPerChar); - int myindex = nextScaffoldPart(parser); - if (myindex < 0) - return XML_ERROR_NO_MEMORY; - dtd->scaffold[myindex].type = XML_CTYPE_NAME; - dtd->scaffold[myindex].quant = quant; - el = getElementType(parser, enc, s, nxt); - if (!el) - return XML_ERROR_NO_MEMORY; - name = el->name; - dtd->scaffold[myindex].name = name; - nameLen = 0; - for (; name[nameLen++]; ); - dtd->contentStringLen += nameLen; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - break; - - case XML_ROLE_GROUP_CLOSE: - quant = XML_CQUANT_NONE; - goto closeGroup; - case XML_ROLE_GROUP_CLOSE_OPT: - quant = XML_CQUANT_OPT; - goto closeGroup; - case XML_ROLE_GROUP_CLOSE_REP: - quant = XML_CQUANT_REP; - goto closeGroup; - case XML_ROLE_GROUP_CLOSE_PLUS: - quant = XML_CQUANT_PLUS; - closeGroup: - if (dtd->in_eldecl) { - if (elementDeclHandler) - handleDefault = XML_FALSE; - dtd->scaffLevel--; - dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel]].quant = quant; - if (dtd->scaffLevel == 0) { - if (!handleDefault) { - XML_Content *model = build_model(parser); - if (!model) - return XML_ERROR_NO_MEMORY; - *eventEndPP = s; - elementDeclHandler(handlerArg, declElementType->name, model); - } - dtd->in_eldecl = XML_FALSE; - dtd->contentStringLen = 0; - } - } - break; - /* End element declaration stuff */ - - case XML_ROLE_PI: - if (!reportProcessingInstruction(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - handleDefault = XML_FALSE; - break; - case XML_ROLE_COMMENT: - if (!reportComment(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - handleDefault = XML_FALSE; - break; - case XML_ROLE_NONE: - switch (tok) { - case XML_TOK_BOM: - handleDefault = XML_FALSE; - break; - } - break; - case XML_ROLE_DOCTYPE_NONE: - if (startDoctypeDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ENTITY_NONE: - if (dtd->keepProcessing && entityDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_NOTATION_NONE: - if (notationDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ATTLIST_NONE: - if (dtd->keepProcessing && attlistDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ELEMENT_NONE: - if (elementDeclHandler) - handleDefault = XML_FALSE; - break; - } /* end of big switch */ - - if (handleDefault && defaultHandler) - reportDefault(parser, enc, s, next); - - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: - s = next; - tok = XmlPrologTok(enc, s, end, &next); - } - } - /* not reached */ -} - -static enum XML_Error PTRCALL -epilogProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - processor = epilogProcessor; - eventPtr = s; - for (;;) { - const char *next = NULL; - int tok = XmlPrologTok(encoding, s, end, &next); - eventEndPtr = next; - switch (tok) { - /* report partial linebreak - it might be the last token */ - case -XML_TOK_PROLOG_S: - if (defaultHandler) { - reportDefault(parser, encoding, s, next); - if (ps_parsing == XML_FINISHED) - return XML_ERROR_ABORTED; - } - *nextPtr = next; - return XML_ERROR_NONE; - case XML_TOK_NONE: - *nextPtr = s; - return XML_ERROR_NONE; - case XML_TOK_PROLOG_S: - if (defaultHandler) - reportDefault(parser, encoding, s, next); - break; - case XML_TOK_PI: - if (!reportProcessingInstruction(parser, encoding, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_COMMENT: - if (!reportComment(parser, encoding, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_INVALID: - eventPtr = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - if (!ps_finalBuffer) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (!ps_finalBuffer) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - default: - return XML_ERROR_JUNK_AFTER_DOC_ELEMENT; - } - eventPtr = s = next; - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: ; - } - } -} - -static enum XML_Error -processInternalEntity(XML_Parser parser, ENTITY *entity, - XML_Bool betweenDecl) -{ - const char *textStart, *textEnd; - const char *next; - enum XML_Error result; - OPEN_INTERNAL_ENTITY *openEntity; - - if (freeInternalEntities) { - openEntity = freeInternalEntities; - freeInternalEntities = openEntity->next; - } - else { - openEntity = (OPEN_INTERNAL_ENTITY *)MALLOC(sizeof(OPEN_INTERNAL_ENTITY)); - if (!openEntity) - return XML_ERROR_NO_MEMORY; - } - entity->open = XML_TRUE; - entity->processed = 0; - openEntity->next = openInternalEntities; - openInternalEntities = openEntity; - openEntity->entity = entity; - openEntity->startTagLevel = tagLevel; - openEntity->betweenDecl = betweenDecl; - openEntity->internalEventPtr = NULL; - openEntity->internalEventEndPtr = NULL; - textStart = (char *)entity->textPtr; - textEnd = (char *)(entity->textPtr + entity->textLen); - -#ifdef XML_DTD - if (entity->is_param) { - int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next); - result = doProlog(parser, internalEncoding, textStart, textEnd, tok, - next, &next, XML_FALSE); - } - else -#endif /* XML_DTD */ - result = doContent(parser, tagLevel, internalEncoding, textStart, - textEnd, &next, XML_FALSE); - - if (result == XML_ERROR_NONE) { - if (textEnd != next && ps_parsing == XML_SUSPENDED) { - entity->processed = (int)(next - textStart); - processor = internalEntityProcessor; - } - else { - entity->open = XML_FALSE; - openInternalEntities = openEntity->next; - /* put openEntity back in list of free instances */ - openEntity->next = freeInternalEntities; - freeInternalEntities = openEntity; - } - } - return result; -} - -static enum XML_Error PTRCALL -internalEntityProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - ENTITY *entity; - const char *textStart, *textEnd; - const char *next; - enum XML_Error result; - OPEN_INTERNAL_ENTITY *openEntity = openInternalEntities; - if (!openEntity) - return XML_ERROR_UNEXPECTED_STATE; - - entity = openEntity->entity; - textStart = ((char *)entity->textPtr) + entity->processed; - textEnd = (char *)(entity->textPtr + entity->textLen); - -#ifdef XML_DTD - if (entity->is_param) { - int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next); - result = doProlog(parser, internalEncoding, textStart, textEnd, tok, - next, &next, XML_FALSE); - } - else -#endif /* XML_DTD */ - result = doContent(parser, openEntity->startTagLevel, internalEncoding, - textStart, textEnd, &next, XML_FALSE); - - if (result != XML_ERROR_NONE) - return result; - else if (textEnd != next && ps_parsing == XML_SUSPENDED) { - entity->processed = (int)(next - (char *)entity->textPtr); - return result; - } - else { - entity->open = XML_FALSE; - openInternalEntities = openEntity->next; - /* put openEntity back in list of free instances */ - openEntity->next = freeInternalEntities; - freeInternalEntities = openEntity; - } - -#ifdef XML_DTD - if (entity->is_param) { - int tok; - processor = prologProcessor; - tok = XmlPrologTok(encoding, s, end, &next); - return doProlog(parser, encoding, s, end, tok, next, nextPtr, - (XML_Bool)!ps_finalBuffer); - } - else -#endif /* XML_DTD */ - { - processor = contentProcessor; - /* see externalEntityContentProcessor vs contentProcessor */ - return doContent(parser, parentParser ? 1 : 0, encoding, s, end, - nextPtr, (XML_Bool)!ps_finalBuffer); - } -} - -static enum XML_Error PTRCALL -errorProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - return errorCode; -} - -static enum XML_Error -storeAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, - const char *ptr, const char *end, - STRING_POOL *pool) -{ - enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr, - end, pool); - if (result) - return result; - if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20) - poolChop(pool); - if (!poolAppendChar(pool, XML_T('\0'))) - return XML_ERROR_NO_MEMORY; - return XML_ERROR_NONE; -} - -static enum XML_Error -appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, - const char *ptr, const char *end, - STRING_POOL *pool) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - for (;;) { - const char *next; - int tok = XmlAttributeValueTok(enc, ptr, end, &next); - switch (tok) { - case XML_TOK_NONE: - return XML_ERROR_NONE; - case XML_TOK_INVALID: - if (enc == encoding) - eventPtr = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_CHAR_REF: - { - XML_Char buf[XML_ENCODE_MAX]; - int i; - int n = XmlCharRefNumber(enc, ptr); - if (n < 0) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BAD_CHAR_REF; - } - if (!isCdata - && n == 0x20 /* space */ - && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) - break; - n = XmlEncode(n, (ICHAR *)buf); - if (!n) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BAD_CHAR_REF; - } - for (i = 0; i < n; i++) { - if (!poolAppendChar(pool, buf[i])) - return XML_ERROR_NO_MEMORY; - } - } - break; - case XML_TOK_DATA_CHARS: - if (!poolAppend(pool, enc, ptr, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_TRAILING_CR: - next = ptr + enc->minBytesPerChar; - /* fall through */ - case XML_TOK_ATTRIBUTE_VALUE_S: - case XML_TOK_DATA_NEWLINE: - if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) - break; - if (!poolAppendChar(pool, 0x20)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_ENTITY_REF: - { - const XML_Char *name; - ENTITY *entity; - char checkEntityDecl; - XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc, - ptr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (ch) { - if (!poolAppendChar(pool, ch)) - return XML_ERROR_NO_MEMORY; - break; - } - name = poolStoreString(&temp2Pool, enc, - ptr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0); - poolDiscard(&temp2Pool); - /* First, determine if a check for an existing declaration is needed; - if yes, check that the entity exists, and that it is internal. - */ - if (pool == &dtd->pool) /* are we called from prolog? */ - checkEntityDecl = -#ifdef XML_DTD - prologState.documentEntity && -#endif /* XML_DTD */ - (dtd->standalone - ? !openInternalEntities - : !dtd->hasParamEntityRefs); - else /* if (pool == &tempPool): we are called from content */ - checkEntityDecl = !dtd->hasParamEntityRefs || dtd->standalone; - if (checkEntityDecl) { - if (!entity) - return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; - } - else if (!entity) { - /* Cannot report skipped entity here - see comments on - skippedEntityHandler. - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, name, 0); - */ - /* Cannot call the default handler because this would be - out of sync with the call to the startElementHandler. - if ((pool == &tempPool) && defaultHandler) - reportDefault(parser, enc, ptr, next); - */ - break; - } - if (entity->open) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_RECURSIVE_ENTITY_REF; - } - if (entity->notation) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BINARY_ENTITY_REF; - } - if (!entity->textPtr) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF; - } - else { - enum XML_Error result; - const XML_Char *textEnd = entity->textPtr + entity->textLen; - entity->open = XML_TRUE; - result = appendAttributeValue(parser, internalEncoding, isCdata, - (char *)entity->textPtr, - (char *)textEnd, pool); - entity->open = XML_FALSE; - if (result) - return result; - } - } - break; - default: - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_UNEXPECTED_STATE; - } - ptr = next; - } - /* not reached */ -} - -static enum XML_Error -storeEntityValue(XML_Parser parser, - const ENCODING *enc, - const char *entityTextPtr, - const char *entityTextEnd) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - STRING_POOL *pool = &(dtd->entityValuePool); - enum XML_Error result = XML_ERROR_NONE; -#ifdef XML_DTD - int oldInEntityValue = prologState.inEntityValue; - prologState.inEntityValue = 1; -#endif /* XML_DTD */ - /* never return Null for the value argument in EntityDeclHandler, - since this would indicate an external entity; therefore we - have to make sure that entityValuePool.start is not null */ - if (!pool->blocks) { - if (!poolGrow(pool)) - return XML_ERROR_NO_MEMORY; - } - - for (;;) { - const char *next; - int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next); - switch (tok) { - case XML_TOK_PARAM_ENTITY_REF: -#ifdef XML_DTD - if (isParamEntity || enc != encoding) { - const XML_Char *name; - ENTITY *entity; - name = poolStoreString(&tempPool, enc, - entityTextPtr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - entity = (ENTITY *)lookup(parser, &dtd->paramEntities, name, 0); - poolDiscard(&tempPool); - if (!entity) { - /* not a well-formedness error - see XML 1.0: WFC Entity Declared */ - /* cannot report skipped entity here - see comments on - skippedEntityHandler - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, name, 0); - */ - dtd->keepProcessing = dtd->standalone; - goto endEntityValue; - } - if (entity->open) { - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_RECURSIVE_ENTITY_REF; - goto endEntityValue; - } - if (entity->systemId) { - if (externalEntityRefHandler) { - dtd->paramEntityRead = XML_FALSE; - entity->open = XML_TRUE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) { - entity->open = XML_FALSE; - result = XML_ERROR_EXTERNAL_ENTITY_HANDLING; - goto endEntityValue; - } - entity->open = XML_FALSE; - if (!dtd->paramEntityRead) - dtd->keepProcessing = dtd->standalone; - } - else - dtd->keepProcessing = dtd->standalone; - } - else { - entity->open = XML_TRUE; - result = storeEntityValue(parser, - internalEncoding, - (char *)entity->textPtr, - (char *)(entity->textPtr - + entity->textLen)); - entity->open = XML_FALSE; - if (result) - goto endEntityValue; - } - break; - } -#endif /* XML_DTD */ - /* In the internal subset, PE references are not legal - within markup declarations, e.g entity values in this case. */ - eventPtr = entityTextPtr; - result = XML_ERROR_PARAM_ENTITY_REF; - goto endEntityValue; - case XML_TOK_NONE: - result = XML_ERROR_NONE; - goto endEntityValue; - case XML_TOK_ENTITY_REF: - case XML_TOK_DATA_CHARS: - if (!poolAppend(pool, enc, entityTextPtr, next)) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - break; - case XML_TOK_TRAILING_CR: - next = entityTextPtr + enc->minBytesPerChar; - /* fall through */ - case XML_TOK_DATA_NEWLINE: - if (pool->end == pool->ptr && !poolGrow(pool)) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - *(pool->ptr)++ = 0xA; - break; - case XML_TOK_CHAR_REF: - { - XML_Char buf[XML_ENCODE_MAX]; - int i; - int n = XmlCharRefNumber(enc, entityTextPtr); - if (n < 0) { - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_BAD_CHAR_REF; - goto endEntityValue; - } - n = XmlEncode(n, (ICHAR *)buf); - if (!n) { - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_BAD_CHAR_REF; - goto endEntityValue; - } - for (i = 0; i < n; i++) { - if (pool->end == pool->ptr && !poolGrow(pool)) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - *(pool->ptr)++ = buf[i]; - } - } - break; - case XML_TOK_PARTIAL: - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_INVALID_TOKEN; - goto endEntityValue; - case XML_TOK_INVALID: - if (enc == encoding) - eventPtr = next; - result = XML_ERROR_INVALID_TOKEN; - goto endEntityValue; - default: - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_UNEXPECTED_STATE; - goto endEntityValue; - } - entityTextPtr = next; - } -endEntityValue: -#ifdef XML_DTD - prologState.inEntityValue = oldInEntityValue; -#endif /* XML_DTD */ - return result; -} - -static void FASTCALL -normalizeLines(XML_Char *s) -{ - XML_Char *p; - for (;; s++) { - if (*s == XML_T('\0')) - return; - if (*s == 0xD) - break; - } - p = s; - do { - if (*s == 0xD) { - *p++ = 0xA; - if (*++s == 0xA) - s++; - } - else - *p++ = *s++; - } while (*s); - *p = XML_T('\0'); -} - -static int -reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end) -{ - const XML_Char *target; - XML_Char *data; - const char *tem; - if (!processingInstructionHandler) { - if (defaultHandler) - reportDefault(parser, enc, start, end); - return 1; - } - start += enc->minBytesPerChar * 2; - tem = start + XmlNameLength(enc, start); - target = poolStoreString(&tempPool, enc, start, tem); - if (!target) - return 0; - poolFinish(&tempPool); - data = poolStoreString(&tempPool, enc, - XmlSkipS(enc, tem), - end - enc->minBytesPerChar*2); - if (!data) - return 0; - normalizeLines(data); - processingInstructionHandler(handlerArg, target, data); - poolClear(&tempPool); - return 1; -} - -static int -reportComment(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end) -{ - XML_Char *data; - if (!commentHandler) { - if (defaultHandler) - reportDefault(parser, enc, start, end); - return 1; - } - data = poolStoreString(&tempPool, - enc, - start + enc->minBytesPerChar * 4, - end - enc->minBytesPerChar * 3); - if (!data) - return 0; - normalizeLines(data); - commentHandler(handlerArg, data); - poolClear(&tempPool); - return 1; -} - -static void -reportDefault(XML_Parser parser, const ENCODING *enc, - const char *s, const char *end) -{ - if (MUST_CONVERT(enc, s)) { - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - do { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = s; - defaultHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf)); - *eventPP = s; - } while (s != end); - } - else - defaultHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s)); -} - - -static int -defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, XML_Bool isCdata, - XML_Bool isId, const XML_Char *value, XML_Parser parser) -{ - DEFAULT_ATTRIBUTE *att; - if (value || isId) { - /* The handling of default attributes gets messed up if we have - a default which duplicates a non-default. */ - int i; - for (i = 0; i < type->nDefaultAtts; i++) - if (attId == type->defaultAtts[i].id) - return 1; - if (isId && !type->idAtt && !attId->xmlns) - type->idAtt = attId; - } - if (type->nDefaultAtts == type->allocDefaultAtts) { - if (type->allocDefaultAtts == 0) { - type->allocDefaultAtts = 8; - type->defaultAtts = (DEFAULT_ATTRIBUTE *)MALLOC(type->allocDefaultAtts - * sizeof(DEFAULT_ATTRIBUTE)); - if (!type->defaultAtts) - return 0; - } - else { - DEFAULT_ATTRIBUTE *temp; - int count = type->allocDefaultAtts * 2; - temp = (DEFAULT_ATTRIBUTE *) - REALLOC(type->defaultAtts, (count * sizeof(DEFAULT_ATTRIBUTE))); - if (temp == NULL) - return 0; - type->allocDefaultAtts = count; - type->defaultAtts = temp; - } - } - att = type->defaultAtts + type->nDefaultAtts; - att->id = attId; - att->value = value; - att->isCdata = isCdata; - if (!isCdata) - attId->maybeTokenized = XML_TRUE; - type->nDefaultAtts += 1; - return 1; -} - -static int -setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - const XML_Char *name; - for (name = elementType->name; *name; name++) { - if (*name == XML_T(ASCII_COLON)) { - PREFIX *prefix; - const XML_Char *s; - for (s = elementType->name; s != name; s++) { - if (!poolAppendChar(&dtd->pool, *s)) - return 0; - } - if (!poolAppendChar(&dtd->pool, XML_T('\0'))) - return 0; - prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool), - sizeof(PREFIX)); - if (!prefix) - return 0; - if (prefix->name == poolStart(&dtd->pool)) - poolFinish(&dtd->pool); - else - poolDiscard(&dtd->pool); - elementType->prefix = prefix; - - } - } - return 1; -} - -static ATTRIBUTE_ID * -getAttributeId(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - ATTRIBUTE_ID *id; - const XML_Char *name; - if (!poolAppendChar(&dtd->pool, XML_T('\0'))) - return NULL; - name = poolStoreString(&dtd->pool, enc, start, end); - if (!name) - return NULL; - /* skip quotation mark - its storage will be re-used (like in name[-1]) */ - ++name; - id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, name, sizeof(ATTRIBUTE_ID)); - if (!id) - return NULL; - if (id->name != name) - poolDiscard(&dtd->pool); - else { - poolFinish(&dtd->pool); - if (!ns) - ; - else if (name[0] == XML_T(ASCII_x) - && name[1] == XML_T(ASCII_m) - && name[2] == XML_T(ASCII_l) - && name[3] == XML_T(ASCII_n) - && name[4] == XML_T(ASCII_s) - && (name[5] == XML_T('\0') || name[5] == XML_T(ASCII_COLON))) { - if (name[5] == XML_T('\0')) - id->prefix = &dtd->defaultPrefix; - else - id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, name + 6, sizeof(PREFIX)); - id->xmlns = XML_TRUE; - } - else { - int i; - for (i = 0; name[i]; i++) { - /* attributes without prefix are *not* in the default namespace */ - if (name[i] == XML_T(ASCII_COLON)) { - int j; - for (j = 0; j < i; j++) { - if (!poolAppendChar(&dtd->pool, name[j])) - return NULL; - } - if (!poolAppendChar(&dtd->pool, XML_T('\0'))) - return NULL; - id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool), - sizeof(PREFIX)); - if (id->prefix->name == poolStart(&dtd->pool)) - poolFinish(&dtd->pool); - else - poolDiscard(&dtd->pool); - break; - } - } - } - } - return id; -} - -#define CONTEXT_SEP XML_T(ASCII_FF) - -static const XML_Char * -getContext(XML_Parser parser) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - HASH_TABLE_ITER iter; - XML_Bool needSep = XML_FALSE; - - if (dtd->defaultPrefix.binding) { - int i; - int len; - if (!poolAppendChar(&tempPool, XML_T(ASCII_EQUALS))) - return NULL; - len = dtd->defaultPrefix.binding->uriLen; - if (namespaceSeparator) - len--; - for (i = 0; i < len; i++) - if (!poolAppendChar(&tempPool, dtd->defaultPrefix.binding->uri[i])) - return NULL; - needSep = XML_TRUE; - } - - hashTableIterInit(&iter, &(dtd->prefixes)); - for (;;) { - int i; - int len; - const XML_Char *s; - PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter); - if (!prefix) - break; - if (!prefix->binding) - continue; - if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) - return NULL; - for (s = prefix->name; *s; s++) - if (!poolAppendChar(&tempPool, *s)) - return NULL; - if (!poolAppendChar(&tempPool, XML_T(ASCII_EQUALS))) - return NULL; - len = prefix->binding->uriLen; - if (namespaceSeparator) - len--; - for (i = 0; i < len; i++) - if (!poolAppendChar(&tempPool, prefix->binding->uri[i])) - return NULL; - needSep = XML_TRUE; - } - - - hashTableIterInit(&iter, &(dtd->generalEntities)); - for (;;) { - const XML_Char *s; - ENTITY *e = (ENTITY *)hashTableIterNext(&iter); - if (!e) - break; - if (!e->open) - continue; - if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) - return NULL; - for (s = e->name; *s; s++) - if (!poolAppendChar(&tempPool, *s)) - return 0; - needSep = XML_TRUE; - } - - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return NULL; - return tempPool.start; -} - -static XML_Bool -setContext(XML_Parser parser, const XML_Char *context) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - const XML_Char *s = context; - - while (*context != XML_T('\0')) { - if (*s == CONTEXT_SEP || *s == XML_T('\0')) { - ENTITY *e; - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return XML_FALSE; - e = (ENTITY *)lookup(parser, &dtd->generalEntities, poolStart(&tempPool), 0); - if (e) - e->open = XML_TRUE; - if (*s != XML_T('\0')) - s++; - context = s; - poolDiscard(&tempPool); - } - else if (*s == XML_T(ASCII_EQUALS)) { - PREFIX *prefix; - if (poolLength(&tempPool) == 0) - prefix = &dtd->defaultPrefix; - else { - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return XML_FALSE; - prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&tempPool), - sizeof(PREFIX)); - if (!prefix) - return XML_FALSE; - if (prefix->name == poolStart(&tempPool)) { - prefix->name = poolCopyString(&dtd->pool, prefix->name); - if (!prefix->name) - return XML_FALSE; - } - poolDiscard(&tempPool); - } - for (context = s + 1; - *context != CONTEXT_SEP && *context != XML_T('\0'); - context++) - if (!poolAppendChar(&tempPool, *context)) - return XML_FALSE; - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return XML_FALSE; - if (addBinding(parser, prefix, NULL, poolStart(&tempPool), - &inheritedBindings) != XML_ERROR_NONE) - return XML_FALSE; - poolDiscard(&tempPool); - if (*context != XML_T('\0')) - ++context; - s = context; - } - else { - if (!poolAppendChar(&tempPool, *s)) - return XML_FALSE; - s++; - } - } - return XML_TRUE; -} - -static void FASTCALL -normalizePublicId(XML_Char *publicId) -{ - XML_Char *p = publicId; - XML_Char *s; - for (s = publicId; *s; s++) { - switch (*s) { - case 0x20: - case 0xD: - case 0xA: - if (p != publicId && p[-1] != 0x20) - *p++ = 0x20; - break; - default: - *p++ = *s; - } - } - if (p != publicId && p[-1] == 0x20) - --p; - *p = XML_T('\0'); -} - -static DTD * -dtdCreate(const XML_Memory_Handling_Suite *ms) -{ - DTD *p = (DTD *)ms->malloc_fcn(sizeof(DTD)); - if (p == NULL) - return p; - poolInit(&(p->pool), ms); - poolInit(&(p->entityValuePool), ms); - hashTableInit(&(p->generalEntities), ms); - hashTableInit(&(p->elementTypes), ms); - hashTableInit(&(p->attributeIds), ms); - hashTableInit(&(p->prefixes), ms); -#ifdef XML_DTD - p->paramEntityRead = XML_FALSE; - hashTableInit(&(p->paramEntities), ms); -#endif /* XML_DTD */ - p->defaultPrefix.name = NULL; - p->defaultPrefix.binding = NULL; - - p->in_eldecl = XML_FALSE; - p->scaffIndex = NULL; - p->scaffold = NULL; - p->scaffLevel = 0; - p->scaffSize = 0; - p->scaffCount = 0; - p->contentStringLen = 0; - - p->keepProcessing = XML_TRUE; - p->hasParamEntityRefs = XML_FALSE; - p->standalone = XML_FALSE; - return p; -} - -static void -dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms) -{ - HASH_TABLE_ITER iter; - hashTableIterInit(&iter, &(p->elementTypes)); - for (;;) { - ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!e) - break; - if (e->allocDefaultAtts != 0) - ms->free_fcn(e->defaultAtts); - } - hashTableClear(&(p->generalEntities)); -#ifdef XML_DTD - p->paramEntityRead = XML_FALSE; - hashTableClear(&(p->paramEntities)); -#endif /* XML_DTD */ - hashTableClear(&(p->elementTypes)); - hashTableClear(&(p->attributeIds)); - hashTableClear(&(p->prefixes)); - poolClear(&(p->pool)); - poolClear(&(p->entityValuePool)); - p->defaultPrefix.name = NULL; - p->defaultPrefix.binding = NULL; - - p->in_eldecl = XML_FALSE; - - ms->free_fcn(p->scaffIndex); - p->scaffIndex = NULL; - ms->free_fcn(p->scaffold); - p->scaffold = NULL; - - p->scaffLevel = 0; - p->scaffSize = 0; - p->scaffCount = 0; - p->contentStringLen = 0; - - p->keepProcessing = XML_TRUE; - p->hasParamEntityRefs = XML_FALSE; - p->standalone = XML_FALSE; -} - -static void -dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms) -{ - HASH_TABLE_ITER iter; - hashTableIterInit(&iter, &(p->elementTypes)); - for (;;) { - ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!e) - break; - if (e->allocDefaultAtts != 0) - ms->free_fcn(e->defaultAtts); - } - hashTableDestroy(&(p->generalEntities)); -#ifdef XML_DTD - hashTableDestroy(&(p->paramEntities)); -#endif /* XML_DTD */ - hashTableDestroy(&(p->elementTypes)); - hashTableDestroy(&(p->attributeIds)); - hashTableDestroy(&(p->prefixes)); - poolDestroy(&(p->pool)); - poolDestroy(&(p->entityValuePool)); - if (isDocEntity) { - ms->free_fcn(p->scaffIndex); - ms->free_fcn(p->scaffold); - } - ms->free_fcn(p); -} - -/* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise. - The new DTD has already been initialized. -*/ -static int -dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms) -{ - HASH_TABLE_ITER iter; - - /* Copy the prefix table. */ - - hashTableIterInit(&iter, &(oldDtd->prefixes)); - for (;;) { - const XML_Char *name; - const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter); - if (!oldP) - break; - name = poolCopyString(&(newDtd->pool), oldP->name); - if (!name) - return 0; - if (!lookup(oldParser, &(newDtd->prefixes), name, sizeof(PREFIX))) - return 0; - } - - hashTableIterInit(&iter, &(oldDtd->attributeIds)); - - /* Copy the attribute id table. */ - - for (;;) { - ATTRIBUTE_ID *newA; - const XML_Char *name; - const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter); - - if (!oldA) - break; - /* Remember to allocate the scratch byte before the name. */ - if (!poolAppendChar(&(newDtd->pool), XML_T('\0'))) - return 0; - name = poolCopyString(&(newDtd->pool), oldA->name); - if (!name) - return 0; - ++name; - newA = (ATTRIBUTE_ID *)lookup(oldParser, &(newDtd->attributeIds), name, - sizeof(ATTRIBUTE_ID)); - if (!newA) - return 0; - newA->maybeTokenized = oldA->maybeTokenized; - if (oldA->prefix) { - newA->xmlns = oldA->xmlns; - if (oldA->prefix == &oldDtd->defaultPrefix) - newA->prefix = &newDtd->defaultPrefix; - else - newA->prefix = (PREFIX *)lookup(oldParser, &(newDtd->prefixes), - oldA->prefix->name, 0); - } - } - - /* Copy the element type table. */ - - hashTableIterInit(&iter, &(oldDtd->elementTypes)); - - for (;;) { - int i; - ELEMENT_TYPE *newE; - const XML_Char *name; - const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!oldE) - break; - name = poolCopyString(&(newDtd->pool), oldE->name); - if (!name) - return 0; - newE = (ELEMENT_TYPE *)lookup(oldParser, &(newDtd->elementTypes), name, - sizeof(ELEMENT_TYPE)); - if (!newE) - return 0; - if (oldE->nDefaultAtts) { - newE->defaultAtts = (DEFAULT_ATTRIBUTE *) - ms->malloc_fcn(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE)); - if (!newE->defaultAtts) { - ms->free_fcn(newE); - return 0; - } - } - if (oldE->idAtt) - newE->idAtt = (ATTRIBUTE_ID *) - lookup(oldParser, &(newDtd->attributeIds), oldE->idAtt->name, 0); - newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts; - if (oldE->prefix) - newE->prefix = (PREFIX *)lookup(oldParser, &(newDtd->prefixes), - oldE->prefix->name, 0); - for (i = 0; i < newE->nDefaultAtts; i++) { - newE->defaultAtts[i].id = (ATTRIBUTE_ID *) - lookup(oldParser, &(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0); - newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata; - if (oldE->defaultAtts[i].value) { - newE->defaultAtts[i].value - = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value); - if (!newE->defaultAtts[i].value) - return 0; - } - else - newE->defaultAtts[i].value = NULL; - } - } - - /* Copy the entity tables. */ - if (!copyEntityTable(oldParser, - &(newDtd->generalEntities), - &(newDtd->pool), - &(oldDtd->generalEntities))) - return 0; - -#ifdef XML_DTD - if (!copyEntityTable(oldParser, - &(newDtd->paramEntities), - &(newDtd->pool), - &(oldDtd->paramEntities))) - return 0; - newDtd->paramEntityRead = oldDtd->paramEntityRead; -#endif /* XML_DTD */ - - newDtd->keepProcessing = oldDtd->keepProcessing; - newDtd->hasParamEntityRefs = oldDtd->hasParamEntityRefs; - newDtd->standalone = oldDtd->standalone; - - /* Don't want deep copying for scaffolding */ - newDtd->in_eldecl = oldDtd->in_eldecl; - newDtd->scaffold = oldDtd->scaffold; - newDtd->contentStringLen = oldDtd->contentStringLen; - newDtd->scaffSize = oldDtd->scaffSize; - newDtd->scaffLevel = oldDtd->scaffLevel; - newDtd->scaffIndex = oldDtd->scaffIndex; - - return 1; -} /* End dtdCopy */ - -static int -copyEntityTable(XML_Parser oldParser, - HASH_TABLE *newTable, - STRING_POOL *newPool, - const HASH_TABLE *oldTable) -{ - HASH_TABLE_ITER iter; - const XML_Char *cachedOldBase = NULL; - const XML_Char *cachedNewBase = NULL; - - hashTableIterInit(&iter, oldTable); - - for (;;) { - ENTITY *newE; - const XML_Char *name; - const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter); - if (!oldE) - break; - name = poolCopyString(newPool, oldE->name); - if (!name) - return 0; - newE = (ENTITY *)lookup(oldParser, newTable, name, sizeof(ENTITY)); - if (!newE) - return 0; - if (oldE->systemId) { - const XML_Char *tem = poolCopyString(newPool, oldE->systemId); - if (!tem) - return 0; - newE->systemId = tem; - if (oldE->base) { - if (oldE->base == cachedOldBase) - newE->base = cachedNewBase; - else { - cachedOldBase = oldE->base; - tem = poolCopyString(newPool, cachedOldBase); - if (!tem) - return 0; - cachedNewBase = newE->base = tem; - } - } - if (oldE->publicId) { - tem = poolCopyString(newPool, oldE->publicId); - if (!tem) - return 0; - newE->publicId = tem; - } - } - else { - const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr, - oldE->textLen); - if (!tem) - return 0; - newE->textPtr = tem; - newE->textLen = oldE->textLen; - } - if (oldE->notation) { - const XML_Char *tem = poolCopyString(newPool, oldE->notation); - if (!tem) - return 0; - newE->notation = tem; - } - newE->is_param = oldE->is_param; - newE->is_internal = oldE->is_internal; - } - return 1; -} - -#define INIT_POWER 6 - -static XML_Bool FASTCALL -keyeq(KEY s1, KEY s2) -{ - for (; *s1 == *s2; s1++, s2++) - if (*s1 == 0) - return XML_TRUE; - return XML_FALSE; -} - -static unsigned long FASTCALL -hash(XML_Parser parser, KEY s) -{ - unsigned long h = hash_secret_salt; - while (*s) - h = CHAR_HASH(h, *s++); - return h; -} - -static NAMED * -lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize) -{ - size_t i; - if (table->size == 0) { - size_t tsize; - if (!createSize) - return NULL; - table->power = INIT_POWER; - /* table->size is a power of 2 */ - table->size = (size_t)1 << INIT_POWER; - tsize = table->size * sizeof(NAMED *); - table->v = (NAMED **)table->mem->malloc_fcn(tsize); - if (!table->v) { - table->size = 0; - return NULL; - } - memset(table->v, 0, tsize); - i = hash(parser, name) & ((unsigned long)table->size - 1); - } - else { - unsigned long h = hash(parser, name); - unsigned long mask = (unsigned long)table->size - 1; - unsigned char step = 0; - i = h & mask; - while (table->v[i]) { - if (keyeq(name, table->v[i]->name)) - return table->v[i]; - if (!step) - step = PROBE_STEP(h, mask, table->power); - i < step ? (i += table->size - step) : (i -= step); - } - if (!createSize) - return NULL; - - /* check for overflow (table is half full) */ - if (table->used >> (table->power - 1)) { - unsigned char newPower = table->power + 1; - size_t newSize = (size_t)1 << newPower; - unsigned long newMask = (unsigned long)newSize - 1; - size_t tsize = newSize * sizeof(NAMED *); - NAMED **newV = (NAMED **)table->mem->malloc_fcn(tsize); - if (!newV) - return NULL; - memset(newV, 0, tsize); - for (i = 0; i < table->size; i++) - if (table->v[i]) { - unsigned long newHash = hash(parser, table->v[i]->name); - size_t j = newHash & newMask; - step = 0; - while (newV[j]) { - if (!step) - step = PROBE_STEP(newHash, newMask, newPower); - j < step ? (j += newSize - step) : (j -= step); - } - newV[j] = table->v[i]; - } - table->mem->free_fcn(table->v); - table->v = newV; - table->power = newPower; - table->size = newSize; - i = h & newMask; - step = 0; - while (table->v[i]) { - if (!step) - step = PROBE_STEP(h, newMask, newPower); - i < step ? (i += newSize - step) : (i -= step); - } - } - } - table->v[i] = (NAMED *)table->mem->malloc_fcn(createSize); - if (!table->v[i]) - return NULL; - memset(table->v[i], 0, createSize); - table->v[i]->name = name; - (table->used)++; - return table->v[i]; -} - -static void FASTCALL -hashTableClear(HASH_TABLE *table) -{ - size_t i; - for (i = 0; i < table->size; i++) { - table->mem->free_fcn(table->v[i]); - table->v[i] = NULL; - } - table->used = 0; -} - -static void FASTCALL -hashTableDestroy(HASH_TABLE *table) -{ - size_t i; - for (i = 0; i < table->size; i++) - table->mem->free_fcn(table->v[i]); - table->mem->free_fcn(table->v); -} - -static void FASTCALL -hashTableInit(HASH_TABLE *p, const XML_Memory_Handling_Suite *ms) -{ - p->power = 0; - p->size = 0; - p->used = 0; - p->v = NULL; - p->mem = ms; -} - -static void FASTCALL -hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) -{ - iter->p = table->v; - iter->end = iter->p + table->size; -} - -static NAMED * FASTCALL -hashTableIterNext(HASH_TABLE_ITER *iter) -{ - while (iter->p != iter->end) { - NAMED *tem = *(iter->p)++; - if (tem) - return tem; - } - return NULL; -} - -static void FASTCALL -poolInit(STRING_POOL *pool, const XML_Memory_Handling_Suite *ms) -{ - pool->blocks = NULL; - pool->freeBlocks = NULL; - pool->start = NULL; - pool->ptr = NULL; - pool->end = NULL; - pool->mem = ms; -} - -static void FASTCALL -poolClear(STRING_POOL *pool) -{ - if (!pool->freeBlocks) - pool->freeBlocks = pool->blocks; - else { - BLOCK *p = pool->blocks; - while (p) { - BLOCK *tem = p->next; - p->next = pool->freeBlocks; - pool->freeBlocks = p; - p = tem; - } - } - pool->blocks = NULL; - pool->start = NULL; - pool->ptr = NULL; - pool->end = NULL; -} - -static void FASTCALL -poolDestroy(STRING_POOL *pool) -{ - BLOCK *p = pool->blocks; - while (p) { - BLOCK *tem = p->next; - pool->mem->free_fcn(p); - p = tem; - } - p = pool->freeBlocks; - while (p) { - BLOCK *tem = p->next; - pool->mem->free_fcn(p); - p = tem; - } -} - -static XML_Char * -poolAppend(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end) -{ - if (!pool->ptr && !poolGrow(pool)) - return NULL; - for (;;) { - XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end); - if (ptr == end) - break; - if (!poolGrow(pool)) - return NULL; - } - return pool->start; -} - -static const XML_Char * FASTCALL -poolCopyString(STRING_POOL *pool, const XML_Char *s) -{ - do { - if (!poolAppendChar(pool, *s)) - return NULL; - } while (*s++); - s = pool->start; - poolFinish(pool); - return s; -} - -static const XML_Char * -poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) -{ - if (!pool->ptr && !poolGrow(pool)) - return NULL; - for (; n > 0; --n, s++) { - if (!poolAppendChar(pool, *s)) - return NULL; - } - s = pool->start; - poolFinish(pool); - return s; -} - -static const XML_Char * FASTCALL -poolAppendString(STRING_POOL *pool, const XML_Char *s) -{ - while (*s) { - if (!poolAppendChar(pool, *s)) - return NULL; - s++; - } - return pool->start; -} - -static XML_Char * -poolStoreString(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end) -{ - if (!poolAppend(pool, enc, ptr, end)) - return NULL; - if (pool->ptr == pool->end && !poolGrow(pool)) - return NULL; - *(pool->ptr)++ = 0; - return pool->start; -} - -static XML_Bool FASTCALL -poolGrow(STRING_POOL *pool) -{ - if (pool->freeBlocks) { - if (pool->start == 0) { - pool->blocks = pool->freeBlocks; - pool->freeBlocks = pool->freeBlocks->next; - pool->blocks->next = NULL; - pool->start = pool->blocks->s; - pool->end = pool->start + pool->blocks->size; - pool->ptr = pool->start; - return XML_TRUE; - } - if (pool->end - pool->start < pool->freeBlocks->size) { - BLOCK *tem = pool->freeBlocks->next; - pool->freeBlocks->next = pool->blocks; - pool->blocks = pool->freeBlocks; - pool->freeBlocks = tem; - memcpy(pool->blocks->s, pool->start, - (pool->end - pool->start) * sizeof(XML_Char)); - pool->ptr = pool->blocks->s + (pool->ptr - pool->start); - pool->start = pool->blocks->s; - pool->end = pool->start + pool->blocks->size; - return XML_TRUE; - } - } - if (pool->blocks && pool->start == pool->blocks->s) { - int blockSize = (int)(pool->end - pool->start)*2; - BLOCK *temp = (BLOCK *) - pool->mem->realloc_fcn(pool->blocks, - (offsetof(BLOCK, s) - + blockSize * sizeof(XML_Char))); - if (temp == NULL) - return XML_FALSE; - pool->blocks = temp; - pool->blocks->size = blockSize; - pool->ptr = pool->blocks->s + (pool->ptr - pool->start); - pool->start = pool->blocks->s; - pool->end = pool->start + blockSize; - } - else { - BLOCK *tem; - int blockSize = (int)(pool->end - pool->start); - if (blockSize < INIT_BLOCK_SIZE) - blockSize = INIT_BLOCK_SIZE; - else - blockSize *= 2; - tem = (BLOCK *)pool->mem->malloc_fcn(offsetof(BLOCK, s) - + blockSize * sizeof(XML_Char)); - if (!tem) - return XML_FALSE; - tem->size = blockSize; - tem->next = pool->blocks; - pool->blocks = tem; - if (pool->ptr != pool->start) - memcpy(tem->s, pool->start, - (pool->ptr - pool->start) * sizeof(XML_Char)); - pool->ptr = tem->s + (pool->ptr - pool->start); - pool->start = tem->s; - pool->end = tem->s + blockSize; - } - return XML_TRUE; -} - -static int FASTCALL -nextScaffoldPart(XML_Parser parser) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - CONTENT_SCAFFOLD * me; - int next; - - if (!dtd->scaffIndex) { - dtd->scaffIndex = (int *)MALLOC(groupSize * sizeof(int)); - if (!dtd->scaffIndex) - return -1; - dtd->scaffIndex[0] = 0; - } - - if (dtd->scaffCount >= dtd->scaffSize) { - CONTENT_SCAFFOLD *temp; - if (dtd->scaffold) { - temp = (CONTENT_SCAFFOLD *) - REALLOC(dtd->scaffold, dtd->scaffSize * 2 * sizeof(CONTENT_SCAFFOLD)); - if (temp == NULL) - return -1; - dtd->scaffSize *= 2; - } - else { - temp = (CONTENT_SCAFFOLD *)MALLOC(INIT_SCAFFOLD_ELEMENTS - * sizeof(CONTENT_SCAFFOLD)); - if (temp == NULL) - return -1; - dtd->scaffSize = INIT_SCAFFOLD_ELEMENTS; - } - dtd->scaffold = temp; - } - next = dtd->scaffCount++; - me = &dtd->scaffold[next]; - if (dtd->scaffLevel) { - CONTENT_SCAFFOLD *parent = &dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel-1]]; - if (parent->lastchild) { - dtd->scaffold[parent->lastchild].nextsib = next; - } - if (!parent->childcnt) - parent->firstchild = next; - parent->lastchild = next; - parent->childcnt++; - } - me->firstchild = me->lastchild = me->childcnt = me->nextsib = 0; - return next; -} - -static void -build_node(XML_Parser parser, - int src_node, - XML_Content *dest, - XML_Content **contpos, - XML_Char **strpos) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - dest->type = dtd->scaffold[src_node].type; - dest->quant = dtd->scaffold[src_node].quant; - if (dest->type == XML_CTYPE_NAME) { - const XML_Char *src; - dest->name = *strpos; - src = dtd->scaffold[src_node].name; - for (;;) { - *(*strpos)++ = *src; - if (!*src) - break; - src++; - } - dest->numchildren = 0; - dest->children = NULL; - } - else { - unsigned int i; - int cn; - dest->numchildren = dtd->scaffold[src_node].childcnt; - dest->children = *contpos; - *contpos += dest->numchildren; - for (i = 0, cn = dtd->scaffold[src_node].firstchild; - i < dest->numchildren; - i++, cn = dtd->scaffold[cn].nextsib) { - build_node(parser, cn, &(dest->children[i]), contpos, strpos); - } - dest->name = NULL; - } -} - -static XML_Content * -build_model (XML_Parser parser) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - XML_Content *ret; - XML_Content *cpos; - XML_Char * str; - int allocsize = (dtd->scaffCount * sizeof(XML_Content) - + (dtd->contentStringLen * sizeof(XML_Char))); - - ret = (XML_Content *)MALLOC(allocsize); - if (!ret) - return NULL; - - str = (XML_Char *) (&ret[dtd->scaffCount]); - cpos = &ret[1]; - - build_node(parser, 0, ret, &cpos, &str); - return ret; -} - -static ELEMENT_TYPE * -getElementType(XML_Parser parser, - const ENCODING *enc, - const char *ptr, - const char *end) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - const XML_Char *name = poolStoreString(&dtd->pool, enc, ptr, end); - ELEMENT_TYPE *ret; - - if (!name) - return NULL; - ret = (ELEMENT_TYPE *) lookup(parser, &dtd->elementTypes, name, sizeof(ELEMENT_TYPE)); - if (!ret) - return NULL; - if (ret->name != name) - poolDiscard(&dtd->pool); - else { - poolFinish(&dtd->pool); - if (!setElementTypePrefix(parser, ret)) - return NULL; - } - return ret; -} diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmlrole.c b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmlrole.c deleted file mode 100644 index 44772e21..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmlrole.c +++ /dev/null @@ -1,1336 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include - -#ifdef COMPILED_FROM_DSP -#include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" -#else -#ifdef HAVE_EXPAT_CONFIG_H -#include -#endif -#endif /* ndef COMPILED_FROM_DSP */ - -#include "expat_external.h" -#include "internal.h" -#include "xmlrole.h" -#include "ascii.h" - -/* Doesn't check: - - that ,| are not mixed in a model group - content of literals - -*/ - -static const char KW_ANY[] = { - ASCII_A, ASCII_N, ASCII_Y, '\0' }; -static const char KW_ATTLIST[] = { - ASCII_A, ASCII_T, ASCII_T, ASCII_L, ASCII_I, ASCII_S, ASCII_T, '\0' }; -static const char KW_CDATA[] = { - ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_DOCTYPE[] = { - ASCII_D, ASCII_O, ASCII_C, ASCII_T, ASCII_Y, ASCII_P, ASCII_E, '\0' }; -static const char KW_ELEMENT[] = { - ASCII_E, ASCII_L, ASCII_E, ASCII_M, ASCII_E, ASCII_N, ASCII_T, '\0' }; -static const char KW_EMPTY[] = { - ASCII_E, ASCII_M, ASCII_P, ASCII_T, ASCII_Y, '\0' }; -static const char KW_ENTITIES[] = { - ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, - '\0' }; -static const char KW_ENTITY[] = { - ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' }; -static const char KW_FIXED[] = { - ASCII_F, ASCII_I, ASCII_X, ASCII_E, ASCII_D, '\0' }; -static const char KW_ID[] = { - ASCII_I, ASCII_D, '\0' }; -static const char KW_IDREF[] = { - ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' }; -static const char KW_IDREFS[] = { - ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' }; -#ifdef XML_DTD -static const char KW_IGNORE[] = { - ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' }; -#endif -static const char KW_IMPLIED[] = { - ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' }; -#ifdef XML_DTD -static const char KW_INCLUDE[] = { - ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' }; -#endif -static const char KW_NDATA[] = { - ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_NMTOKEN[] = { - ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' }; -static const char KW_NMTOKENS[] = { - ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, - '\0' }; -static const char KW_NOTATION[] = - { ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, - '\0' }; -static const char KW_PCDATA[] = { - ASCII_P, ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_PUBLIC[] = { - ASCII_P, ASCII_U, ASCII_B, ASCII_L, ASCII_I, ASCII_C, '\0' }; -static const char KW_REQUIRED[] = { - ASCII_R, ASCII_E, ASCII_Q, ASCII_U, ASCII_I, ASCII_R, ASCII_E, ASCII_D, - '\0' }; -static const char KW_SYSTEM[] = { - ASCII_S, ASCII_Y, ASCII_S, ASCII_T, ASCII_E, ASCII_M, '\0' }; - -#ifndef MIN_BYTES_PER_CHAR -#define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar) -#endif - -#ifdef XML_DTD -#define setTopLevel(state) \ - ((state)->handler = ((state)->documentEntity \ - ? internalSubset \ - : externalSubset1)) -#else /* not XML_DTD */ -#define setTopLevel(state) ((state)->handler = internalSubset) -#endif /* not XML_DTD */ - -typedef int PTRCALL PROLOG_HANDLER(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc); - -static PROLOG_HANDLER - prolog0, prolog1, prolog2, - doctype0, doctype1, doctype2, doctype3, doctype4, doctype5, - internalSubset, - entity0, entity1, entity2, entity3, entity4, entity5, entity6, - entity7, entity8, entity9, entity10, - notation0, notation1, notation2, notation3, notation4, - attlist0, attlist1, attlist2, attlist3, attlist4, attlist5, attlist6, - attlist7, attlist8, attlist9, - element0, element1, element2, element3, element4, element5, element6, - element7, -#ifdef XML_DTD - externalSubset0, externalSubset1, - condSect0, condSect1, condSect2, -#endif /* XML_DTD */ - declClose, - error; - -static int FASTCALL common(PROLOG_STATE *state, int tok); - -static int PTRCALL -prolog0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - state->handler = prolog1; - return XML_ROLE_NONE; - case XML_TOK_XML_DECL: - state->handler = prolog1; - return XML_ROLE_XML_DECL; - case XML_TOK_PI: - state->handler = prolog1; - return XML_ROLE_PI; - case XML_TOK_COMMENT: - state->handler = prolog1; - return XML_ROLE_COMMENT; - case XML_TOK_BOM: - return XML_ROLE_NONE; - case XML_TOK_DECL_OPEN: - if (!XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_DOCTYPE)) - break; - state->handler = doctype0; - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_INSTANCE_START: - state->handler = error; - return XML_ROLE_INSTANCE_START; - } - return common(state, tok); -} - -static int PTRCALL -prolog1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_PI: - return XML_ROLE_PI; - case XML_TOK_COMMENT: - return XML_ROLE_COMMENT; - case XML_TOK_BOM: - return XML_ROLE_NONE; - case XML_TOK_DECL_OPEN: - if (!XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_DOCTYPE)) - break; - state->handler = doctype0; - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_INSTANCE_START: - state->handler = error; - return XML_ROLE_INSTANCE_START; - } - return common(state, tok); -} - -static int PTRCALL -prolog2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_PI: - return XML_ROLE_PI; - case XML_TOK_COMMENT: - return XML_ROLE_COMMENT; - case XML_TOK_INSTANCE_START: - state->handler = error; - return XML_ROLE_INSTANCE_START; - } - return common(state, tok); -} - -static int PTRCALL -doctype0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = doctype1; - return XML_ROLE_DOCTYPE_NAME; - } - return common(state, tok); -} - -static int PTRCALL -doctype1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = internalSubset; - return XML_ROLE_DOCTYPE_INTERNAL_SUBSET; - case XML_TOK_DECL_CLOSE: - state->handler = prolog2; - return XML_ROLE_DOCTYPE_CLOSE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = doctype3; - return XML_ROLE_DOCTYPE_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = doctype2; - return XML_ROLE_DOCTYPE_NONE; - } - break; - } - return common(state, tok); -} - -static int PTRCALL -doctype2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_LITERAL: - state->handler = doctype3; - return XML_ROLE_DOCTYPE_PUBLIC_ID; - } - return common(state, tok); -} - -static int PTRCALL -doctype3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_LITERAL: - state->handler = doctype4; - return XML_ROLE_DOCTYPE_SYSTEM_ID; - } - return common(state, tok); -} - -static int PTRCALL -doctype4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = internalSubset; - return XML_ROLE_DOCTYPE_INTERNAL_SUBSET; - case XML_TOK_DECL_CLOSE: - state->handler = prolog2; - return XML_ROLE_DOCTYPE_CLOSE; - } - return common(state, tok); -} - -static int PTRCALL -doctype5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_DECL_CLOSE: - state->handler = prolog2; - return XML_ROLE_DOCTYPE_CLOSE; - } - return common(state, tok); -} - -static int PTRCALL -internalSubset(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_DECL_OPEN: - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_ENTITY)) { - state->handler = entity0; - return XML_ROLE_ENTITY_NONE; - } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_ATTLIST)) { - state->handler = attlist0; - return XML_ROLE_ATTLIST_NONE; - } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_ELEMENT)) { - state->handler = element0; - return XML_ROLE_ELEMENT_NONE; - } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_NOTATION)) { - state->handler = notation0; - return XML_ROLE_NOTATION_NONE; - } - break; - case XML_TOK_PI: - return XML_ROLE_PI; - case XML_TOK_COMMENT: - return XML_ROLE_COMMENT; - case XML_TOK_PARAM_ENTITY_REF: - return XML_ROLE_PARAM_ENTITY_REF; - case XML_TOK_CLOSE_BRACKET: - state->handler = doctype5; - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_NONE: - return XML_ROLE_NONE; - } - return common(state, tok); -} - -#ifdef XML_DTD - -static int PTRCALL -externalSubset0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - state->handler = externalSubset1; - if (tok == XML_TOK_XML_DECL) - return XML_ROLE_TEXT_DECL; - return externalSubset1(state, tok, ptr, end, enc); -} - -static int PTRCALL -externalSubset1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_COND_SECT_OPEN: - state->handler = condSect0; - return XML_ROLE_NONE; - case XML_TOK_COND_SECT_CLOSE: - if (state->includeLevel == 0) - break; - state->includeLevel -= 1; - return XML_ROLE_NONE; - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_CLOSE_BRACKET: - break; - case XML_TOK_NONE: - if (state->includeLevel) - break; - return XML_ROLE_NONE; - default: - return internalSubset(state, tok, ptr, end, enc); - } - return common(state, tok); -} - -#endif /* XML_DTD */ - -static int PTRCALL -entity0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_PERCENT: - state->handler = entity1; - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - state->handler = entity2; - return XML_ROLE_GENERAL_ENTITY_NAME; - } - return common(state, tok); -} - -static int PTRCALL -entity1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - state->handler = entity7; - return XML_ROLE_PARAM_ENTITY_NAME; - } - return common(state, tok); -} - -static int PTRCALL -entity2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = entity4; - return XML_ROLE_ENTITY_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = entity3; - return XML_ROLE_ENTITY_NONE; - } - break; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_ENTITY_NONE; - return XML_ROLE_ENTITY_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -entity3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity4; - return XML_ROLE_ENTITY_PUBLIC_ID; - } - return common(state, tok); -} - -static int PTRCALL -entity4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity5; - return XML_ROLE_ENTITY_SYSTEM_ID; - } - return common(state, tok); -} - -static int PTRCALL -entity5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_ENTITY_COMPLETE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_NDATA)) { - state->handler = entity6; - return XML_ROLE_ENTITY_NONE; - } - break; - } - return common(state, tok); -} - -static int PTRCALL -entity6(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - state->handler = declClose; - state->role_none = XML_ROLE_ENTITY_NONE; - return XML_ROLE_ENTITY_NOTATION_NAME; - } - return common(state, tok); -} - -static int PTRCALL -entity7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = entity9; - return XML_ROLE_ENTITY_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = entity8; - return XML_ROLE_ENTITY_NONE; - } - break; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_ENTITY_NONE; - return XML_ROLE_ENTITY_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -entity8(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity9; - return XML_ROLE_ENTITY_PUBLIC_ID; - } - return common(state, tok); -} - -static int PTRCALL -entity9(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity10; - return XML_ROLE_ENTITY_SYSTEM_ID; - } - return common(state, tok); -} - -static int PTRCALL -entity10(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_ENTITY_COMPLETE; - } - return common(state, tok); -} - -static int PTRCALL -notation0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_NAME: - state->handler = notation1; - return XML_ROLE_NOTATION_NAME; - } - return common(state, tok); -} - -static int PTRCALL -notation1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = notation3; - return XML_ROLE_NOTATION_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = notation2; - return XML_ROLE_NOTATION_NONE; - } - break; - } - return common(state, tok); -} - -static int PTRCALL -notation2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_LITERAL: - state->handler = notation4; - return XML_ROLE_NOTATION_PUBLIC_ID; - } - return common(state, tok); -} - -static int PTRCALL -notation3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_NOTATION_NONE; - return XML_ROLE_NOTATION_SYSTEM_ID; - } - return common(state, tok); -} - -static int PTRCALL -notation4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_NOTATION_NONE; - return XML_ROLE_NOTATION_SYSTEM_ID; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_NOTATION_NO_SYSTEM_ID; - } - return common(state, tok); -} - -static int PTRCALL -attlist0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = attlist1; - return XML_ROLE_ATTLIST_ELEMENT_NAME; - } - return common(state, tok); -} - -static int PTRCALL -attlist1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = attlist2; - return XML_ROLE_ATTRIBUTE_NAME; - } - return common(state, tok); -} - -static int PTRCALL -attlist2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - { - static const char * const types[] = { - KW_CDATA, - KW_ID, - KW_IDREF, - KW_IDREFS, - KW_ENTITY, - KW_ENTITIES, - KW_NMTOKEN, - KW_NMTOKENS, - }; - int i; - for (i = 0; i < (int)(sizeof(types)/sizeof(types[0])); i++) - if (XmlNameMatchesAscii(enc, ptr, end, types[i])) { - state->handler = attlist8; - return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i; - } - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_NOTATION)) { - state->handler = attlist5; - return XML_ROLE_ATTLIST_NONE; - } - break; - case XML_TOK_OPEN_PAREN: - state->handler = attlist3; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -static int PTRCALL -attlist3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NMTOKEN: - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = attlist4; - return XML_ROLE_ATTRIBUTE_ENUM_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -attlist4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_CLOSE_PAREN: - state->handler = attlist8; - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_OR: - state->handler = attlist3; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -static int PTRCALL -attlist5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_OPEN_PAREN: - state->handler = attlist6; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -static int PTRCALL -attlist6(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - state->handler = attlist7; - return XML_ROLE_ATTRIBUTE_NOTATION_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -attlist7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_CLOSE_PAREN: - state->handler = attlist8; - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_OR: - state->handler = attlist6; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -/* default value */ -static int PTRCALL -attlist8(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_POUND_NAME: - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_IMPLIED)) { - state->handler = attlist1; - return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE; - } - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_REQUIRED)) { - state->handler = attlist1; - return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE; - } - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_FIXED)) { - state->handler = attlist9; - return XML_ROLE_ATTLIST_NONE; - } - break; - case XML_TOK_LITERAL: - state->handler = attlist1; - return XML_ROLE_DEFAULT_ATTRIBUTE_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -attlist9(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_LITERAL: - state->handler = attlist1; - return XML_ROLE_FIXED_ATTRIBUTE_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -element0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element1; - return XML_ROLE_ELEMENT_NAME; - } - return common(state, tok); -} - -static int PTRCALL -element1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_EMPTY)) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_CONTENT_EMPTY; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_ANY)) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_CONTENT_ANY; - } - break; - case XML_TOK_OPEN_PAREN: - state->handler = element2; - state->level = 1; - return XML_ROLE_GROUP_OPEN; - } - return common(state, tok); -} - -static int PTRCALL -element2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_POUND_NAME: - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_PCDATA)) { - state->handler = element3; - return XML_ROLE_CONTENT_PCDATA; - } - break; - case XML_TOK_OPEN_PAREN: - state->level = 2; - state->handler = element6; - return XML_ROLE_GROUP_OPEN; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT; - case XML_TOK_NAME_QUESTION: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_OPT; - case XML_TOK_NAME_ASTERISK: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_REP; - case XML_TOK_NAME_PLUS: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_PLUS; - } - return common(state, tok); -} - -static int PTRCALL -element3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_CLOSE_PAREN: - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_GROUP_CLOSE; - case XML_TOK_CLOSE_PAREN_ASTERISK: - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_GROUP_CLOSE_REP; - case XML_TOK_OR: - state->handler = element4; - return XML_ROLE_ELEMENT_NONE; - } - return common(state, tok); -} - -static int PTRCALL -element4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element5; - return XML_ROLE_CONTENT_ELEMENT; - } - return common(state, tok); -} - -static int PTRCALL -element5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_CLOSE_PAREN_ASTERISK: - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_GROUP_CLOSE_REP; - case XML_TOK_OR: - state->handler = element4; - return XML_ROLE_ELEMENT_NONE; - } - return common(state, tok); -} - -static int PTRCALL -element6(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_OPEN_PAREN: - state->level += 1; - return XML_ROLE_GROUP_OPEN; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT; - case XML_TOK_NAME_QUESTION: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_OPT; - case XML_TOK_NAME_ASTERISK: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_REP; - case XML_TOK_NAME_PLUS: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_PLUS; - } - return common(state, tok); -} - -static int PTRCALL -element7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_CLOSE_PAREN: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE; - case XML_TOK_CLOSE_PAREN_ASTERISK: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE_REP; - case XML_TOK_CLOSE_PAREN_QUESTION: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE_OPT; - case XML_TOK_CLOSE_PAREN_PLUS: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE_PLUS; - case XML_TOK_COMMA: - state->handler = element6; - return XML_ROLE_GROUP_SEQUENCE; - case XML_TOK_OR: - state->handler = element6; - return XML_ROLE_GROUP_CHOICE; - } - return common(state, tok); -} - -#ifdef XML_DTD - -static int PTRCALL -condSect0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_INCLUDE)) { - state->handler = condSect1; - return XML_ROLE_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_IGNORE)) { - state->handler = condSect2; - return XML_ROLE_NONE; - } - break; - } - return common(state, tok); -} - -static int PTRCALL -condSect1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = externalSubset1; - state->includeLevel += 1; - return XML_ROLE_NONE; - } - return common(state, tok); -} - -static int PTRCALL -condSect2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = externalSubset1; - return XML_ROLE_IGNORE_SECT; - } - return common(state, tok); -} - -#endif /* XML_DTD */ - -static int PTRCALL -declClose(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return state->role_none; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return state->role_none; - } - return common(state, tok); -} - -static int PTRCALL -error(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - return XML_ROLE_NONE; -} - -static int FASTCALL -common(PROLOG_STATE *state, int tok) -{ -#ifdef XML_DTD - if (!state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF) - return XML_ROLE_INNER_PARAM_ENTITY_REF; -#endif - state->handler = error; - return XML_ROLE_ERROR; -} - -void -XmlPrologStateInit(PROLOG_STATE *state) -{ - state->handler = prolog0; -#ifdef XML_DTD - state->documentEntity = 1; - state->includeLevel = 0; - state->inEntityValue = 0; -#endif /* XML_DTD */ -} - -#ifdef XML_DTD - -void -XmlPrologStateInitExternalEntity(PROLOG_STATE *state) -{ - state->handler = externalSubset0; - state->documentEntity = 0; - state->includeLevel = 0; -} - -#endif /* XML_DTD */ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmlrole.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmlrole.h deleted file mode 100644 index 4dd9f06f..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmlrole.h +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef XmlRole_INCLUDED -#define XmlRole_INCLUDED 1 - -#ifdef __VMS -/* 0 1 2 3 0 1 2 3 - 1234567890123456789012345678901 1234567890123456789012345678901 */ -#define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt -#endif - -#include "xmltok.h" - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - XML_ROLE_ERROR = -1, - XML_ROLE_NONE = 0, - XML_ROLE_XML_DECL, - XML_ROLE_INSTANCE_START, - XML_ROLE_DOCTYPE_NONE, - XML_ROLE_DOCTYPE_NAME, - XML_ROLE_DOCTYPE_SYSTEM_ID, - XML_ROLE_DOCTYPE_PUBLIC_ID, - XML_ROLE_DOCTYPE_INTERNAL_SUBSET, - XML_ROLE_DOCTYPE_CLOSE, - XML_ROLE_GENERAL_ENTITY_NAME, - XML_ROLE_PARAM_ENTITY_NAME, - XML_ROLE_ENTITY_NONE, - XML_ROLE_ENTITY_VALUE, - XML_ROLE_ENTITY_SYSTEM_ID, - XML_ROLE_ENTITY_PUBLIC_ID, - XML_ROLE_ENTITY_COMPLETE, - XML_ROLE_ENTITY_NOTATION_NAME, - XML_ROLE_NOTATION_NONE, - XML_ROLE_NOTATION_NAME, - XML_ROLE_NOTATION_SYSTEM_ID, - XML_ROLE_NOTATION_NO_SYSTEM_ID, - XML_ROLE_NOTATION_PUBLIC_ID, - XML_ROLE_ATTRIBUTE_NAME, - XML_ROLE_ATTRIBUTE_TYPE_CDATA, - XML_ROLE_ATTRIBUTE_TYPE_ID, - XML_ROLE_ATTRIBUTE_TYPE_IDREF, - XML_ROLE_ATTRIBUTE_TYPE_IDREFS, - XML_ROLE_ATTRIBUTE_TYPE_ENTITY, - XML_ROLE_ATTRIBUTE_TYPE_ENTITIES, - XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN, - XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS, - XML_ROLE_ATTRIBUTE_ENUM_VALUE, - XML_ROLE_ATTRIBUTE_NOTATION_VALUE, - XML_ROLE_ATTLIST_NONE, - XML_ROLE_ATTLIST_ELEMENT_NAME, - XML_ROLE_IMPLIED_ATTRIBUTE_VALUE, - XML_ROLE_REQUIRED_ATTRIBUTE_VALUE, - XML_ROLE_DEFAULT_ATTRIBUTE_VALUE, - XML_ROLE_FIXED_ATTRIBUTE_VALUE, - XML_ROLE_ELEMENT_NONE, - XML_ROLE_ELEMENT_NAME, - XML_ROLE_CONTENT_ANY, - XML_ROLE_CONTENT_EMPTY, - XML_ROLE_CONTENT_PCDATA, - XML_ROLE_GROUP_OPEN, - XML_ROLE_GROUP_CLOSE, - XML_ROLE_GROUP_CLOSE_REP, - XML_ROLE_GROUP_CLOSE_OPT, - XML_ROLE_GROUP_CLOSE_PLUS, - XML_ROLE_GROUP_CHOICE, - XML_ROLE_GROUP_SEQUENCE, - XML_ROLE_CONTENT_ELEMENT, - XML_ROLE_CONTENT_ELEMENT_REP, - XML_ROLE_CONTENT_ELEMENT_OPT, - XML_ROLE_CONTENT_ELEMENT_PLUS, - XML_ROLE_PI, - XML_ROLE_COMMENT, -#ifdef XML_DTD - XML_ROLE_TEXT_DECL, - XML_ROLE_IGNORE_SECT, - XML_ROLE_INNER_PARAM_ENTITY_REF, -#endif /* XML_DTD */ - XML_ROLE_PARAM_ENTITY_REF -}; - -typedef struct prolog_state { - int (PTRCALL *handler) (struct prolog_state *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc); - unsigned level; - int role_none; -#ifdef XML_DTD - unsigned includeLevel; - int documentEntity; - int inEntityValue; -#endif /* XML_DTD */ -} PROLOG_STATE; - -void XmlPrologStateInit(PROLOG_STATE *); -#ifdef XML_DTD -void XmlPrologStateInitExternalEntity(PROLOG_STATE *); -#endif /* XML_DTD */ - -#define XmlTokenRole(state, tok, ptr, end, enc) \ - (((state)->handler)(state, tok, ptr, end, enc)) - -#ifdef __cplusplus -} -#endif - -#endif /* not XmlRole_INCLUDED */ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmltok.c b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmltok.c deleted file mode 100644 index bf09dfc7..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmltok.c +++ /dev/null @@ -1,1651 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include - -#ifdef COMPILED_FROM_DSP -#include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" -#else -#ifdef HAVE_EXPAT_CONFIG_H -#include -#endif -#endif /* ndef COMPILED_FROM_DSP */ - -#include "expat_external.h" -#include "internal.h" -#include "xmltok.h" -#include "nametab.h" - -#ifdef XML_DTD -#define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok) -#else -#define IGNORE_SECTION_TOK_VTABLE /* as nothing */ -#endif - -#define VTABLE1 \ - { PREFIX(prologTok), PREFIX(contentTok), \ - PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE }, \ - { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \ - PREFIX(sameName), \ - PREFIX(nameMatchesAscii), \ - PREFIX(nameLength), \ - PREFIX(skipS), \ - PREFIX(getAtts), \ - PREFIX(charRefNumber), \ - PREFIX(predefinedEntityName), \ - PREFIX(updatePosition), \ - PREFIX(isPublicId) - -#define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16) - -#define UCS2_GET_NAMING(pages, hi, lo) \ - (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F))) - -/* A 2 byte UTF-8 representation splits the characters 11 bits between - the bottom 5 and 6 bits of the bytes. We need 8 bits to index into - pages, 3 bits to add to that index and 5 bits to generate the mask. -*/ -#define UTF8_GET_NAMING2(pages, byte) \ - (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \ - + ((((byte)[0]) & 3) << 1) \ - + ((((byte)[1]) >> 5) & 1)] \ - & (1 << (((byte)[1]) & 0x1F))) - -/* A 3 byte UTF-8 representation splits the characters 16 bits between - the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index - into pages, 3 bits to add to that index and 5 bits to generate the - mask. -*/ -#define UTF8_GET_NAMING3(pages, byte) \ - (namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \ - + ((((byte)[1]) >> 2) & 0xF)] \ - << 3) \ - + ((((byte)[1]) & 3) << 1) \ - + ((((byte)[2]) >> 5) & 1)] \ - & (1 << (((byte)[2]) & 0x1F))) - -#define UTF8_GET_NAMING(pages, p, n) \ - ((n) == 2 \ - ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \ - : ((n) == 3 \ - ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \ - : 0)) - -/* Detection of invalid UTF-8 sequences is based on Table 3.1B - of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/ - with the additional restriction of not allowing the Unicode - code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE). - Implementation details: - (A & 0x80) == 0 means A < 0x80 - and - (A & 0xC0) == 0xC0 means A > 0xBF -*/ - -#define UTF8_INVALID2(p) \ - ((*p) < 0xC2 || ((p)[1] & 0x80) == 0 || ((p)[1] & 0xC0) == 0xC0) - -#define UTF8_INVALID3(p) \ - (((p)[2] & 0x80) == 0 \ - || \ - ((*p) == 0xEF && (p)[1] == 0xBF \ - ? \ - (p)[2] > 0xBD \ - : \ - ((p)[2] & 0xC0) == 0xC0) \ - || \ - ((*p) == 0xE0 \ - ? \ - (p)[1] < 0xA0 || ((p)[1] & 0xC0) == 0xC0 \ - : \ - ((p)[1] & 0x80) == 0 \ - || \ - ((*p) == 0xED ? (p)[1] > 0x9F : ((p)[1] & 0xC0) == 0xC0))) - -#define UTF8_INVALID4(p) \ - (((p)[3] & 0x80) == 0 || ((p)[3] & 0xC0) == 0xC0 \ - || \ - ((p)[2] & 0x80) == 0 || ((p)[2] & 0xC0) == 0xC0 \ - || \ - ((*p) == 0xF0 \ - ? \ - (p)[1] < 0x90 || ((p)[1] & 0xC0) == 0xC0 \ - : \ - ((p)[1] & 0x80) == 0 \ - || \ - ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0))) - -static int PTRFASTCALL -isNever(const ENCODING *enc, const char *p) -{ - return 0; -} - -static int PTRFASTCALL -utf8_isName2(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING2(namePages, (const unsigned char *)p); -} - -static int PTRFASTCALL -utf8_isName3(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING3(namePages, (const unsigned char *)p); -} - -#define utf8_isName4 isNever - -static int PTRFASTCALL -utf8_isNmstrt2(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p); -} - -static int PTRFASTCALL -utf8_isNmstrt3(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p); -} - -#define utf8_isNmstrt4 isNever - -static int PTRFASTCALL -utf8_isInvalid2(const ENCODING *enc, const char *p) -{ - return UTF8_INVALID2((const unsigned char *)p); -} - -static int PTRFASTCALL -utf8_isInvalid3(const ENCODING *enc, const char *p) -{ - return UTF8_INVALID3((const unsigned char *)p); -} - -static int PTRFASTCALL -utf8_isInvalid4(const ENCODING *enc, const char *p) -{ - return UTF8_INVALID4((const unsigned char *)p); -} - -struct normal_encoding { - ENCODING enc; - unsigned char type[256]; -#ifdef XML_MIN_SIZE - int (PTRFASTCALL *byteType)(const ENCODING *, const char *); - int (PTRFASTCALL *isNameMin)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrtMin)(const ENCODING *, const char *); - int (PTRFASTCALL *byteToAscii)(const ENCODING *, const char *); - int (PTRCALL *charMatches)(const ENCODING *, const char *, int); -#endif /* XML_MIN_SIZE */ - int (PTRFASTCALL *isName2)(const ENCODING *, const char *); - int (PTRFASTCALL *isName3)(const ENCODING *, const char *); - int (PTRFASTCALL *isName4)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrt2)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrt3)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrt4)(const ENCODING *, const char *); - int (PTRFASTCALL *isInvalid2)(const ENCODING *, const char *); - int (PTRFASTCALL *isInvalid3)(const ENCODING *, const char *); - int (PTRFASTCALL *isInvalid4)(const ENCODING *, const char *); -}; - -#define AS_NORMAL_ENCODING(enc) ((const struct normal_encoding *) (enc)) - -#ifdef XML_MIN_SIZE - -#define STANDARD_VTABLE(E) \ - E ## byteType, \ - E ## isNameMin, \ - E ## isNmstrtMin, \ - E ## byteToAscii, \ - E ## charMatches, - -#else - -#define STANDARD_VTABLE(E) /* as nothing */ - -#endif - -#define NORMAL_VTABLE(E) \ - E ## isName2, \ - E ## isName3, \ - E ## isName4, \ - E ## isNmstrt2, \ - E ## isNmstrt3, \ - E ## isNmstrt4, \ - E ## isInvalid2, \ - E ## isInvalid3, \ - E ## isInvalid4 - -static int FASTCALL checkCharRefNumber(int); - -#include "xmltok_impl.h" -#include "ascii.h" - -#ifdef XML_MIN_SIZE -#define sb_isNameMin isNever -#define sb_isNmstrtMin isNever -#endif - -#ifdef XML_MIN_SIZE -#define MINBPC(enc) ((enc)->minBytesPerChar) -#else -/* minimum bytes per character */ -#define MINBPC(enc) 1 -#endif - -#define SB_BYTE_TYPE(enc, p) \ - (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)]) - -#ifdef XML_MIN_SIZE -static int PTRFASTCALL -sb_byteType(const ENCODING *enc, const char *p) -{ - return SB_BYTE_TYPE(enc, p); -} -#define BYTE_TYPE(enc, p) \ - (AS_NORMAL_ENCODING(enc)->byteType(enc, p)) -#else -#define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p) -#endif - -#ifdef XML_MIN_SIZE -#define BYTE_TO_ASCII(enc, p) \ - (AS_NORMAL_ENCODING(enc)->byteToAscii(enc, p)) -static int PTRFASTCALL -sb_byteToAscii(const ENCODING *enc, const char *p) -{ - return *p; -} -#else -#define BYTE_TO_ASCII(enc, p) (*(p)) -#endif - -#define IS_NAME_CHAR(enc, p, n) \ - (AS_NORMAL_ENCODING(enc)->isName ## n(enc, p)) -#define IS_NMSTRT_CHAR(enc, p, n) \ - (AS_NORMAL_ENCODING(enc)->isNmstrt ## n(enc, p)) -#define IS_INVALID_CHAR(enc, p, n) \ - (AS_NORMAL_ENCODING(enc)->isInvalid ## n(enc, p)) - -#ifdef XML_MIN_SIZE -#define IS_NAME_CHAR_MINBPC(enc, p) \ - (AS_NORMAL_ENCODING(enc)->isNameMin(enc, p)) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) \ - (AS_NORMAL_ENCODING(enc)->isNmstrtMin(enc, p)) -#else -#define IS_NAME_CHAR_MINBPC(enc, p) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) (0) -#endif - -#ifdef XML_MIN_SIZE -#define CHAR_MATCHES(enc, p, c) \ - (AS_NORMAL_ENCODING(enc)->charMatches(enc, p, c)) -static int PTRCALL -sb_charMatches(const ENCODING *enc, const char *p, int c) -{ - return *p == c; -} -#else -/* c is an ASCII character */ -#define CHAR_MATCHES(enc, p, c) (*(p) == c) -#endif - -#define PREFIX(ident) normal_ ## ident -#define XML_TOK_IMPL_C -#include "xmltok_impl.c" -#undef XML_TOK_IMPL_C - -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR - -enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */ - UTF8_cval1 = 0x00, - UTF8_cval2 = 0xc0, - UTF8_cval3 = 0xe0, - UTF8_cval4 = 0xf0 -}; - -static void PTRCALL -utf8_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - char *to; - const char *from; - if (fromLim - *fromP > toLim - *toP) { - /* Avoid copying partial characters. */ - for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--) - if (((unsigned char)fromLim[-1] & 0xc0) != 0x80) - break; - } - for (to = *toP, from = *fromP; from != fromLim; from++, to++) - *to = *from; - *fromP = from; - *toP = to; -} - -static void PTRCALL -utf8_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ - unsigned short *to = *toP; - const char *from = *fromP; - while (from != fromLim && to != toLim) { - switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) { - case BT_LEAD2: - *to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f)); - from += 2; - break; - case BT_LEAD3: - *to++ = (unsigned short)(((from[0] & 0xf) << 12) - | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f)); - from += 3; - break; - case BT_LEAD4: - { - unsigned long n; - if (to + 1 == toLim) - goto after; - n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) - | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); - n -= 0x10000; - to[0] = (unsigned short)((n >> 10) | 0xD800); - to[1] = (unsigned short)((n & 0x3FF) | 0xDC00); - to += 2; - from += 4; - } - break; - default: - *to++ = *from++; - break; - } - } -after: - *fromP = from; - *toP = to; -} - -#ifdef XML_NS -static const struct normal_encoding utf8_encoding_ns = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#include "asciitab.h" -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; -#endif - -static const struct normal_encoding utf8_encoding = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; - -#ifdef XML_NS - -static const struct normal_encoding internal_utf8_encoding_ns = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#include "iasciitab.h" -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; - -#endif - -static const struct normal_encoding internal_utf8_encoding = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; - -static void PTRCALL -latin1_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - for (;;) { - unsigned char c; - if (*fromP == fromLim) - break; - c = (unsigned char)**fromP; - if (c & 0x80) { - if (toLim - *toP < 2) - break; - *(*toP)++ = (char)((c >> 6) | UTF8_cval2); - *(*toP)++ = (char)((c & 0x3f) | 0x80); - (*fromP)++; - } - else { - if (*toP == toLim) - break; - *(*toP)++ = *(*fromP)++; - } - } -} - -static void PTRCALL -latin1_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ - while (*fromP != fromLim && *toP != toLim) - *(*toP)++ = (unsigned char)*(*fromP)++; -} - -#ifdef XML_NS - -static const struct normal_encoding latin1_encoding_ns = { - { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(sb_) -}; - -#endif - -static const struct normal_encoding latin1_encoding = { - { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(sb_) -}; - -static void PTRCALL -ascii_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - while (*fromP != fromLim && *toP != toLim) - *(*toP)++ = *(*fromP)++; -} - -#ifdef XML_NS - -static const struct normal_encoding ascii_encoding_ns = { - { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, - { -#include "asciitab.h" -/* BT_NONXML == 0 */ - }, - STANDARD_VTABLE(sb_) -}; - -#endif - -static const struct normal_encoding ascii_encoding = { - { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -/* BT_NONXML == 0 */ - }, - STANDARD_VTABLE(sb_) -}; - -static int PTRFASTCALL -unicode_byte_type(char hi, char lo) -{ - switch ((unsigned char)hi) { - case 0xD8: case 0xD9: case 0xDA: case 0xDB: - return BT_LEAD4; - case 0xDC: case 0xDD: case 0xDE: case 0xDF: - return BT_TRAIL; - case 0xFF: - switch ((unsigned char)lo) { - case 0xFF: - case 0xFE: - return BT_NONXML; - } - break; - } - return BT_NONASCII; -} - -#define DEFINE_UTF16_TO_UTF8(E) \ -static void PTRCALL \ -E ## toUtf8(const ENCODING *enc, \ - const char **fromP, const char *fromLim, \ - char **toP, const char *toLim) \ -{ \ - const char *from; \ - for (from = *fromP; from != fromLim; from += 2) { \ - int plane; \ - unsigned char lo2; \ - unsigned char lo = GET_LO(from); \ - unsigned char hi = GET_HI(from); \ - switch (hi) { \ - case 0: \ - if (lo < 0x80) { \ - if (*toP == toLim) { \ - *fromP = from; \ - return; \ - } \ - *(*toP)++ = lo; \ - break; \ - } \ - /* fall through */ \ - case 0x1: case 0x2: case 0x3: \ - case 0x4: case 0x5: case 0x6: case 0x7: \ - if (toLim - *toP < 2) { \ - *fromP = from; \ - return; \ - } \ - *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \ - *(*toP)++ = ((lo & 0x3f) | 0x80); \ - break; \ - default: \ - if (toLim - *toP < 3) { \ - *fromP = from; \ - return; \ - } \ - /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \ - *(*toP)++ = ((hi >> 4) | UTF8_cval3); \ - *(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \ - *(*toP)++ = ((lo & 0x3f) | 0x80); \ - break; \ - case 0xD8: case 0xD9: case 0xDA: case 0xDB: \ - if (toLim - *toP < 4) { \ - *fromP = from; \ - return; \ - } \ - plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \ - *(*toP)++ = ((plane >> 2) | UTF8_cval4); \ - *(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \ - from += 2; \ - lo2 = GET_LO(from); \ - *(*toP)++ = (((lo & 0x3) << 4) \ - | ((GET_HI(from) & 0x3) << 2) \ - | (lo2 >> 6) \ - | 0x80); \ - *(*toP)++ = ((lo2 & 0x3f) | 0x80); \ - break; \ - } \ - } \ - *fromP = from; \ -} - -#define DEFINE_UTF16_TO_UTF16(E) \ -static void PTRCALL \ -E ## toUtf16(const ENCODING *enc, \ - const char **fromP, const char *fromLim, \ - unsigned short **toP, const unsigned short *toLim) \ -{ \ - /* Avoid copying first half only of surrogate */ \ - if (fromLim - *fromP > ((toLim - *toP) << 1) \ - && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \ - fromLim -= 2; \ - for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \ - *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \ -} - -#define SET2(ptr, ch) \ - (((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8))) -#define GET_LO(ptr) ((unsigned char)(ptr)[0]) -#define GET_HI(ptr) ((unsigned char)(ptr)[1]) - -DEFINE_UTF16_TO_UTF8(little2_) -DEFINE_UTF16_TO_UTF16(little2_) - -#undef SET2 -#undef GET_LO -#undef GET_HI - -#define SET2(ptr, ch) \ - (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF))) -#define GET_LO(ptr) ((unsigned char)(ptr)[1]) -#define GET_HI(ptr) ((unsigned char)(ptr)[0]) - -DEFINE_UTF16_TO_UTF8(big2_) -DEFINE_UTF16_TO_UTF16(big2_) - -#undef SET2 -#undef GET_LO -#undef GET_HI - -#define LITTLE2_BYTE_TYPE(enc, p) \ - ((p)[1] == 0 \ - ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \ - : unicode_byte_type((p)[1], (p)[0])) -#define LITTLE2_BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1) -#define LITTLE2_CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c) -#define LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0]) -#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0]) - -#ifdef XML_MIN_SIZE - -static int PTRFASTCALL -little2_byteType(const ENCODING *enc, const char *p) -{ - return LITTLE2_BYTE_TYPE(enc, p); -} - -static int PTRFASTCALL -little2_byteToAscii(const ENCODING *enc, const char *p) -{ - return LITTLE2_BYTE_TO_ASCII(enc, p); -} - -static int PTRCALL -little2_charMatches(const ENCODING *enc, const char *p, int c) -{ - return LITTLE2_CHAR_MATCHES(enc, p, c); -} - -static int PTRFASTCALL -little2_isNameMin(const ENCODING *enc, const char *p) -{ - return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p); -} - -static int PTRFASTCALL -little2_isNmstrtMin(const ENCODING *enc, const char *p) -{ - return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p); -} - -#undef VTABLE -#define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16 - -#else /* not XML_MIN_SIZE */ - -#undef PREFIX -#define PREFIX(ident) little2_ ## ident -#define MINBPC(enc) 2 -/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ -#define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p) -#define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(enc, p) -#define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(enc, p, c) -#define IS_NAME_CHAR(enc, p, n) 0 -#define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) -#define IS_NMSTRT_CHAR(enc, p, n) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) - -#define XML_TOK_IMPL_C -#include "xmltok_impl.c" -#undef XML_TOK_IMPL_C - -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR - -#endif /* not XML_MIN_SIZE */ - -#ifdef XML_NS - -static const struct normal_encoding little2_encoding_ns = { - { VTABLE, 2, 0, -#if BYTEORDER == 1234 - 1 -#else - 0 -#endif - }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#endif - -static const struct normal_encoding little2_encoding = { - { VTABLE, 2, 0, -#if BYTEORDER == 1234 - 1 -#else - 0 -#endif - }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#if BYTEORDER != 4321 - -#ifdef XML_NS - -static const struct normal_encoding internal_little2_encoding_ns = { - { VTABLE, 2, 0, 1 }, - { -#include "iasciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#endif - -static const struct normal_encoding internal_little2_encoding = { - { VTABLE, 2, 0, 1 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#endif - - -#define BIG2_BYTE_TYPE(enc, p) \ - ((p)[0] == 0 \ - ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \ - : unicode_byte_type((p)[0], (p)[1])) -#define BIG2_BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1) -#define BIG2_CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c) -#define BIG2_IS_NAME_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1]) -#define BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1]) - -#ifdef XML_MIN_SIZE - -static int PTRFASTCALL -big2_byteType(const ENCODING *enc, const char *p) -{ - return BIG2_BYTE_TYPE(enc, p); -} - -static int PTRFASTCALL -big2_byteToAscii(const ENCODING *enc, const char *p) -{ - return BIG2_BYTE_TO_ASCII(enc, p); -} - -static int PTRCALL -big2_charMatches(const ENCODING *enc, const char *p, int c) -{ - return BIG2_CHAR_MATCHES(enc, p, c); -} - -static int PTRFASTCALL -big2_isNameMin(const ENCODING *enc, const char *p) -{ - return BIG2_IS_NAME_CHAR_MINBPC(enc, p); -} - -static int PTRFASTCALL -big2_isNmstrtMin(const ENCODING *enc, const char *p) -{ - return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p); -} - -#undef VTABLE -#define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16 - -#else /* not XML_MIN_SIZE */ - -#undef PREFIX -#define PREFIX(ident) big2_ ## ident -#define MINBPC(enc) 2 -/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ -#define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p) -#define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(enc, p) -#define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(enc, p, c) -#define IS_NAME_CHAR(enc, p, n) 0 -#define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(enc, p) -#define IS_NMSTRT_CHAR(enc, p, n) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) - -#define XML_TOK_IMPL_C -#include "xmltok_impl.c" -#undef XML_TOK_IMPL_C - -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR - -#endif /* not XML_MIN_SIZE */ - -#ifdef XML_NS - -static const struct normal_encoding big2_encoding_ns = { - { VTABLE, 2, 0, -#if BYTEORDER == 4321 - 1 -#else - 0 -#endif - }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#endif - -static const struct normal_encoding big2_encoding = { - { VTABLE, 2, 0, -#if BYTEORDER == 4321 - 1 -#else - 0 -#endif - }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#if BYTEORDER != 1234 - -#ifdef XML_NS - -static const struct normal_encoding internal_big2_encoding_ns = { - { VTABLE, 2, 0, 1 }, - { -#include "iasciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#endif - -static const struct normal_encoding internal_big2_encoding = { - { VTABLE, 2, 0, 1 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#endif - -#undef PREFIX - -static int FASTCALL -streqci(const char *s1, const char *s2) -{ - for (;;) { - char c1 = *s1++; - char c2 = *s2++; - if (ASCII_a <= c1 && c1 <= ASCII_z) - c1 += ASCII_A - ASCII_a; - if (ASCII_a <= c2 && c2 <= ASCII_z) - c2 += ASCII_A - ASCII_a; - if (c1 != c2) - return 0; - if (!c1) - break; - } - return 1; -} - -static void PTRCALL -initUpdatePosition(const ENCODING *enc, const char *ptr, - const char *end, POSITION *pos) -{ - normal_updatePosition(&utf8_encoding.enc, ptr, end, pos); -} - -static int -toAscii(const ENCODING *enc, const char *ptr, const char *end) -{ - char buf[1]; - char *p = buf; - XmlUtf8Convert(enc, &ptr, end, &p, p + 1); - if (p == buf) - return -1; - else - return buf[0]; -} - -static int FASTCALL -isSpace(int c) -{ - switch (c) { - case 0x20: - case 0xD: - case 0xA: - case 0x9: - return 1; - } - return 0; -} - -/* Return 1 if there's just optional white space or there's an S - followed by name=val. -*/ -static int -parsePseudoAttribute(const ENCODING *enc, - const char *ptr, - const char *end, - const char **namePtr, - const char **nameEndPtr, - const char **valPtr, - const char **nextTokPtr) -{ - int c; - char open; - if (ptr == end) { - *namePtr = NULL; - return 1; - } - if (!isSpace(toAscii(enc, ptr, end))) { - *nextTokPtr = ptr; - return 0; - } - do { - ptr += enc->minBytesPerChar; - } while (isSpace(toAscii(enc, ptr, end))); - if (ptr == end) { - *namePtr = NULL; - return 1; - } - *namePtr = ptr; - for (;;) { - c = toAscii(enc, ptr, end); - if (c == -1) { - *nextTokPtr = ptr; - return 0; - } - if (c == ASCII_EQUALS) { - *nameEndPtr = ptr; - break; - } - if (isSpace(c)) { - *nameEndPtr = ptr; - do { - ptr += enc->minBytesPerChar; - } while (isSpace(c = toAscii(enc, ptr, end))); - if (c != ASCII_EQUALS) { - *nextTokPtr = ptr; - return 0; - } - break; - } - ptr += enc->minBytesPerChar; - } - if (ptr == *namePtr) { - *nextTokPtr = ptr; - return 0; - } - ptr += enc->minBytesPerChar; - c = toAscii(enc, ptr, end); - while (isSpace(c)) { - ptr += enc->minBytesPerChar; - c = toAscii(enc, ptr, end); - } - if (c != ASCII_QUOT && c != ASCII_APOS) { - *nextTokPtr = ptr; - return 0; - } - open = (char)c; - ptr += enc->minBytesPerChar; - *valPtr = ptr; - for (;; ptr += enc->minBytesPerChar) { - c = toAscii(enc, ptr, end); - if (c == open) - break; - if (!(ASCII_a <= c && c <= ASCII_z) - && !(ASCII_A <= c && c <= ASCII_Z) - && !(ASCII_0 <= c && c <= ASCII_9) - && c != ASCII_PERIOD - && c != ASCII_MINUS - && c != ASCII_UNDERSCORE) { - *nextTokPtr = ptr; - return 0; - } - } - *nextTokPtr = ptr + enc->minBytesPerChar; - return 1; -} - -static const char KW_version[] = { - ASCII_v, ASCII_e, ASCII_r, ASCII_s, ASCII_i, ASCII_o, ASCII_n, '\0' -}; - -static const char KW_encoding[] = { - ASCII_e, ASCII_n, ASCII_c, ASCII_o, ASCII_d, ASCII_i, ASCII_n, ASCII_g, '\0' -}; - -static const char KW_standalone[] = { - ASCII_s, ASCII_t, ASCII_a, ASCII_n, ASCII_d, ASCII_a, ASCII_l, ASCII_o, - ASCII_n, ASCII_e, '\0' -}; - -static const char KW_yes[] = { - ASCII_y, ASCII_e, ASCII_s, '\0' -}; - -static const char KW_no[] = { - ASCII_n, ASCII_o, '\0' -}; - -static int -doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, - const char *, - const char *), - int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingName, - const ENCODING **encoding, - int *standalone) -{ - const char *val = NULL; - const char *name = NULL; - const char *nameEnd = NULL; - ptr += 5 * enc->minBytesPerChar; - end -= 2 * enc->minBytesPerChar; - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr) - || !name) { - *badPtr = ptr; - return 0; - } - if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_version)) { - if (!isGeneralTextEntity) { - *badPtr = name; - return 0; - } - } - else { - if (versionPtr) - *versionPtr = val; - if (versionEndPtr) - *versionEndPtr = ptr; - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { - *badPtr = ptr; - return 0; - } - if (!name) { - if (isGeneralTextEntity) { - /* a TextDecl must have an EncodingDecl */ - *badPtr = ptr; - return 0; - } - return 1; - } - } - if (XmlNameMatchesAscii(enc, name, nameEnd, KW_encoding)) { - int c = toAscii(enc, val, end); - if (!(ASCII_a <= c && c <= ASCII_z) && !(ASCII_A <= c && c <= ASCII_Z)) { - *badPtr = val; - return 0; - } - if (encodingName) - *encodingName = val; - if (encoding) - *encoding = encodingFinder(enc, val, ptr - enc->minBytesPerChar); - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { - *badPtr = ptr; - return 0; - } - if (!name) - return 1; - } - if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_standalone) - || isGeneralTextEntity) { - *badPtr = name; - return 0; - } - if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_yes)) { - if (standalone) - *standalone = 1; - } - else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_no)) { - if (standalone) - *standalone = 0; - } - else { - *badPtr = val; - return 0; - } - while (isSpace(toAscii(enc, ptr, end))) - ptr += enc->minBytesPerChar; - if (ptr != end) { - *badPtr = ptr; - return 0; - } - return 1; -} - -static int FASTCALL -checkCharRefNumber(int result) -{ - switch (result >> 8) { - case 0xD8: case 0xD9: case 0xDA: case 0xDB: - case 0xDC: case 0xDD: case 0xDE: case 0xDF: - return -1; - case 0: - if (latin1_encoding.type[result] == BT_NONXML) - return -1; - break; - case 0xFF: - if (result == 0xFFFE || result == 0xFFFF) - return -1; - break; - } - return result; -} - -int FASTCALL -XmlUtf8Encode(int c, char *buf) -{ - enum { - /* minN is minimum legal resulting value for N byte sequence */ - min2 = 0x80, - min3 = 0x800, - min4 = 0x10000 - }; - - if (c < 0) - return 0; - if (c < min2) { - buf[0] = (char)(c | UTF8_cval1); - return 1; - } - if (c < min3) { - buf[0] = (char)((c >> 6) | UTF8_cval2); - buf[1] = (char)((c & 0x3f) | 0x80); - return 2; - } - if (c < min4) { - buf[0] = (char)((c >> 12) | UTF8_cval3); - buf[1] = (char)(((c >> 6) & 0x3f) | 0x80); - buf[2] = (char)((c & 0x3f) | 0x80); - return 3; - } - if (c < 0x110000) { - buf[0] = (char)((c >> 18) | UTF8_cval4); - buf[1] = (char)(((c >> 12) & 0x3f) | 0x80); - buf[2] = (char)(((c >> 6) & 0x3f) | 0x80); - buf[3] = (char)((c & 0x3f) | 0x80); - return 4; - } - return 0; -} - -int FASTCALL -XmlUtf16Encode(int charNum, unsigned short *buf) -{ - if (charNum < 0) - return 0; - if (charNum < 0x10000) { - buf[0] = (unsigned short)charNum; - return 1; - } - if (charNum < 0x110000) { - charNum -= 0x10000; - buf[0] = (unsigned short)((charNum >> 10) + 0xD800); - buf[1] = (unsigned short)((charNum & 0x3FF) + 0xDC00); - return 2; - } - return 0; -} - -struct unknown_encoding { - struct normal_encoding normal; - CONVERTER convert; - void *userData; - unsigned short utf16[256]; - char utf8[256][4]; -}; - -#define AS_UNKNOWN_ENCODING(enc) ((const struct unknown_encoding *) (enc)) - -int -XmlSizeOfUnknownEncoding(void) -{ - return sizeof(struct unknown_encoding); -} - -static int PTRFASTCALL -unknown_isName(const ENCODING *enc, const char *p) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - int c = uenc->convert(uenc->userData, p); - if (c & ~0xFFFF) - return 0; - return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF); -} - -static int PTRFASTCALL -unknown_isNmstrt(const ENCODING *enc, const char *p) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - int c = uenc->convert(uenc->userData, p); - if (c & ~0xFFFF) - return 0; - return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF); -} - -static int PTRFASTCALL -unknown_isInvalid(const ENCODING *enc, const char *p) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - int c = uenc->convert(uenc->userData, p); - return (c & ~0xFFFF) || checkCharRefNumber(c) < 0; -} - -static void PTRCALL -unknown_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - char buf[XML_UTF8_ENCODE_MAX]; - for (;;) { - const char *utf8; - int n; - if (*fromP == fromLim) - break; - utf8 = uenc->utf8[(unsigned char)**fromP]; - n = *utf8++; - if (n == 0) { - int c = uenc->convert(uenc->userData, *fromP); - n = XmlUtf8Encode(c, buf); - if (n > toLim - *toP) - break; - utf8 = buf; - *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] - - (BT_LEAD2 - 2)); - } - else { - if (n > toLim - *toP) - break; - (*fromP)++; - } - do { - *(*toP)++ = *utf8++; - } while (--n != 0); - } -} - -static void PTRCALL -unknown_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - while (*fromP != fromLim && *toP != toLim) { - unsigned short c = uenc->utf16[(unsigned char)**fromP]; - if (c == 0) { - c = (unsigned short) - uenc->convert(uenc->userData, *fromP); - *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] - - (BT_LEAD2 - 2)); - } - else - (*fromP)++; - *(*toP)++ = c; - } -} - -ENCODING * -XmlInitUnknownEncoding(void *mem, - int *table, - CONVERTER convert, - void *userData) -{ - int i; - struct unknown_encoding *e = (struct unknown_encoding *)mem; - for (i = 0; i < (int)sizeof(struct normal_encoding); i++) - ((char *)mem)[i] = ((char *)&latin1_encoding)[i]; - for (i = 0; i < 128; i++) - if (latin1_encoding.type[i] != BT_OTHER - && latin1_encoding.type[i] != BT_NONXML - && table[i] != i) - return 0; - for (i = 0; i < 256; i++) { - int c = table[i]; - if (c == -1) { - e->normal.type[i] = BT_MALFORM; - /* This shouldn't really get used. */ - e->utf16[i] = 0xFFFF; - e->utf8[i][0] = 1; - e->utf8[i][1] = 0; - } - else if (c < 0) { - if (c < -4) - return 0; - e->normal.type[i] = (unsigned char)(BT_LEAD2 - (c + 2)); - e->utf8[i][0] = 0; - e->utf16[i] = 0; - } - else if (c < 0x80) { - if (latin1_encoding.type[c] != BT_OTHER - && latin1_encoding.type[c] != BT_NONXML - && c != i) - return 0; - e->normal.type[i] = latin1_encoding.type[c]; - e->utf8[i][0] = 1; - e->utf8[i][1] = (char)c; - e->utf16[i] = (unsigned short)(c == 0 ? 0xFFFF : c); - } - else if (checkCharRefNumber(c) < 0) { - e->normal.type[i] = BT_NONXML; - /* This shouldn't really get used. */ - e->utf16[i] = 0xFFFF; - e->utf8[i][0] = 1; - e->utf8[i][1] = 0; - } - else { - if (c > 0xFFFF) - return 0; - if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff)) - e->normal.type[i] = BT_NMSTRT; - else if (UCS2_GET_NAMING(namePages, c >> 8, c & 0xff)) - e->normal.type[i] = BT_NAME; - else - e->normal.type[i] = BT_OTHER; - e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1); - e->utf16[i] = (unsigned short)c; - } - } - e->userData = userData; - e->convert = convert; - if (convert) { - e->normal.isName2 = unknown_isName; - e->normal.isName3 = unknown_isName; - e->normal.isName4 = unknown_isName; - e->normal.isNmstrt2 = unknown_isNmstrt; - e->normal.isNmstrt3 = unknown_isNmstrt; - e->normal.isNmstrt4 = unknown_isNmstrt; - e->normal.isInvalid2 = unknown_isInvalid; - e->normal.isInvalid3 = unknown_isInvalid; - e->normal.isInvalid4 = unknown_isInvalid; - } - e->normal.enc.utf8Convert = unknown_toUtf8; - e->normal.enc.utf16Convert = unknown_toUtf16; - return &(e->normal.enc); -} - -/* If this enumeration is changed, getEncodingIndex and encodings -must also be changed. */ -enum { - UNKNOWN_ENC = -1, - ISO_8859_1_ENC = 0, - US_ASCII_ENC, - UTF_8_ENC, - UTF_16_ENC, - UTF_16BE_ENC, - UTF_16LE_ENC, - /* must match encodingNames up to here */ - NO_ENC -}; - -static const char KW_ISO_8859_1[] = { - ASCII_I, ASCII_S, ASCII_O, ASCII_MINUS, ASCII_8, ASCII_8, ASCII_5, ASCII_9, - ASCII_MINUS, ASCII_1, '\0' -}; -static const char KW_US_ASCII[] = { - ASCII_U, ASCII_S, ASCII_MINUS, ASCII_A, ASCII_S, ASCII_C, ASCII_I, ASCII_I, - '\0' -}; -static const char KW_UTF_8[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_8, '\0' -}; -static const char KW_UTF_16[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, '\0' -}; -static const char KW_UTF_16BE[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_B, ASCII_E, - '\0' -}; -static const char KW_UTF_16LE[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_L, ASCII_E, - '\0' -}; - -static int FASTCALL -getEncodingIndex(const char *name) -{ - static const char * const encodingNames[] = { - KW_ISO_8859_1, - KW_US_ASCII, - KW_UTF_8, - KW_UTF_16, - KW_UTF_16BE, - KW_UTF_16LE, - }; - int i; - if (name == NULL) - return NO_ENC; - for (i = 0; i < (int)(sizeof(encodingNames)/sizeof(encodingNames[0])); i++) - if (streqci(name, encodingNames[i])) - return i; - return UNKNOWN_ENC; -} - -/* For binary compatibility, we store the index of the encoding - specified at initialization in the isUtf16 member. -*/ - -#define INIT_ENC_INDEX(enc) ((int)(enc)->initEnc.isUtf16) -#define SET_INIT_ENC_INDEX(enc, i) ((enc)->initEnc.isUtf16 = (char)i) - -/* This is what detects the encoding. encodingTable maps from - encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of - the external (protocol) specified encoding; state is - XML_CONTENT_STATE if we're parsing an external text entity, and - XML_PROLOG_STATE otherwise. -*/ - - -static int -initScan(const ENCODING * const *encodingTable, - const INIT_ENCODING *enc, - int state, - const char *ptr, - const char *end, - const char **nextTokPtr) -{ - const ENCODING **encPtr; - - if (ptr == end) - return XML_TOK_NONE; - encPtr = enc->encPtr; - if (ptr + 1 == end) { - /* only a single byte available for auto-detection */ -#ifndef XML_DTD /* FIXME */ - /* a well-formed document entity must have more than one byte */ - if (state != XML_CONTENT_STATE) - return XML_TOK_PARTIAL; -#endif - /* so we're parsing an external text entity... */ - /* if UTF-16 was externally specified, then we need at least 2 bytes */ - switch (INIT_ENC_INDEX(enc)) { - case UTF_16_ENC: - case UTF_16LE_ENC: - case UTF_16BE_ENC: - return XML_TOK_PARTIAL; - } - switch ((unsigned char)*ptr) { - case 0xFE: - case 0xFF: - case 0xEF: /* possibly first byte of UTF-8 BOM */ - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) - break; - /* fall through */ - case 0x00: - case 0x3C: - return XML_TOK_PARTIAL; - } - } - else { - switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) { - case 0xFEFF: - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) - break; - *nextTokPtr = ptr + 2; - *encPtr = encodingTable[UTF_16BE_ENC]; - return XML_TOK_BOM; - /* 00 3C is handled in the default case */ - case 0x3C00: - if ((INIT_ENC_INDEX(enc) == UTF_16BE_ENC - || INIT_ENC_INDEX(enc) == UTF_16_ENC) - && state == XML_CONTENT_STATE) - break; - *encPtr = encodingTable[UTF_16LE_ENC]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - case 0xFFFE: - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) - break; - *nextTokPtr = ptr + 2; - *encPtr = encodingTable[UTF_16LE_ENC]; - return XML_TOK_BOM; - case 0xEFBB: - /* Maybe a UTF-8 BOM (EF BB BF) */ - /* If there's an explicitly specified (external) encoding - of ISO-8859-1 or some flavour of UTF-16 - and this is an external text entity, - don't look for the BOM, - because it might be a legal data. - */ - if (state == XML_CONTENT_STATE) { - int e = INIT_ENC_INDEX(enc); - if (e == ISO_8859_1_ENC || e == UTF_16BE_ENC - || e == UTF_16LE_ENC || e == UTF_16_ENC) - break; - } - if (ptr + 2 == end) - return XML_TOK_PARTIAL; - if ((unsigned char)ptr[2] == 0xBF) { - *nextTokPtr = ptr + 3; - *encPtr = encodingTable[UTF_8_ENC]; - return XML_TOK_BOM; - } - break; - default: - if (ptr[0] == '\0') { - /* 0 isn't a legal data character. Furthermore a document - entity can only start with ASCII characters. So the only - way this can fail to be big-endian UTF-16 if it it's an - external parsed general entity that's labelled as - UTF-16LE. - */ - if (state == XML_CONTENT_STATE && INIT_ENC_INDEX(enc) == UTF_16LE_ENC) - break; - *encPtr = encodingTable[UTF_16BE_ENC]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - } - else if (ptr[1] == '\0') { - /* We could recover here in the case: - - parsing an external entity - - second byte is 0 - - no externally specified encoding - - no encoding declaration - by assuming UTF-16LE. But we don't, because this would mean when - presented just with a single byte, we couldn't reliably determine - whether we needed further bytes. - */ - if (state == XML_CONTENT_STATE) - break; - *encPtr = encodingTable[UTF_16LE_ENC]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - } - break; - } - } - *encPtr = encodingTable[INIT_ENC_INDEX(enc)]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); -} - - -#define NS(x) x -#define ns(x) x -#define XML_TOK_NS_C -#include "xmltok_ns.c" -#undef XML_TOK_NS_C -#undef NS -#undef ns - -#ifdef XML_NS - -#define NS(x) x ## NS -#define ns(x) x ## _ns - -#define XML_TOK_NS_C -#include "xmltok_ns.c" -#undef XML_TOK_NS_C - -#undef NS -#undef ns - -ENCODING * -XmlInitUnknownEncodingNS(void *mem, - int *table, - CONVERTER convert, - void *userData) -{ - ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData); - if (enc) - ((struct normal_encoding *)enc)->type[ASCII_COLON] = BT_COLON; - return enc; -} - -#endif /* XML_NS */ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmltok.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmltok.h deleted file mode 100644 index ca867aa6..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmltok.h +++ /dev/null @@ -1,316 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef XmlTok_INCLUDED -#define XmlTok_INCLUDED 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* The following token may be returned by XmlContentTok */ -#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be - start of illegal ]]> sequence */ -/* The following tokens may be returned by both XmlPrologTok and - XmlContentTok. -*/ -#define XML_TOK_NONE -4 /* The string to be scanned is empty */ -#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan; - might be part of CRLF sequence */ -#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ -#define XML_TOK_PARTIAL -1 /* only part of a token */ -#define XML_TOK_INVALID 0 - -/* The following tokens are returned by XmlContentTok; some are also - returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok. -*/ -#define XML_TOK_START_TAG_WITH_ATTS 1 -#define XML_TOK_START_TAG_NO_ATTS 2 -#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag */ -#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4 -#define XML_TOK_END_TAG 5 -#define XML_TOK_DATA_CHARS 6 -#define XML_TOK_DATA_NEWLINE 7 -#define XML_TOK_CDATA_SECT_OPEN 8 -#define XML_TOK_ENTITY_REF 9 -#define XML_TOK_CHAR_REF 10 /* numeric character reference */ - -/* The following tokens may be returned by both XmlPrologTok and - XmlContentTok. -*/ -#define XML_TOK_PI 11 /* processing instruction */ -#define XML_TOK_XML_DECL 12 /* XML decl or text decl */ -#define XML_TOK_COMMENT 13 -#define XML_TOK_BOM 14 /* Byte order mark */ - -/* The following tokens are returned only by XmlPrologTok */ -#define XML_TOK_PROLOG_S 15 -#define XML_TOK_DECL_OPEN 16 /* */ -#define XML_TOK_NAME 18 -#define XML_TOK_NMTOKEN 19 -#define XML_TOK_POUND_NAME 20 /* #name */ -#define XML_TOK_OR 21 /* | */ -#define XML_TOK_PERCENT 22 -#define XML_TOK_OPEN_PAREN 23 -#define XML_TOK_CLOSE_PAREN 24 -#define XML_TOK_OPEN_BRACKET 25 -#define XML_TOK_CLOSE_BRACKET 26 -#define XML_TOK_LITERAL 27 -#define XML_TOK_PARAM_ENTITY_REF 28 -#define XML_TOK_INSTANCE_START 29 - -/* The following occur only in element type declarations */ -#define XML_TOK_NAME_QUESTION 30 /* name? */ -#define XML_TOK_NAME_ASTERISK 31 /* name* */ -#define XML_TOK_NAME_PLUS 32 /* name+ */ -#define XML_TOK_COND_SECT_OPEN 33 /* */ -#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */ -#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */ -#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */ -#define XML_TOK_COMMA 38 - -/* The following token is returned only by XmlAttributeValueTok */ -#define XML_TOK_ATTRIBUTE_VALUE_S 39 - -/* The following token is returned only by XmlCdataSectionTok */ -#define XML_TOK_CDATA_SECT_CLOSE 40 - -/* With namespace processing this is returned by XmlPrologTok for a - name with a colon. -*/ -#define XML_TOK_PREFIXED_NAME 41 - -#ifdef XML_DTD -#define XML_TOK_IGNORE_SECT 42 -#endif /* XML_DTD */ - -#ifdef XML_DTD -#define XML_N_STATES 4 -#else /* not XML_DTD */ -#define XML_N_STATES 3 -#endif /* not XML_DTD */ - -#define XML_PROLOG_STATE 0 -#define XML_CONTENT_STATE 1 -#define XML_CDATA_SECTION_STATE 2 -#ifdef XML_DTD -#define XML_IGNORE_SECTION_STATE 3 -#endif /* XML_DTD */ - -#define XML_N_LITERAL_TYPES 2 -#define XML_ATTRIBUTE_VALUE_LITERAL 0 -#define XML_ENTITY_VALUE_LITERAL 1 - -/* The size of the buffer passed to XmlUtf8Encode must be at least this. */ -#define XML_UTF8_ENCODE_MAX 4 -/* The size of the buffer passed to XmlUtf16Encode must be at least this. */ -#define XML_UTF16_ENCODE_MAX 2 - -typedef struct position { - /* first line and first column are 0 not 1 */ - XML_Size lineNumber; - XML_Size columnNumber; -} POSITION; - -typedef struct { - const char *name; - const char *valuePtr; - const char *valueEnd; - char normalized; -} ATTRIBUTE; - -struct encoding; -typedef struct encoding ENCODING; - -typedef int (PTRCALL *SCANNER)(const ENCODING *, - const char *, - const char *, - const char **); - -struct encoding { - SCANNER scanners[XML_N_STATES]; - SCANNER literalScanners[XML_N_LITERAL_TYPES]; - int (PTRCALL *sameName)(const ENCODING *, - const char *, - const char *); - int (PTRCALL *nameMatchesAscii)(const ENCODING *, - const char *, - const char *, - const char *); - int (PTRFASTCALL *nameLength)(const ENCODING *, const char *); - const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *); - int (PTRCALL *getAtts)(const ENCODING *enc, - const char *ptr, - int attsMax, - ATTRIBUTE *atts); - int (PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr); - int (PTRCALL *predefinedEntityName)(const ENCODING *, - const char *, - const char *); - void (PTRCALL *updatePosition)(const ENCODING *, - const char *ptr, - const char *end, - POSITION *); - int (PTRCALL *isPublicId)(const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr); - void (PTRCALL *utf8Convert)(const ENCODING *enc, - const char **fromP, - const char *fromLim, - char **toP, - const char *toLim); - void (PTRCALL *utf16Convert)(const ENCODING *enc, - const char **fromP, - const char *fromLim, - unsigned short **toP, - const unsigned short *toLim); - int minBytesPerChar; - char isUtf8; - char isUtf16; -}; - -/* Scan the string starting at ptr until the end of the next complete - token, but do not scan past eptr. Return an integer giving the - type of token. - - Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set. - - Return XML_TOK_PARTIAL when the string does not contain a complete - token; nextTokPtr will not be set. - - Return XML_TOK_INVALID when the string does not start a valid - token; nextTokPtr will be set to point to the character which made - the token invalid. - - Otherwise the string starts with a valid token; nextTokPtr will be - set to point to the character following the end of that token. - - Each data character counts as a single token, but adjacent data - characters may be returned together. Similarly for characters in - the prolog outside literals, comments and processing instructions. -*/ - - -#define XmlTok(enc, state, ptr, end, nextTokPtr) \ - (((enc)->scanners[state])(enc, ptr, end, nextTokPtr)) - -#define XmlPrologTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr) - -#define XmlContentTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr) - -#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr) - -#ifdef XML_DTD - -#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr) - -#endif /* XML_DTD */ - -/* This is used for performing a 2nd-level tokenization on the content - of a literal that has already been returned by XmlTok. -*/ -#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \ - (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr)) - -#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \ - XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr) - -#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \ - XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr) - -#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2)) - -#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \ - (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2)) - -#define XmlNameLength(enc, ptr) \ - (((enc)->nameLength)(enc, ptr)) - -#define XmlSkipS(enc, ptr) \ - (((enc)->skipS)(enc, ptr)) - -#define XmlGetAttributes(enc, ptr, attsMax, atts) \ - (((enc)->getAtts)(enc, ptr, attsMax, atts)) - -#define XmlCharRefNumber(enc, ptr) \ - (((enc)->charRefNumber)(enc, ptr)) - -#define XmlPredefinedEntityName(enc, ptr, end) \ - (((enc)->predefinedEntityName)(enc, ptr, end)) - -#define XmlUpdatePosition(enc, ptr, end, pos) \ - (((enc)->updatePosition)(enc, ptr, end, pos)) - -#define XmlIsPublicId(enc, ptr, end, badPtr) \ - (((enc)->isPublicId)(enc, ptr, end, badPtr)) - -#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \ - (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim)) - -#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \ - (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim)) - -typedef struct { - ENCODING initEnc; - const ENCODING **encPtr; -} INIT_ENCODING; - -int XmlParseXmlDecl(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingNamePtr, - const ENCODING **namedEncodingPtr, - int *standalonePtr); - -int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name); -const ENCODING *XmlGetUtf8InternalEncoding(void); -const ENCODING *XmlGetUtf16InternalEncoding(void); -int FASTCALL XmlUtf8Encode(int charNumber, char *buf); -int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf); -int XmlSizeOfUnknownEncoding(void); - - -typedef int (XMLCALL *CONVERTER) (void *userData, const char *p); - -ENCODING * -XmlInitUnknownEncoding(void *mem, - int *table, - CONVERTER convert, - void *userData); - -int XmlParseXmlDeclNS(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingNamePtr, - const ENCODING **namedEncodingPtr, - int *standalonePtr); - -int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name); -const ENCODING *XmlGetUtf8InternalEncodingNS(void); -const ENCODING *XmlGetUtf16InternalEncodingNS(void); -ENCODING * -XmlInitUnknownEncodingNS(void *mem, - int *table, - CONVERTER convert, - void *userData); -#ifdef __cplusplus -} -#endif - -#endif /* not XmlTok_INCLUDED */ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmltok_impl.c b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmltok_impl.c deleted file mode 100644 index 9c2895b8..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmltok_impl.c +++ /dev/null @@ -1,1783 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* This file is included! */ -#ifdef XML_TOK_IMPL_C - -#ifndef IS_INVALID_CHAR -#define IS_INVALID_CHAR(enc, ptr, n) (0) -#endif - -#define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (IS_INVALID_CHAR(enc, ptr, n)) { \ - *(nextTokPtr) = (ptr); \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; - -#define INVALID_CASES(ptr, nextTokPtr) \ - INVALID_LEAD_CASE(2, ptr, nextTokPtr) \ - INVALID_LEAD_CASE(3, ptr, nextTokPtr) \ - INVALID_LEAD_CASE(4, ptr, nextTokPtr) \ - case BT_NONXML: \ - case BT_MALFORM: \ - case BT_TRAIL: \ - *(nextTokPtr) = (ptr); \ - return XML_TOK_INVALID; - -#define CHECK_NAME_CASE(n, enc, ptr, end, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (!IS_NAME_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; - -#define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \ - case BT_NONASCII: \ - if (!IS_NAME_CHAR_MINBPC(enc, ptr)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - case BT_NMSTRT: \ - case BT_HEX: \ - case BT_DIGIT: \ - case BT_NAME: \ - case BT_MINUS: \ - ptr += MINBPC(enc); \ - break; \ - CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \ - CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \ - CHECK_NAME_CASE(4, enc, ptr, end, nextTokPtr) - -#define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (!IS_NMSTRT_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; - -#define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \ - case BT_NONASCII: \ - if (!IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - case BT_NMSTRT: \ - case BT_HEX: \ - ptr += MINBPC(enc); \ - break; \ - CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \ - CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \ - CHECK_NMSTRT_CASE(4, enc, ptr, end, nextTokPtr) - -#ifndef PREFIX -#define PREFIX(ident) ident -#endif - -/* ptr points to character following " */ - switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) { - case BT_S: case BT_CR: case BT_LF: case BT_PERCNT: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - /* fall through */ - case BT_S: case BT_CR: case BT_LF: - *nextTokPtr = ptr; - return XML_TOK_DECL_OPEN; - case BT_NMSTRT: - case BT_HEX: - ptr += MINBPC(enc); - break; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -} - -static int PTRCALL -PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, - const char *end, int *tokPtr) -{ - int upper = 0; - *tokPtr = XML_TOK_PI; - if (end - ptr != MINBPC(enc)*3) - return 1; - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_x: - break; - case ASCII_X: - upper = 1; - break; - default: - return 1; - } - ptr += MINBPC(enc); - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_m: - break; - case ASCII_M: - upper = 1; - break; - default: - return 1; - } - ptr += MINBPC(enc); - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_l: - break; - case ASCII_L: - upper = 1; - break; - default: - return 1; - } - if (upper) - return 0; - *tokPtr = XML_TOK_XML_DECL; - return 1; -} - -/* ptr points to character following " 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - if (n == 0) - return XML_TOK_PARTIAL; - end = ptr + n; - } - } - switch (BYTE_TYPE(enc, ptr)) { - case BT_RSQB: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) - break; - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { - ptr -= MINBPC(enc); - break; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CDATA_SECT_CLOSE; - case BT_CR: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - case BT_LF: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - INVALID_CASES(ptr, nextTokPtr) - default: - ptr += MINBPC(enc); - break; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_DATA_CHARS; \ - } \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NONXML: - case BT_MALFORM: - case BT_TRAIL: - case BT_CR: - case BT_LF: - case BT_RSQB: - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -/* ptr points to character following " 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - if (n == 0) - return XML_TOK_PARTIAL; - end = ptr + n; - } - } - switch (BYTE_TYPE(enc, ptr)) { - case BT_LT: - return PREFIX(scanLt)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_AMP: - return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_CR: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_CR; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - case BT_LF: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - case BT_RSQB: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_RSQB; - if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) - break; - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_RSQB; - if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { - ptr -= MINBPC(enc); - break; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - INVALID_CASES(ptr, nextTokPtr) - default: - ptr += MINBPC(enc); - break; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_DATA_CHARS; \ - } \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_RSQB: - if (ptr + MINBPC(enc) != end) { - if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) { - ptr += MINBPC(enc); - break; - } - if (ptr + 2*MINBPC(enc) != end) { - if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), ASCII_GT)) { - ptr += MINBPC(enc); - break; - } - *nextTokPtr = ptr + 2*MINBPC(enc); - return XML_TOK_INVALID; - } - } - /* fall through */ - case BT_AMP: - case BT_LT: - case BT_NONXML: - case BT_MALFORM: - case BT_TRAIL: - case BT_CR: - case BT_LF: - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -/* ptr points to character following "%" */ - -static int PTRCALL -PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) - case BT_S: case BT_LF: case BT_CR: case BT_PERCNT: - *nextTokPtr = ptr; - return XML_TOK_PERCENT; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_SEMI: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_PARAM_ENTITY_REF; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -} - -static int PTRCALL -PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_CR: case BT_LF: case BT_S: - case BT_RPAR: case BT_GT: case BT_PERCNT: case BT_VERBAR: - *nextTokPtr = ptr; - return XML_TOK_POUND_NAME; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return -XML_TOK_POUND_NAME; -} - -static int PTRCALL -PREFIX(scanLit)(int open, const ENCODING *enc, - const char *ptr, const char *end, - const char **nextTokPtr) -{ - while (ptr != end) { - int t = BYTE_TYPE(enc, ptr); - switch (t) { - INVALID_CASES(ptr, nextTokPtr) - case BT_QUOT: - case BT_APOS: - ptr += MINBPC(enc); - if (t != open) - break; - if (ptr == end) - return -XML_TOK_LITERAL; - *nextTokPtr = ptr; - switch (BYTE_TYPE(enc, ptr)) { - case BT_S: case BT_CR: case BT_LF: - case BT_GT: case BT_PERCNT: case BT_LSQB: - return XML_TOK_LITERAL; - default: - return XML_TOK_INVALID; - } - default: - ptr += MINBPC(enc); - break; - } - } - return XML_TOK_PARTIAL; -} - -static int PTRCALL -PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - int tok; - if (ptr == end) - return XML_TOK_NONE; - if (MINBPC(enc) > 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - if (n == 0) - return XML_TOK_PARTIAL; - end = ptr + n; - } - } - switch (BYTE_TYPE(enc, ptr)) { - case BT_QUOT: - return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_APOS: - return PREFIX(scanLit)(BT_APOS, enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_LT: - { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - case BT_EXCL: - return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_QUEST: - return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_NMSTRT: - case BT_HEX: - case BT_NONASCII: - case BT_LEAD2: - case BT_LEAD3: - case BT_LEAD4: - *nextTokPtr = ptr - MINBPC(enc); - return XML_TOK_INSTANCE_START; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - case BT_CR: - if (ptr + MINBPC(enc) == end) { - *nextTokPtr = end; - /* indicate that this might be part of a CR/LF pair */ - return -XML_TOK_PROLOG_S; - } - /* fall through */ - case BT_S: case BT_LF: - for (;;) { - ptr += MINBPC(enc); - if (ptr == end) - break; - switch (BYTE_TYPE(enc, ptr)) { - case BT_S: case BT_LF: - break; - case BT_CR: - /* don't split CR/LF pair */ - if (ptr + MINBPC(enc) != end) - break; - /* fall through */ - default: - *nextTokPtr = ptr; - return XML_TOK_PROLOG_S; - } - } - *nextTokPtr = ptr; - return XML_TOK_PROLOG_S; - case BT_PERCNT: - return PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_COMMA: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_COMMA; - case BT_LSQB: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_OPEN_BRACKET; - case BT_RSQB: - ptr += MINBPC(enc); - if (ptr == end) - return -XML_TOK_CLOSE_BRACKET; - if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { - if (ptr + MINBPC(enc) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) { - *nextTokPtr = ptr + 2*MINBPC(enc); - return XML_TOK_COND_SECT_CLOSE; - } - } - *nextTokPtr = ptr; - return XML_TOK_CLOSE_BRACKET; - case BT_LPAR: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_OPEN_PAREN; - case BT_RPAR: - ptr += MINBPC(enc); - if (ptr == end) - return -XML_TOK_CLOSE_PAREN; - switch (BYTE_TYPE(enc, ptr)) { - case BT_AST: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CLOSE_PAREN_ASTERISK; - case BT_QUEST: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CLOSE_PAREN_QUESTION; - case BT_PLUS: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CLOSE_PAREN_PLUS; - case BT_CR: case BT_LF: case BT_S: - case BT_GT: case BT_COMMA: case BT_VERBAR: - case BT_RPAR: - *nextTokPtr = ptr; - return XML_TOK_CLOSE_PAREN; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - case BT_VERBAR: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_OR; - case BT_GT: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DECL_CLOSE; - case BT_NUM: - return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr); -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (IS_NMSTRT_CHAR(enc, ptr, n)) { \ - ptr += n; \ - tok = XML_TOK_NAME; \ - break; \ - } \ - if (IS_NAME_CHAR(enc, ptr, n)) { \ - ptr += n; \ - tok = XML_TOK_NMTOKEN; \ - break; \ - } \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NMSTRT: - case BT_HEX: - tok = XML_TOK_NAME; - ptr += MINBPC(enc); - break; - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: -#ifdef XML_NS - case BT_COLON: -#endif - tok = XML_TOK_NMTOKEN; - ptr += MINBPC(enc); - break; - case BT_NONASCII: - if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { - ptr += MINBPC(enc); - tok = XML_TOK_NAME; - break; - } - if (IS_NAME_CHAR_MINBPC(enc, ptr)) { - ptr += MINBPC(enc); - tok = XML_TOK_NMTOKEN; - break; - } - /* fall through */ - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_GT: case BT_RPAR: case BT_COMMA: - case BT_VERBAR: case BT_LSQB: case BT_PERCNT: - case BT_S: case BT_CR: case BT_LF: - *nextTokPtr = ptr; - return tok; -#ifdef XML_NS - case BT_COLON: - ptr += MINBPC(enc); - switch (tok) { - case XML_TOK_NAME: - if (ptr == end) - return XML_TOK_PARTIAL; - tok = XML_TOK_PREFIXED_NAME; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - default: - tok = XML_TOK_NMTOKEN; - break; - } - break; - case XML_TOK_PREFIXED_NAME: - tok = XML_TOK_NMTOKEN; - break; - } - break; -#endif - case BT_PLUS: - if (tok == XML_TOK_NMTOKEN) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_NAME_PLUS; - case BT_AST: - if (tok == XML_TOK_NMTOKEN) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_NAME_ASTERISK; - case BT_QUEST: - if (tok == XML_TOK_NMTOKEN) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_NAME_QUESTION; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return -tok; -} - -static int PTRCALL -PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, - const char *end, const char **nextTokPtr) -{ - const char *start; - if (ptr == end) - return XML_TOK_NONE; - start = ptr; - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_AMP: - if (ptr == start) - return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_LT: - /* this is for inside entity references */ - *nextTokPtr = ptr; - return XML_TOK_INVALID; - case BT_LF: - if (ptr == start) { - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_CR: - if (ptr == start) { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_CR; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_S: - if (ptr == start) { - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_ATTRIBUTE_VALUE_S; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -static int PTRCALL -PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, - const char *end, const char **nextTokPtr) -{ - const char *start; - if (ptr == end) - return XML_TOK_NONE; - start = ptr; - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_AMP: - if (ptr == start) - return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_PERCNT: - if (ptr == start) { - int tok = PREFIX(scanPercent)(enc, ptr + MINBPC(enc), - end, nextTokPtr); - return (tok == XML_TOK_PERCENT) ? XML_TOK_INVALID : tok; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_LF: - if (ptr == start) { - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_CR: - if (ptr == start) { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_CR; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -#ifdef XML_DTD - -static int PTRCALL -PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, - const char *end, const char **nextTokPtr) -{ - int level = 0; - if (MINBPC(enc) > 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - end = ptr + n; - } - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - INVALID_CASES(ptr, nextTokPtr) - case BT_LT: - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) { - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) { - ++level; - ptr += MINBPC(enc); - } - } - break; - case BT_RSQB: - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_GT)) { - ptr += MINBPC(enc); - if (level == 0) { - *nextTokPtr = ptr; - return XML_TOK_IGNORE_SECT; - } - --level; - } - } - break; - default: - ptr += MINBPC(enc); - break; - } - } - return XML_TOK_PARTIAL; -} - -#endif /* XML_DTD */ - -static int PTRCALL -PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, - const char **badPtr) -{ - ptr += MINBPC(enc); - end -= MINBPC(enc); - for (; ptr != end; ptr += MINBPC(enc)) { - switch (BYTE_TYPE(enc, ptr)) { - case BT_DIGIT: - case BT_HEX: - case BT_MINUS: - case BT_APOS: - case BT_LPAR: - case BT_RPAR: - case BT_PLUS: - case BT_COMMA: - case BT_SOL: - case BT_EQUALS: - case BT_QUEST: - case BT_CR: - case BT_LF: - case BT_SEMI: - case BT_EXCL: - case BT_AST: - case BT_PERCNT: - case BT_NUM: -#ifdef XML_NS - case BT_COLON: -#endif - break; - case BT_S: - if (CHAR_MATCHES(enc, ptr, ASCII_TAB)) { - *badPtr = ptr; - return 0; - } - break; - case BT_NAME: - case BT_NMSTRT: - if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f)) - break; - default: - switch (BYTE_TO_ASCII(enc, ptr)) { - case 0x24: /* $ */ - case 0x40: /* @ */ - break; - default: - *badPtr = ptr; - return 0; - } - break; - } - } - return 1; -} - -/* This must only be called for a well-formed start-tag or empty - element tag. Returns the number of attributes. Pointers to the - first attsMax attributes are stored in atts. -*/ - -static int PTRCALL -PREFIX(getAtts)(const ENCODING *enc, const char *ptr, - int attsMax, ATTRIBUTE *atts) -{ - enum { other, inName, inValue } state = inName; - int nAtts = 0; - int open = 0; /* defined when state == inValue; - initialization just to shut up compilers */ - - for (ptr += MINBPC(enc);; ptr += MINBPC(enc)) { - switch (BYTE_TYPE(enc, ptr)) { -#define START_NAME \ - if (state == other) { \ - if (nAtts < attsMax) { \ - atts[nAtts].name = ptr; \ - atts[nAtts].normalized = 1; \ - } \ - state = inName; \ - } -#define LEAD_CASE(n) \ - case BT_LEAD ## n: START_NAME ptr += (n - MINBPC(enc)); break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NONASCII: - case BT_NMSTRT: - case BT_HEX: - START_NAME - break; -#undef START_NAME - case BT_QUOT: - if (state != inValue) { - if (nAtts < attsMax) - atts[nAtts].valuePtr = ptr + MINBPC(enc); - state = inValue; - open = BT_QUOT; - } - else if (open == BT_QUOT) { - state = other; - if (nAtts < attsMax) - atts[nAtts].valueEnd = ptr; - nAtts++; - } - break; - case BT_APOS: - if (state != inValue) { - if (nAtts < attsMax) - atts[nAtts].valuePtr = ptr + MINBPC(enc); - state = inValue; - open = BT_APOS; - } - else if (open == BT_APOS) { - state = other; - if (nAtts < attsMax) - atts[nAtts].valueEnd = ptr; - nAtts++; - } - break; - case BT_AMP: - if (nAtts < attsMax) - atts[nAtts].normalized = 0; - break; - case BT_S: - if (state == inName) - state = other; - else if (state == inValue - && nAtts < attsMax - && atts[nAtts].normalized - && (ptr == atts[nAtts].valuePtr - || BYTE_TO_ASCII(enc, ptr) != ASCII_SPACE - || BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ASCII_SPACE - || BYTE_TYPE(enc, ptr + MINBPC(enc)) == open)) - atts[nAtts].normalized = 0; - break; - case BT_CR: case BT_LF: - /* This case ensures that the first attribute name is counted - Apart from that we could just change state on the quote. */ - if (state == inName) - state = other; - else if (state == inValue && nAtts < attsMax) - atts[nAtts].normalized = 0; - break; - case BT_GT: - case BT_SOL: - if (state != inValue) - return nAtts; - break; - default: - break; - } - } - /* not reached */ -} - -static int PTRFASTCALL -PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) -{ - int result = 0; - /* skip &# */ - ptr += 2*MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_x)) { - for (ptr += MINBPC(enc); - !CHAR_MATCHES(enc, ptr, ASCII_SEMI); - ptr += MINBPC(enc)) { - int c = BYTE_TO_ASCII(enc, ptr); - switch (c) { - case ASCII_0: case ASCII_1: case ASCII_2: case ASCII_3: case ASCII_4: - case ASCII_5: case ASCII_6: case ASCII_7: case ASCII_8: case ASCII_9: - result <<= 4; - result |= (c - ASCII_0); - break; - case ASCII_A: case ASCII_B: case ASCII_C: - case ASCII_D: case ASCII_E: case ASCII_F: - result <<= 4; - result += 10 + (c - ASCII_A); - break; - case ASCII_a: case ASCII_b: case ASCII_c: - case ASCII_d: case ASCII_e: case ASCII_f: - result <<= 4; - result += 10 + (c - ASCII_a); - break; - } - if (result >= 0x110000) - return -1; - } - } - else { - for (; !CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) { - int c = BYTE_TO_ASCII(enc, ptr); - result *= 10; - result += (c - ASCII_0); - if (result >= 0x110000) - return -1; - } - } - return checkCharRefNumber(result); -} - -static int PTRCALL -PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, - const char *end) -{ - switch ((end - ptr)/MINBPC(enc)) { - case 2: - if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_t)) { - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_l: - return ASCII_LT; - case ASCII_g: - return ASCII_GT; - } - } - break; - case 3: - if (CHAR_MATCHES(enc, ptr, ASCII_a)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_m)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_p)) - return ASCII_AMP; - } - } - break; - case 4: - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_q: - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_u)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_o)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_t)) - return ASCII_QUOT; - } - } - break; - case ASCII_a: - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_p)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_o)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_s)) - return ASCII_APOS; - } - } - break; - } - } - return 0; -} - -static int PTRCALL -PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2) -{ - for (;;) { - switch (BYTE_TYPE(enc, ptr1)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (*ptr1++ != *ptr2++) \ - return 0; - LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2) -#undef LEAD_CASE - /* fall through */ - if (*ptr1++ != *ptr2++) - return 0; - break; - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 1) { - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 2) { - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 3) { - if (*ptr2++ != *ptr1++) - return 0; - } - } - } - break; - default: - if (MINBPC(enc) == 1 && *ptr1 == *ptr2) - return 1; - switch (BYTE_TYPE(enc, ptr2)) { - case BT_LEAD2: - case BT_LEAD3: - case BT_LEAD4: - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - return 0; - default: - return 1; - } - } - } - /* not reached */ -} - -static int PTRCALL -PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, - const char *end1, const char *ptr2) -{ - for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) { - if (ptr1 == end1) - return 0; - if (!CHAR_MATCHES(enc, ptr1, *ptr2)) - return 0; - } - return ptr1 == end1; -} - -static int PTRFASTCALL -PREFIX(nameLength)(const ENCODING *enc, const char *ptr) -{ - const char *start = ptr; - for (;;) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - ptr += MINBPC(enc); - break; - default: - return (int)(ptr - start); - } - } -} - -static const char * PTRFASTCALL -PREFIX(skipS)(const ENCODING *enc, const char *ptr) -{ - for (;;) { - switch (BYTE_TYPE(enc, ptr)) { - case BT_LF: - case BT_CR: - case BT_S: - ptr += MINBPC(enc); - break; - default: - return ptr; - } - } -} - -static void PTRCALL -PREFIX(updatePosition)(const ENCODING *enc, - const char *ptr, - const char *end, - POSITION *pos) -{ - while (ptr < end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_LF: - pos->columnNumber = (XML_Size)-1; - pos->lineNumber++; - ptr += MINBPC(enc); - break; - case BT_CR: - pos->lineNumber++; - ptr += MINBPC(enc); - if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - pos->columnNumber = (XML_Size)-1; - break; - default: - ptr += MINBPC(enc); - break; - } - pos->columnNumber++; - } -} - -#undef DO_LEAD_CASE -#undef MULTIBYTE_CASES -#undef INVALID_CASES -#undef CHECK_NAME_CASE -#undef CHECK_NAME_CASES -#undef CHECK_NMSTRT_CASE -#undef CHECK_NMSTRT_CASES - -#endif /* XML_TOK_IMPL_C */ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmltok_impl.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmltok_impl.h deleted file mode 100644 index da0ea60a..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmltok_impl.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -enum { - BT_NONXML, - BT_MALFORM, - BT_LT, - BT_AMP, - BT_RSQB, - BT_LEAD2, - BT_LEAD3, - BT_LEAD4, - BT_TRAIL, - BT_CR, - BT_LF, - BT_GT, - BT_QUOT, - BT_APOS, - BT_EQUALS, - BT_QUEST, - BT_EXCL, - BT_SOL, - BT_SEMI, - BT_NUM, - BT_LSQB, - BT_S, - BT_NMSTRT, - BT_COLON, - BT_HEX, - BT_DIGIT, - BT_NAME, - BT_MINUS, - BT_OTHER, /* known not to be a name or name start character */ - BT_NONASCII, /* might be a name or name start character */ - BT_PERCNT, - BT_LPAR, - BT_RPAR, - BT_AST, - BT_PLUS, - BT_COMMA, - BT_VERBAR -}; - -#include diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmltok_ns.c b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmltok_ns.c deleted file mode 100644 index c3b88fdf..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/lib/xmltok_ns.c +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* This file is included! */ -#ifdef XML_TOK_NS_C - -const ENCODING * -NS(XmlGetUtf8InternalEncoding)(void) -{ - return &ns(internal_utf8_encoding).enc; -} - -const ENCODING * -NS(XmlGetUtf16InternalEncoding)(void) -{ -#if BYTEORDER == 1234 - return &ns(internal_little2_encoding).enc; -#elif BYTEORDER == 4321 - return &ns(internal_big2_encoding).enc; -#else - const short n = 1; - return (*(const char *)&n - ? &ns(internal_little2_encoding).enc - : &ns(internal_big2_encoding).enc); -#endif -} - -static const ENCODING * const NS(encodings)[] = { - &ns(latin1_encoding).enc, - &ns(ascii_encoding).enc, - &ns(utf8_encoding).enc, - &ns(big2_encoding).enc, - &ns(big2_encoding).enc, - &ns(little2_encoding).enc, - &ns(utf8_encoding).enc /* NO_ENC */ -}; - -static int PTRCALL -NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - return initScan(NS(encodings), (const INIT_ENCODING *)enc, - XML_PROLOG_STATE, ptr, end, nextTokPtr); -} - -static int PTRCALL -NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - return initScan(NS(encodings), (const INIT_ENCODING *)enc, - XML_CONTENT_STATE, ptr, end, nextTokPtr); -} - -int -NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, - const char *name) -{ - int i = getEncodingIndex(name); - if (i == UNKNOWN_ENC) - return 0; - SET_INIT_ENC_INDEX(p, i); - p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog); - p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent); - p->initEnc.updatePosition = initUpdatePosition; - p->encPtr = encPtr; - *encPtr = &(p->initEnc); - return 1; -} - -static const ENCODING * -NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) -{ -#define ENCODING_MAX 128 - char buf[ENCODING_MAX]; - char *p = buf; - int i; - XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1); - if (ptr != end) - return 0; - *p = 0; - if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2) - return enc; - i = getEncodingIndex(buf); - if (i == UNKNOWN_ENC) - return 0; - return NS(encodings)[i]; -} - -int -NS(XmlParseXmlDecl)(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingName, - const ENCODING **encoding, - int *standalone) -{ - return doParseXmlDecl(NS(findEncoding), - isGeneralTextEntity, - enc, - ptr, - end, - badPtr, - versionPtr, - versionEndPtr, - encodingName, - encoding, - standalone); -} - -#endif /* XML_TOK_NS_C */ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/codepage.c b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/codepage.c deleted file mode 100644 index 57e48ff2..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/codepage.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include "codepage.h" - -#if (defined(WIN32) || (defined(__WATCOMC__) && defined(__NT__))) -#define STRICT 1 -#define WIN32_LEAN_AND_MEAN 1 - -#include - -int -codepageMap(int cp, int *map) -{ - int i; - CPINFO info; - if (!GetCPInfo(cp, &info) || info.MaxCharSize > 2) - return 0; - for (i = 0; i < 256; i++) - map[i] = -1; - if (info.MaxCharSize > 1) { - for (i = 0; i < MAX_LEADBYTES; i+=2) { - int j, lim; - if (info.LeadByte[i] == 0 && info.LeadByte[i + 1] == 0) - break; - lim = info.LeadByte[i + 1]; - for (j = info.LeadByte[i]; j <= lim; j++) - map[j] = -2; - } - } - for (i = 0; i < 256; i++) { - if (map[i] == -1) { - char c = (char)i; - unsigned short n; - if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, - &c, 1, &n, 1) == 1) - map[i] = n; - } - } - return 1; -} - -int -codepageConvert(int cp, const char *p) -{ - unsigned short c; - if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, - p, 2, &c, 1) == 1) - return c; - return -1; -} - -#else /* not WIN32 */ - -int -codepageMap(int cp, int *map) -{ - return 0; -} - -int -codepageConvert(int cp, const char *p) -{ - return -1; -} - -#endif /* not WIN32 */ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/codepage.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/codepage.h deleted file mode 100644 index 6a4df688..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/codepage.h +++ /dev/null @@ -1,6 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -int codepageMap(int cp, int *map); -int codepageConvert(int cp, const char *p); diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/ct.c b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/ct.c deleted file mode 100644 index 95903a34..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/ct.c +++ /dev/null @@ -1,147 +0,0 @@ -#define CHARSET_MAX 41 - -static const char * -getTok(const char **pp) -{ - enum { inAtom, inString, init, inComment }; - int state = init; - const char *tokStart = 0; - for (;;) { - switch (**pp) { - case '\0': - return 0; - case ' ': - case '\r': - case '\t': - case '\n': - if (state == inAtom) - return tokStart; - break; - case '(': - if (state == inAtom) - return tokStart; - if (state != inString) - state++; - break; - case ')': - if (state > init) - --state; - else if (state != inString) - return 0; - break; - case ';': - case '/': - case '=': - if (state == inAtom) - return tokStart; - if (state == init) - return (*pp)++; - break; - case '\\': - ++*pp; - if (**pp == '\0') - return 0; - break; - case '"': - switch (state) { - case inString: - ++*pp; - return tokStart; - case inAtom: - return tokStart; - case init: - tokStart = *pp; - state = inString; - break; - } - break; - default: - if (state == init) { - tokStart = *pp; - state = inAtom; - } - break; - } - ++*pp; - } - /* not reached */ -} - -/* key must be lowercase ASCII */ - -static int -matchkey(const char *start, const char *end, const char *key) -{ - if (!start) - return 0; - for (; start != end; start++, key++) - if (*start != *key && *start != 'A' + (*key - 'a')) - return 0; - return *key == '\0'; -} - -void -getXMLCharset(const char *buf, char *charset) -{ - const char *next, *p; - - charset[0] = '\0'; - next = buf; - p = getTok(&next); - if (matchkey(p, next, "text")) - strcpy(charset, "us-ascii"); - else if (!matchkey(p, next, "application")) - return; - p = getTok(&next); - if (!p || *p != '/') - return; - p = getTok(&next); - if (matchkey(p, next, "xml")) - isXml = 1; - p = getTok(&next); - while (p) { - if (*p == ';') { - p = getTok(&next); - if (matchkey(p, next, "charset")) { - p = getTok(&next); - if (p && *p == '=') { - p = getTok(&next); - if (p) { - char *s = charset; - if (*p == '"') { - while (++p != next - 1) { - if (*p == '\\') - ++p; - if (s == charset + CHARSET_MAX - 1) { - charset[0] = '\0'; - break; - } - *s++ = *p; - } - *s++ = '\0'; - } - else { - if (next - p > CHARSET_MAX - 1) - break; - while (p != next) - *s++ = *p++; - *s = 0; - break; - } - } - } - } - } - else - p = getTok(&next); - } -} - -int -main(int argc, char **argv) -{ - char buf[CHARSET_MAX]; - getXMLCharset(argv[1], buf); - printf("charset = \"%s\"\n", buf); - return 0; -} diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/filemap.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/filemap.h deleted file mode 100644 index 814edec2..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/filemap.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include - -#ifdef XML_UNICODE -int filemap(const wchar_t *name, - void (*processor)(const void *, size_t, - const wchar_t *, void *arg), - void *arg); -#else -int filemap(const char *name, - void (*processor)(const void *, size_t, - const char *, void *arg), - void *arg); -#endif diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/readfilemap.c b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/readfilemap.c deleted file mode 100644 index bd32b934..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/readfilemap.c +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include -#include -#include -#include -#include - -#ifdef __WATCOMC__ -#ifndef __LINUX__ -#include -#else -#include -#endif -#endif - -#ifdef __BEOS__ -#include -#endif - -#ifndef S_ISREG -#ifndef S_IFREG -#define S_IFREG _S_IFREG -#endif -#ifndef S_IFMT -#define S_IFMT _S_IFMT -#endif -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#endif /* not S_ISREG */ - -#ifndef O_BINARY -#ifdef _O_BINARY -#define O_BINARY _O_BINARY -#else -#define O_BINARY 0 -#endif -#endif - -#include "filemap.h" - -int -filemap(const char *name, - void (*processor)(const void *, size_t, const char *, void *arg), - void *arg) -{ - size_t nbytes; - int fd; - int n; - struct stat sb; - void *p; - - fd = open(name, O_RDONLY|O_BINARY); - if (fd < 0) { - perror(name); - return 0; - } - if (fstat(fd, &sb) < 0) { - perror(name); - close(fd); - return 0; - } - if (!S_ISREG(sb.st_mode)) { - fprintf(stderr, "%s: not a regular file\n", name); - close(fd); - return 0; - } - nbytes = sb.st_size; - /* malloc will return NULL with nbytes == 0, handle files with size 0 */ - if (nbytes == 0) { - static const char c = '\0'; - processor(&c, 0, name, arg); - close(fd); - return 1; - } - p = malloc(nbytes); - if (!p) { - fprintf(stderr, "%s: out of memory\n", name); - close(fd); - return 0; - } - n = read(fd, p, nbytes); - if (n < 0) { - perror(name); - free(p); - close(fd); - return 0; - } - if (n != nbytes) { - fprintf(stderr, "%s: read unexpected number of bytes\n", name); - free(p); - close(fd); - return 0; - } - processor(p, nbytes, name, arg); - free(p); - close(fd); - return 1; -} diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/unixfilemap.c b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/unixfilemap.c deleted file mode 100644 index 93adce32..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/unixfilemap.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef MAP_FILE -#define MAP_FILE 0 -#endif - -#include "filemap.h" - -int -filemap(const char *name, - void (*processor)(const void *, size_t, const char *, void *arg), - void *arg) -{ - int fd; - size_t nbytes; - struct stat sb; - void *p; - - fd = open(name, O_RDONLY); - if (fd < 0) { - perror(name); - return 0; - } - if (fstat(fd, &sb) < 0) { - perror(name); - close(fd); - return 0; - } - if (!S_ISREG(sb.st_mode)) { - close(fd); - fprintf(stderr, "%s: not a regular file\n", name); - return 0; - } - - nbytes = sb.st_size; - /* mmap fails for zero length files */ - if (nbytes == 0) { - static const char c = '\0'; - processor(&c, 0, name, arg); - close(fd); - return 1; - } - p = (void *)mmap((caddr_t)0, (size_t)nbytes, PROT_READ, - MAP_FILE|MAP_PRIVATE, fd, (off_t)0); - if (p == (void *)-1) { - perror(name); - close(fd); - return 0; - } - processor(p, nbytes, name, arg); - munmap((caddr_t)p, nbytes); - close(fd); - return 1; -} diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/win32filemap.c b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/win32filemap.c deleted file mode 100644 index 41dc35b6..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/win32filemap.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#define STRICT 1 -#define WIN32_LEAN_AND_MEAN 1 - -#ifdef XML_UNICODE_WCHAR_T -#ifndef XML_UNICODE -#define XML_UNICODE -#endif -#endif - -#ifdef XML_UNICODE -#define UNICODE -#define _UNICODE -#endif /* XML_UNICODE */ -#include -#include -#include -#include "filemap.h" - -static void win32perror(const TCHAR *); - -int -filemap(const TCHAR *name, - void (*processor)(const void *, size_t, const TCHAR *, void *arg), - void *arg) -{ - HANDLE f; - HANDLE m; - DWORD size; - DWORD sizeHi; - void *p; - - f = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, - FILE_FLAG_SEQUENTIAL_SCAN, NULL); - if (f == INVALID_HANDLE_VALUE) { - win32perror(name); - return 0; - } - size = GetFileSize(f, &sizeHi); - if (size == (DWORD)-1) { - win32perror(name); - return 0; - } - if (sizeHi) { - _ftprintf(stderr, _T("%s: bigger than 2Gb\n"), name); - return 0; - } - /* CreateFileMapping barfs on zero length files */ - if (size == 0) { - static const char c = '\0'; - processor(&c, 0, name, arg); - CloseHandle(f); - return 1; - } - m = CreateFileMapping(f, NULL, PAGE_READONLY, 0, 0, NULL); - if (m == NULL) { - win32perror(name); - CloseHandle(f); - return 0; - } - p = MapViewOfFile(m, FILE_MAP_READ, 0, 0, 0); - if (p == NULL) { - win32perror(name); - CloseHandle(m); - CloseHandle(f); - return 0; - } - processor(p, size, name, arg); - UnmapViewOfFile(p); - CloseHandle(m); - CloseHandle(f); - return 1; -} - -static void -win32perror(const TCHAR *s) -{ - LPVOID buf; - if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &buf, - 0, - NULL)) { - _ftprintf(stderr, _T("%s: %s"), s, buf); - fflush(stderr); - LocalFree(buf); - } - else - _ftprintf(stderr, _T("%s: unknown Windows error\n"), s); -} diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlfile.c b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlfile.c deleted file mode 100644 index 99eeeaae..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlfile.c +++ /dev/null @@ -1,244 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include -#include -#include -#include -#include - -#ifdef COMPILED_FROM_DSP -#include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" -#elif defined(HAVE_EXPAT_CONFIG_H) -#include -#endif /* ndef COMPILED_FROM_DSP */ - -#include "expat.h" -#include "xmlfile.h" -#include "xmltchar.h" -#include "filemap.h" - -#if (defined(_MSC_VER) || (defined(__WATCOMC__) && !defined(__LINUX__))) -#include -#endif - -#if defined(__amigaos__) && defined(__USE_INLINE__) -#include -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifndef O_BINARY -#ifdef _O_BINARY -#define O_BINARY _O_BINARY -#else -#define O_BINARY 0 -#endif -#endif - -#ifdef _DEBUG -#define READ_SIZE 16 -#else -#define READ_SIZE (1024*8) -#endif - - -typedef struct { - XML_Parser parser; - int *retPtr; -} PROCESS_ARGS; - -static void -reportError(XML_Parser parser, const XML_Char *filename) -{ - enum XML_Error code = XML_GetErrorCode(parser); - const XML_Char *message = XML_ErrorString(code); - if (message) - ftprintf(stdout, T("%s:%" XML_FMT_INT_MOD "u:%" XML_FMT_INT_MOD "u: %s\n"), - filename, - XML_GetErrorLineNumber(parser), - XML_GetErrorColumnNumber(parser), - message); - else - ftprintf(stderr, T("%s: (unknown message %d)\n"), filename, code); -} - -/* This implementation will give problems on files larger than INT_MAX. */ -static void -processFile(const void *data, size_t size, - const XML_Char *filename, void *args) -{ - XML_Parser parser = ((PROCESS_ARGS *)args)->parser; - int *retPtr = ((PROCESS_ARGS *)args)->retPtr; - if (XML_Parse(parser, (const char *)data, (int)size, 1) == XML_STATUS_ERROR) { - reportError(parser, filename); - *retPtr = 0; - } - else - *retPtr = 1; -} - -#if (defined(WIN32) || defined(__WATCOMC__)) - -static int -isAsciiLetter(XML_Char c) -{ - return (T('a') <= c && c <= T('z')) || (T('A') <= c && c <= T('Z')); -} - -#endif /* WIN32 */ - -static const XML_Char * -resolveSystemId(const XML_Char *base, const XML_Char *systemId, - XML_Char **toFree) -{ - XML_Char *s; - *toFree = 0; - if (!base - || *systemId == T('/') -#if (defined(WIN32) || defined(__WATCOMC__)) - || *systemId == T('\\') - || (isAsciiLetter(systemId[0]) && systemId[1] == T(':')) -#endif - ) - return systemId; - *toFree = (XML_Char *)malloc((tcslen(base) + tcslen(systemId) + 2) - * sizeof(XML_Char)); - if (!*toFree) - return systemId; - tcscpy(*toFree, base); - s = *toFree; - if (tcsrchr(s, T('/'))) - s = tcsrchr(s, T('/')) + 1; -#if (defined(WIN32) || defined(__WATCOMC__)) - if (tcsrchr(s, T('\\'))) - s = tcsrchr(s, T('\\')) + 1; -#endif - tcscpy(s, systemId); - return *toFree; -} - -static int -externalEntityRefFilemap(XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) -{ - int result; - XML_Char *s; - const XML_Char *filename; - XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0); - PROCESS_ARGS args; - args.retPtr = &result; - args.parser = entParser; - filename = resolveSystemId(base, systemId, &s); - XML_SetBase(entParser, filename); - if (!filemap(filename, processFile, &args)) - result = 0; - free(s); - XML_ParserFree(entParser); - return result; -} - -static int -processStream(const XML_Char *filename, XML_Parser parser) -{ - /* passing NULL for filename means read intput from stdin */ - int fd = 0; /* 0 is the fileno for stdin */ - - if (filename != NULL) { - fd = topen(filename, O_BINARY|O_RDONLY); - if (fd < 0) { - tperror(filename); - return 0; - } - } - for (;;) { - int nread; - char *buf = (char *)XML_GetBuffer(parser, READ_SIZE); - if (!buf) { - if (filename != NULL) - close(fd); - ftprintf(stderr, T("%s: out of memory\n"), - filename != NULL ? filename : "xmlwf"); - return 0; - } - nread = read(fd, buf, READ_SIZE); - if (nread < 0) { - tperror(filename != NULL ? filename : "STDIN"); - if (filename != NULL) - close(fd); - return 0; - } - if (XML_ParseBuffer(parser, nread, nread == 0) == XML_STATUS_ERROR) { - reportError(parser, filename != NULL ? filename : "STDIN"); - if (filename != NULL) - close(fd); - return 0; - } - if (nread == 0) { - if (filename != NULL) - close(fd); - break;; - } - } - return 1; -} - -static int -externalEntityRefStream(XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) -{ - XML_Char *s; - const XML_Char *filename; - int ret; - XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0); - filename = resolveSystemId(base, systemId, &s); - XML_SetBase(entParser, filename); - ret = processStream(filename, entParser); - free(s); - XML_ParserFree(entParser); - return ret; -} - -int -XML_ProcessFile(XML_Parser parser, - const XML_Char *filename, - unsigned flags) -{ - int result; - - if (!XML_SetBase(parser, filename)) { - ftprintf(stderr, T("%s: out of memory"), filename); - exit(1); - } - - if (flags & XML_EXTERNAL_ENTITIES) - XML_SetExternalEntityRefHandler(parser, - (flags & XML_MAP_FILE) - ? externalEntityRefFilemap - : externalEntityRefStream); - if (flags & XML_MAP_FILE) { - PROCESS_ARGS args; - args.retPtr = &result; - args.parser = parser; - if (!filemap(filename, processFile, &args)) - result = 0; - } - else - result = processStream(filename, parser); - return result; -} diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlfile.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlfile.h deleted file mode 100644 index d093ecc0..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlfile.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#define XML_MAP_FILE 01 -#define XML_EXTERNAL_ENTITIES 02 - -#ifdef XML_LARGE_SIZE -#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 -#define XML_FMT_INT_MOD "I64" -#else -#define XML_FMT_INT_MOD "ll" -#endif -#else -#define XML_FMT_INT_MOD "l" -#endif - -extern int XML_ProcessFile(XML_Parser parser, - const XML_Char *filename, - unsigned flags); diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlmime.c b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlmime.c deleted file mode 100644 index 56a0e7f4..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlmime.c +++ /dev/null @@ -1,163 +0,0 @@ -#include -#include "xmlmime.h" - -static const char * -getTok(const char **pp) -{ - /* inComment means one level of nesting; inComment+1 means two levels etc */ - enum { inAtom, inString, init, inComment }; - int state = init; - const char *tokStart = 0; - for (;;) { - switch (**pp) { - case '\0': - if (state == inAtom) - return tokStart; - return 0; - case ' ': - case '\r': - case '\t': - case '\n': - if (state == inAtom) - return tokStart; - break; - case '(': - if (state == inAtom) - return tokStart; - if (state != inString) - state++; - break; - case ')': - if (state > init) - --state; - else if (state != inString) - return 0; - break; - case ';': - case '/': - case '=': - if (state == inAtom) - return tokStart; - if (state == init) - return (*pp)++; - break; - case '\\': - ++*pp; - if (**pp == '\0') - return 0; - break; - case '"': - switch (state) { - case inString: - ++*pp; - return tokStart; - case inAtom: - return tokStart; - case init: - tokStart = *pp; - state = inString; - break; - } - break; - default: - if (state == init) { - tokStart = *pp; - state = inAtom; - } - break; - } - ++*pp; - } - /* not reached */ -} - -/* key must be lowercase ASCII */ - -static int -matchkey(const char *start, const char *end, const char *key) -{ - if (!start) - return 0; - for (; start != end; start++, key++) - if (*start != *key && *start != 'A' + (*key - 'a')) - return 0; - return *key == '\0'; -} - -void -getXMLCharset(const char *buf, char *charset) -{ - const char *next, *p; - - charset[0] = '\0'; - next = buf; - p = getTok(&next); - if (matchkey(p, next, "text")) - strcpy(charset, "us-ascii"); - else if (!matchkey(p, next, "application")) - return; - p = getTok(&next); - if (!p || *p != '/') - return; - p = getTok(&next); -#if 0 - if (!matchkey(p, next, "xml") && charset[0] == '\0') - return; -#endif - p = getTok(&next); - while (p) { - if (*p == ';') { - p = getTok(&next); - if (matchkey(p, next, "charset")) { - p = getTok(&next); - if (p && *p == '=') { - p = getTok(&next); - if (p) { - char *s = charset; - if (*p == '"') { - while (++p != next - 1) { - if (*p == '\\') - ++p; - if (s == charset + CHARSET_MAX - 1) { - charset[0] = '\0'; - break; - } - *s++ = *p; - } - *s++ = '\0'; - } - else { - if (next - p > CHARSET_MAX - 1) - break; - while (p != next) - *s++ = *p++; - *s = 0; - break; - } - } - } - break; - } - } - else - p = getTok(&next); - } -} - -#ifdef TEST - -#include - -int -main(int argc, char *argv[]) -{ - char buf[CHARSET_MAX]; - if (argc <= 1) - return 1; - printf("%s\n", argv[1]); - getXMLCharset(argv[1], buf); - printf("charset=\"%s\"\n", buf); - return 0; -} - -#endif /* TEST */ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlmime.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlmime.h deleted file mode 100644 index bf0356df..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlmime.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif - -/* Registered charset names are at most 40 characters long. */ - -#define CHARSET_MAX 41 - -/* Figure out the charset to use from the ContentType. - buf contains the body of the header field (the part after "Content-Type:"). - charset gets the charset to use. It must be at least CHARSET_MAX chars - long. charset will be empty if the default charset should be used. -*/ - -void getXMLCharset(const char *buf, char *charset); - -#ifdef __cplusplus -} -#endif diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmltchar.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmltchar.h deleted file mode 100644 index 10885755..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmltchar.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifdef XML_UNICODE -#ifndef XML_UNICODE_WCHAR_T -#error xmlwf requires a 16-bit Unicode-compatible wchar_t -#endif -#define T(x) L ## x -#define ftprintf fwprintf -#define tfopen _wfopen -#define fputts fputws -#define puttc putwc -#define tcscmp wcscmp -#define tcscpy wcscpy -#define tcscat wcscat -#define tcschr wcschr -#define tcsrchr wcsrchr -#define tcslen wcslen -#define tperror _wperror -#define topen _wopen -#define tmain wmain -#define tremove _wremove -#else /* not XML_UNICODE */ -#define T(x) x -#define ftprintf fprintf -#define tfopen fopen -#define fputts fputs -#define puttc putc -#define tcscmp strcmp -#define tcscpy strcpy -#define tcscat strcat -#define tcschr strchr -#define tcsrchr strrchr -#define tcslen strlen -#define tperror perror -#define topen open -#define tmain main -#define tremove remove -#endif /* not XML_UNICODE */ diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlurl.h b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlurl.h deleted file mode 100644 index d329913a..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlurl.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif - -int XML_URLInit(); -void XML_URLUninit(); -int XML_ProcessURL(XML_Parser parser, - const XML_Char *url, - unsigned flags); - -#ifdef __cplusplus -} -#endif diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlwf.c b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlwf.c deleted file mode 100644 index 4fc77da9..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlwf.c +++ /dev/null @@ -1,861 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include -#include -#include -#include - -#include "expat.h" -#include "codepage.h" -#include "xmlfile.h" -#include "xmltchar.h" - -#ifdef _MSC_VER -#include -#endif - -#if defined(__amigaos__) && defined(__USE_INLINE__) -#include -#endif - -/* This ensures proper sorting. */ - -#define NSSEP T('\001') - -static void XMLCALL -characterData(void *userData, const XML_Char *s, int len) -{ - FILE *fp = (FILE *)userData; - for (; len > 0; --len, ++s) { - switch (*s) { - case T('&'): - fputts(T("&"), fp); - break; - case T('<'): - fputts(T("<"), fp); - break; - case T('>'): - fputts(T(">"), fp); - break; -#ifdef W3C14N - case 13: - fputts(T(" "), fp); - break; -#else - case T('"'): - fputts(T("""), fp); - break; - case 9: - case 10: - case 13: - ftprintf(fp, T("&#%d;"), *s); - break; -#endif - default: - puttc(*s, fp); - break; - } - } -} - -static void -attributeValue(FILE *fp, const XML_Char *s) -{ - puttc(T('='), fp); - puttc(T('"'), fp); - for (;;) { - switch (*s) { - case 0: - case NSSEP: - puttc(T('"'), fp); - return; - case T('&'): - fputts(T("&"), fp); - break; - case T('<'): - fputts(T("<"), fp); - break; - case T('"'): - fputts(T("""), fp); - break; -#ifdef W3C14N - case 9: - fputts(T(" "), fp); - break; - case 10: - fputts(T(" "), fp); - break; - case 13: - fputts(T(" "), fp); - break; -#else - case T('>'): - fputts(T(">"), fp); - break; - case 9: - case 10: - case 13: - ftprintf(fp, T("&#%d;"), *s); - break; -#endif - default: - puttc(*s, fp); - break; - } - s++; - } -} - -/* Lexicographically comparing UTF-8 encoded attribute values, -is equivalent to lexicographically comparing based on the character number. */ - -static int -attcmp(const void *att1, const void *att2) -{ - return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2); -} - -static void XMLCALL -startElement(void *userData, const XML_Char *name, const XML_Char **atts) -{ - int nAtts; - const XML_Char **p; - FILE *fp = (FILE *)userData; - puttc(T('<'), fp); - fputts(name, fp); - - p = atts; - while (*p) - ++p; - nAtts = (int)((p - atts) >> 1); - if (nAtts > 1) - qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, attcmp); - while (*atts) { - puttc(T(' '), fp); - fputts(*atts++, fp); - attributeValue(fp, *atts); - atts++; - } - puttc(T('>'), fp); -} - -static void XMLCALL -endElement(void *userData, const XML_Char *name) -{ - FILE *fp = (FILE *)userData; - puttc(T('<'), fp); - puttc(T('/'), fp); - fputts(name, fp); - puttc(T('>'), fp); -} - -static int -nsattcmp(const void *p1, const void *p2) -{ - const XML_Char *att1 = *(const XML_Char **)p1; - const XML_Char *att2 = *(const XML_Char **)p2; - int sep1 = (tcsrchr(att1, NSSEP) != 0); - int sep2 = (tcsrchr(att1, NSSEP) != 0); - if (sep1 != sep2) - return sep1 - sep2; - return tcscmp(att1, att2); -} - -static void XMLCALL -startElementNS(void *userData, const XML_Char *name, const XML_Char **atts) -{ - int nAtts; - int nsi; - const XML_Char **p; - FILE *fp = (FILE *)userData; - const XML_Char *sep; - puttc(T('<'), fp); - - sep = tcsrchr(name, NSSEP); - if (sep) { - fputts(T("n1:"), fp); - fputts(sep + 1, fp); - fputts(T(" xmlns:n1"), fp); - attributeValue(fp, name); - nsi = 2; - } - else { - fputts(name, fp); - nsi = 1; - } - - p = atts; - while (*p) - ++p; - nAtts = (int)((p - atts) >> 1); - if (nAtts > 1) - qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, nsattcmp); - while (*atts) { - name = *atts++; - sep = tcsrchr(name, NSSEP); - puttc(T(' '), fp); - if (sep) { - ftprintf(fp, T("n%d:"), nsi); - fputts(sep + 1, fp); - } - else - fputts(name, fp); - attributeValue(fp, *atts); - if (sep) { - ftprintf(fp, T(" xmlns:n%d"), nsi++); - attributeValue(fp, name); - } - atts++; - } - puttc(T('>'), fp); -} - -static void XMLCALL -endElementNS(void *userData, const XML_Char *name) -{ - FILE *fp = (FILE *)userData; - const XML_Char *sep; - puttc(T('<'), fp); - puttc(T('/'), fp); - sep = tcsrchr(name, NSSEP); - if (sep) { - fputts(T("n1:"), fp); - fputts(sep + 1, fp); - } - else - fputts(name, fp); - puttc(T('>'), fp); -} - -#ifndef W3C14N - -static void XMLCALL -processingInstruction(void *userData, const XML_Char *target, - const XML_Char *data) -{ - FILE *fp = (FILE *)userData; - puttc(T('<'), fp); - puttc(T('?'), fp); - fputts(target, fp); - puttc(T(' '), fp); - fputts(data, fp); - puttc(T('?'), fp); - puttc(T('>'), fp); -} - -#endif /* not W3C14N */ - -static void XMLCALL -defaultCharacterData(void *userData, const XML_Char *s, int len) -{ - XML_DefaultCurrent((XML_Parser) userData); -} - -static void XMLCALL -defaultStartElement(void *userData, const XML_Char *name, - const XML_Char **atts) -{ - XML_DefaultCurrent((XML_Parser) userData); -} - -static void XMLCALL -defaultEndElement(void *userData, const XML_Char *name) -{ - XML_DefaultCurrent((XML_Parser) userData); -} - -static void XMLCALL -defaultProcessingInstruction(void *userData, const XML_Char *target, - const XML_Char *data) -{ - XML_DefaultCurrent((XML_Parser) userData); -} - -static void XMLCALL -nopCharacterData(void *userData, const XML_Char *s, int len) -{ -} - -static void XMLCALL -nopStartElement(void *userData, const XML_Char *name, const XML_Char **atts) -{ -} - -static void XMLCALL -nopEndElement(void *userData, const XML_Char *name) -{ -} - -static void XMLCALL -nopProcessingInstruction(void *userData, const XML_Char *target, - const XML_Char *data) -{ -} - -static void XMLCALL -markup(void *userData, const XML_Char *s, int len) -{ - FILE *fp = (FILE *)XML_GetUserData((XML_Parser) userData); - for (; len > 0; --len, ++s) - puttc(*s, fp); -} - -static void -metaLocation(XML_Parser parser) -{ - const XML_Char *uri = XML_GetBase(parser); - if (uri) - ftprintf((FILE *)XML_GetUserData(parser), T(" uri=\"%s\""), uri); - ftprintf((FILE *)XML_GetUserData(parser), - T(" byte=\"%" XML_FMT_INT_MOD "d\" nbytes=\"%d\" \ - line=\"%" XML_FMT_INT_MOD "u\" col=\"%" XML_FMT_INT_MOD "u\""), - XML_GetCurrentByteIndex(parser), - XML_GetCurrentByteCount(parser), - XML_GetCurrentLineNumber(parser), - XML_GetCurrentColumnNumber(parser)); -} - -static void -metaStartDocument(void *userData) -{ - fputts(T("\n"), (FILE *)XML_GetUserData((XML_Parser) userData)); -} - -static void -metaEndDocument(void *userData) -{ - fputts(T("\n"), (FILE *)XML_GetUserData((XML_Parser) userData)); -} - -static void XMLCALL -metaStartElement(void *userData, const XML_Char *name, - const XML_Char **atts) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - const XML_Char **specifiedAttsEnd - = atts + XML_GetSpecifiedAttributeCount(parser); - const XML_Char **idAttPtr; - int idAttIndex = XML_GetIdAttributeIndex(parser); - if (idAttIndex < 0) - idAttPtr = 0; - else - idAttPtr = atts + idAttIndex; - - ftprintf(fp, T("\n"), fp); - do { - ftprintf(fp, T("= specifiedAttsEnd) - fputts(T("\" defaulted=\"yes\"/>\n"), fp); - else if (atts == idAttPtr) - fputts(T("\" id=\"yes\"/>\n"), fp); - else - fputts(T("\"/>\n"), fp); - } while (*(atts += 2)); - fputts(T("\n"), fp); - } - else - fputts(T("/>\n"), fp); -} - -static void XMLCALL -metaEndElement(void *userData, const XML_Char *name) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - ftprintf(fp, T("\n"), fp); -} - -static void XMLCALL -metaProcessingInstruction(void *userData, const XML_Char *target, - const XML_Char *data) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - ftprintf(fp, T("\n"), fp); -} - -static void XMLCALL -metaComment(void *userData, const XML_Char *data) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - fputts(T("\n"), fp); -} - -static void XMLCALL -metaStartCdataSection(void *userData) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - fputts(T("\n"), fp); -} - -static void XMLCALL -metaEndCdataSection(void *userData) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - fputts(T("\n"), fp); -} - -static void XMLCALL -metaCharacterData(void *userData, const XML_Char *s, int len) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - fputts(T("\n"), fp); -} - -static void XMLCALL -metaStartDoctypeDecl(void *userData, - const XML_Char *doctypeName, - const XML_Char *sysid, - const XML_Char *pubid, - int has_internal_subset) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - ftprintf(fp, T("\n"), fp); -} - -static void XMLCALL -metaEndDoctypeDecl(void *userData) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - fputts(T("\n"), fp); -} - -static void XMLCALL -metaNotationDecl(void *userData, - const XML_Char *notationName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - ftprintf(fp, T("\n"), fp); -} - - -static void XMLCALL -metaEntityDecl(void *userData, - const XML_Char *entityName, - int is_param, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - - if (value) { - ftprintf(fp, T("'), fp); - characterData(fp, value, value_length); - fputts(T("\n"), fp); - } - else if (notationName) { - ftprintf(fp, T("\n"), fp); - } - else { - ftprintf(fp, T("\n"), fp); - } -} - -static void XMLCALL -metaStartNamespaceDecl(void *userData, - const XML_Char *prefix, - const XML_Char *uri) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - fputts(T("\n"), fp); - } - else - fputts(T("/>\n"), fp); -} - -static void XMLCALL -metaEndNamespaceDecl(void *userData, const XML_Char *prefix) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - if (!prefix) - fputts(T("\n"), fp); - else - ftprintf(fp, T("\n"), prefix); -} - -static int XMLCALL -unknownEncodingConvert(void *data, const char *p) -{ - return codepageConvert(*(int *)data, p); -} - -static int XMLCALL -unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info) -{ - int cp; - static const XML_Char prefixL[] = T("windows-"); - static const XML_Char prefixU[] = T("WINDOWS-"); - int i; - - for (i = 0; prefixU[i]; i++) - if (name[i] != prefixU[i] && name[i] != prefixL[i]) - return 0; - - cp = 0; - for (; name[i]; i++) { - static const XML_Char digits[] = T("0123456789"); - const XML_Char *s = tcschr(digits, name[i]); - if (!s) - return 0; - cp *= 10; - cp += (int)(s - digits); - if (cp >= 0x10000) - return 0; - } - if (!codepageMap(cp, info->map)) - return 0; - info->convert = unknownEncodingConvert; - /* We could just cast the code page integer to a void *, - and avoid the use of release. */ - info->release = free; - info->data = malloc(sizeof(int)); - if (!info->data) - return 0; - *(int *)info->data = cp; - return 1; -} - -static int XMLCALL -notStandalone(void *userData) -{ - return 0; -} - -static void -showVersion(XML_Char *prog) -{ - XML_Char *s = prog; - XML_Char ch; - const XML_Feature *features = XML_GetFeatureList(); - while ((ch = *s) != 0) { - if (ch == '/' -#if (defined(WIN32) || defined(__WATCOMC__)) - || ch == '\\' -#endif - ) - prog = s + 1; - ++s; - } - ftprintf(stdout, T("%s using %s\n"), prog, XML_ExpatVersion()); - if (features != NULL && features[0].feature != XML_FEATURE_END) { - int i = 1; - ftprintf(stdout, T("%s"), features[0].name); - if (features[0].value) - ftprintf(stdout, T("=%ld"), features[0].value); - while (features[i].feature != XML_FEATURE_END) { - ftprintf(stdout, T(", %s"), features[i].name); - if (features[i].value) - ftprintf(stdout, T("=%ld"), features[i].value); - ++i; - } - ftprintf(stdout, T("\n")); - } -} - -static void -usage(const XML_Char *prog, int rc) -{ - ftprintf(stderr, - T("usage: %s [-n] [-p] [-r] [-s] [-w] [-x] [-d output-dir] " - "[-e encoding] file ...\n"), prog); - exit(rc); -} - -int -tmain(int argc, XML_Char **argv) -{ - int i, j; - const XML_Char *outputDir = NULL; - const XML_Char *encoding = NULL; - unsigned processFlags = XML_MAP_FILE; - int windowsCodePages = 0; - int outputType = 0; - int useNamespaces = 0; - int requireStandalone = 0; - enum XML_ParamEntityParsing paramEntityParsing = - XML_PARAM_ENTITY_PARSING_NEVER; - int useStdin = 0; - -#ifdef _MSC_VER - _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF); -#endif - - i = 1; - j = 0; - while (i < argc) { - if (j == 0) { - if (argv[i][0] != T('-')) - break; - if (argv[i][1] == T('-') && argv[i][2] == T('\0')) { - i++; - break; - } - j++; - } - switch (argv[i][j]) { - case T('r'): - processFlags &= ~XML_MAP_FILE; - j++; - break; - case T('s'): - requireStandalone = 1; - j++; - break; - case T('n'): - useNamespaces = 1; - j++; - break; - case T('p'): - paramEntityParsing = XML_PARAM_ENTITY_PARSING_ALWAYS; - /* fall through */ - case T('x'): - processFlags |= XML_EXTERNAL_ENTITIES; - j++; - break; - case T('w'): - windowsCodePages = 1; - j++; - break; - case T('m'): - outputType = 'm'; - j++; - break; - case T('c'): - outputType = 'c'; - useNamespaces = 0; - j++; - break; - case T('t'): - outputType = 't'; - j++; - break; - case T('d'): - if (argv[i][j + 1] == T('\0')) { - if (++i == argc) - usage(argv[0], 2); - outputDir = argv[i]; - } - else - outputDir = argv[i] + j + 1; - i++; - j = 0; - break; - case T('e'): - if (argv[i][j + 1] == T('\0')) { - if (++i == argc) - usage(argv[0], 2); - encoding = argv[i]; - } - else - encoding = argv[i] + j + 1; - i++; - j = 0; - break; - case T('h'): - usage(argv[0], 0); - return 0; - case T('v'): - showVersion(argv[0]); - return 0; - case T('\0'): - if (j > 1) { - i++; - j = 0; - break; - } - /* fall through */ - default: - usage(argv[0], 2); - } - } - if (i == argc) { - useStdin = 1; - processFlags &= ~XML_MAP_FILE; - i--; - } - for (; i < argc; i++) { - FILE *fp = 0; - XML_Char *outName = 0; - int result; - XML_Parser parser; - if (useNamespaces) - parser = XML_ParserCreateNS(encoding, NSSEP); - else - parser = XML_ParserCreate(encoding); - if (requireStandalone) - XML_SetNotStandaloneHandler(parser, notStandalone); - XML_SetParamEntityParsing(parser, paramEntityParsing); - if (outputType == 't') { - /* This is for doing timings; this gives a more realistic estimate of - the parsing time. */ - outputDir = 0; - XML_SetElementHandler(parser, nopStartElement, nopEndElement); - XML_SetCharacterDataHandler(parser, nopCharacterData); - XML_SetProcessingInstructionHandler(parser, nopProcessingInstruction); - } - else if (outputDir) { - const XML_Char * delim = T("/"); - const XML_Char *file = useStdin ? T("STDIN") : argv[i]; - if (!useStdin) { - /* Jump after last (back)slash */ - const XML_Char * lastDelim = tcsrchr(file, delim[0]); - if (lastDelim) - file = lastDelim + 1; -#if (defined(WIN32) || defined(__WATCOMC__)) - else { - const XML_Char * winDelim = T("\\"); - lastDelim = tcsrchr(file, winDelim[0]); - if (lastDelim) { - file = lastDelim + 1; - delim = winDelim; - } - } -#endif - } - outName = (XML_Char *)malloc((tcslen(outputDir) + tcslen(file) + 2) - * sizeof(XML_Char)); - tcscpy(outName, outputDir); - tcscat(outName, delim); - tcscat(outName, file); - fp = tfopen(outName, T("wb")); - if (!fp) { - tperror(outName); - exit(1); - } - setvbuf(fp, NULL, _IOFBF, 16384); -#ifdef XML_UNICODE - puttc(0xFEFF, fp); -#endif - XML_SetUserData(parser, fp); - switch (outputType) { - case 'm': - XML_UseParserAsHandlerArg(parser); - XML_SetElementHandler(parser, metaStartElement, metaEndElement); - XML_SetProcessingInstructionHandler(parser, metaProcessingInstruction); - XML_SetCommentHandler(parser, metaComment); - XML_SetCdataSectionHandler(parser, metaStartCdataSection, - metaEndCdataSection); - XML_SetCharacterDataHandler(parser, metaCharacterData); - XML_SetDoctypeDeclHandler(parser, metaStartDoctypeDecl, - metaEndDoctypeDecl); - XML_SetEntityDeclHandler(parser, metaEntityDecl); - XML_SetNotationDeclHandler(parser, metaNotationDecl); - XML_SetNamespaceDeclHandler(parser, metaStartNamespaceDecl, - metaEndNamespaceDecl); - metaStartDocument(parser); - break; - case 'c': - XML_UseParserAsHandlerArg(parser); - XML_SetDefaultHandler(parser, markup); - XML_SetElementHandler(parser, defaultStartElement, defaultEndElement); - XML_SetCharacterDataHandler(parser, defaultCharacterData); - XML_SetProcessingInstructionHandler(parser, - defaultProcessingInstruction); - break; - default: - if (useNamespaces) - XML_SetElementHandler(parser, startElementNS, endElementNS); - else - XML_SetElementHandler(parser, startElement, endElement); - XML_SetCharacterDataHandler(parser, characterData); -#ifndef W3C14N - XML_SetProcessingInstructionHandler(parser, processingInstruction); -#endif /* not W3C14N */ - break; - } - } - if (windowsCodePages) - XML_SetUnknownEncodingHandler(parser, unknownEncoding, 0); - result = XML_ProcessFile(parser, useStdin ? NULL : argv[i], processFlags); - if (outputDir) { - if (outputType == 'm') - metaEndDocument(parser); - fclose(fp); - if (!result) { - tremove(outName); - exit(2); - } - free(outName); - } - XML_ParserFree(parser); - } - return 0; -} diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlwf.dsp b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlwf.dsp deleted file mode 100644 index eb80c62b..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlwf.dsp +++ /dev/null @@ -1,139 +0,0 @@ -# Microsoft Developer Studio Project File - Name="xmlwf" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=xmlwf - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "xmlwf.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "xmlwf.mak" CFG="xmlwf - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "xmlwf - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "xmlwf - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "xmlwf - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "." -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\win32\bin\Release" -# PROP Intermediate_Dir "..\win32\tmp\Release-xmlwf" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "." -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\lib" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "COMPILED_FROM_DSP" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:console /machine:I386 -# ADD LINK32 libexpat.lib setargv.obj /nologo /subsystem:console /pdb:none /machine:I386 /libpath:"..\win32\bin\Release" /out:"..\win32\bin\Release\xmlwf.exe" -# SUBTRACT LINK32 /nodefaultlib - -!ELSEIF "$(CFG)" == "xmlwf - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "." -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\win32\bin\Debug" -# PROP Intermediate_Dir "..\win32\tmp\Debug-xmlwf" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "." -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\lib" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "COMPILED_FROM_DSP" /FD /c -# SUBTRACT CPP /Fr /YX -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 -# ADD LINK32 libexpat.lib setargv.obj /nologo /subsystem:console /pdb:none /debug /machine:I386 /libpath:"..\win32\bin\Debug" /out:"..\win32\bin\Debug\xmlwf.exe" - -!ENDIF - -# Begin Target - -# Name "xmlwf - Win32 Release" -# Name "xmlwf - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=.\codepage.c -# End Source File -# Begin Source File - -SOURCE=.\readfilemap.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=.\unixfilemap.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=.\win32filemap.c -# End Source File -# Begin Source File - -SOURCE=.\xmlfile.c -# End Source File -# Begin Source File - -SOURCE=.\xmlwf.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" -# Begin Source File - -SOURCE=.\codepage.h -# End Source File -# Begin Source File - -SOURCE=.\xmlfile.h -# End Source File -# Begin Source File - -SOURCE=.\xmltchar.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlwin32url.cxx b/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlwin32url.cxx deleted file mode 100644 index bbfcce22..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/_expat/xmlwf/xmlwin32url.cxx +++ /dev/null @@ -1,395 +0,0 @@ -#include "expat.h" -#ifdef XML_UNICODE -#define UNICODE -#endif -#include -#include -#include -#include -#include -#include "xmlurl.h" -#include "xmlmime.h" - -static int -processURL(XML_Parser parser, IMoniker *baseMoniker, const XML_Char *url); - -typedef void (*StopHandler)(void *, HRESULT); - -class Callback : public IBindStatusCallback { -public: - // IUnknown methods - STDMETHODIMP QueryInterface(REFIID,void **); - STDMETHODIMP_(ULONG) AddRef(); - STDMETHODIMP_(ULONG) Release(); - // IBindStatusCallback methods - STDMETHODIMP OnStartBinding(DWORD, IBinding *); - STDMETHODIMP GetPriority(LONG *); - STDMETHODIMP OnLowResource(DWORD); - STDMETHODIMP OnProgress(ULONG, ULONG, ULONG, LPCWSTR); - STDMETHODIMP OnStopBinding(HRESULT, LPCWSTR); - STDMETHODIMP GetBindInfo(DWORD *, BINDINFO *); - STDMETHODIMP OnDataAvailable(DWORD, DWORD, FORMATETC *, STGMEDIUM *); - STDMETHODIMP OnObjectAvailable(REFIID, IUnknown *); - Callback(XML_Parser, IMoniker *, StopHandler, void *); - ~Callback(); - int externalEntityRef(const XML_Char *context, - const XML_Char *systemId, const XML_Char *publicId); -private: - XML_Parser parser_; - IMoniker *baseMoniker_; - DWORD totalRead_; - ULONG ref_; - IBinding *pBinding_; - StopHandler stopHandler_; - void *stopArg_; -}; - -STDMETHODIMP_(ULONG) -Callback::AddRef() -{ - return ref_++; -} - -STDMETHODIMP_(ULONG) -Callback::Release() -{ - if (--ref_ == 0) { - delete this; - return 0; - } - return ref_; -} - -STDMETHODIMP -Callback::QueryInterface(REFIID riid, void** ppv) -{ - if (IsEqualGUID(riid, IID_IUnknown)) - *ppv = (IUnknown *)this; - else if (IsEqualGUID(riid, IID_IBindStatusCallback)) - *ppv = (IBindStatusCallback *)this; - else - return E_NOINTERFACE; - ((LPUNKNOWN)*ppv)->AddRef(); - return S_OK; -} - -STDMETHODIMP -Callback::OnStartBinding(DWORD, IBinding* pBinding) -{ - pBinding_ = pBinding; - pBinding->AddRef(); - return S_OK; -} - -STDMETHODIMP -Callback::GetPriority(LONG *) -{ - return E_NOTIMPL; -} - -STDMETHODIMP -Callback::OnLowResource(DWORD) -{ - return E_NOTIMPL; -} - -STDMETHODIMP -Callback::OnProgress(ULONG, ULONG, ULONG, LPCWSTR) -{ - return S_OK; -} - -STDMETHODIMP -Callback::OnStopBinding(HRESULT hr, LPCWSTR szError) -{ - if (pBinding_) { - pBinding_->Release(); - pBinding_ = 0; - } - if (baseMoniker_) { - baseMoniker_->Release(); - baseMoniker_ = 0; - } - stopHandler_(stopArg_, hr); - return S_OK; -} - -STDMETHODIMP -Callback::GetBindInfo(DWORD* pgrfBINDF, BINDINFO* pbindinfo) -{ - *pgrfBINDF = BINDF_ASYNCHRONOUS; - return S_OK; -} - -static void -reportError(XML_Parser parser) -{ - int code = XML_GetErrorCode(parser); - const XML_Char *message = XML_ErrorString(code); - if (message) - _ftprintf(stderr, _T("%s:%d:%ld: %s\n"), - XML_GetBase(parser), - XML_GetErrorLineNumber(parser), - XML_GetErrorColumnNumber(parser), - message); - else - _ftprintf(stderr, _T("%s: (unknown message %d)\n"), - XML_GetBase(parser), code); -} - -STDMETHODIMP -Callback::OnDataAvailable(DWORD grfBSCF, - DWORD dwSize, - FORMATETC *pfmtetc, - STGMEDIUM* pstgmed) -{ - if (grfBSCF & BSCF_FIRSTDATANOTIFICATION) { - IWinInetHttpInfo *hp; - HRESULT hr = pBinding_->QueryInterface(IID_IWinInetHttpInfo, - (void **)&hp); - if (SUCCEEDED(hr)) { - char contentType[1024]; - DWORD bufSize = sizeof(contentType); - DWORD flags = 0; - contentType[0] = 0; - hr = hp->QueryInfo(HTTP_QUERY_CONTENT_TYPE, contentType, - &bufSize, 0, NULL); - if (SUCCEEDED(hr)) { - char charset[CHARSET_MAX]; - getXMLCharset(contentType, charset); - if (charset[0]) { -#ifdef XML_UNICODE - XML_Char wcharset[CHARSET_MAX]; - XML_Char *p1 = wcharset; - const char *p2 = charset; - while ((*p1++ = (unsigned char)*p2++) != 0) - ; - XML_SetEncoding(parser_, wcharset); -#else - XML_SetEncoding(parser_, charset); -#endif - } - } - hp->Release(); - } - } - if (!parser_) - return E_ABORT; - if (pstgmed->tymed == TYMED_ISTREAM) { - while (totalRead_ < dwSize) { -#define READ_MAX (64*1024) - DWORD nToRead = dwSize - totalRead_; - if (nToRead > READ_MAX) - nToRead = READ_MAX; - void *buf = XML_GetBuffer(parser_, nToRead); - if (!buf) { - _ftprintf(stderr, _T("out of memory\n")); - return E_ABORT; - } - DWORD nRead; - HRESULT hr = pstgmed->pstm->Read(buf, nToRead, &nRead); - if (SUCCEEDED(hr)) { - totalRead_ += nRead; - if (!XML_ParseBuffer(parser_, - nRead, - (grfBSCF & BSCF_LASTDATANOTIFICATION) != 0 - && totalRead_ == dwSize)) { - reportError(parser_); - return E_ABORT; - } - } - } - } - return S_OK; -} - -STDMETHODIMP -Callback::OnObjectAvailable(REFIID, IUnknown *) -{ - return S_OK; -} - -int -Callback::externalEntityRef(const XML_Char *context, - const XML_Char *systemId, - const XML_Char *publicId) -{ - XML_Parser entParser = XML_ExternalEntityParserCreate(parser_, context, 0); - XML_SetBase(entParser, systemId); - int ret = processURL(entParser, baseMoniker_, systemId); - XML_ParserFree(entParser); - return ret; -} - -Callback::Callback(XML_Parser parser, IMoniker *baseMoniker, - StopHandler stopHandler, void *stopArg) -: parser_(parser), - baseMoniker_(baseMoniker), - ref_(0), - pBinding_(0), - totalRead_(0), - stopHandler_(stopHandler), - stopArg_(stopArg) -{ - if (baseMoniker_) - baseMoniker_->AddRef(); -} - -Callback::~Callback() -{ - if (pBinding_) - pBinding_->Release(); - if (baseMoniker_) - baseMoniker_->Release(); -} - -static int -externalEntityRef(void *arg, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) -{ - return ((Callback *)arg)->externalEntityRef(context, systemId, publicId); -} - - -static HRESULT -openStream(XML_Parser parser, - IMoniker *baseMoniker, - const XML_Char *uri, - StopHandler stopHandler, void *stopArg) -{ - if (!XML_SetBase(parser, uri)) - return E_OUTOFMEMORY; - HRESULT hr; - IMoniker *m; -#ifdef XML_UNICODE - hr = CreateURLMoniker(0, uri, &m); -#else - LPWSTR uriw = new wchar_t[strlen(uri) + 1]; - for (int i = 0;; i++) { - uriw[i] = uri[i]; - if (uriw[i] == 0) - break; - } - hr = CreateURLMoniker(baseMoniker, uriw, &m); - delete [] uriw; -#endif - if (FAILED(hr)) - return hr; - IBindStatusCallback *cb = new Callback(parser, m, stopHandler, stopArg); - XML_SetExternalEntityRefHandler(parser, externalEntityRef); - XML_SetExternalEntityRefHandlerArg(parser, cb); - cb->AddRef(); - IBindCtx *b; - if (FAILED(hr = CreateAsyncBindCtx(0, cb, 0, &b))) { - cb->Release(); - m->Release(); - return hr; - } - cb->Release(); - IStream *pStream; - hr = m->BindToStorage(b, 0, IID_IStream, (void **)&pStream); - if (SUCCEEDED(hr)) { - if (pStream) - pStream->Release(); - } - if (hr == MK_S_ASYNCHRONOUS) - hr = S_OK; - m->Release(); - b->Release(); - return hr; -} - -struct QuitInfo { - const XML_Char *url; - HRESULT hr; - int stop; -}; - -static void -winPerror(const XML_Char *url, HRESULT hr) -{ - LPVOID buf; - if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_FROM_HMODULE, - GetModuleHandleA("urlmon.dll"), - hr, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &buf, - 0, - NULL) - || FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_FROM_SYSTEM, - 0, - hr, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &buf, - 0, - NULL)) { - /* The system error messages seem to end with a newline. */ - _ftprintf(stderr, _T("%s: %s"), url, buf); - fflush(stderr); - LocalFree(buf); - } - else - _ftprintf(stderr, _T("%s: error %x\n"), url, hr); -} - -static void -threadQuit(void *p, HRESULT hr) -{ - QuitInfo *qi = (QuitInfo *)p; - qi->hr = hr; - qi->stop = 1; -} - -extern "C" -int -XML_URLInit(void) -{ - return SUCCEEDED(CoInitialize(0)); -} - -extern "C" -void -XML_URLUninit(void) -{ - CoUninitialize(); -} - -static int -processURL(XML_Parser parser, IMoniker *baseMoniker, - const XML_Char *url) -{ - QuitInfo qi; - qi.stop = 0; - qi.url = url; - - XML_SetBase(parser, url); - HRESULT hr = openStream(parser, baseMoniker, url, threadQuit, &qi); - if (FAILED(hr)) { - winPerror(url, hr); - return 0; - } - else if (FAILED(qi.hr)) { - winPerror(url, qi.hr); - return 0; - } - MSG msg; - while (!qi.stop && GetMessage (&msg, NULL, 0, 0)) { - TranslateMessage (&msg); - DispatchMessage (&msg); - } - return 1; -} - -extern "C" -int -XML_ProcessURL(XML_Parser parser, - const XML_Char *url, - unsigned flags) -{ - return processURL(parser, 0, url); -} diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/aolxml.cpp b/Src/Plugins/DSP/sc_serv3/aolxml/aolxml.cpp deleted file mode 100644 index cd71111e..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/aolxml.cpp +++ /dev/null @@ -1,428 +0,0 @@ -#include -#include "aolxml.h" -#include "stl/stringUtils.h" -#include - -#ifdef AOLXML_FASTLOOKUP -#ifdef _WIN32 -#include -#endif -#endif - -using namespace std; -using namespace stringUtil; - -// stl helpers -static void ndelete(aolxml::node *n) { delete n; } -static bool matchNameVS2005(const aolxml::node* n, string name) - { return (n->name() == name); } -////////// - -aolxml::node::~node() -{ - // delete the children - for_each(m_children.begin(),m_children.end(),ndelete); -} - -void aolxml::node::deleteChild(childIterator_t i) -{ - // deletes child and all subchildren - aolxml::node *n = (*i); - -#ifdef AOLXML_FASTLOOKUP - bool found(false); - for(nameToNodeMap_t::iterator mi = m_nameToNodeMap.begin(); mi != m_nameToNodeMap.end(); ++mi) - { - if ((*mi).second == n) - { - m_nameToNodeMap.erase(mi); - found = true; - break; - } - } - _ASSERTE(found); -#endif - m_children.erase(i); - - delete n; -} - -bool aolxml::node::deleteChild(aolxml::node *n) -{ - list::iterator i = find(m_children.begin(),m_children.end(),n); - if (i != m_children.end()) - { - #ifdef AOLXML_FASTLOOKUP - bool found(false); - for(nameToNodeMap_t::iterator mi = m_nameToNodeMap.begin(); mi != m_nameToNodeMap.end(); ++mi) - { - if ((*mi).second == n) - { - m_nameToNodeMap.erase(mi); - found = true; - break; - } - } - _ASSERTE(found); - #endif - m_children.erase(i); - delete n; - return true; - } - return false; -} - -void aolxml::node::snipChild(childIterator_t i) -{ - // remove child from this node but keeps subtree in tact -#ifdef AOLXML_FASTLOOKUP - aolxml::node *n = (*i); - bool found(false); - for(nameToNodeMap_t::iterator mi = m_nameToNodeMap.begin(); mi != m_nameToNodeMap.end(); ++mi) - { - if ((*mi).second == n) - { - m_nameToNodeMap.erase(mi); - found = true; - break; - } - } - _ASSERTE(found); -#endif - (*i)->m_parent = 0; - m_children.erase(i); -} - -void aolxml::node::addChild(node *n) -{ - n->m_parent = this; - m_children.push_back(n); -#ifdef AOLXML_FASTLOOKUP - m_nameToNodeMap.insert(make_pair(n->name(),n)); -#endif -} - -void aolxml::node::insertChild(childIterator_t i,node *n) -{ - n->m_parent = this; - m_children.insert(i,n); -#ifdef AOLXML_FASTLOOKUP - m_nameToNodeMap.insert(make_pair(n->name(),n)); -#endif -} - -aolxml::node* aolxml::node::findNode(node *root,const string &path) throw() -{ - if (path.empty() || (!root)) - { - return 0; - } - - vector v = tokenizer(path,'/'); - - node *current = root; - if (path[0] == '/') - { - // move to root of tree - while (current->parent()) - current = current->parent(); - - // make sure first tag matches first token - if (current && (!v.empty()) && (current->name() != v[0])) - { - current = 0; - } - else - { - v.erase(v.begin()); - } - } - - for(vector::const_iterator i = v.begin(); (i != v.end()) && current; ++i) - { - string s = stripWhitespace(*i); - if (s == "" || s == ".") - { - continue; - } - else if (s == "..") - { - current = current->parent(); - } - else - { -#ifdef AOLXML_FASTLOOKUP - nameToNodeMap_t::iterator mi = current->m_nameToNodeMap.find(s); - current = (mi == current->m_nameToNodeMap.end() ? 0 : (*mi).second); -#else - list::iterator ci = find_if( - current->childrenBegin(),current->childrenEnd(),bind2nd(ptr_fun(matchNameVS2005),s)); - current = (ci == current->childrenEnd() ? 0 : (*ci)); -#endif - } - } - - return current; -} - -list aolxml::node::findNodes(node *root,const string &path) throw() -{ - list result; - - if (path.empty() || (!root)) - { - return result; - } - - vector v = tokenizer(path,'/'); - - node *current = root; - if (path[0] == '/') - { - // move to root of tree - while (current->parent()) - { - current = current->parent(); - } - - // make sure first tag matches first token - if (current && (!v.empty()) && (current->name() != v[0])) - { - current = 0; - } - else - { - v.erase(v.begin()); - } - } - - string last; - if (!v.empty()) - { - last = v.back(); - v.pop_back(); - } - - for(vector::const_iterator i = v.begin(); (i != v.end()) && current; ++i) - { - string s = stripWhitespace(*i); - if (s == "" || s == ".") - { - continue; - } - else if (s == "..") - { - current = current->parent(); - } - else - { -#ifdef AOLXML_FASTLOOKUP - nameToNodeMap_t::iterator mi = current->m_nameToNodeMap.find(s); - current = (mi == current->m_nameToNodeMap.end() ? 0 : (*mi).second); -#else - list::iterator ci = find_if( - current->childrenBegin(),current->childrenEnd(),bind2nd(ptr_fun(matchNameVS2005),s)); - current = (ci == current->childrenEnd() ? 0 : (*ci)); -#endif - } - } - // now do last - if (current && last != "") - { - list nv = current->m_children; - copy(nv.begin(),stable_partition(nv.begin(),nv.end(),bind2nd(ptr_fun(matchNameVS2005),last)),back_inserter(result)); - } - - return result; -} - -static bool isAttr(pair attr,string name) throw() -{ - return (attr.first == name); -} - -aolxml::node::attributeList_t::iterator aolxml::node::findAttribute(const string &name) throw() -{ - return find_if(m_attributes.begin(),m_attributes.end(),bind2nd(ptr_fun(isAttr),name)); -} - -aolxml::node::attributeList_t::const_iterator aolxml::node::findAttribute(const string &name) const throw() -{ - return find_if(m_attributes.begin(),m_attributes.end(),bind2nd(ptr_fun(isAttr),name)); -} - -std::string aolxml::node::findAttributeString(const std::string &attr,const std::string &deflt) const throw() -{ - aolxml::node::attributeList_t::const_iterator i = findAttribute(attr); - return (i == m_attributes.end() ? deflt : (*i).second); -} - -std::string aolxml::node::findAttributeStringTHROW(const std::string &attr) const throw(std::runtime_error) -{ - aolxml::node::attributeList_t::const_iterator i = findAttribute(attr); - if (i == m_attributes.end()) - { - throw runtime_error("attribute " + attr + " in node " + m_name + " not found."); - } - return (*i).second; -} - -void aolxml::node::findAttributeStringTHROW(const std::string &attr,std::string &s) const throw(std::runtime_error) -{ - s = findAttributeStringTHROW(attr); -} - -void aolxml::node::findAttributeStringTHROW(const std::string &attr,int &i) const throw(std::runtime_error) -{ - i = atoi(findAttributeStringTHROW(attr).c_str()); -} - -void aolxml::node::findAttributeStringTHROW(const std::string &attr,double &d) const throw(std::runtime_error) -{ - d = atof(findAttributeStringTHROW(attr).c_str()); -} - -///////////////////////////////////////////////////////////////////////////// -////////////////////// Parsing (expat) ////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - -void aolxml::StartTag (void *parser, const XML_Char * name, const XML_Char ** atts) -{ - aolxml::node* parent = reinterpret_cast(XML_GetUserData((XML_Parser) parser)); - aolxml::node* current = new aolxml::node(name); - - if (parent) - { - current->m_preserveSpaces = parent->m_preserveSpaces; - parent->addChild(current); - } - - int attnum = XML_GetSpecifiedAttributeCount((XML_Parser) parser); - for (int i = 0; i < attnum; i += 2) - { - string key = atts[i]; - string value = atts[i+1]; - current->addAttribute(aolxml::node::attribute_t(key,value)); - if (key == "xml:space") - { - current->m_preserveSpaces = (value == "preserve"); - } - } - - XML_SetUserData((XML_Parser) parser, current); -} - -void aolxml::EndTag(void *parser, const XML_Char * /*name*/) -{ - aolxml::node* current = reinterpret_cast(XML_GetUserData ((XML_Parser) parser)); - if (!current->m_preserveSpaces) - { - current->pcdata() = stripWhitespace(current->pcdata()); - } - XML_SetUserData((XML_Parser) parser,current->parent() ? current->parent() : current); -} - -void aolxml::CData(void *parser) -{ - aolxml::node* tag = reinterpret_cast(XML_GetUserData ((XML_Parser) parser)); - tag->m_preserveSpaces = true; -} - -void aolxml::PCData (void *parser, const XML_Char * s, int len) -{ - aolxml::node* tag = reinterpret_cast(XML_GetUserData ((XML_Parser) parser)); - - string ss(s,s+len); - tag->pcdata() = tag->pcdata() + ss;//(tag->m_preserveSpaces ? ss : stripWhitespace(ss)); - // whitespace stripping moved to end tag because sometimes we get the PCData in - // multiple calls -} - -aolxml::node* aolxml::node::parse(const char *data,size_t len) throw(runtime_error) -{ - aolxml::node *root = 0; - - XML_Parser parser = XML_ParserCreate (NULL); - - // setup the parser - XML_UseParserAsHandlerArg(parser); - XML_SetElementHandler(parser, StartTag, EndTag); - XML_SetCharacterDataHandler(parser, PCData); - XML_SetUserData(parser, 0); - XML_SetStartCdataSectionHandler(parser,CData); - - if (XML_Parse(parser, data,(int)len, 1)) - { - root = reinterpret_cast(XML_GetUserData (parser)); - } - else - { - // cleanup tree fragment - root = reinterpret_cast(XML_GetUserData (parser)); - if (root) - { - while (root->parent()) - { - root = root->parent(); - } - delete root; - } - ////////// - - std::ostringstream o; - o << "[XML] " << XML_ErrorString(XML_GetErrorCode(parser)) << - " at line " << XML_GetCurrentLineNumber(parser); - XML_ParserFree(parser); - throw std::runtime_error(o.str()); - } - - XML_ParserFree (parser); - return root; -} - -aolxml::node* aolxml::node::parse(const string &text) throw(runtime_error) -{ - return aolxml::node::parse(text.c_str(),text.size()); -} - -aolxml::node* aolxml::node::parse(const uniString::utf8::value_type *data,size_t len) throw(std::runtime_error) -{ - return aolxml::node::parse((const char *)data,len); -} - -aolxml::node* aolxml::node::parse(const uniString::utf8 &text) throw(std::runtime_error) -{ - return aolxml::node::parse(&(text[0]),text.size()); -} - -static void out_tabs(ostream &o,int t) -{ - for(int x = 0; x < t; ++x) o << "\t"; -} - -static void outputXML(ostream &o,const aolxml::node *n,int tabs) -{ - o << endl; out_tabs(o,tabs); - o << "<" << n->name(); - for(aolxml::node::attributeList_t::const_iterator i = n->attributes().begin(); - i != n->attributes().end(); ++i) - o << " " << (*i).first << "=\"" << (*i).second << "\""; - o << ">" << n->pcdata(); - if (!n->childrenEmpty()) - { - for(aolxml::node::const_childIterator_t i = n->childrenBegin(); i != n->childrenEnd(); ++i) - { - outputXML(o,(*i),tabs+1); - } - o << endl; - out_tabs(o,tabs); - } - o << "name() << ">"; -} - -ostream& aolxml::operator<<(ostream &o,const aolxml::node *n) -{ - outputXML(o,n,0); - o << endl; - return o; -} diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/aolxml.h b/Src/Plugins/DSP/sc_serv3/aolxml/aolxml.h deleted file mode 100644 index f87e4789..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/aolxml.h +++ /dev/null @@ -1,372 +0,0 @@ -#pragma once -#ifndef xml_H_ -#define xml_H_ - -#include -#include -#include -#include -#include -#include -#include "stl/stringUtils.h" -#include "unicode/uniString.h" - -#define XMLIMPORT -#include "expat.h" - -#ifdef _WIN32 -#pragma warning(push) -#pragma warning( disable : 4290 ) -#pragma warning( disable : 4996 ) -#endif - -//#define AOLXML_FASTLOOKUP 1 - -#ifdef AOLXML_FASTLOOKUP -#include -#endif - -namespace aolxml -{ - class node - { - public: - typedef std::pair attribute_t; - typedef std::list attributeList_t; - typedef std::list nodeList_t; - typedef nodeList_t::iterator childIterator_t; - typedef nodeList_t::const_iterator const_childIterator_t; - - private: - std::string m_name; - attributeList_t m_attributes; - std::string m_pcdata; - node* m_parent; - std::list m_children; - -#ifdef AOLXML_FASTLOOKUP - typedef std::multimap nameToNodeMap_t; - nameToNodeMap_t m_nameToNodeMap; -#endif - bool m_preserveSpaces; - - public: - node(const std::string &name,const std::string &pcd = "") - :m_name(name),m_pcdata(pcd),m_parent(0),m_preserveSpaces(false){} - - ~node(); - - const std::string &name() const throw() { return m_name; } - std::string& name() throw() { return m_name; } - - attributeList_t& attributes() throw() { return m_attributes; } - const attributeList_t& attributes() const throw() { return m_attributes; } - void addAttribute(const attribute_t &a) throw() { m_attributes.push_back(a); } - attributeList_t::iterator findAttribute(const std::string &attr) throw(); - attributeList_t::const_iterator findAttribute(const std::string &attr) const throw(); - std::string findAttributeString(const std::string &attr,const std::string &deflt = "") const throw(); - std::string findAttributeStringTHROW(const std::string &attr) const throw(std::runtime_error); // throws if attribute not found - void findAttributeStringTHROW(const std::string &attr,std::string &s) const throw(std::runtime_error); - void findAttributeStringTHROW(const std::string &attr,int &i) const throw(std::runtime_error); - void findAttributeStringTHROW(const std::string &attr,double &f) const throw(std::runtime_error); - - node* parent() throw() { return m_parent;} - const node* parent() const throw() { return m_parent; } - const std::string &pcdata() const throw() { return m_pcdata; } - std::string& pcdata() throw() { return m_pcdata; } - - childIterator_t childrenBegin() throw() { return m_children.begin(); } - childIterator_t childrenEnd() throw() { return m_children.end(); } - const_childIterator_t childrenBegin() const throw() { return m_children.begin(); } - const_childIterator_t childrenEnd() const throw() { return m_children.end(); } - bool childrenEmpty() const throw() { return m_children.empty(); } - - void deleteChild(childIterator_t i); // deletes child and all subchildren - bool deleteChild(node *n); - void snipChild(childIterator_t i); // remove child from this node but keeps subtree in tact - - void addChild(node *n); - void insertChild(childIterator_t i,node *n); - - static node* findNode(node *root,const std::string &path) throw(); - static nodeList_t findNodes(node *root,const std::string &path) throw(); - - static node* parse(const std::string &text) throw(std::runtime_error); - static node* parse(const char *data,size_t len) throw(std::runtime_error); - static node* parse(const uniString::utf8 &text) throw(std::runtime_error); - static node* parse(const uniString::utf8::value_type *data,size_t len) throw(std::runtime_error); - - friend std::ostream& operator<<(std::ostream &o,const node *n); - friend void StartTag (void *parser, const XML_Char * name, const XML_Char ** atts); - friend void EndTag(void *parser, const XML_Char * name); - friend void PCData (void *parser, const XML_Char * s, int len); - friend void CData(void *parser); - }; - - ////////////////////////////////////////////// - ///// utility functions on nodes //////// - //////////////////////////////////////////////// - - template // convert from text - inline T nodeText(node *n) { return n->pcdata(); } - - template<> - inline int nodeText(node *n) { return atoi(n->pcdata().c_str()); } - - template<> - inline unsigned short nodeText(node *n) { return atoi(n->pcdata().c_str()); } - -#ifdef _WIN32 - template<> - inline __int64 nodeText(node *n) { return _strtoi64(n->pcdata().c_str(),0,10); } - - template<> - inline unsigned __int64 nodeText(node *n) { return _strtoui64(n->pcdata().c_str(),0,10); } -#endif - - template<> - inline bool nodeText(node *n) - { - const std::string &s = n->pcdata(); - if (s.empty()) return false; - return (s[0] == 't' || s[0] == 'T' || s[0] == '1' || s[0] == 'y' || s[0] == 'Y'); - } - - template<> - inline double nodeText(node *n) { return atof(n->pcdata().c_str()); } - - - // get a subnode value. Returns true if value existed - template - inline bool subNodeText(node *n,const std::string &path,T& value,const T defaultValue) throw() - { - value = defaultValue; - if (!n) - { - return false; - } - node *subNode = node::findNode(n,path); - if (!subNode) - { - return false; - } - value = aolxml::nodeText(subNode); - - return true; - } - - // same as above, but you cannot detect missing value - template - inline T subNodeText(node *n,const std::string &path,const T defaultValue) throw() - { - if (!n) - { - return defaultValue; - } - node *subNode = node::findNode(n,path); - if (!subNode) - { - return defaultValue; - } - return aolxml::nodeText(subNode); - } - - inline void subNodeText(node *n,const std::string &path,char *result,int maxLen,const char *defaultValue) throw() - { - strncpy(result,defaultValue,maxLen); - - if (!n) - { - return; - } - - node *subNode = node::findNode(n,path); - if (!subNode) - { - return; - } - std::string tmp = aolxml::nodeText(subNode); - strncpy(result,tmp.c_str(),maxLen); - } - - // this one throws if the value is not found - template - inline T subNodeTextTHROW(node *n,const std::string &path) throw(std::runtime_error) - { - if (!n) - { - throw std::runtime_error("node NULL"); - } - node *subNode = node::findNode(n,path); - if (!subNode) - { - throw std::runtime_error(path + " missing"); - } - return aolxml::nodeText(subNode); - } - - // throws and returns value as a param instead of a function value - template - inline void subNodeTextTHROW(node *n,const std::string &path,T &result) throw(std::runtime_error) - { - result = aolxml::subNodeTextTHROW(n,path); - } - - /// calls function 'f' with each node in the list and the value 'l' - // The purpose is to allow you to write a function which will insert - // data from each node into container 'l' - template - inline void XMLList(L &l,const node::nodeList_t &lnode,Func f) throw(std::runtime_error) - { - for(node::nodeList_t::const_iterator i = lnode.begin(); i != lnode.end(); ++i) - { - if (*i) - { - f(l,*i); - } - } - } - - template - inline void XMLList(L &l,node::nodeList_t &lnode,Func f) throw(std::runtime_error) - { - for(node::nodeList_t::iterator i = lnode.begin(); i != lnode.end(); ++i) - { - if (*i) - { - f(l,*i); - } - } - } - - template - inline void XMLList(L &l,node *n,const std::string &path,Func f) throw(std::runtime_error) - { - if (!n) - { - return; - } - node::nodeList_t lnode = node::findNodes(n,path); - for(node::nodeList_t::iterator i = lnode.begin(); i != lnode.end(); ++i) - { - if (*i) - { - f(l,*i); - } - } - } - - - //**************************************************************** - //* Various templates for constructing XML data - //**************************************************************** - - // embed a value in a set of tags (value) providing a function - // which will convert the value to a string - template - std::string xmlTag(const std::string &tag,const T value,ConverterFunc func) - { - return std::string("<") + tag + ">" + func(value) + ""; - } - - // embed a string convertible value to value - template - std::string xmlTag(const std::string &tag,const T value) - { - return std::string("<") + tag + ">" + stringUtil::tos(value) + ""; - } - - inline std::string xmlTag(const std::string &tag,bool value) - { - return std::string("<") + tag + ">" + (value ? "1" : "0") + ""; - } - - // helper functor to make lists of web taged values using accumulate - template - class xmlListFunctor: public std::binary_function - { - std::string m_tag; - ConverterFunc m_func; - - public: - xmlListFunctor(const std::string &tag,ConverterFunc f): m_tag(tag),m_func(f){} - std::string operator()(const std::string &accum,const T &val) - { - return accum + xmlTag(m_tag,val,m_func); - } - }; - - // template function so we don't have to use the entire accumulate syntax. - /* example: - - list items; - items.push_back("foo"); - items.push_back("bar"); - items.push_back("narf"); - - string result = xmlList(items,"junk"); - - // the value of result is now - // foobarnarf - */ - - template - std::string xmlList(const Container &c,const std::string &tag) - { - typedef std::string (*tostype)(const typename Container::value_type); - - return std::accumulate(c.begin(),c.end(),std::string(""), - xmlListFunctor(tag,stringUtil::tos)); - } - - // similar to xmlList, but you provide a converter func to make your values into a string - template - std::string xmlList(const Container &c,const std::string &tag,ConverterFunc func) - { - return std::accumulate(c.begin(),c.end(),std::string(""), - xmlListFunctor(tag,func)); - } - - // similar to xmlList, but with auto indenting - template - static std::string xmlListIndented(const Container &c,const std::string &tag,const std::string &indent) - { - std::string result; - for (typename Container::const_iterator i = c.begin(); i != c.end(); ++i) - { - result += indent + "<" + tag + ">" + stringUtil::tos(*i) + "" + stringUtil::eol(); - } - return result; - } - - template - static std::string xmlListIndented(const Container &c,const std::string &tag,const std::string &indent,Func f) - { - std::string result; - for (typename Container::const_iterator i = c.begin(); i != c.end(); ++i) - { - result += indent + "<" + tag + ">" + stringUtil::eol(); - result += f(*i,indent + "\t"); - result += indent + "" + stringUtil::eol(); - } - return result; - } - - // escape a string so it is valid inside an XML tag - std::string escapeXML(const std::string &s) throw(); - uniString::utf8 escapeXML(const uniString::utf8 &s) throw(); - /*static std::string utf8Header() throw() { return "\n"; } - static std::string latin1Header() throw() { return "\n"; }*/ - - std::ostream& operator<<(std::ostream &o,const node *n); - void StartTag (void *parser, const XML_Char * name, const XML_Char ** atts); - void EndTag(void *parser, const XML_Char * name); - void PCData (void *parser, const XML_Char * s, int len); - void CData(void *parser); -} - -#ifdef _WIN32 -#pragma warning(pop) -#endif - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/aolxmlutils.cpp b/Src/Plugins/DSP/sc_serv3/aolxml/aolxmlutils.cpp deleted file mode 100644 index df8ad66d..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/aolxmlutils.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "aolxml.h" -#include "stl/stringUtils.h" -#include - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -class xmlEscapes: public map -{ -public: - xmlEscapes() - { - (*this)['<'] = "<"; - (*this)['>'] = ">"; - (*this)['&'] = "&"; - (*this)['\''] = "'"; - (*this)['"'] = """; - } -}; - -static const xmlEscapes gsXmlEscapes; - -string aolxml::escapeXML(const string &s) throw() -{ - string result; - string::size_type siz = s.size(); - for(string::size_type x = 0; x < siz; ++x) - { - unsigned char uc = s[x]; - if (((uc > 0x7f) || (uc >= 1 && uc <= 8) || (uc >= 0x0b && uc <= 0x0c) || (uc >= 0x0e && uc <= 0x1f))) - { - result += "&#" + tos((unsigned int)uc) + ";"; - } - else - { - xmlEscapes::const_iterator i = gsXmlEscapes.find(s[x]); - if (i != gsXmlEscapes.end()) - result += (*i).second; - else - result += s[x]; - } - } - return result; -} - -utf8 aolxml::escapeXML(const utf8 &s) throw() -{ - string result; - string::size_type siz = s.size(); - for(string::size_type x = 0; x < siz; ++x) - { - //unsigned char uc = s[x]; - xmlEscapes::const_iterator i = gsXmlEscapes.find(s[x]); - if (i != gsXmlEscapes.end()) - result += (*i).second; - else - result += s[x]; - } - return result; -} diff --git a/Src/Plugins/DSP/sc_serv3/aolxml/unix_build_expat b/Src/Plugins/DSP/sc_serv3/aolxml/unix_build_expat deleted file mode 100644 index a54a8b4c..00000000 --- a/Src/Plugins/DSP/sc_serv3/aolxml/unix_build_expat +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -cd expat -chmod a+x configure -./configure --prefix=$OLDPWD -make install diff --git a/Src/Plugins/DSP/sc_serv3/auth.cpp b/Src/Plugins/DSP/sc_serv3/auth.cpp deleted file mode 100644 index 021e0919..00000000 --- a/Src/Plugins/DSP/sc_serv3/auth.cpp +++ /dev/null @@ -1,434 +0,0 @@ -/* auth.cpp routines for authenticating client details with external server */ - -#include -#include - -#include "protocol_shoutcastClient.h" -#include "uvox2Common.h" -#include "webClient.h" -#include "auth.h" -#include "bandwidth.h" -#include "file/fileUtils.h" -#include "services/stdServiceImpl.h" - -#define MAX_AUTH_THREADS 20 -#define AMNT_ALLOWED_BEFORE_SKIPPING 1000 - -#define LOGNAME "[AUTH] " -#define DEBUG_LOG(...) do { if (gOptions.authDebug()) DLOG(__VA_ARGS__); } while(0) - -extern int xferinfo(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow); - -namespace auth -{ - using namespace std; - using namespace uniString; - using namespace stringUtil; - - class authService - { - public: - time_t restart_time; - utf8 main_post; - list clients; - CURL *m_curl; - bool in_use; - - authService(); - ~authService(); - - static THREAD_FUNC process(void *arg); - - friend void schedule(auth_info *info); - friend void init(); - }; - - list g_queue; - AOL_namespace::mutex g_qMutex; - authService * g_services = 0; - utf8 g_authURL = DNAS_AUTH_URL; - -#ifdef CURLOPT_PASSWDFUNCTION - /* make sure that prompting at the console does not occur */ - static int my_getpass(void *client, char *prompt, char *buffer, int buflen) - { - buffer[0] = '\0'; - return 0; - } -#endif - - static int handle_returned_header(void *ptr, size_t size, size_t nmemb, void *stream) - { - auth_info *info = reinterpret_cast(stream); - if (info) - { - utf8 line((char*)ptr); - if (!line.empty()) - { - line = stripWhitespace(line); - if (!line.empty()) - { - // skip over the initial HTTP header and just look at key pairs - utf8::size_type pos = line.find(utf8(":")); - if (pos != utf8::npos) - { - utf8 key = toLower(stripWhitespace(line.substr(0,pos))); - utf8 value = stripWhitespace(line.substr(pos+1)); - - if (!key.empty()) - { - DEBUG_LOG("[AUTH sid=" + tos(info->sid) + "] Auth Header [" + key + ":" + value + "]"); - - if (key == "shoutcast-auth-user") - { - if (value == "withintro") - { - info->has_intro = true; - } - info->authenticated = true; - info->valid_response = true; - } - else if (key == "advert-group") - { - info->group = atoi(value.hideAsString().c_str()); - #if defined(_DEBUG) || defined(DEBUG) - if (info->group == 1729) - { - info->group = 501; - } - #endif - info->valid_response = true; - } - } - } - } - } - } - - int amount = (int)(size * nmemb); - bandWidth::updateAmount(bandWidth::AUTH_AND_METRICS, amount); - return amount; - } - - static int handle_returned_data(void *ptr, size_t size, size_t nmemb, void *stream) - { - auth_info *info = reinterpret_cast(stream); - if (info) - { - // cap any intro content to a few meg - if (info->has_intro && ((int)info->content.size() <= gOptions.maxSpecialFileSize())) - { - vector <__uint8> &v = info->content; - __uint8 *s = (__uint8*)ptr; - v.insert (v.end(), s, s + (size * nmemb)); - } - } - - int amount = (int)(size * nmemb); - bandWidth::updateAmount(bandWidth::AUTH_AND_METRICS, amount); - return amount; - } - - authService::authService() : restart_time(0), in_use(false) - { - m_curl = webClient::setupCurlDefaults (NULL, LOGNAME, g_authURL, 4L); - //DEBUG_LOG("[AUTH] Starting auth instance"); - } - - authService::~authService() - { - restart_time = 0; - in_use = false; - if (m_curl) - { - curl_easy_cleanup(m_curl); - m_curl = NULL; - } - //DEBUG_LOG("[AUTH] Stopping auth instance"); - } - - THREAD_FUNC authService::process(void* arg) - { - try - { - authService* m_auth = reinterpret_cast(arg); - if (m_auth) - { - if (!iskilled()) - { - g_qMutex.lock(); - - while (!m_auth->clients.empty()) - { - auth_info *info = m_auth->clients.front(); - m_auth->clients.pop_front(); - g_qMutex.unlock(); - - if (info) - { - if (info->url.empty() == false) - { - g_qMutex.lock(); - m_auth->main_post = info->post; - m_auth->m_curl = webClient::setupCurlDefaults (m_auth->m_curl, LOGNAME, info->url, 4L); - DLOG ("updated main post to " + m_auth->main_post + " and URL " + info->url, LOGNAME, info->sid); - g_qMutex.unlock(); - } - - if (m_auth->restart_time && (::time(NULL) >= m_auth->restart_time)) - { - m_auth->restart_time = 0; - DEBUG_LOG("Restarting disabled auth", LOGNAME, info->sid); - } - - protocol_shoutcastClient *client = info->client; - if (client) // if set to be kicked then no point in processing - { - if (client->m_kickNextRound == false) - { - if (m_auth->restart_time) - { - // auth is disabled for now, but assume client is ok - info->authenticated = true; - } - else - { - if (info->post.empty() == false) - { - utf8 post = info->post + "&" + m_auth->main_post; - -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG("POST body: " + utf8(post.c_str()), LOGNAME, info->sid); -#endif - - char errormsg[CURL_ERROR_SIZE] = {0}; - if (m_auth->m_curl) - { - curl_easy_setopt(m_auth->m_curl, CURLOPT_HEADERFUNCTION, handle_returned_header); - curl_easy_setopt(m_auth->m_curl, CURLOPT_WRITEFUNCTION, handle_returned_data); - - curl_easy_setopt(m_auth->m_curl, CURLOPT_ERRORBUFFER, errormsg); - curl_easy_setopt(m_auth->m_curl, CURLOPT_HEADERDATA, info); - curl_easy_setopt(m_auth->m_curl, CURLOPT_WRITEDATA, info); - curl_easy_setopt(m_auth->m_curl, CURLOPT_POSTFIELDSIZE, post.size()); - curl_easy_setopt(m_auth->m_curl, CURLOPT_COPYPOSTFIELDS, post.c_str()); - - // use progress/xfer functions to trap for the server kill case - curl_easy_setopt(m_auth->m_curl, CURLOPT_NOPROGRESS, 0L); - curl_easy_setopt(m_auth->m_curl, CURLOPT_XFERINFOFUNCTION, xferinfo); - curl_easy_setopt(m_auth->m_curl, CURLOPT_XFERINFODATA, info->sid); - } - - CURLcode ret = CURLE_FAILED_INIT; - if (!m_auth->m_curl || ((ret = curl_easy_perform(m_auth->m_curl)) != CURLE_OK)) - { - ELOG("[AUTH sid=" + tos(info->sid) + "] Request failed on auth with " + - (errormsg[0] ? errormsg : curl_easy_strerror(ret))); - - g_qMutex.lock(); - if (m_auth->restart_time == 0) - { - m_auth->restart_time = ::time(NULL) + 60; - } - g_qMutex.unlock(); - - info->authenticated = true; - } - } - } - - if (info->authenticated) - { - // we need to double-check that the client still - // exists as there could have been a delay with - // the processing of this and it's since dropped - // or been kicked - if so we don't want to crash - //stats:: - - if (info->group >= 0) - { - client->setGroup(info->group); - } - if (info->has_intro) - { - DEBUG_LOG("[AUTH sid=" + tos(info->sid) + "] Listener auth supplied intro of " + tos((long)info->content.size())); - client->setIntro(info->content, info->m_dataType); - } - } - else - { - // if we didn't get the required header responses - // but we did get a valid response from the server - // then we should just allow the client to connect - // as we don't know what's going on so assume "ok" - if (!info->valid_response) - { - info->authenticated = true; - } - else - { - DEBUG_LOG("[AUTH sid=" + tos(info->sid) + "] Auth failed, 403 returned"); - client->return_403(); - } - } - } - - // if we're re-processing the client then we - // musn't re-schedule it else it'll go boom! - if (!info->delayed_auth) - { - threadedRunner::scheduleRunnable(client); - } - } - } - - delete info; - info = NULL; - - g_qMutex.lock(); - } - - m_auth->clients.clear(); - m_auth->in_use = false; - g_qMutex.unlock(); - } - } - } - catch (...) - { - authService* m_auth = reinterpret_cast(arg); - if (m_auth) - { - g_qMutex.lock(); - m_auth->clients.clear(); - m_auth->in_use = false; - g_qMutex.unlock(); - } - } - return 0; - } - - void schedule(auth_info *info) - { - if (info) - { - g_qMutex.lock(); - do - { - if (g_queue.size() > AMNT_ALLOWED_BEFORE_SKIPPING) - { - // what to do when under stress/timeout - DEBUG_LOG(LOGNAME "Heavy backlog of auth requests, skipping"); - threadedRunner::scheduleRunnable(info->client); - delete info; - info = NULL; - break; - } - - if (g_services) - { - int i = 0; - for (; i < MAX_AUTH_THREADS; ++i) - { - if (g_services[i].in_use == false) - { - // start auth thread processing - g_services[i].in_use = true; - g_services[i].clients.push_back(info); - if (!g_queue.empty()) - { - g_services[i].clients.insert(g_services[i].clients.end(), g_queue.begin(), g_queue.end()); - g_queue.clear(); - } - - // do what we can to make sure that if we fail - // to start the thread then we'll pass it on - DEBUG_LOG(LOGNAME "Starting auth thread #" + tos(i+1)); - SimpleThread(authService::process, &g_services[i]); - break; - } - } - - if (i >= MAX_AUTH_THREADS) - { - g_queue.push_back(info); - //DEBUG_LOG(LOGNAME "Unable to process auth requests, skipping"); - //threadedRunner::scheduleRunnable(info->client); - //delete info; - //info = NULL; - break; - } - } - else - { - DEBUG_LOG(LOGNAME "Unable to process auth requests, skipping"); - info->authenticated = true; - threadedRunner::scheduleRunnable(info->client); - delete info; - info = NULL; - break; - } - - // make sure that if things go arwy that we should be able to terminate - if (iskilled()) - { - break; - } - } while (0); - g_qMutex.unlock(); - } - } - - void updateServices (bool initial) - { - if (g_services == NULL) - return; - httpHeaderMap_t vars; - vars["server"] = "Shoutcast v" + gOptions.getVersionBuildStrings(); - vars["port"] = tos(g_portForClients); - utf8 main_post = encodeVariables(vars); - - for (int i = 0; i < MAX_AUTH_THREADS; ++i) - { - if (initial) - { - g_services[i].main_post = main_post; - } - else - { - auth_info *info = new auth::auth_info (g_authURL); - info->post = main_post; - g_qMutex.lock(); - g_services[i].clients.push_back (info); - if (g_services[i].in_use == false) - { - g_services[i].in_use = true; - SimpleThread(authService::process, &g_services[i]); - } - g_qMutex.unlock(); - } - } - } - - void init() - { - g_services = new authService[MAX_AUTH_THREADS]; - if (g_services) - { - updateServices (true); - } - else - { - WLOG(LOGNAME "Failed to start auth service threads"); - } - } - - void cleanup() - { - if (g_services) - { - delete[] g_services; - g_services = NULL; - } - } -} diff --git a/Src/Plugins/DSP/sc_serv3/auth.h b/Src/Plugins/DSP/sc_serv3/auth.h deleted file mode 100644 index 86e96e3d..00000000 --- a/Src/Plugins/DSP/sc_serv3/auth.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once -#ifndef _AUTH_H -#define _AUTH_H - -#include -#include "unicode/uniString.h" -#include "uvox2Common.h" - - -class protocol_shoutcastClient; - -#define DNAS_AUTH_URL "https://auth.shoutcast.com/AddShout" - -namespace auth -{ - using namespace uniString; - class authService; - - typedef size_t streamID_t; - struct auth_info - { - protocol_shoutcastClient *client; - utf8 url; - utf8 post; - std::vector<__uint8> content; - streamID_t sid; - int group; - int m_dataType; - bool authenticated; - bool has_intro; - bool valid_response; - bool delayed_auth; - - explicit auth_info(const utf8& _url = "") - { - url = _url; - client = NULL; - group = -1; - authenticated = false; - has_intro = false; - valid_response = false; - delayed_auth = false; - sid = 1; - m_dataType = MP3_DATA; // default - } - - ~auth_info() - { - client = NULL; - post.clear(); - group = -1; - authenticated = false; - has_intro = false; - valid_response = false; - delayed_auth = false; - content.clear(); - sid = 0; - } - }; - - extern utf8 g_authURL; - - void schedule(auth_info *info); - void updateServices (bool initial = false); - void init(); - void cleanup(); -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/banList.cpp b/Src/Plugins/DSP/sc_serv3/banList.cpp deleted file mode 100644 index ac9bf6a4..00000000 --- a/Src/Plugins/DSP/sc_serv3/banList.cpp +++ /dev/null @@ -1,431 +0,0 @@ -#ifdef _WIN32 -#include -#else -#include -#include -#include -#endif - -#include -#include "banList.h" -#include "global.h" -#include "stl/stringUtils.h" -#include "macros.h" -#include -#include "webNet/socketOps.h" -#include "file/fileUtils.h" -#include "services/stdServiceImpl.h" -#include - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define LOGNAME "[BAN] " - -#ifdef _WIN32 -typedef unsigned long in_addr_t; -#endif - -banList g_banList; - -class banList::impl -{ -private: - struct banEntrySave - { - FILE *f; - size_t stream_ID; - }; - - struct banEntry: public ban_t - { - in_addr_t m_ip; // ip as binary type. Old style, but that's how the old sc_serv did it and we'll - // continue to do it that way until we're ready to break the old software - - void save(banEntrySave entrySave) throw(exception) - { - if (m_stream_ID == entrySave.stream_ID) - { - utf8 s(m_numericIP + ";" + tos(m_mask) + ";" + m_comment + eol()); - if (fwrite(s.c_str(),1,s.size(),entrySave.f) != s.size()) - { - throwEx(LOGNAME "I/O error writing " + (!entrySave.stream_ID ? "global" : "sid=" + tos(entrySave.stream_ID)) + " ban file"); - } - } - } - - bool validIP() throw() - { - return ((m_ip != INADDR_NONE) && (m_ip != 0)); - } - - bool validMask() throw() - { - return (m_mask <= 255); - } - - static in_addr_t stringToIP(const utf8 &sIP, utf8 &hostIP) - { - // default is to assume a raw IP address in the list - in_addr_t ip = inet_addr((const char *)sIP.c_str()); - if (ip == INADDR_NONE) - { - // though if that fails then attempt to - // get an IP address from a hostname... - string sHost; - try - { - sHost = socketOps::hostNameToAddress(sIP.hideAsString()); - } - catch(...) - { - } - if (!sHost.empty()) - { - ip = inet_addr((const char *)sHost.c_str()); - if (ip != INADDR_NONE) - { - hostIP = sHost; - } - } - } - return ip; - } - - banEntry(const utf8 &numericIP, const __uint32 mask, const utf8 &comment, const size_t stream_ID) throw() - :ban_t(numericIP, mask, comment, stream_ID), m_ip(stringToIP(numericIP, m_hostIP)) {} - banEntry() throw():m_ip(0){} - }; - - AOL_namespace::mutex m_lock; - list m_list; - -public: - bool load(const uniFile::filenameType &fn, size_t stream_ID) throw(exception) - { - if (fn.empty()) - { - throwEx(LOGNAME "No " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " ban file"); - } - else if (gOptions.microServerDebug()) - { - DLOG(LOGNAME "Attempting to read ban file: " + fileUtil::getFullFilePath(fn)); - } - - stackLock sml(m_lock); - - FILE *f = uniFile::fopen(fn,"rb"); - if (!f) return false; - - try - { - int l = 0; - int count = 0; - while (true) - { - char buffer[4096] = {0}; - - if (!fgets(buffer, sizeof(buffer), f)) break; // get a line - - ++l; // increment line counter - - utf8 s; - - // skip utf-8 BOM - if ((strlen(buffer) > 2) && - (((unsigned char*)buffer)[0] == 0xef) && - (((unsigned char*)buffer)[1] == 0xbb) && - (((unsigned char*)buffer)[2] == 0xbf)) - { - s = &(buffer[3]); - } - else - { - s = buffer; - } - - s = stripWhitespace(s); - - utf8::size_type pos1 = s.find(utf8::value_type(';')); - if (pos1 == utf8::npos) - { - throwEx(LOGNAME "Parse error in " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " ban file on line " + tos(l)); - } - - utf8::size_type pos2 = s.find(utf8::value_type(';'),pos1+1); - if (pos2 == utf8::npos) - { - throwEx(LOGNAME "Parse error in " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + "ban file on line " + tos(l)); - } - - banEntry e(s.substr(0,pos1),utf8(s.substr(pos1+1,pos2 - pos1 - 1)).toInt(),s.substr(pos2+1),stream_ID); - - if (!e.validIP()) - { - WLOG(LOGNAME "Line " + tos(l) + " of " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " ban list has been ignored (bad IP)"); - } - else if (!e.validMask()) - { - WLOG(LOGNAME "Line " + tos(l) + " of " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " ban list has been ignored (bad MASK)"); - } - else - { - if (this->find(e.m_numericIP,e.m_mask,e.m_stream_ID,false) == false) - { - m_list.push_back(e); - ++count; - } - } - } - ILOG(LOGNAME "Banned " + tos(count) + " IP" + (count != 1 ? "'s" : "") + " from " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " ban file"); - } - catch(...) - { - if (f) ::fclose(f); - throw; - } - if (f) ::fclose(f); - return true; - } - - void save(const uniFile::filenameType &fn, size_t stream_ID) throw(exception) - { - stackLock sml(m_lock); - - FILE *f = uniFile::fopen(fn,"wb"); - if (!f) - { - throwEx(LOGNAME "Could not open " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + - " ban file `" + fn + "' for writing (" + errMessage().hideAsString() + ")"); - } - try - { - banEntrySave entrySave; - entrySave.f = f; - entrySave.stream_ID = stream_ID; - for_each(m_list.begin(),m_list.end(),bind2nd(mem_fun_ref(&banEntry::save),entrySave)); - } - catch(...) - { - if (f) ::fclose(f); - throw; - } - if (f) ::fclose(f); - - if (!uniFile::fileSize(fn)) - { - uniFile::unlink(fn); - } - } - - bool add(const utf8 &ipAddr, const __uint32 mask, const utf8 &comment, const size_t stream_ID) throw(exception) - { - // skip loopback addresses as we treat them specially anyway - if ((ipAddr.find(utf8("127.")) == utf8::npos)) - { - banEntry e(ipAddr, mask,comment, stream_ID); - if (!e.validIP()) - { - throwEx(LOGNAME "Invalid IP specified - `" + ipAddr + "'"); - } - if (!e.validMask()) - { - throwEx(LOGNAME "Invalid MASK specified - `" + tos(mask) + "'"); - } - - stackLock sml(m_lock); - m_list.push_back(e); - return true; - } - return false; - } - - // true if removed - bool remove(const utf8 &ipAddr, const __uint32 mask, const size_t stream_ID, - const bool allStream, const bool fallback = false, const bool use_lock = true) - { - if (use_lock) - { - stackLock sml(m_lock); - } - - for (list::iterator i = m_list.begin(); i != m_list.end(); ++i) - { - if ( - (allStream || (!allStream && (((*i).m_numericIP == ipAddr) || ((*i).m_hostIP == ipAddr)) && ((*i).m_mask == mask))) && - ((*i).m_stream_ID == stream_ID)) - { - m_list.erase(i); - return true; - } - } - - // attempt to see if we've got a hostname which has not been detected from the loading mapping - if (!fallback) - { - string sHost; - try - { - sHost = socketOps::hostNameToAddress(ipAddr.hideAsString()); - } - catch(...) - { - } - if (!sHost.empty()) - { - return remove(sHost, mask, stream_ID, allStream, true, false); - } - } - - return false; - } - - // true if found - bool find(const utf8 &ipAddr, const size_t mask, const size_t stream_ID, const bool use_lock=true) - { - if (use_lock) - { - stackLock sml(m_lock); - } - - if (!m_list.empty()) - { - utf8 hostIP; - in_addr_t ip = banEntry::stringToIP(ipAddr, hostIP); - for (list::const_iterator i = m_list.begin(); i != m_list.end(); ++i) - { - if (((*i).m_mask == mask) && - ((*i).m_stream_ID == stream_ID) && - (ntohl((*i).m_ip) & ((*i).m_mask|0xffffff00)) == - (ntohl(ip) & ((*i).m_mask|0xffffff00) - ) - ) - return true; - } - } - - return false; - } - - // true if found - bool find(const utf8 &ipAddr, const size_t stream_ID, const bool use_lock = true) - { - if (use_lock) - { - stackLock sml(m_lock); - } - - if (!m_list.empty()) - { - utf8 hostIP; - in_addr_t ip = banEntry::stringToIP(ipAddr, hostIP); - for (list::const_iterator i = m_list.begin(); i != m_list.end(); ++i) - { - if (((*i).m_stream_ID == stream_ID) && - (ntohl((*i).m_ip) & ((*i).m_mask|0xffffff00)) == - (ntohl(ip) & ((*i).m_mask|0xffffff00))) - { - return true; - } - } - } - - return false; - } - - void get(std::vector &bl, size_t stream_ID) throw() - { - stackLock sml(m_lock); - - for (list::const_iterator i = m_list.begin(); i != m_list.end(); ++i) - { - if ((*i).m_stream_ID == stream_ID) - { - bl.push_back(*i); - } - } - } -}; - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -banList::banList():m_impl(0) -{ - m_impl = new banList::impl; -} - -banList::~banList() throw() -{ - forget(m_impl); -} - -bool banList::load(const uniFile::filenameType &fn, size_t stream_ID) throw() -{ - assert(m_impl); - - bool result(false); - - try - { - result = m_impl->load(fn,stream_ID); - } - catch(const exception &ex) - { - ELOG(ex.what()); - } - return result; -} - -bool banList::save(const uniFile::filenameType &fn, size_t stream_ID) throw() -{ - assert(m_impl); - - bool result(false); - - try - { - m_impl->save(fn,stream_ID); - result = true; - } - catch(const exception &ex) - { - ELOG(ex.what()); - } - return result; -} - -// throws if parameters are invalid -bool banList::add(const utf8 &ipAddr, const __uint32 mask, const utf8 &comment, const size_t stream_ID) throw(exception) -{ - assert(m_impl); - return m_impl->add(ipAddr, mask, comment, stream_ID); -} - -// true if removed -bool banList::remove(const utf8 &ipAddr, const __uint32 mask, const size_t stream_ID, const bool allStream) throw() -{ - assert(m_impl); - return m_impl->remove(ipAddr, mask, stream_ID, allStream); -} - -// true if found -bool banList::find(const utf8 &ipAddr, const size_t stream_ID) throw() -{ - assert(m_impl); - return m_impl->find(ipAddr, stream_ID); -} - -// true if found -bool banList::find(const utf8 &ipAddr, const __uint32 mask, const size_t stream_ID) throw() -{ - assert(m_impl); - return m_impl->find(ipAddr, mask, stream_ID); -} - -void banList::get(vector &bl, const size_t stream_ID) throw() -{ - assert(m_impl); - m_impl->get(bl, stream_ID); -} diff --git a/Src/Plugins/DSP/sc_serv3/banList.h b/Src/Plugins/DSP/sc_serv3/banList.h deleted file mode 100644 index 97cb781d..00000000 --- a/Src/Plugins/DSP/sc_serv3/banList.h +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once -#ifndef banList_H_ -#define banList_H_ - -#include -#include "unicode/uniFile.h" - -// class that manages list of addresses banned from the system - -class banList -{ -private: - class impl; - impl *m_impl; - -public: - struct ban_t - { - size_t m_mask; - size_t m_stream_ID; // used to differentiate - uniString::utf8 m_numericIP; - uniString::utf8 m_comment; // hostname or other symbolic name - uniString::utf8 m_hostIP; // used to hold the converted IP from a hostname - - ban_t(const uniString::utf8 &numericIP, const __uint32 mask, const uniString::utf8 &comment, const size_t stream_ID) throw() - : m_mask(mask), m_stream_ID(stream_ID), m_numericIP(numericIP), m_comment(comment) {} - - ban_t() throw() : m_mask(0), m_stream_ID(1){} - }; - - // throws if parameters are invalid - bool add(const uniString::utf8 &ipAddr, const __uint32 mask, const uniString::utf8 &comment, const size_t stream_ID) throw(std::exception); - // true if removed - bool remove(const uniString::utf8 &ipAddr, const __uint32 mask, const size_t stream_ID, const bool allStream) throw(); - // true if found - bool find(const uniString::utf8 &ipAddr, const size_t stream_ID) throw(); - bool find(const uniString::utf8 &ipAddr, const __uint32 mask, const size_t stream_ID) throw(); - - bool load(const uniFile::filenameType &fn, const size_t stream_ID) throw(); - bool save(const uniFile::filenameType &fn, const size_t stream_ID) throw(); - - banList(); - ~banList() throw(); - - // for web administration reference - void get(std::vector &bl, const size_t stream_ID) throw(); -}; - -extern banList g_banList; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/bandwidth.cpp b/Src/Plugins/DSP/sc_serv3/bandwidth.cpp deleted file mode 100644 index b909eb8f..00000000 --- a/Src/Plugins/DSP/sc_serv3/bandwidth.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include "bandwidth.h" -#include "global.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define DEBUG_LOG(...) do { if (gOptions.statsDebug()) DLOG(__VA_ARGS__); } while (0) - -#define LOGNAME "[BANDWIDTH] " - -static __uint64 g_bandWidthTable[bandWidth::ALL_OTHER]; -static AOL_namespace::rwLock g_bandwidthLock; - -const __uint64 bandWidth::getAmount(const bandWidth::usageType_t type) -{ - stackRWLock sl (g_bandwidthLock); - - if (type < ALL_SENT) - { - return g_bandWidthTable[type]; - } - - switch (type) - { - case bandWidth::ALL_SENT: - { - return g_bandWidthTable[CLIENT_V1_SENT] + - g_bandWidthTable[CLIENT_V2_SENT] + - g_bandWidthTable[CLIENT_HTTP_SENT] + - g_bandWidthTable[CLIENT_FLV_SENT] + - g_bandWidthTable[CLIENT_M4A_SENT] + - g_bandWidthTable[SOURCE_V1_SENT] + - g_bandWidthTable[SOURCE_V2_SENT] + - g_bandWidthTable[PUBLIC_WEB] + - g_bandWidthTable[PRIVATE_WEB] + - g_bandWidthTable[FLASH_POLICY] + - g_bandWidthTable[RELAY_V2_SENT]+ - g_bandWidthTable[YP_SENT] + - g_bandWidthTable[AUTH_AND_METRICS]; - } - case bandWidth::ALL_RECV: - { - return g_bandWidthTable[SOURCE_V1_RECV] + - g_bandWidthTable[SOURCE_V2_RECV] + - g_bandWidthTable[RELAY_MISC_RECV] + - g_bandWidthTable[RELAY_V1_RECV] + - g_bandWidthTable[RELAY_V2_RECV] + - g_bandWidthTable[YP_RECV] + - g_bandWidthTable[ADVERTS]; - } - case bandWidth::ALL_WEB: - { - return g_bandWidthTable[PUBLIC_WEB] + - g_bandWidthTable[PRIVATE_WEB]; - } - case bandWidth::ALL_SOURCE_SENT: - { - return g_bandWidthTable[SOURCE_V1_SENT] + - g_bandWidthTable[SOURCE_V2_SENT]; - } - case bandWidth::ALL_SOURCE_RECV: - { - return g_bandWidthTable[SOURCE_V1_RECV] + - g_bandWidthTable[SOURCE_V2_RECV]; - } - case bandWidth::ALL_CLIENT_SENT: - { - return g_bandWidthTable[CLIENT_V1_SENT] + - g_bandWidthTable[CLIENT_V2_SENT] + - g_bandWidthTable[CLIENT_HTTP_SENT] + - g_bandWidthTable[CLIENT_FLV_SENT] + - g_bandWidthTable[CLIENT_M4A_SENT]; - } - case bandWidth::ALL_RELAY_RECV: - { - return g_bandWidthTable[RELAY_MISC_RECV] + - g_bandWidthTable[RELAY_V1_RECV] + - g_bandWidthTable[RELAY_V2_RECV]; - } - case bandWidth::ALL_OTHER: - { - return g_bandWidthTable[FLASH_POLICY] + - g_bandWidthTable[RELAY_V2_SENT] + - g_bandWidthTable[YP_SENT] + - g_bandWidthTable[YP_RECV] + - g_bandWidthTable[AUTH_AND_METRICS] + - g_bandWidthTable[ADVERTS]; - } - default: - { - return 0; - } - } -} - -void bandWidth::updateAmount(const bandWidth::usageType_t type, const __uint64 amount) -{ - if (amount > 0) - { - stackRWLock sl (g_bandwidthLock, false); - g_bandWidthTable[type] += amount; - g_bandWidthTable[bandWidth::ALL] += amount; - } -} - -void bandWidth::getFinalAmounts() -{ - __uint64 all = getAmount(bandWidth::ALL); - if (all > 0) - { - ILOG(LOGNAME "Total: " + tos(all) + - ", Sent: " + tos(getAmount(bandWidth::ALL_SENT)) + - ", Recv: " + tos(getAmount(bandWidth::ALL_RECV))); - } -} diff --git a/Src/Plugins/DSP/sc_serv3/bandwidth.h b/Src/Plugins/DSP/sc_serv3/bandwidth.h deleted file mode 100644 index a74c1c8b..00000000 --- a/Src/Plugins/DSP/sc_serv3/bandwidth.h +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once -#ifndef bandWidth_H_ -#define bandWidth_H_ - -#include "unicode/uniString.h" - -namespace bandWidth -{ - typedef enum - { - ALL = 0, - PUBLIC_WEB, // public facing pages - PRIVATE_WEB, // private admin pages - - SOURCE_V1_SENT, // v1 source connections sent - SOURCE_V1_RECV, // v1 source connections received - SOURCE_V2_SENT, // v2 source connections sent - SOURCE_V2_RECV, // v2 source connections received - - CLIENT_V1_SENT, // v1 client connections - CLIENT_V2_SENT, // v2 client connections - CLIENT_HTTP_SENT, // HTTP client connections - CLIENT_FLV_SENT, // FLV client connections - CLIENT_M4A_SENT, // M4A client connections - - FLASH_POLICY, // flash policy server - - RELAY_MISC_RECV, // relay connnections handshaking - RELAY_V1_RECV, // v1 relay connnections received - RELAY_V2_SENT, // v2 relay connnections sent - RELAY_V2_RECV, // v2 relay connnections received - - YP_SENT, // YP connections sent - YP_RECV, // YP connections received - - AUTH_AND_METRICS, // metrics based responses - ADVERTS, // advert data requests / pulls - - ALL_SENT, // consolidated sent total - ALL_RECV, // consolidated received total - ALL_WEB, // consolidated web page total - ALL_SOURCE_SENT, // consolidated source sent total - ALL_SOURCE_RECV, // consolidated source received total - ALL_CLIENT_SENT, // consolidated client sent total - ALL_RELAY_RECV, // consolidated relay received total - ALL_OTHER // consolidated remainder total - } usageType_t; - - const __uint64 getAmount(const bandWidth::usageType_t); - void updateAmount(const bandWidth::usageType_t, const __uint64 amount); - void getFinalAmounts(); -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/base64.cpp b/Src/Plugins/DSP/sc_serv3/base64.cpp deleted file mode 100644 index 358ed66c..00000000 --- a/Src/Plugins/DSP/sc_serv3/base64.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include "base64.h" - -using namespace std; - -static const std::string base64_chars = - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789+/"; - -static inline bool is_base64(__uint8 c) -{ - return (isalnum(c) || (c == '+') || (c == '/')); -} - -const std::vector<__uint8> base64::decode(std::string const& encoded_string) -{ - size_t in_len = encoded_string.size(); - int i = 0, in_ = 0; - __uint8 char_array_4[4], char_array_3[3]; - std::vector<__uint8> ret; - - while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) - { - char_array_4[i++] = encoded_string[in_]; ++in_; - if (i == 4) - { - for (i = 0; i <4; i++) - { - char_array_4[i] = (__uint8)base64_chars.find(char_array_4[i]); - } - - char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); - char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); - char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; - - for (i = 0; (i < 3); i++) - { - ret.push_back(char_array_3[i]); - } - - i = 0; - } - } - - if (i) - { - int j = 0; - for (j = i; j <4; j++) - { - char_array_4[j] = 0; - } - - for (j = 0; j <4; j++) - { - char_array_4[j] = (__uint8)base64_chars.find(char_array_4[j]); - } - - char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); - char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); - char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; - - for (j = 0; (j < i - 1); j++) - { - ret.push_back(char_array_3[j]); - } - } - - return ret; -} diff --git a/Src/Plugins/DSP/sc_serv3/base64.h b/Src/Plugins/DSP/sc_serv3/base64.h deleted file mode 100644 index 723cc6a1..00000000 --- a/Src/Plugins/DSP/sc_serv3/base64.h +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once -#ifndef base64_H_ -#define base64_H_ - -#include "unicode/uniString.h" - -// no decoding... yet -namespace base64 -{ - template - OUTT encode(ITER start, ITER finish) throw() - { - static const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - int shift = 0; - int accum = 0; - - ITER i = start; - OUTT result; - - while (i != finish) - { - accum <<= 8; - shift += 8; - accum |= *(i++); - while (shift >= 6) - { - shift -= 6; - result.push_back((typename OUTT::value_type)alphabet[(accum >> shift) & 0x3F]); - } - } - if (shift == 4) - { - result.push_back((typename OUTT::value_type)alphabet[(accum & 0xF)<<2]); - result.push_back((typename OUTT::value_type)'='); - } - else if (shift == 2) - { - result.push_back((typename OUTT::value_type)alphabet[(accum & 0x3)<<4]); - result.push_back((typename OUTT::value_type)'='); - result.push_back((typename OUTT::value_type)'='); - } - return result; - } - - template - OUTT encode(const CONT &c) throw() - { - return base64::encode(c.begin(), c.end()); - } - - const std::vector<__uint8> decode(std::string const& encoded_string); -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/cache.cpp b/Src/Plugins/DSP/sc_serv3/cache.cpp deleted file mode 100644 index ea9fe2fa..00000000 --- a/Src/Plugins/DSP/sc_serv3/cache.cpp +++ /dev/null @@ -1,104 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include -#include "cache.h" - -void AddorUpdateCache(cacheItem *item, const time_t now, const bool compressed, - const uniString::utf8 &header, const uniString::utf8 &response, - CacheMap_t &cache, AOL_namespace::mutex &lock, - const streamData::streamID_t sid) -{ - if (lock.timedLock(3000)) - { - // if we've already got an instance then we update - if (item == NULL) - { - item = cache[sid] = new cacheItem(); - } - - if (item != NULL) - { - if (compressed) - { - item->generatedGZIP = now; - item->responseGZIP = response; - item->headerGZIP = header; - } - else - { - item->generatedRaw = now; - item->responseRaw = response; - item->headerRaw = header; - } - } - lock.unlock(); - } -} - -bool GetFromCache(const cacheItem *item, AOL_namespace::mutex &lock, - const time_t now, const bool compressed, - const bool headRequest, uniString::utf8 &response, - const int limit) -{ - if (lock.timedLock(3000)) - { - if (item != NULL) - { - if (((now - item->generatedGZIP) < limit) && compressed) - { - if (item->responseGZIP.size() > 0) - { - response = (!headRequest ? item->responseGZIP : item->headerGZIP); - lock.unlock(); - return true; - } - } - else if (((now - item->generatedRaw) < limit) && !compressed) - { - if (item->responseRaw.size() > 0) - { - response = (!headRequest ? item->responseRaw : item->headerRaw); - lock.unlock(); - return true; - } - } - } - lock.unlock(); - } - return false; -} - -void DeleteCache(CacheMap_t &cache) -{ - if (!cache.empty()) - { - for (CacheMap_t::const_iterator i = cache.begin(); i != cache.end(); ++i) - { - delete (*i).second; - } - cache.clear(); - } -} - -void DeleteAllCaches() -{ - DeleteCache(m_xmlStatsCache); - DeleteCache(m_xmlStatisticsCache); - DeleteCache(m_jsonStatsCache); - DeleteCache(m_jsonStatisticsCache); - DeleteCache(m_7Cache); - DeleteCache(m_PLSCache); - DeleteCache(m_M3UCache); - DeleteCache(m_ASXCache); - DeleteCache(m_QTLCache); - DeleteCache(m_XSPFCache); - DeleteCache(m_xmlTracksCache); - DeleteCache(m_jsonTracksCache); - DeleteCache(m_xmlPlayedCache); - DeleteCache(m_jsonPlayedCache); - DeleteCache(m_htmlPlayedCache); - DeleteCache(m_streamArtCache); - DeleteCache(m_playingArtCache); - DeleteCache(m_crossdomainCache); -} diff --git a/Src/Plugins/DSP/sc_serv3/cache.h b/Src/Plugins/DSP/sc_serv3/cache.h deleted file mode 100644 index 72dfb9c5..00000000 --- a/Src/Plugins/DSP/sc_serv3/cache.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once -#ifndef _CACHE_H -#define _CACHE_H - -#include "unicode/uniString.h" -#include "streamData.h" - -struct cacheItem -{ - time_t generatedGZIP; - time_t generatedRaw; - uniString::utf8 headerGZIP; - uniString::utf8 headerRaw; - uniString::utf8 responseGZIP; - uniString::utf8 responseRaw; - - cacheItem() : generatedGZIP(0), generatedRaw(0) - { - } - - ~cacheItem() - { - generatedGZIP = generatedRaw = 0; - headerGZIP.clear(); - headerRaw.clear(); - responseGZIP.clear(); - responseRaw.clear(); - } -}; - -typedef std::map CacheMap_t; - -void AddorUpdateCache(cacheItem *item, const time_t now, const bool compressed, - const uniString::utf8 &header, const uniString::utf8 &response, - CacheMap_t &cache, AOL_namespace::mutex &lock, - const streamData::streamID_t sid); - -bool GetFromCache(const cacheItem *item, AOL_namespace::mutex &lock, - const time_t now, const bool compressed, - const bool headRequest, uniString::utf8 &response, - const int limit = 1); - -void DeleteCache(CacheMap_t &cache); -void DeleteAllCaches(); - -extern CacheMap_t m_xmlStatsCache, m_xmlStatisticsCache, m_jsonStatsCache, - m_jsonStatisticsCache, m_7Cache, m_PLSCache, m_M3UCache, - m_ASXCache, m_QTLCache, m_XSPFCache, m_xmlTracksCache, - m_jsonTracksCache, m_xmlPlayedCache, m_jsonPlayedCache, - m_htmlPlayedCache, m_streamArtCache, m_playingArtCache, - m_crossdomainCache; -#endif diff --git a/Src/Plugins/DSP/sc_serv3/config.cpp b/Src/Plugins/DSP/sc_serv3/config.cpp deleted file mode 100644 index 0b6cd64b..00000000 --- a/Src/Plugins/DSP/sc_serv3/config.cpp +++ /dev/null @@ -1,2867 +0,0 @@ -#include "config.h" -#include "stl/stringUtils.h" -#include -#include "cpucount.h" -#include "file/fileUtils.h" -#include "services/stdServiceImpl.h" -#ifdef _WIN32 -#include "win32/rezFuncs.h" -#else -#include "unixversion.h" -#endif -#include "banList.h" -#include "ripList.h" -#include "adminList.h" -#include "agentList.h" -#include "w3cLog.h" -#include "global.h" -#include -#include -#include -#include - -#define LOGNAME "[CONFIG] " - -using namespace std; -using namespace stringUtil; -using namespace uniString; - -config::config() throw() -{ - #define OPTINIT(n) accessor_t(&config::assign_##n, &config::fetch_##n, &config::count_##n, &config::multi_##n, &config::def_##n) - - m_optMap["configrewrite"] = OPTINIT(configRewrite); - - m_optMap["log"] = OPTINIT(log); - m_optMap["screenlog"] = OPTINIT(screenLog); - m_optMap["logfile"] = OPTINIT(logFile); - m_optMap["reallogfile"] = OPTINIT(realLogFile); - m_optMap["logrotates"] = OPTINIT(logRotates); - m_optMap["logarchive"] = OPTINIT(logArchive); - m_optMap["rotateinterval"] = OPTINIT(rotateInterval); - - // networking - m_optMap["namelookups"] = OPTINIT(nameLookups); - m_optMap["alternateports"] = OPTINIT(alternatePorts); - m_optMap["portbase"] = OPTINIT(portBase); - m_optMap["publicport"] = OPTINIT(publicPort); - m_optMap["portlegacy"] = OPTINIT(portLegacy); - m_optMap["autodumptime"] = OPTINIT(autoDumpTime); - m_optMap["maxheaderlinesize"] = OPTINIT(maxHeaderLineSize); - m_optMap["maxheaderlinecount"] = OPTINIT(maxHeaderLineCount); - m_optMap["password"] = OPTINIT(password); - m_optMap["adminpassword"] = OPTINIT(adminPassword); - m_optMap["sslcertificatefile"] = OPTINIT(sslCertificateFile); - m_optMap["sslcertificatekeyfile"] = OPTINIT(sslCertificateKeyFile); - - m_optMap["buffertype"] = OPTINIT(bufferType); - m_optMap["fixedbuffersize"] = OPTINIT(fixedBufferSize); - m_optMap["adaptivebuffersize"] = OPTINIT(adaptiveBufferSize); - m_optMap["bufferhardlimit"] = OPTINIT(bufferHardLimit); - m_optMap["metainterval"] = OPTINIT(metaInterval); - - m_optMap["adtestfileloop"] = OPTINIT(adTestFileLoop); - m_optMap["adtestfile"] = OPTINIT(adTestFile); - m_optMap["adtestfile2"] = OPTINIT(adTestFile2); - m_optMap["adtestfile3"] = OPTINIT(adTestFile3); - m_optMap["adtestfile4"] = OPTINIT(adTestFile4); - m_optMap["introfile"] = OPTINIT(introFile); - m_optMap["backupfile"] = OPTINIT(backupFile); - m_optMap["backuptitle"] = OPTINIT(backupTitle); - m_optMap["backuploop"] = OPTINIT(backupLoop); - m_optMap["maxspecialfilesize"] = OPTINIT(maxSpecialFileSize); - - m_optMap["artworkfile"] = OPTINIT(artworkFile); - - m_optMap["uvoxcipherkey"] = OPTINIT(uvoxCipherKey); - - //// w3c logging - m_optMap["w3cenable"] = OPTINIT(w3cEnable); - m_optMap["w3clog"] = OPTINIT(w3cLog); - - m_optMap["pidfile"] = OPTINIT(pidFile); - - //// relaying - m_optMap["relayreconnecttime"] = OPTINIT(relayReconnectTime); - m_optMap["relayconnectretries"] = OPTINIT(relayConnectRetries); - m_optMap["maxhttpredirects"] = OPTINIT(maxHTTPRedirects); - m_optMap["allowrelay"] = OPTINIT(allowRelay); - m_optMap["allowpublicrelay"] = OPTINIT(allowPublicRelay); - ///// - - //// stream configuration - m_optMap["streamid"] = OPTINIT(stream_ID); - m_optMap["streamauthhash"] = OPTINIT(stream_authHash); - m_optMap["streampath"] = OPTINIT(stream_path); - m_optMap["streamrelayurl"] = OPTINIT(stream_relayURL); - m_optMap["streambackupurl"] = OPTINIT(stream_backupURL); - m_optMap["streamminbitrate"] = OPTINIT(stream_minBitrate); - m_optMap["streammaxbitrate"] = OPTINIT(stream_maxBitrate); - m_optMap["streammaxuser"] = OPTINIT(stream_maxUser); - m_optMap["streampassword"] = OPTINIT(stream_password); - m_optMap["streamadminpassword"] = OPTINIT(stream_adminPassword); - m_optMap["streampublicserver"] = OPTINIT(stream_publicServer); - m_optMap["streamallowrelay"] = OPTINIT(stream_allowRelay); - m_optMap["streamallowpublicrelay"] = OPTINIT(stream_allowPublicRelay); - m_optMap["streamriponly"] = OPTINIT(stream_ripOnly); - m_optMap["streamautodumpsourcetime"] = OPTINIT(stream_autoDumpSourceTime); - m_optMap["streamautodumptime"] = OPTINIT(stream_autoDumpTime); - m_optMap["streamautodumpusers"] = OPTINIT(stream_autoDumpUsers); - m_optMap["streamlistenertime"] = OPTINIT(stream_listenerTime); - m_optMap["streamsonghistory"] = OPTINIT(stream_songHistory); - m_optMap["streamuvoxcipherkey"] = OPTINIT(stream_uvoxCipherKey); - m_optMap["streamlogfile"] = OPTINIT(stream_logFile); - m_optMap["streamadtestfileloop"] = OPTINIT(stream_adTestFileLoop); - m_optMap["streamadtestfile"] = OPTINIT(stream_adTestFile); - m_optMap["streamadtestfile2"] = OPTINIT(stream_adTestFile2); - m_optMap["streamadtestfile3"] = OPTINIT(stream_adTestFile3); - m_optMap["streamadtestfile4"] = OPTINIT(stream_adTestFile4); - m_optMap["streamintrofile"] = OPTINIT(stream_introFile); - m_optMap["streambackupfile"] = OPTINIT(stream_backupFile); - m_optMap["streambackuptitle"] = OPTINIT(stream_backupTitle); - m_optMap["streambackuploop"] = OPTINIT(stream_backupLoop); - m_optMap["streambanfile"] = OPTINIT(stream_banFile); - m_optMap["streamripfile"] = OPTINIT(stream_ripFile); - m_optMap["streamagentfile"] = OPTINIT(stream_agentFile); - m_optMap["streamartworkfile"] = OPTINIT(stream_artworkFile); - m_optMap["streamw3clog"] = OPTINIT(stream_w3cLog); - m_optMap["streamhidestats"] = OPTINIT(stream_hideStats); - m_optMap["streamredirecturl"] = OPTINIT(stream_redirectUrl); - m_optMap["streammovedurl"] = OPTINIT(stream_movedUrl); - m_optMap["streamratelimitwait"] = OPTINIT(stream_rateLimitWait); - - m_optMap["requirestreamconfigs"] = OPTINIT(requireStreamConfigs); - m_optMap["userid"] = OPTINIT(userId); - m_optMap["licenceid"] = OPTINIT(licenceId); - - //// cdn - m_optMap["cdn"] = OPTINIT(cdn); - m_optMap["cdnmaster"] = OPTINIT(cdn_master); - m_optMap["cdnslave"] = OPTINIT(cdn_slave); - - //// flash - m_optMap["flashpolicyfile"] = OPTINIT(flashPolicyFile); - m_optMap["flashpolicyserverport"] = OPTINIT(flashPolicyServerPort); - - //// yp - m_optMap["yptimeout"] = OPTINIT(ypTimeout); - m_optMap["ypaddr"] = OPTINIT(ypAddr); - m_optMap["ypport"] = OPTINIT(ypPort); - m_optMap["yport"] = OPTINIT(ypPort); - m_optMap["yppath"] = OPTINIT(ypPath); - m_optMap["ypmaxretries"] = OPTINIT(ypMaxRetries); - m_optMap["ypreportinterval"] = OPTINIT(ypReportInterval); - m_optMap["ypminreportinterval"] = OPTINIT(ypMinReportInterval); - m_optMap["publicserver"] = OPTINIT(publicServer); - - /// agent - m_optMap["agentfile"] = OPTINIT(agentFile); - m_optMap["saveagentlistonexit"] = OPTINIT(saveAgentListOnExit); - m_optMap["blockemptyuseragent"] = OPTINIT(blockEmptyUserAgent); - - //// stats - m_optMap["hidestats"] = OPTINIT(hideStats); - m_optMap["minbitrate"] = OPTINIT(minBitrate); - m_optMap["maxbitrate"] = OPTINIT(maxBitrate); - m_optMap["maxuser"] = OPTINIT(maxUser); - - // radionomy metrics - m_optMap["admetricsdebug"] = OPTINIT(adMetricsDebug); - m_optMap["metricsmaxqueue"] = OPTINIT(metricsMaxQueue); - - m_optMap["authdebug"] = OPTINIT(authDebug); - - /// client behaviour - m_optMap["listenertime"] = OPTINIT(listenerTime); - m_optMap["autodumpusers"] = OPTINIT(autoDumpUsers); - m_optMap["srcdns"] = OPTINIT(srcIP); - m_optMap["srcip"] = OPTINIT(srcIP); - m_optMap["destdns"] = OPTINIT(destIP); - m_optMap["destip"] = OPTINIT(destIP); - m_optMap["dstip"] = OPTINIT(destIP); - m_optMap["publicdns"] = OPTINIT(publicIP); - m_optMap["publicip"] = OPTINIT(publicIP); - m_optMap["titleformat"] = OPTINIT(titleFormat); - m_optMap["urlformat"] = OPTINIT(urlFormat); - - //// banning - m_optMap["banfile"] = OPTINIT(banFile); - m_optMap["savebanlistonexit"] = OPTINIT(saveBanListOnExit); - - //// rip - m_optMap["ripfile"] = OPTINIT(ripFile); - m_optMap["saveriplistonexit"] = OPTINIT(saveRipListOnExit); - m_optMap["riponly"] = OPTINIT(ripOnly); - - m_optMap["adminfile"] = OPTINIT(adminFile); - - //// debugging - m_optMap["webclientdebug"] = OPTINIT(webClientDebug); - m_optMap["yp2debug"] = OPTINIT(yp2Debug); - m_optMap["shoutcastsourcedebug"] = OPTINIT(shoutcastSourceDebug); - m_optMap["uvox2sourcedebug"] = OPTINIT(uvox2SourceDebug); - m_optMap["httpsourcedebug"] = OPTINIT(HTTPSourceDebug); - m_optMap["streamdatadebug"] = OPTINIT(streamDataDebug); - m_optMap["microserverdebug"] = OPTINIT(microServerDebug); - m_optMap["httpstyledebug"] = OPTINIT(httpStyleDebug); - m_optMap["shoutcast1clientdebug"] = OPTINIT(shoutcast1ClientDebug); - m_optMap["shoutcast2clientdebug"] = OPTINIT(shoutcast2ClientDebug); - m_optMap["httpclientdebug"] = OPTINIT(HTTPClientDebug); - m_optMap["flvclientdebug"] = OPTINIT(flvClientDebug); - m_optMap["m4aclientdebug"] = OPTINIT(m4aClientDebug); - m_optMap["relaydebug"] = OPTINIT(relayDebug); - m_optMap["relayshoutcastdebug"] = OPTINIT(relayShoutcastDebug); - m_optMap["relayuvoxdebug"] = OPTINIT(relayUvoxDebug); - m_optMap["statsdebug"] = OPTINIT(statsDebug); - m_optMap["threadrunnerdebug"] = OPTINIT(threadRunnerDebug); - - m_optMap["songhistory"] = OPTINIT(songHistory); - m_optMap["showlastsongs"] = OPTINIT(songHistory); - - ///// misc nonsense - m_optMap["unique"] = OPTINIT(unique); - m_optMap["include"] = OPTINIT(include); - m_optMap["cpucount"] = OPTINIT(cpuCount); - m_optMap["clacks"] = OPTINIT(clacks); - m_optMap["startinactive"] = OPTINIT(startInactive); - m_optMap["ratelimit"] = OPTINIT(rateLimit); - m_optMap["ratelimitwait"] = OPTINIT(rateLimitWait); - m_optMap["usexff"] = OPTINIT(useXFF); - m_optMap["logclients"] = OPTINIT(logClients); - m_optMap["admincssfile"] = OPTINIT(adminCSSFile); - m_optMap["faviconfile"] = OPTINIT(faviconFile); - m_optMap["faviconmimetype"] = OPTINIT(faviconFileMimeType); - m_optMap["robotstxtfile"] = OPTINIT(robotstxtFile); - m_optMap["redirecturl"] = OPTINIT(redirectUrl); - m_optMap["forceshortsends"] = OPTINIT(forceShortSends); - m_optMap["adminnowrap"] = OPTINIT(adminNoWrap); - - // used to control the cache handling - m_favIconTime = m_styleCustomHeaderTime = 0; -} - -// return the streamConfig entries that reference relays -const vector config::getRelayList() -{ - vector result; - streams_t stream_configs; - getStreamConfigs(stream_configs); - - // get all stream configs and then make a vector list of only valid configs - // which ensures we're only getting known stream configs unlike prior to - // the behaviour with builds 24 which usually gave an extra config than was - for (config::streams_t::const_iterator i = stream_configs.begin(); i != stream_configs.end(); ++i) - { - if ((*i).second.m_relayUrl.isSet()) - { - result.push_back((*i).second); - } - } - - return result; -} - -// return the streamConfig entry that references the backup url asked -const vector config::getBackupUrl(const size_t streamID) throw(exception) -{ - vector result; - streams_t stream_configs; - getStreamConfigs(stream_configs); - config::streams_t::const_iterator i = stream_configs.find(streamID); - - if (i != stream_configs.end()) - { - if ((*i).second.m_backupUrl.isSet()) - { - result.push_back((*i).second); - } - } - - return result; -} - -unsigned short config::getMetaInterval(const size_t streamID) const throw() -{ - unsigned short metainterval = stream_metaInterval(streamID); - if (!read_stream_metaInterval(streamID)) - { - metainterval = metaInterval(); - } - - // don't allow less than 256 and - // due to overflow we don't need - // to do an upper check as it'll - // have wrapped around for this. - return (metainterval < 256 ? 256 : metainterval); -} - -int config::getBackupLoop(const size_t streamID) const throw() -{ - int backuploop = stream_backupLoop(streamID); - if (!read_stream_backupLoop(streamID)) - { - backuploop = backupLoop(); - } - return backuploop; -} - -int config::getRateLimitWait(const size_t streamID) const throw() -{ - int ratelimitwait = stream_rateLimitWait(streamID); - if (!read_stream_rateLimitWait(streamID)) - { - ratelimitwait = rateLimitWait(); - } - // just to make sure that we're giving a sane value - return (ratelimitwait > 0 ? ratelimitwait : def_rateLimitWait().toInt()); -} - -const int config::isBitrateDisallowed(const size_t streamID, const int bitrate, - int &streamMinBitrate, int &streamMaxBitrate) const throw() -{ - int ret = 0; - - // check that these bitrates are allowed (looking at both max and average values) - streamMinBitrate = stream_minBitrate(streamID); - if (!read_stream_minBitrate(streamID) || !streamMinBitrate) - { - streamMinBitrate = minBitrate(); - } - - if ((streamMinBitrate > 0) && (bitrate < streamMinBitrate)) - { - ret |= 1; - } - - streamMaxBitrate = stream_maxBitrate(streamID); - if (!read_stream_maxBitrate(streamID) || !streamMaxBitrate) - { - streamMaxBitrate = maxBitrate(); - } - - if ((streamMaxBitrate > 0) && (bitrate > streamMaxBitrate)) - { - ret |= 2; - } - - return ret; -} - -size_t config::getSongHistorySize(const size_t streamID) const throw() -{ - size_t songhistory = stream_songHistory(streamID); - if (!read_stream_songHistory(streamID)) - { - songhistory = songHistory(); - } - return songhistory; -} - -const int config::getAutoDumpTime(const size_t streamID) const throw() -{ - size_t sid = (!streamID ? streamID : DEFAULT_SOURCE_STREAM); - int dumpTime = stream_autoDumpTime(sid); - if (!read_stream_autoDumpTime(sid) || !dumpTime) - { - dumpTime = autoDumpTime(); - } - return dumpTime; -} - -const int config::getCPUCount() const throw() -{ - int cpu_count = cpuCount(); // check options - - if (cpu_count < 1) - { - int maxclients = gOptions.maxUser(); - if (maxclients < 1100) - cpu_count = (maxclients/350) +1; - else - { - int hwcpus = cpucount(); - if (hwcpus < 5) - cpu_count = hwcpus; - else - cpu_count = (((int)::log10 ((double)maxclients) - 2) * 6) - 2; // should be range of 4-12 - } - } - if (cpu_count < 1) cpu_count = 2; // eh? can never be less than 1 - return cpu_count; -} - -bool config::setupPasswords(const streams_t &stream_configs) throw(exception) -{ - // now form the per stream versions of passwords if there are any - bool passwordError = false; - for (streams_t::const_iterator i = stream_configs.begin(); i != stream_configs.end(); ++i) - { - utf8 tempAdminPassword = (*i).second.m_adminPassword; - if (tempAdminPassword.empty()) - { - tempAdminPassword = gOptions.adminPassword(); - } - - utf8 tempPassword = (*i).second.m_password; - if (tempPassword.empty()) - { - tempPassword = gOptions.password(); - } - - // follow legacy behaviour (just incase) - if (tempAdminPassword.empty()) - { - tempAdminPassword = tempPassword; - } - else - { - // otherwise if explicitly set as the same then we abort - if (tempAdminPassword == tempPassword) - { - WLOG(logSectionName() + "Stream " + tos((*i).first) + " should not have matching passwords for `adminpassword' and `password'."); - } - } - - if (tempAdminPassword.empty() && tempPassword.empty()) - { - ELOG(logSectionName() + "Stream " + tos((*i).first) + " does not have any passwords specified."); - passwordError = true; - } - } - - return passwordError; -} - -config::streamConfig& config::getPerStreamConfig(streamConfig& stream, const size_t sid, const bool useParent) -{ - // tweak the maxuser setting on the stream so it can be made to follow the - // per stream setting or for it to revert to the global server limit - int tempMaxUser = native_fetch_stream_maxUser(sid); - if (!tempMaxUser || (tempMaxUser > gOptions.maxUser())) - { - if (useParent) - { - tempMaxUser = 0; - } - } - - int tempMaxBitrate = native_fetch_stream_maxBitrate(sid); - if (!read_stream_maxBitrate(sid)) - { - if (useParent) - { - tempMaxBitrate = gOptions.maxBitrate(); - } - } - - int tempMinBitrate = native_fetch_stream_minBitrate(sid); - if (!read_stream_minBitrate(sid)) - { - if (useParent) - { - tempMinBitrate = gOptions.minBitrate(); - } - } - - bool tempAllowRelay = native_fetch_stream_allowRelay(sid); - if (!read_stream_allowRelay(sid)) - { - if (useParent) - { - tempAllowRelay = gOptions.allowRelay(); - } - } - - bool tempAllowPublicRelay = native_fetch_stream_allowPublicRelay(sid); - if (!read_stream_allowPublicRelay(sid)) - { - if (useParent) - { - tempAllowPublicRelay = gOptions.allowPublicRelay(); - } - } - - utf8 tempAdminPassword = native_fetch_stream_adminPassword(sid); - if (tempAdminPassword.empty()) - { - if (useParent) - { - tempAdminPassword = gOptions.adminPassword(); - } - } - - utf8 tempPassword = native_fetch_stream_password(sid); - if (tempPassword.empty()) - { - if (useParent) - { - tempPassword = gOptions.password(); - } - } - - utf8 tempPublicServer = native_fetch_stream_publicServer(sid); - if (tempPublicServer.empty()) - { - if (useParent) - { - tempPublicServer = gOptions.publicServer(); - } - } - - return (stream = streamConfig(native_fetch_stream_ID(sid), native_fetch_stream_authHash(sid), - native_fetch_stream_path(sid), native_fetch_stream_relayURL(sid), - native_fetch_stream_backupURL(sid), tempMaxUser, tempMaxBitrate, - tempMinBitrate, tempAdminPassword, tempPassword, - tempPublicServer, tempAllowRelay, tempAllowPublicRelay)); -} - -// return a streamConfig entry for the streamID -const bool config::getStreamConfig(streamConfig& stream, const size_t streamID) -{ - stackLock sml(m_lock); - - map::iterator i = m_stream_ID.find(streamID); - if (i != m_stream_ID.end()) - { - config::getPerStreamConfig(stream, streamID); - return true; - } - - return false; -} - -// return all streamConfig entries organized by streamID -void config::getStreamConfigs(streams_t& streams, const bool useParent) -{ - stackLock sml(m_lock); - - for (map::const_iterator i = m_stream_ID.begin(); i != m_stream_ID.end(); ++i) - { - streamConfig stream; - streams[native_fetch_stream_ID((*i).second)] = getPerStreamConfig(stream, (*i).second, useParent); - } - - -} - -// attempt to update an existing stream configuration with the new data -// and then attempt to pass it to the currently active stream based on it -__uint64 config::updateStreamConfig(config &readConfig, streamConfig update) throw(exception) -{ - if (!update.m_streamID) - { - return 0; - } - - stackLock sml(m_lock); - size_t streamID = update.m_streamID; - __uint64 updated = 0; - - if (native_fetch_stream_authHash(streamID) != update.m_authHash) - { - native_assign_stream_authHash(streamID, update.m_authHash); - updated |= AUTH_HASH; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("AUTH_HASH"); - #endif - } - - if (native_fetch_stream_path(streamID) != update.m_urlPath) - { - native_assign_stream_path(streamID, update.m_urlPath); - updated |= URL_PATH; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("URL_PATH"); - #endif - } - - if (native_fetch_stream_relayURL(streamID) != update.m_relayUrl.url()) - { - native_assign_stream_relayURL(streamID, update.m_relayUrl.url()); - updated |= RELAY_URL; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("RELAY_URL"); - #endif - } - - if (native_fetch_stream_backupURL(streamID) != update.m_backupUrl.url()) - { - native_assign_stream_backupURL(streamID, update.m_backupUrl.url()); - updated |= BACKUP_URL; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("BACKUP_URL"); - #endif - } - - if (native_fetch_stream_maxUser(streamID) != update.m_maxStreamUser) - { - native_assign_stream_maxUser(streamID, update.m_maxStreamUser); - updated |= MAX_USER; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("MAX_USER"); - #endif - } - - if (native_fetch_stream_maxBitrate(streamID) != update.m_maxStreamBitrate) - { - native_assign_stream_maxBitrate(streamID, update.m_maxStreamBitrate); - updated |= MAX_BITRATE; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("MAX_BITRATE"); - #endif - } - - if (native_fetch_stream_minBitrate(streamID) != update.m_minStreamBitrate) - { - native_assign_stream_minBitrate(streamID, update.m_minStreamBitrate); - updated |= MIN_BITRATE; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("MIN_BITRATE"); - #endif - } - - utf8 publicServer = readConfig.stream_publicServer(streamID); - if (native_fetch_stream_publicServer(streamID) != publicServer) - { - if (!readConfig.read_stream_publicServer(streamID)) - { - publicServer = gOptions.publicServer(); - } - else - { - updated |= PUBLIC_SRV; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("PUBLIC_SRV"); - #endif - } - native_assign_stream_publicServer(streamID, publicServer); - } - - bool allowRelay = readConfig.stream_allowRelay(streamID); - if (native_fetch_stream_allowRelay(streamID) != allowRelay) - { - if (!readConfig.read_stream_allowRelay(streamID)) - { - allowRelay = gOptions.allowRelay(); - } - native_assign_stream_allowRelay(streamID, allowRelay); - updated |= ALLOW_RELAY; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("ALLOW_RELAY"); - #endif - } - - bool allowPublicRelay = readConfig.stream_allowPublicRelay(streamID); - if (native_fetch_stream_allowPublicRelay(streamID) != allowPublicRelay) - { - if (!readConfig.read_stream_allowPublicRelay(streamID)) - { - allowPublicRelay = gOptions.allowPublicRelay(); - } - native_assign_stream_allowPublicRelay(streamID, allowPublicRelay); - updated |= ALLOW_PUBLIC_RELAY; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("ALLOW_PUBLIC_RELAY"); - #endif - } - - bool ripOnly = readConfig.stream_ripOnly(streamID); - if (native_fetch_stream_ripOnly(streamID) != ripOnly) - { - if (!readConfig.read_stream_ripOnly(streamID)) - { - ripOnly = gOptions.ripOnly(); - } - native_assign_stream_ripOnly(streamID, ripOnly); - updated |= RIP_ONLY; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("RIP_ONLY"); - #endif - } - - int autoDumpTime = readConfig.stream_autoDumpTime(streamID); - if (native_fetch_stream_autoDumpTime(streamID) != autoDumpTime) - { - if (!readConfig.read_stream_autoDumpTime(streamID)) - { - autoDumpTime = gOptions.autoDumpTime(); - } - native_assign_stream_autoDumpTime(streamID, autoDumpTime); - updated |= DUMP_TIME; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("DUMP_TIME"); - #endif - } - - bool autoDumpUsers = readConfig.stream_autoDumpUsers(streamID); - if (native_fetch_stream_autoDumpUsers(streamID) != autoDumpUsers) - { - if (!readConfig.read_stream_autoDumpUsers(streamID)) - { - autoDumpUsers = gOptions.autoDumpUsers(); - } - native_assign_stream_autoDumpUsers(streamID, autoDumpUsers); - updated |= DUMP_USER; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("DUMP_USER"); - #endif - } - - size_t listenerTime = readConfig.stream_listenerTime(streamID); - if (native_fetch_stream_listenerTime(streamID) != listenerTime) - { - if (!readConfig.read_stream_listenerTime(streamID)) - { - listenerTime = gOptions.listenerTime(); - } - native_assign_stream_listenerTime(streamID, listenerTime); - updated |= LIST_TIME; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("LIST_TIME"); - #endif - } - - int songHistory = readConfig.stream_songHistory(streamID); - if (native_fetch_stream_songHistory(streamID) != songHistory) - { - if (!readConfig.read_stream_songHistory(streamID)) - { - songHistory = gOptions.songHistory(); - } - native_assign_stream_songHistory(streamID, songHistory); - updated |= SONG_HIST; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("SONG_HIST"); - #endif - } - - utf8 uvoxCipherKey = readConfig.stream_uvoxCipherKey(streamID); - if (native_fetch_stream_uvoxCipherKey(streamID) != uvoxCipherKey) - { - if (!readConfig.read_stream_uvoxCipherKey(streamID)) - { - uvoxCipherKey = gOptions.uvoxCipherKey(); - } - native_assign_stream_uvoxCipherKey(streamID, uvoxCipherKey); - updated |= CIPHER_KEY; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("CIPHER_KEY"); - #endif - } - - // passwords are handled slightly differently as clearing of the - // password will lead to an invalid scenario so we check and block - utf8 streamPassword = readConfig.stream_password(streamID); - if (native_fetch_stream_password(streamID) != streamPassword) - { - if (!readConfig.read_stream_password(streamID)) - { - // clear what was being previously stored if possible - m_stream_password[streamID].clear(); - updated |= SOURCE_PWD; - } - else - { - // if empty then set back to the master password - if(streamPassword.empty()) - { - streamPassword = readConfig.password(); - } - - // if empty then set back to the master admin password - if(streamPassword.empty()) - { - ELOG(LOGNAME "'password' cannot be set to empty. Not applying this change to stream config# " + tos(streamID)); - } - else - { - native_assign_stream_password(streamID, streamPassword); - updated |= SOURCE_PWD; - } - } - - #if defined(_DEBUG) || defined(DEBUG) - if (updated & SOURCE_PWD) - { - ELOG("SOURCE_PWD"); - } - #endif - } - - utf8 adminPassword = readConfig.stream_adminPassword(streamID); - if (native_fetch_stream_adminPassword(streamID) != adminPassword) - { - if (!readConfig.read_stream_adminPassword(streamID)) - { - // clear what was being previously stored if possible - m_stream_adminPassword[streamID].clear(); - updated |= ADMIN_PWD; - } - // if empty then set back to the master admin password - else if (adminPassword.empty()) - { - ELOG(LOGNAME "'adminpassword' cannot be set to empty. Not applying this change to stream config# " + tos(streamID)); - } - else - { - native_assign_stream_adminPassword(streamID, adminPassword); - updated |= ADMIN_PWD; - } - - #if defined(_DEBUG) || defined(DEBUG) - if (updated & ADMIN_PWD) - { - ELOG("ADMIN_PWD"); - } - #endif - } - - utf8 movedUrl = readConfig.stream_movedUrl(streamID); - if (native_fetch_stream_movedUrl(streamID) != movedUrl) - { - native_assign_stream_movedUrl(streamID, movedUrl); - updated |= MOVED_URL; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("MOVED_URL"); - #endif - } - - utf8 artworkFile = readConfig.stream_artworkFile(streamID); - if (native_fetch_stream_artworkFile(streamID) != artworkFile) - { - if (!readConfig.read_stream_artworkFile(streamID)) - { - artworkFile = gOptions.artworkFile(); - } - native_assign_stream_artworkFile(streamID, artworkFile); - updated |= ARTWORK_FILE; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("ARTWORK_FILE"); - #endif - } - - utf8 adTestFile = readConfig.stream_adTestFile(streamID); - if (native_fetch_stream_adTestFile(streamID) != adTestFile) - { - if (!readConfig.read_stream_adTestFile(streamID)) - { - adTestFile = gOptions.adTestFile(); - } - native_assign_stream_adTestFile(streamID, adTestFile); - updated |= AD_TEST_FILE; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("AD_TEST_FILE"); - #endif - } - - utf8 adTestFile2 = readConfig.stream_adTestFile2(streamID); - if (native_fetch_stream_adTestFile2(streamID) != adTestFile2) - { - if (!readConfig.read_stream_adTestFile2(streamID)) - { - adTestFile2 = gOptions.adTestFile2(); - } - native_assign_stream_adTestFile2(streamID, adTestFile2); - updated |= AD_TEST_FILE_2; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("AD_TEST_FILE_2"); - #endif - } - - utf8 adTestFile3 = readConfig.stream_adTestFile3(streamID); - if (native_fetch_stream_adTestFile3(streamID) != adTestFile3) - { - if (!readConfig.read_stream_adTestFile3(streamID)) - { - adTestFile3 = gOptions.adTestFile3(); - } - native_assign_stream_adTestFile3(streamID, adTestFile3); - updated |= AD_TEST_FILE_3; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("AD_TEST_FILE_3"); - #endif - } - - utf8 adTestFile4 = readConfig.stream_adTestFile4(streamID); - if (native_fetch_stream_adTestFile4(streamID) != adTestFile4) - { - if (!readConfig.read_stream_adTestFile4(streamID)) - { - adTestFile4 = gOptions.adTestFile4(); - } - native_assign_stream_adTestFile4(streamID, adTestFile4); - updated |= AD_TEST_FILE_4; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("AD_TEST_FILE_4"); - #endif - } - - int adTestFileLoop = readConfig.stream_adTestFileLoop(streamID); - if (native_fetch_stream_adTestFileLoop(streamID) != adTestFileLoop) - { - if (!readConfig.read_stream_adTestFileLoop(streamID)) - { - adTestFileLoop = gOptions.adTestFileLoop(); - } - native_assign_stream_adTestFileLoop(streamID, adTestFileLoop); - updated |= AD_TEST_FILE_LOOP; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("AD_TEST_FILE_LOOP"); - #endif - } - - utf8 introFile = readConfig.stream_introFile(streamID); - if (native_fetch_stream_introFile(streamID) != introFile) - { - if (!readConfig.read_stream_introFile(streamID)) - { - introFile = gOptions.introFile(); - } - native_assign_stream_introFile(streamID, introFile); - updated |= INTRO_FILE; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("INTRO_FILE"); - #endif - } - - utf8 backupFile = readConfig.stream_backupFile(streamID); - if (native_fetch_stream_backupFile(streamID) != backupFile) - { - if (!readConfig.read_stream_backupFile(streamID)) - { - backupFile = gOptions.backupFile(); - } - native_assign_stream_backupFile(streamID, backupFile); - updated |= BACKUP_FILE; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("BACKUP_FILE"); - #endif - } - - utf8 backupTitle = readConfig.stream_backupTitle(streamID); - if (native_fetch_stream_backupTitle(streamID) != backupTitle) - { - if (!readConfig.read_stream_backupTitle(streamID)) - { - backupTitle = gOptions.backupTitle(); - } - native_assign_stream_backupTitle(streamID, backupTitle); - updated |= BACKUP_TITLE; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("BACKUP_TITLE"); - #endif - } - - utf8 banFile = readConfig.stream_banFile(streamID); - if (native_fetch_stream_banFile(streamID) != banFile) - { - if (!readConfig.read_stream_banFile(streamID)) - { - m_stream_banFile[streamID].clear(); - gOptions.unread_stream_banFile(streamID); - - // unload the IPs from the list - g_banList.remove("", 0, streamID, true); - } - else - { - // load the IPs from the list - size_t sID = (!banFile.empty() ? streamID : 0); - g_banList.load(banFile,sID); - } - native_assign_stream_banFile(streamID, banFile); - updated |= BAN_FILE; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("BAN_FILE"); - #endif - } - - utf8 ripFile = readConfig.stream_ripFile(streamID); - if (native_fetch_stream_ripFile(streamID) != ripFile) - { - if (!readConfig.read_stream_ripFile(streamID)) - { - m_stream_ripFile[streamID].clear(); - gOptions.unread_stream_ripFile(streamID); - - // unload the IPs from the list - g_ripList.remove("",streamID,true); - } - else - { - // load the IPs from the list - size_t sID = (!ripFile.empty() ? streamID : 0); - g_ripList.load(ripFile,sID); - } - native_assign_stream_ripFile(streamID, ripFile); - updated |= RIP_FILE; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("RIP_FILE"); - #endif - } - - utf8 agentFile = readConfig.stream_agentFile(streamID); - if (native_fetch_stream_agentFile(streamID) != agentFile) - { - if (!readConfig.read_stream_agentFile(streamID)) - { - m_stream_agentFile[streamID].clear(); - gOptions.unread_stream_agentFile(streamID); - - // unload the agents from the list - g_agentList.remove("", streamID, true); - } - else - { - // load the agents from the list - size_t sID = (!agentFile.empty() ? streamID : 0); - g_agentList.load(agentFile, sID); - } - native_assign_stream_agentFile(streamID, agentFile); - updated |= AGENT_FILE; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("AGENT_FILE"); - #endif - } - - utf8 w3cLog = readConfig.stream_w3cLog(streamID); - if (native_fetch_stream_w3cLog(streamID) != w3cLog) - { - if (!readConfig.read_stream_w3cLog(streamID)) - { - m_stream_w3cLog[streamID].clear(); - gOptions.unread_stream_w3cLog(streamID); - w3cLog::close(streamID); - } - else - { - // could have just changed so update as needed - utf8 oldw3cLog = native_fetch_stream_w3cLog(streamID); - if (!oldw3cLog.empty()) - { - w3cLog::close(streamID); - } - size_t sID = (!w3cLog.empty() ? streamID : 0); - if (gOptions.w3cEnable()) - { - w3cLog::open(w3cLog, sID); - } - } - native_assign_stream_w3cLog(streamID, w3cLog); - updated |= W3C_FILE; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("W3C_FILE"); - #endif - } - - utf8 hideStats = readConfig.stream_hideStats(streamID); - if (native_fetch_stream_hideStats(streamID) != hideStats) - { - if (!readConfig.read_stream_hideStats(streamID)) - { - hideStats = gOptions.hideStats(); - } - native_assign_stream_hideStats(streamID, hideStats); - updated |= HIDE_STATS; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("HIDE_STATS"); - #endif - } - - int cdnMaster = readConfig.cdn_master(streamID); - if (native_fetch_cdn_master(streamID) != cdnMaster) - { - if (!readConfig.read_cdn_master(streamID)) - { - cdnMaster = -1; - } - native_assign_cdn_master(streamID, cdnMaster); - updated |= CDN_MASTER; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("CDN_MASTER"); - #endif - } - - int cdnSlave = readConfig.cdn_slave(streamID); - if (native_fetch_cdn_slave(streamID) != cdnSlave) - { - if (!readConfig.read_cdn_slave(streamID)) - { - cdnSlave = -1; - } - native_assign_cdn_slave(streamID, cdnSlave); - updated |= CDN_SLAVE; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("CDN_SLAVE"); - #endif - } - - int backupLoop = readConfig.stream_backupLoop(streamID); - if (native_fetch_stream_backupLoop(streamID) != backupLoop) - { - if (!readConfig.read_stream_backupLoop(streamID)) - { - backupLoop = gOptions.backupLoop(); - } - native_assign_stream_backupLoop(streamID, backupLoop); - updated |= DUMP_USER; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("BACKUP_LOOP"); - #endif - } - - int rateLimitWait = readConfig.stream_rateLimitWait(streamID); - if (native_fetch_stream_rateLimitWait(streamID) != rateLimitWait) - { - if (!readConfig.read_stream_rateLimitWait(streamID)) - { - rateLimitWait = gOptions.rateLimitWait(); - } - native_assign_stream_rateLimitWait(streamID, rateLimitWait); - updated |= RATE_LIMIT_WAIT; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("RATE_LIMIT_WAIT"); - #endif - } - - int metainterval = readConfig.stream_metaInterval(streamID); - if (native_fetch_stream_metaInterval(streamID) != metainterval) - { - if (!readConfig.read_stream_metaInterval(streamID)) - { - metainterval = gOptions.metaInterval(); - } - native_assign_stream_metaInterval(streamID, metainterval); - updated |= METAINTERVAL; - #if defined(_DEBUG) || defined(DEBUG) - ELOG("METAINTERVAL"); - #endif - } - - if (updated) - { - ILOG(LOGNAME "Updates applied to stream config# " + tos(streamID) + " [code: 0x" + tohex(updated) + "]"); - } - else - { - ILOG(LOGNAME "No updates required for stream config# " + tos(streamID)); - } - return updated; -} - -void config::addStreamConfig(config &readConfig, streamConfig add) throw(exception) -{ - if (!add.m_streamID) - { - return; - } - - stackLock sml(m_lock); - size_t streamID = add.m_streamID; - - native_assign_stream_ID(streamID, streamID); - native_assign_stream_adminPassword(streamID, add.m_adminPassword); - native_assign_stream_allowPublicRelay(streamID, add.m_allowPublicRelay); - native_assign_stream_allowRelay(streamID, add.m_allowRelay); - native_assign_stream_authHash(streamID, add.m_authHash); - native_assign_stream_password(streamID, add.m_password); - native_assign_stream_publicServer(streamID, add.m_publicServer); - native_assign_stream_maxBitrate(streamID, add.m_maxStreamBitrate); - native_assign_stream_minBitrate(streamID, add.m_minStreamBitrate); - native_assign_stream_maxUser(streamID, add.m_maxStreamUser); - native_assign_stream_relayURL(streamID, add.m_relayUrl.url()); - native_assign_stream_backupURL(streamID, add.m_backupUrl.url()); - native_assign_stream_path(streamID, add.m_urlPath); - - if (gOptions.w3cEnable()) - { - utf8 w3cLog = readConfig.stream_w3cLog(streamID); - if (readConfig.read_stream_w3cLog(streamID)) - { - if (gOptions.w3cEnable()) - { - w3cLog::open(w3cLog, streamID); - } - } - } - - if (gOptions.saveBanListOnExit()) - { - if (readConfig.read_stream_banFile(streamID) && !gOptions.stream_banFile(streamID).empty()) - { - g_banList.save(gOptions.stream_banFile(streamID),streamID); - } - } - - if (gOptions.saveRipListOnExit()) - { - if (readConfig.read_stream_ripFile(streamID) && !gOptions.stream_ripFile(streamID).empty()) - { - g_ripList.save(gOptions.stream_ripFile(streamID),streamID); - } - } - - if (gOptions.saveAgentListOnExit()) - { - if (readConfig.read_stream_agentFile(streamID) && !gOptions.stream_agentFile(streamID).empty()) - { - g_agentList.save(gOptions.stream_agentFile(streamID),streamID); - } - } - - ILOG(LOGNAME "Added stream config# " + tos(streamID)); -} - -void config::removeStreamConfig(streamConfig remove) throw(exception) -{ - if (!remove.m_streamID) - { - return; - } - - stackLock sml(m_lock); - size_t streamID = remove.m_streamID; - - // clean up the per-stream files - if (gOptions.w3cEnable()) - { - w3cLog::close(streamID); - } - - if (gOptions.saveBanListOnExit()) - { - if (gOptions.read_stream_banFile(streamID) && !gOptions.stream_banFile(streamID).empty()) - { - g_banList.save(gOptions.stream_banFile(streamID),streamID); - } - } - - if (gOptions.saveRipListOnExit()) - { - if (gOptions.read_stream_ripFile(streamID) && !gOptions.stream_ripFile(streamID).empty()) - { - g_ripList.save(gOptions.stream_ripFile(streamID),streamID); - } - } - - if (gOptions.saveAgentListOnExit()) - { - if (gOptions.read_stream_agentFile(streamID) && !gOptions.stream_agentFile(streamID).empty()) - { - g_agentList.save(gOptions.stream_agentFile(streamID),streamID); - } - } - - // now clear out where possible the per-stream values - gOptions.unread_stream_ID(streamID); - gOptions.unread_stream_adminPassword(streamID); - gOptions.unread_stream_agentFile(streamID); - gOptions.unread_stream_allowPublicRelay(streamID); - gOptions.unread_stream_allowRelay(streamID); - gOptions.unread_stream_authHash(streamID); - gOptions.unread_stream_autoDumpTime(streamID); - gOptions.unread_stream_autoDumpUsers(streamID); - gOptions.unread_stream_backupFile(streamID); - gOptions.unread_stream_backupTitle(streamID); - gOptions.unread_stream_backupLoop(streamID); - gOptions.unread_stream_banFile(streamID); - gOptions.unread_stream_introFile(streamID); - gOptions.unread_stream_listenerTime(streamID); - gOptions.unread_stream_maxBitrate(streamID); - gOptions.unread_stream_minBitrate(streamID); - gOptions.unread_stream_maxUser(streamID); - gOptions.unread_stream_password(streamID); - gOptions.unread_stream_path(streamID); - gOptions.unread_stream_publicServer(streamID); - gOptions.unread_stream_relayURL(streamID); - gOptions.unread_stream_backupURL(streamID); - gOptions.unread_stream_ripFile(streamID); - gOptions.unread_stream_ripOnly(streamID); - gOptions.unread_stream_agentFile(streamID); - gOptions.unread_stream_songHistory(streamID); - gOptions.unread_stream_uvoxCipherKey(streamID); - gOptions.unread_stream_w3cLog(streamID); - - gOptions.unread_cdn_master(streamID); - gOptions.unread_cdn_slave(streamID); - - map::iterator i = m_stream_ID.find(streamID); - if (i != m_stream_ID.end()) - { - m_stream_ID.erase(i); - } - - ILOG(LOGNAME "Removed stream config# " + tos(streamID)); -} - -config::~config() throw() -{ -} - -static void write_option(const utf8 &name, const utf8 &value, FILE *f, - const uniFile::filenameType &fn, bool &written) throw(exception) -{ - const char *delimiter = "="; - const size_t delimiter_size = 1; - size_t name_size = name.size(); - size_t value_size = value.size(); - size_t eol_size = eol().size(); - - if (written && (::fwrite(eol().c_str(), 1, eol_size, f) != eol_size)) - { - throw runtime_error("I/O error writing to file " + fn.hideAsString()); - } - if (::fwrite(name.c_str(), 1, name_size, f) != name_size) - { - throw runtime_error("I/O error writing to file " + fn.hideAsString()); - } - if (::fwrite(delimiter, 1, delimiter_size, f) != delimiter_size) - { - throw runtime_error("I/O error writing to file " + fn.hideAsString()); - } - if (::fwrite(value.c_str(), 1, value_size, f) != value_size) - { - throw runtime_error("I/O error writing to file " + fn.hideAsString()); - } - written = true; -} - -std::string config::logSectionName() -{ - return LOGNAME; -} - -bool config::rewriteConfigurationFile(bool minimal, bool messages, bool setup) const throw(exception) -{ - if (!cdn().empty()) - { - WLOG(LOGNAME "CDN mode prevents re-writing of the configuration file"); - return false; - } - - if (messages) - { - ILOG(LOGNAME "Rewriting config file"); - } - - stackLock sml(m_lock); - - // add any config options to be ignored when re-writing - set ignore_set; - ignore_set.insert("streamid"); - ignore_set.insert("include"); - ignore_set.insert("dstip"); - ignore_set.insert("yport"); - ignore_set.insert("showlastsongs"); - ignore_set.insert("streambitrate"); - ignore_set.insert("relayserver"); - ignore_set.insert("relayport"); - ignore_set.insert("reallogfile"); - ignore_set.insert("clacks"); - if (flashPolicyServerPort() == -1) - { - ignore_set.insert("flashpolicyserverport"); - } - if (portLegacy() == -1) - { - ignore_set.insert("portlegacy"); - } - if (publicPort() == -1) - { - ignore_set.insert("publicport"); - } - - bool saved = true; - FILE *f = 0; - try - { - uniFile::filenameType fn = _confFile(); - // create a backup of the current config file and then use that - if (fileUtil::fileExists(fn)) - { - uniFile::filenameType fn_backup(_confFile() + ".backup"); - uniFile::unlink(fn_backup); - #ifdef _WIN32 - if (!::MoveFileW(fn.toWString().c_str(), fn_backup.toWString().c_str())) - { - throw runtime_error("Cannot create backup of the current config file `" + - fn.hideAsString() + "' (" + errMessage().hideAsString() + ")"); - } - #else - if (::rename(fn.hideAsString().c_str(), fn_backup.hideAsString().c_str()) < 0) - { - throw runtime_error("Cannot create backup of the current config file `" + - fn.hideAsString() + "' (" + errMessage().hideAsString() + ")"); - } - #endif - } - - f = uniFile::fopen(fn,"wb"); - if (!f) - { - throw runtime_error("Cannot open config file `" + fn.hideAsString() + - "' for writing (" + errMessage().hideAsString() + ")"); - } - - map deferredOptions = m_deferredOptions; - bool written = false; - for (optMap_t::const_iterator i = m_optMap.begin(); i != m_optMap.end(); ++i) - { - const utf8 &optName = (*i).first; - const accessor_t &a = (*i).second; - - if (ignore_set.find(optName) != ignore_set.end()) - { - continue; - } - - map::iterator deferred_i = deferredOptions.find(optName); - if (deferred_i != deferredOptions.end()) - { - if (!minimal || (!((*deferred_i).second == (this->*a.m_defaultFunc)()))) - { - write_option(optName,(*deferred_i).second, f, fn, written); - } - deferredOptions.erase(deferred_i); - } - else - { - if ((this->*a.m_multiFunc)()) - { - const size_t num = (this->*a.m_countFunc)(); - for (size_t x = 0; x < num; ++x) - { - size_t index = 0; - if (!minimal || (!((this->*a.m_fetchFunc)(x, &index) == (this->*a.m_defaultFunc)()))) - { - write_option(optName + "_" + tos(index), (this->*a.m_fetchFunc)(index, 0), f, fn, written); - } - } - } - else - { - if (!minimal || (!((this->*a.m_fetchFunc)(1, 0) == (this->*a.m_defaultFunc)()))) - { - write_option(optName,(this->*a.m_fetchFunc)(1, 0), f, fn, written); - } - } - } - } - - // remaining deferred options - for (map::const_iterator i = deferredOptions.begin(); i != deferredOptions.end(); ++i) - { - if (ignore_set.find((*i).first) != ignore_set.end()) - { - continue; - } - - optMap_t::const_iterator m = m_optMap.find((*i).first); - const accessor_t &a = (*m).second; - - if (!minimal || (!((*i).second == (this->*a.m_defaultFunc)()))) - { - write_option((*i).first, (*i).second, f, fn, written); - } - } - deferredOptions.clear(); - - ::fclose(f); - } - catch(const exception &ex) - { - saved = false; - ELOG(utf8(setup ? "[SETUP] " : LOGNAME) + ex.what()); - if (f) - { - ::fclose(f); - } - } - return saved; -} - -utf8 config::dumpConfigFile() throw() -{ - utf8 streams, general, debug; - - stackLock sml(m_lock); - - // add any config options to be ignored when re-writing - set ignore_set; - ignore_set.insert("streamid"); - ignore_set.insert("include"); - ignore_set.insert("dstip"); - ignore_set.insert("yport"); - ignore_set.insert("showlastsongs"); - ignore_set.insert("streambitrate"); - ignore_set.insert("relayserver"); - ignore_set.insert("relayport"); - ignore_set.insert("reallogfile"); - if (flashPolicyServerPort() == -1) - { - ignore_set.insert("flashpolicyserverport"); - } - if (portLegacy() == -1) - { - ignore_set.insert("portlegacy"); - } - if (publicPort() == -1) - { - ignore_set.insert("publicport"); - } - - for (optMap_t::const_iterator i = m_optMap.begin(); i != m_optMap.end(); ++i) - { - const utf8 &optName = (*i).first; - const accessor_t &a = (*i).second; - - if (ignore_set.find(optName) != ignore_set.end()) - { - continue; - } - - if ((this->*a.m_multiFunc)()) - { - size_t num = (this->*a.m_countFunc)(); - for (size_t x = 0; x < num; ++x) - { - size_t index = 0; - if (!((this->*a.m_fetchFunc)(x, &index) == (this->*a.m_defaultFunc)())) - { - if (optName.find((utf8)"stream") == 0) - { - streams += optName + "_" + tos(index) + "=" + (this->*a.m_fetchFunc)(index, 0) + "
"; - } - else if (optName.find((utf8)"debug") != utf8::npos) - { - debug += optName + "_" + tos(index) + "=" + (this->*a.m_fetchFunc)(index, 0) + "
"; - } - else - { - general += optName + "_" + tos(index) + "=" + (this->*a.m_fetchFunc)(index, 0) + "
"; - } - } - } - } - else - { - if (!((this->*a.m_fetchFunc)(1, 0) == (this->*a.m_defaultFunc)())) - { - if (optName.find((utf8)"debug") != utf8::npos) - { - debug += optName + "=" + (this->*a.m_fetchFunc)(1, 0) + "
"; - } - else - { - general += optName + "=" + (this->*a.m_fetchFunc)(1, 0) + "
"; - } - } - } - } - - return "
" + - (!streams.empty() ? "
Stream Settings:

" : (utf8)"") + - streams + "
" + - (!general.empty() ? "
General Settings:

" : "") + - general + "
" + - (!debug.empty() ? "
Debugging Settings:

" : "") + - debug + "
"; -} - -int config::promptConfigFile() throw() -{ - if (!sDaemon) - { - #ifdef _WIN32 - vector fileList = fileUtil::directoryFileList(gStartupDirectory.toWString() + L"*.ini", L"", true, true); - vector fileListConf = fileUtil::directoryFileList(gStartupDirectory.toWString() + L"*.conf", L"", true, true); - #else - vector fileList = fileUtil::directoryFileList(gStartupDirectory.hideAsString() + "*.ini", ""); - vector fileListConf = fileUtil::directoryFileList(gStartupDirectory.hideAsString() + "*.conf", ""); - #endif - - if (!fileList.empty()) - { - #ifdef _WIN32 - // exclude desktop.ini on windows builds as that can cause other issues - for (vector::const_iterator i = fileList.begin(); i != fileList.end(); ++i) - { - if ((*i) == L".\\desktop.ini") - { - fileList.erase(i); - break; - } - } - #endif - fileList.insert(fileList.end(), fileListConf.begin(), fileListConf.end()); - } - else - { - fileList = fileListConf; - } - - if (!fileList.empty()) - { - ILOG(LOGNAME "Choose one of the listed config file(s) to load or"); - ILOG(LOGNAME "enter `s' to enable the setup mode for the DNAS or"); -#if CONFIG_BUILDER - ILOG(LOGNAME "enter `b' to enable the builder mode for the DNAS or"); -#endif - ILOG(LOGNAME "enter `x' to close this instance of the DNAS:"); - ILOG(LOGNAME "Note: Press `Enter' after choosing the config file."); - if (fileList.size() > 10) - { - ILOG(LOGNAME " Only the first 10 config files detected will be shown."); - } - - int option = 0; - if (fileList.size() > 10) - { - fileList.resize(10); - } - #ifdef _WIN32 - for (vector::const_iterator i = fileList.begin(); i != fileList.end(); ++i, option++) - #else - for (vector::const_iterator i = fileList.begin(); i != fileList.end(); ++i, option++) - #endif - { - #ifdef _WIN32 - utf32 u32file(*i); - utf8 u8f(u32file.toUtf8().substr(1 + u32file.rfind(utf32("\\")))); - ILOG(LOGNAME " [" + tos(option) + "] : " + u8f + (fileUtil::getSuffix(*i) == L"ini" ? " [1.x config file]" : "")); - #else - ILOG(LOGNAME " [" + tos(option) + "] : " + (*i).substr(1 + (*i).rfind("/")) + (fileUtil::getSuffix(*i) == "ini" ? " [1.x config file]" : "")); - #endif - } - - string input; - cin >> input; - - while ((!input.empty() && (input[0] != 'x') && (input[0] != 's') && (!isdigit(input[0]) || !((size_t)(input[0] - '0') < fileList.size())))) - { - ELOG(LOGNAME "You have entered an invalid option. Please enter a number matching the config file required."); - input.clear(); - cin >> input; - } - - if (input[0] == 'x') - { - return -2; - } - - if (input[0] == 's') - { - ILOG(LOGNAME "Entering setup mode. Open 127.0.0.1:8000/setup in a"); - ILOG(LOGNAME "browser on the same machine the DNAS is started on."); - return 2; - } -#ifdef CONFIG_BUILDER - if (input[0] == 'b') - { - ILOG(LOGNAME "Entering builder mode. Open 127.0.0.1:8000/builder in"); - ILOG(LOGNAME "a browser on the same machine the DNAS is started on."); - return 2; - } -#endif - if (!input.empty() && isdigit(input[0])) - { - size_t index = input[0] - '0'; - // clamped to 0 - 9 (fileList can be larger but input is only 0-9) - if (index < fileList.size()) - { - #ifdef _WIN32 - utf32 u32file(fileList[index]); - utf8 u8f(u32file.toUtf8().substr(2)); - return load(u8f); - #else - return load(fileList[index]); - #endif - } - } - } - else - { - return -1; - } - } - #ifndef _WIN32 - else - { - // if running as a daemon then make checks just for the default - // if we've not had a configuration file specified to be used. - vector fileList = fileUtil::directoryFileList(gStartupDirectory.hideAsString() + "sc_serv.ini", ""); - vector fileListConf = fileUtil::directoryFileList(gStartupDirectory.hideAsString() + "sc_serv.conf", ""); - - if (!fileList.empty()) - { - fileList.insert(fileList.end(), fileListConf.begin(), fileListConf.end()); - } - else - { - fileList = fileListConf; - } - - if (!fileList.empty()) - { - load(fileList[0]); - } - } - #endif - return 0; -} - -bool config::load(const uniFile::filenameType &filename, bool load) throw() -{ - stackLock sml(m_lock); - - // set the option that returns the name of the config file - m_confFile[DEFAULT_CLIENT_STREAM_ID] = filename; - - // only need to set the filename when creating a new file - if (!load) - { - return true; - } - - // check for 'setup' and abort config file loading -#ifdef CONFIG_BUILDER - if ((filename == "builder") || (filename == "setup")) -#else - if (filename == "setup") -#endif - { - return false; - } - - // setup the legacy relay config options to cope with reloads, etc - m_legacyRelayServer.clear(); - m_legacyRelayPort = ":80"; - - bool result = _load(filename, (utf8)"", true); - - // if the server hasn't been read then skip over this as it's - // likely there wasn't any legacy relay config options read - if (!m_legacyRelayServer.empty() && !(m_legacyRelayServer == "http://")) - { - // make sure that the old relay url is added by force setting streamid=1 - optMap_t::const_iterator i = m_optMap.find("streamid"); - (this->*((*i).second.m_assignFunc))(tos(DEFAULT_CLIENT_STREAM_ID), DEFAULT_CLIENT_STREAM_ID); - - utf8 legacyRelay = m_legacyRelayServer + m_legacyRelayPort; - i = m_optMap.find("streamrelayurl"); - (this->*((*i).second.m_assignFunc))(legacyRelay, DEFAULT_CLIENT_STREAM_ID); - } - - // use this to map the v2.0.0 value to that from 2.0.1+ - if (hideStats() == "1") - { - optMap_t::const_iterator i = m_optMap.find("hidestats"); - (this->*((*i).second.m_assignFunc))("stats", 0); - } - - // detect a failed attempt to load a config file and ensure we follow defaults on fail - if (m_log.empty()) - { - m_log[DEFAULT_CLIENT_STREAM_ID] = true; - } - if (result == true) - { - if (m_logFile.empty()) - { - m_log[DEFAULT_CLIENT_STREAM_ID] = true; - } - else if (m_logFile[DEFAULT_CLIENT_STREAM_ID].size() < 1) - { - m_log[DEFAULT_CLIENT_STREAM_ID] = false; - } - else if (compareStringsWithoutCase(m_logFile[0], uniFile::filenameType("none"))) - { - m_log[DEFAULT_CLIENT_STREAM_ID] = false; - } - else if (compareStringsWithoutCase(m_logFile[0], uniFile::filenameType("/dev/null"))) - { - m_log[DEFAULT_CLIENT_STREAM_ID] = false; - } - } - return result; -} - -// load options from a config file. Generally only done at startup. -// Config file should be in utf8 format -const bool config::_load(const uniFile::filenameType &filename, const utf8& uniqueStr, const bool parent = false) throw() -{ - const utf8 unique_matching_token("$"); - utf8 unique(unique_matching_token); - if (uniqueStr.empty()) - { - unique = unique_matching_token; - } - else - { - unique = uniqueStr; - } - - int l = 0; // line counter - bool loaded = true; - - // open it. Use the deferred messages since this happens at startup - FILE *conf = uniFile::fopen(filename, "rb"); - if (!conf) - { - loaded = false; - m_deferredWarnLogMessages.push_back(LOGNAME "Could not find `" + fileUtil::getFullFilePath(filename) + - (parent == true ? "' - looking for config file to load..." : "'")); - goto no_read_conf; - } - - // parse each line of the file - while (true) - { - int subIndex = DEFAULT_CLIENT_STREAM_ID; // for items of form xxxxxx_# (multi-options) - char buffer[4096] = {0}; - - if (!fgets(buffer, sizeof(buffer), conf)) - { - break; // get a line - } - - size_t offset = strlen(buffer) - 1; - while (buffer[offset] == '\n' || buffer[offset] == '\r') - { - buffer[offset]='\0'; // get rid of cr/lf - } - ++l; // increment line counter - - char *pbuffer = buffer; - while (pbuffer && (*pbuffer == ' ' || *pbuffer == '\t')) - { - ++pbuffer; // remove trailing whitespace - } - - if (!pbuffer || !*pbuffer || (*pbuffer == ';') || (*pbuffer == '[') || (*pbuffer == '#')) - { - continue; // blank lines or comments skipped - } - - char *tok = pbuffer; - while (pbuffer && *pbuffer && (*pbuffer != '=') && (*pbuffer != '\r')) - { - ++pbuffer; // look for = sign - } - if (!pbuffer || !*pbuffer) - { - m_deferredWarnLogMessages.push_back(LOGNAME "Invalid statement on line " + tos(l) + " of " + filename + " -> `" + utf8(buffer) + "'"); - continue; - } - *pbuffer++=0; - - // skip utf-8 BOM - if ((strlen(tok) > 2) && - (((unsigned char*)tok)[0] == 0xef) && - (((unsigned char*)tok)[1] == 0xbb) && - (((unsigned char*)tok)[2] == 0xbf)) - { - tok += 3; - } - - utf8 stok = tok; - // see if it's a multi option and set the subIndex value - const vector tokens = tokenizer(stok, '_'); - if (tokens.size() == 2) - { - stok = tokens[0]; - subIndex = atoi((const char *)stripWhitespace(tokens[1]).c_str()); - - // this ensure the subIndex has been specified even if there is no streamid - // this is to fix a load of config setup issues from people not setting it. - optMap_t::const_iterator sid = m_optMap.find("streamid"); - (this->*((*sid).second.m_assignFunc))(tos(subIndex), subIndex); - } - stok = stripWhitespace(stok); // cleanup some more whitespace just in case - - // look for the base option name in the option map - utf8 base_option_name = toLower(stok); - if (base_option_name.empty()) - { - // skip over empty values - continue; - } - - // used for mapping *autodumpsourcetime to *autodumptime - int autoDumpTime = 0; - if (base_option_name == "autodumpsourcetime") - { - base_option_name = "autodumptime"; - autoDumpTime = 1; - } - else if (base_option_name == "streamautodumpsourcetime") - { - base_option_name = "streamautodumptime"; - autoDumpTime = 2; - } - else if (base_option_name == "reallogfile" || - base_option_name == "autoauthhash") - { - // skip over as not pubiically exposed - continue; - } - - optMap_t::const_iterator i = m_optMap.find(base_option_name); - bool legacyRelay = false; - bool stream_bitrate = (base_option_name == "streambitrate"); - if (i == m_optMap.end()) - { - if (!((base_option_name == "relayserver") || (base_option_name == "relayport") || stream_bitrate)) - { - m_deferredWarnLogMessages.push_back(LOGNAME "Invalid item on line " + tos(l) + " of " + filename + " -> `" + base_option_name + "'"); - continue; - } - else - { - if (!stream_bitrate) - { - legacyRelay = true; - } - } - } - else - { - // do we have a stream* entry and no stream id mentioned / working against default - // if yes then force streamid=1 to be set so that the options will be recognised - uniString::utf8::size_type spos = base_option_name.find(utf8("stream")); - if ((spos != uniString::utf8::npos) && (spos == 0) && (subIndex == DEFAULT_CLIENT_STREAM_ID)) - { - // this ensure the subIndex has been specified even if there is no streamid - // this is to fix a load of config setup issues from people not setting it. - const optMap_t::const_iterator sid = m_optMap.find("streamid"); - (this->*((*sid).second.m_assignFunc))(tos(subIndex), subIndex); - } - } - - // move tok to the value - tok = pbuffer; - while (tok && *tok && *tok == ' ') - { - ++tok; - } - - utf8 value = stripWhitespace(utf8(tok)); - - // if we're re-mapping *autodumpsourcetime then indicate in the log output - if (autoDumpTime > 0) - { - m_deferredWarnLogMessages.push_back(LOGNAME "Deprecated statement found on line " + tos(l) + " of " + - filename + " -> change " + (autoDumpTime == 2 ? "stream" : "") + - "autodumpsourcetime_" + tos(subIndex) + "=" + value + " to " + - (autoDumpTime == 2 ? "stream" : "") + "autodumptime_" + - tos(subIndex) + "=" + value); - } - - // this is used in the mapping of the old ocnfig options to the new style streamrelayurl - if (legacyRelay == true) - { - if (base_option_name == "relayserver") - { - utf8::size_type check = (!value.empty() ? value.find(utf8("http://")) : 0); - if (check == utf8::npos) - { - m_legacyRelayServer = "http://" + value; - } - else - { - m_legacyRelayServer = value; - } - } - if (base_option_name == "relayport") - { - utf8::size_type check = value.find(utf8(":")); - if ((check == utf8::npos) || (check != 0)) - { - m_legacyRelayPort = ":" + value; - } - else - { - m_legacyRelayPort = value; - } - } - - continue; - } - - // check for yes / no values and map them to 1 or 0 to cope with legacy config loading - if ((base_option_name == "w3cenable") || - (base_option_name == "allowrelay") || - (base_option_name == "allowpublicrelay") || - (base_option_name == "riponly")) - { - if (toLower(value) == "yes") - { - value = "1"; - } - if (toLower(value) == "no") - { - value = "0"; - } - } - - // validation checks on the 'cdn' parameter to ensure we're all good else where - if (base_option_name == "cdn") - { - value = toLower(value); - if (!(value == "on") && !(value == "always") && !(value == "master")) - { - value = ""; - } - } - - if (stream_bitrate) - { - const optMap_t::const_iterator min = m_optMap.find("streamminbitrate"); - (this->*((*min).second.m_assignFunc))(value, subIndex); - const optMap_t::const_iterator max = m_optMap.find("streammaxbitrate"); - (this->*((*max).second.m_assignFunc))(value, subIndex); - continue; - } - - // validation checks on the port parameters to detect the 'any' - // case which is meant to be treated the same as an empty value - if ((base_option_name == "srcdns") || - (base_option_name == "srcip") || - (base_option_name == "destdns") || - (base_option_name == "destip") || - (base_option_name == "dstip") || - (base_option_name == "publicdns") || - (base_option_name == "publicip")) - { - if (toLower(value) == "any") - { - value = ""; - } - } - - // check for streampath values and fix to have / on the start to ensure it will - // work for client connections without impacting on client connection time, etc - if (base_option_name == "streampath") - { - utf8::size_type path = value.find(utf8(":")); - if (path != utf8::npos) - { - m_deferredWarnLogMessages.push_back(LOGNAME "Ignoring streampath_" + tos(subIndex) + "=" + value + " as this will produce an invalid path."); - value.clear(); - continue; - } - - path = value.find(utf8("var/www")); - // catches var/www... or /var/www... style paths - // which are best just filtered as it gives away - // paths on the host machine which looks crappy! - if ((path != utf8::npos) && (path < 2)) - { - m_deferredWarnLogMessages.push_back(LOGNAME "Ignoring streampath_" + tos(subIndex) + "=" + value + " as this will produce an invalid path."); - value.clear(); - continue; - } - - // check for empty as we can incorrectly end up - // setting streampath_xx=/ which causes issues! - if (!value.empty()) - { - path = value.find(utf8("/")); - if ((path == utf8::npos) || (path != 0)) - { - value = "/" + value; - } - } - - // additionally we check for specific 'default' paths and block their usage - // based on a match against the start of the streampath (might block some - // possibly valid streampaths but it'll avoid stupid configuration issues). - const char * disallowed[] = { "/listen.pls", "/listen.m3u", "/listen.asx", "/listen.xspf", - "/listen.qtl", "/listen", "/7.html", "/index.html", - "/played", "/played.html", "/admin.cgi", "/statistics", - "/stats", "/streamart", "/playingart", "/nextsong", "/home", - "/home.html", "/nextsongs", "/currentsong", "/shoutcast.swf", - "/crossdomain.xml", "/index.css", "/images/", "/favicon.ico", - "/robots.txt", "/images/favicon.ico", "/images/listen.png", - "/images/history.png", "/images/lock.png", "/images/noadavail.png", - "/images/streamart.png", "/images/adavail.png", "/images/v2.png", - "/images/playingart.png", "/adplayed/adplayed.png", "/images/v1.png", - "/images/relay.png", "/images/wa.png", "/images/chrome.png", - "/images/firefox.png", "/images/safari.png", "/images/ie.png", - "/images/vlc.png", "/images/fb2k.png", "/images/wmp.png", - "/images/icecast.png", "/images/html5.png", "/images/rtb.png", - "/images/ps.png", "/images/mplayer.png", "/images/apple.png", - "/images/roku.png", "/images/itunes.png", "/images/warn.png", - "/images/xff.png", "/images/radionomy.png", "/images/curl.png", - "/images/flash.png", "/images/synology.png", "/images/wiimc.png" - }; - for (size_t x = 0; x < sizeof(disallowed) / sizeof(disallowed[0]); x++) - { - path = value.find(utf8(disallowed[x])); - if ((path != utf8::npos) && !path) - { - m_deferredWarnLogMessages.push_back(LOGNAME "Ignoring streampath_" + tos(subIndex) + "=" + value + " as this contains a reserved path."); - value.clear(); - continue; - } - } - } - - // check for redirecturl and streamredirecturl and ensure there is a http:// - // otherwise we need to process multiple times on page hits which isn't good - if ((base_option_name == "redirecturl" || base_option_name == "streamredirecturl") && !value.empty()) - { - utf8::size_type url = (!value.empty() ? value.find(utf8("http://")) : 0); - if (url == utf8::npos) - { - value = "http://" + value; - } - } - - // check the passwords for validity e.g. they're not allowed to contain a colon - // as that can break the multiple-1.x source support as well as 2.x source join - if (base_option_name == "password" || base_option_name == "streampassword" || - base_option_name == "adminpassword" || base_option_name == "streamadminpassword") - { - if (value.find(utf8(":")) != utf8::npos) - { - m_deferredErrorLogMessages.push_back(LOGNAME "`" + base_option_name + - (subIndex > 1 ? "_" + tos(subIndex) : "") + - "' contains a reserved character and will be ignored. " - "Please remove all colons to resolve this issue."); - value.clear(); - continue; - } - } - - // special case to mimic old sc_serv conf file behaviour. In old sc_serv, the conf variable "unique" can - // be subsituted for $ in any value related to a filename - if (base_option_name == "unique") - { - unique = value; - } - - if ((base_option_name == "logfile") || - (base_option_name == "adtestfile") || - (base_option_name == "adtestfile2") || - (base_option_name == "adtestfile3") || - (base_option_name == "adtestfile4") || - (base_option_name == "streamadtestfile") || - (base_option_name == "streamadtestfile2") || - (base_option_name == "streamadtestfile3") || - (base_option_name == "streamadtestfile4") || - (base_option_name == "introfile") || - (base_option_name == "streamintrofile") || - (base_option_name == "backupfile") || - (base_option_name == "streambackupfile") || - (base_option_name == "banfile") || - (base_option_name == "streambanfile") || - (base_option_name == "ripfile") || - (base_option_name == "streamripfile") || - (base_option_name == "agentfile") || - (base_option_name == "artworkfile") || - (base_option_name == "streamagentfile") || - (base_option_name == "streamartworkfile") || - (base_option_name == "include") || - (base_option_name == "w3clog") || - (base_option_name == "streamw3clog") || - (base_option_name == "portbase")) - { - if (unique != unique_matching_token) - { - utf8::size_type pos = value.find(unique_matching_token); - while (pos != utf8::npos) - { - value.replace(pos, 1, unique); - pos = value.find(unique_matching_token); - } - } - - // attempt to convert \ to / and vice versa as needed for cross-platform sharing of configuration files - fileUtil::convertOSFilePathDelimiter(value); - } - - if (base_option_name == "include") - { - // get the current folder so we can load from include=common.conf if using full paths, etc - uniFile::filenameType currentPath = fileUtil::onlyPath(filename); - - // this will handle wildcard matching as applicable to what has been set in the 'include' - // value so will allow us to have individual configs via 'include=./stream/stream_*.conf' - #ifdef _WIN32 - vector fileList = fileUtil::directoryFileList(value.toWString(), currentPath.toWString(), true, true); - #else - vector fileList = fileUtil::directoryFileList(value.hideAsString(), currentPath.hideAsString()); - #endif - if (!fileList.empty()) - { - #ifdef _WIN32 - for (vector::const_iterator i = fileList.begin(); i != fileList.end(); ++i) - #else - for (vector::const_iterator i = fileList.begin(); i != fileList.end(); ++i) - #endif - { - #ifdef _WIN32 - utf32 u32file(*i); - utf8 u8f(u32file.toUtf8()); - _load(u8f, unique); - #else - _load(*i, unique); - #endif - } - } - } - else - { - (this->*((*i).second.m_assignFunc))(value, subIndex); - } - } - - // close the config file - ::fclose(conf); - -no_read_conf: - return loaded; -} - -bool config::editConfigFileEntry(size_t sid, const uniFile::filenameType &filename, - const uniString::utf8 &authhash, - const uniString::utf8 ¶m, const bool add, - bool &handled, bool &idHandled, - const bool parent = false) throw() -{ - bool loaded = true; - FILE *conf = NULL, *newconf = NULL; - char buffer[4096] = {0}; - char copyBuffer[4096] = {0}; - char *pbuffer = buffer; - int l = 0; // line counter - - // create a backup of the current config file and then use that - uniFile::filenameType fn(filename + ".backup"); - uniFile::unlink(fn); - #ifdef _WIN32 - if (!::MoveFileW(filename.toWString().c_str(), fn.toWString().c_str())) - #else - if (::rename(filename.hideAsString().c_str(), fn.hideAsString().c_str())) - #endif - { - loaded = false; - ELOG(LOGNAME "Could not backup original file `" + filename + "'"); - goto no_write_conf; - } - - conf = uniFile::fopen(filename+".backup","rb"); - if (!conf) - { - loaded = false; - ELOG(LOGNAME "Could not open `" + filename + "'(" + errMessage().hideAsString() + ")"); - goto no_write_conf; - } - - newconf = uniFile::fopen(filename,"wb"); - if (!newconf) - { - loaded = false; - ELOG(LOGNAME "Could not open `" + filename+".backup' (" + errMessage().hideAsString() + ")"); - goto no_write_conf; - } - - // parse each line of the file - while (true) - { - size_t subIndex = DEFAULT_CLIENT_STREAM_ID; // for items of form xxxxxx_# (multi-options) - - if (!fgets(buffer, sizeof(buffer), conf)) - { - break; // get a line - } - memcpy(copyBuffer, buffer, sizeof(copyBuffer)); - - size_t offset = strlen(buffer)-1; - while (buffer[offset]=='\n' || buffer[offset]=='\r') - { - buffer[offset]='\0'; // get rid of cr/lf - } - ++l; // increment line counter - - pbuffer = buffer; - while (pbuffer && (*pbuffer == ' ' || *pbuffer == '\t')) - { - ++pbuffer; // remove trailing whitespace - } - - if (!pbuffer || !*pbuffer || *pbuffer == ';' || *pbuffer == '[' || *pbuffer == '#') - { - fwrite(copyBuffer,1,strlen(copyBuffer),newconf); - continue; // blank lines or comments skipped - } - - char *tok = pbuffer; - while (pbuffer && *pbuffer && *pbuffer != '=' && *pbuffer != '\r') - { - ++pbuffer; // look for = sign - } - if (!pbuffer || !*pbuffer) - { - fwrite(copyBuffer,1,strlen(copyBuffer),newconf); - continue; - } - *pbuffer++=0; - - // skip utf-8 BOM - if ((strlen(tok) > 2) && - (((unsigned char*)tok)[0] == 0xef) && - (((unsigned char*)tok)[1] == 0xbb) && - (((unsigned char*)tok)[2] == 0xbf)) - { - tok += 3; - } - - utf8 stok = tok; - // see if it's a multi option and set the subIndex value - const vector tokens = tokenizer(stok, '_'); - if (tokens.size() == 2) - { - stok = tokens[0]; - subIndex = atoi((const char *)stripWhitespace(tokens[1]).c_str()); - } - stok = stripWhitespace(stok); // cleanup some more whitespace just in case - - // look for the base option name in the option map - utf8 base_option_name = toLower(stok); - optMap_t::const_iterator i = m_optMap.find(base_option_name); - if (i == m_optMap.end()) - { - fwrite(copyBuffer,1,strlen(copyBuffer),newconf); - continue; - } - - // move tok to the value - tok = pbuffer; - while (tok && *tok && *tok == ' ') - { - ++tok; - } - - utf8 value = stripWhitespace(utf8(tok)); - - // this will attempt to check if streamid is present, otherwise we need to add otherwise - // when the DNAS is restarted then it will not find the authhash despite being in there - if (base_option_name == "streamid" && subIndex == sid && add == true) - { - idHandled = true; - } - - // this will attempt to update a dummy entry in the config or remove depending on the mode - if (base_option_name == "streamauthhash" && subIndex == sid) - { - // attempt to match the line breaks already in the file so it's consistent - if (add == true) - { - // default to the current platforms encoding so it'll at least have a line break - utf8 readEol = eol(); - if (copyBuffer[0]) - { - // determine if just \n or \r\n - size_t offset = strlen(copyBuffer)-1; - if (copyBuffer[offset] == '\n') - { - if (copyBuffer[offset-1] == '\r') - { - readEol = "\r\n"; - } - else - { - readEol = "\n"; - } - } - else if (copyBuffer[offset] == '\r') - { - readEol = "\r"; - } - } - - uniString::utf8 newEntry("streamauthhash_"+tos(sid)+"="+authhash+readEol); - fwrite(newEntry.c_str(),1,newEntry.size(),newconf); - } - handled = true; - } - // this will attempt to update a dummy entry in the config or remove depending on the mode - else if (base_option_name == authhash && !sid) - { - // attempt to match the line breaks already in the file so it's consistent - if (add == true) - { - // default to the current platforms encoding so it'll at least have a line break - utf8 readEol = eol(); - if (copyBuffer[0]) - { - // determine if just \n or \r\n - size_t offset = strlen(copyBuffer)-1; - if (copyBuffer[offset] == '\n') - { - if (copyBuffer[offset-1] == '\r') - { - readEol = "\r\n"; - } - else - { - readEol = "\n"; - } - } - else if (copyBuffer[offset] == '\r') - { - readEol = "\r"; - } - } - - if (param == "1") - { - uniString::utf8 newEntry(authhash+"="+param+eol()); - fwrite(newEntry.c_str(),1,newEntry.size(),newconf); - } - } - handled = true; - } - else - { - fwrite(copyBuffer,1,strlen(copyBuffer),newconf); - } - - if (base_option_name == "include") - { - // get the current folder so we can load from include=common.conf if using full paths, etc - uniFile::filenameType currentPath = fileUtil::onlyPath(filename); - - // this will handle wildcard matching as applicable to what has been set in the 'include' - // value so will allow us to have individual configs via 'include=./stream/stream_*.conf' - #ifdef _WIN32 - vector fileList = fileUtil::directoryFileList(value.toWString(), currentPath.toWString(), true, true); - #else - vector fileList = fileUtil::directoryFileList(value.hideAsString(), currentPath.hideAsString()); - #endif - if (!fileList.empty()) - { - #ifdef _WIN32 - for (vector::const_iterator i = fileList.begin(); i != fileList.end(); ++i) - #else - for (vector::const_iterator i = fileList.begin(); i != fileList.end(); ++i) - #endif - { - #ifdef _WIN32 - utf32 u32file(*i); - utf8 u8f(u32file.toUtf8()); - editConfigFileEntry(sid, u8f, authhash, param, add, handled, idHandled); - #else - editConfigFileEntry(sid, *i, authhash, param, add, handled, idHandled); - #endif - } - } - } - } - - // only save back to the first config file if nothing was done in any included files - if (parent == true && add == true && (handled == false || idHandled == false)) - { - if (sid && idHandled == false) - { - // look at and append a newline if there isn't one already at the config's eof - if (copyBuffer[0]) - { - size_t len = strlen(copyBuffer)-1; - if (copyBuffer[len] != '\r' && copyBuffer[len] != '\n') - { - fwrite(eol().c_str(),1,eol().size(),newconf); - } - } - idHandled = true; - } - - if (sid && handled == false) - { - // look at and append a newline if there isn't one already at the config's eof - if (copyBuffer[0]) - { - size_t len = strlen(copyBuffer)-1; - if (copyBuffer[len] != '\r' && copyBuffer[len] != '\n') - { - fwrite(eol().c_str(),1,eol().size(),newconf); - } - } - uniString::utf8 newEntry("streamauthhash_"+tos(sid)+"="+authhash+eol()); - fwrite(newEntry.c_str(),1,newEntry.size(),newconf); - handled = true; - } - - // for anything else, if it's at the default then no need to add, just remove it - if (!sid && handled == false && (param == "1")) - { - // look at and append a newline if there isn't one already at the config's eof - if (copyBuffer[0]) - { - size_t len = strlen(copyBuffer)-1; - if (copyBuffer[len] != '\r' && copyBuffer[len] != '\n') - { - fwrite(eol().c_str(),1,eol().size(),newconf); - } - } - uniString::utf8 newEntry(authhash+"="+param+eol()); - fwrite(newEntry.c_str(),1,newEntry.size(),newconf); - handled = true; - } - } - - // close the config file - ::fclose(conf); - ::fclose(newconf); - -no_write_conf: - return loaded; -} - -///////////////////////////////////////////////// -///// service template interface methods //////// -///////////////////////////////////////////////// - -const vector config::fromArgs(const vector &cl) throw() -{ - vector result; - // only attempt to load a passed configuration file otherwise beforehand - // this would cause sc_serv to load and appear to do nothing so make sure - // that we let the defaults stay in effect so it will do work correctly - if (!cl.empty()) - { - load(cl.front()); - vector::const_iterator i = cl.begin(); - ++i; - while (i != cl.end()) - { - result.push_back(*(i++)); - } - } - - #ifdef _WIN32 - if (_logFile() == DEFAULT_LOG) - { - // this will fill in the default log path as required - wchar_t m_fileName[MAX_PATH] = {0}; - ExpandEnvironmentStringsW(DEFAULT_LOGW, m_fileName, MAX_PATH); - assign_logFile(utf32(m_fileName).toUtf8(), DEFAULT_CLIENT_STREAM_ID); - } - #endif - - return result; -} - -bool config::getConsoleLogging() const throw() -{ - stackLock sml(m_lock); - return (!sDaemon ? _screenLog() && _log() : false); -} - -const uniFile::filenameType config::getFileLog() const throw() -{ - stackLock sml(m_lock); - - static const uniFile::filenameType empty; - return (_log() ? _logFile() : empty); -} - -#ifdef _WIN32 -utf8 config::getSystemLogConfigString() throw() { return AOL_logger::systemLogger_element::panicConfiguration(); } -#else -utf8 config::getSystemLogConfigString() throw() { return "";} -#endif - -utf8 config::getVersionBuildStrings() throw() -{ - static utf8 version = ""; - if (version.empty()) - { -#ifdef _WIN32 - getVersionInfo(version); -#else - for (int x = 0; x < VENT; ++x) - { - if (x) - { - version += "."; - } - version += tos(PRODUCTVERSION[x]); - } -#endif -#ifdef LICENCE_FREE - version += " no-licence-check"; -#endif - } - return version; -} - -utf8 config::streamConfig::urlObj::parse(const utf8 &in_url, utf8 &out_server, u_short &out_port, utf8 &out_path) throw(exception) -{ - utf8 url(in_url); - - // quick out - if (in_url.empty()) - { - out_server.clear(); - out_port = 0; - out_path.clear(); - return in_url; - } - ///////////// - - utf8 server; - utf8 path("/"); - u_short port = 80; - - if (url.empty()) - { - throwEx(LOGNAME "Parse error in url (" + url + ")"); - } - - url = stripHTTPprefix(url); - - utf8::size_type pos = url.find(utf8(":")), - pos2 = url.find(utf8("/")); - - if ((pos != utf8::npos) && ((pos2 == utf8::npos) || (pos < pos2))) - { - // port - server = url.substr(0, pos); - url.erase(0,pos + 1); - pos2 = url.find(utf8("/")); - port = utf8(url.substr(0, pos2)).toInt(); - url.erase(0,pos2); - } - else - { - server = url.substr(0,pos2); - url.erase(0,pos2); - } - - if (!url.empty()) - { - path = url; - } - out_server = server; - out_port = port; - out_path = path; - return in_url; -} - -uniString::utf8 config::getCrossDomainFile(const bool compressed) throw() -{ - if (m_crossdomainStr.empty()) - { - utf8 body = loadLocalFile(fileUtil::getFullFilePath(flashPolicyFile())); - if (body.empty()) - { - utf8 ports = tos(portBase()); - if (g_legacyPort >= 1 && g_legacyPort <= 65535) - { - ports += "," + tos(g_legacyPort); - } - if (!m_usedAlternatePorts.empty()) - { - ports += m_usedAlternatePorts; - } - - body = "\n\n" - "\n" - "\n" - "\n" - ""; - } - - m_crossdomainStrGZ = m_crossdomainStr = body; - - if (!compressData(m_crossdomainStrGZ)) - { - m_crossdomainStrGZ.clear(); - } - } - - // default to returning the non-compressed version - return (compressed ? (!m_crossdomainStrGZ.empty() ? m_crossdomainStrGZ : m_crossdomainStr) : m_crossdomainStr); -} - -uniString::utf8 config::getShoutcastSWF(const bool compressed) throw() -{ - if (m_shoutcastSWFStr.empty()) - { - utf8 body = loadLocalFile(gStartupDirectory + "shoutcast.swf"); - if (body.empty()) - { - body = MSG_HTTP404; - } - - m_shoutcastSWFStrGZ = m_shoutcastSWFStr = body; - - if (!compressData(m_shoutcastSWFStrGZ)) - { - m_shoutcastSWFStrGZ.clear(); - } - } - - // default to returning the non-compressed version - return (compressed ? (!m_shoutcastSWFStrGZ.empty() ? m_shoutcastSWFStrGZ : m_shoutcastSWFStr) : m_shoutcastSWFStr); -} - -uniString::utf8 config::getIndexCSS(const bool compressed) throw() -{ - if (m_styleCustomStr.empty()) - { - utf8 body = loadLocalFile(fileUtil::getFullFilePath(adminCSSFile())); - if (!body.empty()) - { - m_styleCustomStrGZ = m_styleCustomStr = body; - - if (!compressData(m_styleCustomStrGZ)) - { - m_styleCustomStrGZ.clear(); - } - } - } - - // default to returning the non-compressed version - return (compressed ? (!m_styleCustomStrGZ.empty() ? m_styleCustomStrGZ : m_styleCustomStr) : m_styleCustomStr); -} - -const uniString::utf8 config::getStreamHideStats(const size_t streamID) const -{ - if (!streamID) - { - return hideStats(); - } - else - { - uniString::utf8 hide = stream_hideStats(streamID); - if (!read_stream_hideStats(streamID) || hide.empty()) - { - hide = hideStats(); - } - return hide; - } -} - -const uniString::utf8 config::getStreamRedirectURL(const size_t streamID, const bool isStats, - const bool homeSet, const bool compress, - const bool force) const throw() -{ - utf8 url; - // check if hiding of public pages is enabled with some - // specific handling as required for 'all' or 'stats'. - bool all = (getStreamHideStats(streamID) == "all"), - //none = !(getStreamHideStats(streamID) == "none"), - stats = ((getStreamHideStats(streamID) == "stats") && isStats); - - if (all || stats || force) - { - // if no streamid then look at global redirect option only - if (!streamID) - { - // if not set then we look at the streamurl from source - // and if that is not valid then and return a 403 error - if (!redirectUrl().empty()) - { - url = redirect(redirectUrl(), compress); - } - else - { - // but we check if it's for a stats only hide on a - // stats method and then redirect to /index.html - if (stats && !force) - { - url = redirect("index.html", compress); - } - else - { - url = MSG_HTTP403; - } - } - } - else - { - // look for a stream specific - utf8 surl = stream_redirectUrl(streamID); - if (!read_stream_redirectUrl(streamID) || surl.empty()) - { - // see if it's a stats page and redirect to /index.html - if (stats && !force) - { - url = redirect("index.html", compress); - } - else - { - // otherwise attempt to use the streamurl (if available) - if (homeSet && !force) - { - url = redirect("home.html?sid="+tos(streamID), compress); - } - else - { - // and if not then try the global redirect - if (!redirectUrl().empty()) - { - url = redirect(redirectUrl(), compress); - } - // before reverting to a 403 error - else - { - url = MSG_HTTP403; - } - } - } - } - else - { - url = redirect(surl, compress); - } - } - } - - return url; -} - -void config::setOption(uniString::utf8 key, uniString::utf8 value) throw(exception) -{ - stackLock sml(m_lock); - - size_t subIndex = DEFAULT_CLIENT_STREAM_ID; // for items of form xxxxxx_# (multi-options) - uniString::utf8 stok = key; - - // see if it's a multi option and set the subIndex value - const vector tokens = tokenizer(stok, '_'); - if (tokens.size() == 2) - { - stok = tokens[0]; - subIndex = atoi((const char *)stripWhitespace(tokens[1]).c_str()); - } - stok = stringUtil::stripWhitespace(stok); // cleanup some more whitespace just in case - - // look for the base option name in the option map - uniString::utf8 base_option_name = stringUtil::toLower(stok); - - std::map::const_iterator mi = m_optMap.find(base_option_name); - if (mi == m_optMap.end()) - { - throw std::runtime_error("Unknown option " + base_option_name.hideAsString()); - } - - // first see if the value has changed. If not then we don't worry about it - if ((this->*(*mi).second.m_fetchFunc)(subIndex, 0) != value) - { - if ((base_option_name == "log") || (base_option_name == "screenlog")) - { - m_deferredOptions[base_option_name] = value; - } - else - { - // tweak things as needed with checking the type so we can use the sid or not - (this->*(*mi).second.m_assignFunc)(value, subIndex); - } - } -} diff --git a/Src/Plugins/DSP/sc_serv3/config.h b/Src/Plugins/DSP/sc_serv3/config.h deleted file mode 100644 index ab2bc095..00000000 --- a/Src/Plugins/DSP/sc_serv3/config.h +++ /dev/null @@ -1,710 +0,0 @@ -#pragma once -#ifndef config_H_ -#define config_H_ - -#include -#include -#include -#include -#include -#include -#include "unicode/uniFile.h" -#include "stl/stringUtils.h" -#include "threading/thread.h" -#include "metrics.h" - -#define DEFAULT_SOURCE_STREAM 1 -#define DEFAULT_CLIENT_STREAM_ID 1 -#define DEFAULT_YP_ADDRESS "yp.shoutcast.com" - -#ifdef _WIN32 -#define DEFAULT_LOG "%temp%\\sc_serv.log" -#define DEFAULT_LOGW L"%temp%\\sc_serv.log" -#else -#define DEFAULT_LOG "/tmp/sc_serv.log" -#endif -#define DEFAULT_FLASH_POLICY_FILE "crossdomain.xml" - -/* - -Each option has a map associated with a member. Let's take an option called foobar - - std::map m_foobar; - -For single options (non-multi options) the map only has a single element. We use a map -so we can treat all options, multi or not, in the same fashion - -The value of the option is assigned via the assign_ method. subIndex is only used -for multi options (zero based). The value is always passed as a string and is converted -automatically internally - - inline void assign_foobar(int subIndex,const uniString::utf8 &value) - -The value of the option is retrieved as a string via the fetch_ method. The value -is fetched as a native type via native_fetch_ method. subIndex is used to select a -particular entry in a multi option. It's ignored for regular options - - uniString::utf8 fetch_foobar(int subIndex) - int native_fetch_foobar(int subIndex) - -A shorthand is provided via the _ method. It returns the same value as native_fetch_ - - const int _foobar() - -The number of elements for the option is returned by the count_ method. For single options -this is always one - - size_t count_foobar() - -The multi_ method returns true if the option is a multi option - - bool multi_foobar() - -The def_ method returns the default value for the option as a string - - utf8 def_foobar() - -All the proceeding options are private, and not protected by a mutex. -There are two public methods for accessing methods that provide mutex -protection. The value of the options is () and the default value -is provided by _Default() - - const int foobar() - const int foobar_Default() - -All of this is created automatically via the OPT and OPT_MULTI macros below - - -In the optMap table we associated all these functions with the actual name of the option -as it appears in the config file. In addition there is a change function associated with -each option that is fired when the option is changed. -*/ - -///////////////////////////////////////////////////////////////////////////////////// -///////// crazy macros to provide uniform assign/fetch functions for each option - -/* - Create a single option of type "tipe" with the name "name" and a default value of "def" -*/ -#define OPT(tipe,name,def)\ -private:\ -std::map m_##name;\ -inline void assign_##name(const uniString::utf8 &value, const size_t subIndex = DEFAULT_CLIENT_STREAM_ID) throw() { assignMulti(m_##name, subIndex, value); }\ -uniString::utf8 fetch_##name(const size_t subIndex = DEFAULT_CLIENT_STREAM_ID, size_t *fetchByPos = 0) const throw() { return revert(fetchMulti(m_##name, subIndex, def, fetchByPos)); }\ -tipe native_fetch_##name(const size_t subIndex = DEFAULT_CLIENT_STREAM_ID, size_t *fetchByPos = 0) const throw() { return fetchMulti(m_##name, subIndex, def, fetchByPos); }\ -const tipe _##name() const throw() { return fetchMulti(m_##name, DEFAULT_CLIENT_STREAM_ID, def, 0); }\ -size_t count_##name() const throw() { return 1; }\ -bool multi_##name() const throw() { return false; }\ -uniString::utf8 def_##name() const throw() { return revert(def); }\ -public:\ -const tipe name() const throw() { return fetchMulti(m_##name, DEFAULT_CLIENT_STREAM_ID, def, 0); }\ -const tipe name##_Default() const throw() { return def; } - -// for options that can have multiple instances (like encoders and broadcast points) -/* - The option has the type "tipe" with the name "name" and a default value of "def" -*/ -#define OPT_MULTI(tipe,name,def)\ -private:\ -std::map m_##name;\ -inline void assign_##name(const uniString::utf8 &value, const size_t subIndex) throw() { assignMulti(m_##name, subIndex, value); }\ -inline void native_assign_##name(const size_t subIndex, const tipe &value) throw() { native_assignMulti(m_##name, subIndex, value); }\ -uniString::utf8 fetch_##name(const size_t subIndex, size_t *fetchByPos = 0) const throw() { return revert(fetchMulti(m_##name, subIndex, def, fetchByPos)); }\ -tipe native_fetch_##name(const size_t subIndex) const throw() { return fetchMulti(m_##name, subIndex, def, 0); }\ -const tipe _##name(const std::vector::size_type i) const throw() { return fetchMulti(m_##name, i, def, 0); }\ -bool multi_##name() const throw() { return true; }\ -uniString::utf8 def_##name() const throw() { return revert(def); }\ -public:\ -const bool read_##name(const size_t subIndex) const throw() { return (m_##name.find(subIndex) != m_##name.end()); }\ -void unread_##name(const size_t subIndex) { native_assignMulti(m_##name, subIndex, name##_Default()); }\ -const tipe name(const size_t subIndex) const throw() { return fetchMulti(m_##name, subIndex, def, 0); }\ -size_t count_##name() const throw() { return m_##name.size(); }\ -const std::map& name##_map() const { return m_##name; } \ -const tipe name##_Default() const throw() { return def; } - -////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////////////// - -// global configuration -class config -{ -public: - // stream specifications from config file. -#pragma pack(push, 1) - struct streamConfig - { -#pragma pack(push, 1) - class urlObj - { - private: - uniString::utf8 m_url; - uniString::utf8 m_server; - uniString::utf8 m_path; - u_short m_port; - - static uniString::utf8 parse(const uniString::utf8 &url, uniString::utf8 &server, - u_short &port, uniString::utf8 &path) throw(std::exception); - - public: - explicit urlObj(const uniString::utf8 &url) throw(std::exception) - { - if (!url.empty()) - { - set(url); - } - else - { - clear(); - } - } - urlObj& operator=(const uniString::utf8 &url) throw(std::exception) - { - set(url); - return *this; - } - const uniString::utf8 &url() const throw() { return m_url; } - const uniString::utf8 &server() const throw() { return m_server; } - const uniString::utf8 &path() const throw() { return m_path; } - const u_short port() const throw() { return m_port; } - bool isSet() const throw() { return !m_url.empty(); } - void set(const uniString::utf8 &url) throw(std::exception) - { - m_url = parse(url, m_server, m_port, m_path); - } - void clear() throw() - { - m_url.clear(); - m_port = 0; - } - }; -#pragma pack(pop) - - uniString::utf8 m_authHash; - uniString::utf8 m_urlPath; // url that clients use to connect - uniString::utf8 m_adminPassword; // per stream admin password - uniString::utf8 m_password; // per stream source password - uniString::utf8 m_publicServer; // per stream source public flag - size_t m_streamID; - int m_maxStreamUser; // per stream user limit - int m_maxStreamBitrate; // per stream max bitrate limit - int m_minStreamBitrate; // per stream min bitrate limit - urlObj m_relayUrl; // if this is a relay, then this is set to the source url - urlObj m_backupUrl; // if there is a backup, then this is set to the backup url - bool m_allowRelay; // per stream relay allowed flag - bool m_allowPublicRelay; // per stream relay public flag - - streamConfig() throw() : m_streamID(DEFAULT_CLIENT_STREAM_ID), m_maxStreamUser(0), - m_maxStreamBitrate(0), m_minStreamBitrate(0), - m_relayUrl((uniString::utf8)""), m_backupUrl((uniString::utf8)""), - m_allowRelay(true), m_allowPublicRelay(true) {} - - streamConfig(const size_t id, const uniString::utf8 &authHash, const uniString::utf8 &url, - const uniString::utf8 &relayUrl, const uniString::utf8 &backupUrl, - const int maxStreamUser, const int maxStreamBitrate, const int minStreamBitrate, - const uniString::utf8 &adminPassword, const uniString::utf8 &password, - const uniString::utf8 &publicServer, const bool allowRelay, - const bool allowPublicRelay) throw(std::exception) - : m_authHash(authHash), m_urlPath(url), m_adminPassword(adminPassword), m_password(password), - m_publicServer(publicServer), m_streamID(id), m_maxStreamUser(maxStreamUser), - m_maxStreamBitrate(maxStreamBitrate), m_minStreamBitrate(minStreamBitrate), m_relayUrl(relayUrl), - m_backupUrl(backupUrl), m_allowRelay(allowRelay), m_allowPublicRelay(allowPublicRelay) {} - }; -#pragma pack(pop) - - /////////////////////////////////////////////////////////////////////// - ///// functions to convert types to and from unicode strings - template inline static void convert(const uniString::utf8 &v,T &r) throw() { r = v; } - #ifdef _WIN64 - inline static void convert(const uniString::utf8 &v,size_t &r) throw() { r = atoi((const char *)v.c_str()); } - #endif - inline static void convert(const uniString::utf8 &v, int &r) throw() { r = atoi((const char *)v.c_str()); } - inline static void convert(const uniString::utf8 &v, unsigned int &r) throw() { r = atoi((const char *)v.c_str()); } - inline static void convert(const uniString::utf8 &v, unsigned long &r) throw() { r = atol((const char *)v.c_str()); } - inline static void convert(const uniString::utf8 &v, unsigned short &r) throw() { r = (unsigned short)atoi((const char *)v.c_str()); } - inline static void convert(const uniString::utf8 &v, short &r) throw() { r = (short)atoi((const char *)v.c_str()); } - inline static void convert(const uniString::utf8 &v, bool &r) throw() { r = (atoi((const char *)v.c_str()) ? true : false); } - inline static void convert(const uniString::utf8 &v, double &r) throw() { r = atof((const char *)v.c_str()); } - - template inline static uniString::utf8 revert(const T &r) throw() { return r; } - #ifdef _WIN64 - inline static uniString::utf8 revert(size_t r) throw() { return stringUtil::tos(r); } - #endif - inline static uniString::utf8 revert(int r) throw() { return stringUtil::tos(r); } - inline static uniString::utf8 revert(unsigned int r) throw() { return stringUtil::tos(r); } - inline static uniString::utf8 revert(unsigned long r) throw() { return stringUtil::tos(r); } - inline static uniString::utf8 revert(unsigned short r) throw() { return stringUtil::tos(r); } - inline static uniString::utf8 revert(short r) throw() { return stringUtil::tos(r); } - inline static uniString::utf8 revert(bool r) throw() { return (r ? "1" : "0"); } - inline static uniString::utf8 revert(double r) throw() { return stringUtil::tos(r); } - //////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////// - -private: - mutable AOL_namespace::mutex m_lock; // api may write to config, so we need a lock - - //////////////////////////////////////////////////////////////////////////////////////////// - //// tables and functions so we can read and write options in a generic manner based - /// on the names that are used in the config file - typedef void (config::*assignFunc_t)(const uniString::utf8 &, const size_t subIndex); - typedef uniString::utf8 (config::*fetchFunc_t)(const size_t subIndex, size_t *fetchByPos) const; - typedef size_t (config::*countFunc_t)() const; - typedef bool (config::*multiFunc_t)() const; - typedef uniString::utf8 (config::*defaultFunc_t)() const; - - struct accessor_t - { - assignFunc_t m_assignFunc; - fetchFunc_t m_fetchFunc; - countFunc_t m_countFunc; - multiFunc_t m_multiFunc; - defaultFunc_t m_defaultFunc; - - accessor_t(assignFunc_t af, fetchFunc_t ff, countFunc_t cf, multiFunc_t mf, defaultFunc_t df) throw() - : m_assignFunc(af), m_fetchFunc(ff), m_countFunc(cf), m_multiFunc(mf), m_defaultFunc(df) {} - - accessor_t() throw() : m_assignFunc(0), m_fetchFunc(0), m_countFunc(0), m_multiFunc(0), m_defaultFunc(0) {} - }; -public: - typedef std::map optMap_t; - ////////////////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////////////////// - - // takes an option map (container) and returns the value at the index (i) if it exists, - // otherwise it returns the default value (defaultValue). Value returned as native type - template - static T fetchMulti(const std::map &container, const typename std::vector::size_type &subIndex, - const D defaultValue, size_t *fetchByPos) throw() - { - if (!fetchByPos) - { - typename std::map::const_iterator i = container.find(subIndex); - if (i != container.end()) - { - return (*i).second; - } - } - else - { - // there's cases where we need to get the value - // effectively by it's position in the map so - // for the moment we'll just look through (bad - // for speed but it's not a commonly used mode). - typename std::vector::size_type pos = 0; - for (typename std::map::const_iterator i = container.begin(); i != container.end(); ++i, pos++) - { - if (pos == subIndex) - { - *fetchByPos = (*i).first; - return (*i).second; - } - } - } - return defaultValue; - } -private: - // assign map index. Expand with default value as needed. Value is specified as a string and converted as needed - template - static void assignMulti(std::map &container, const typename std::vector::size_type subIndex, const uniString::utf8 &value) throw() - { - T vtmp; - convert(value, vtmp); - container[subIndex] = vtmp; - } - - // same as assignMulti, but you can provide the native type instead of a string - template - static void native_assignMulti(std::map &container, const typename std::vector::size_type subIndex, const T &value) throw() - { - container[subIndex] = value; - } - - ///////////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////////// - - // radionomy metrics - OPT(bool,adMetricsDebug,false) - OPT(size_t,metricsMaxQueue,80000) - - OPT(bool,authDebug,false) - -public: - friend void metrics::metrics_apply(config &conf); - -private: - optMap_t m_optMap; - - // we can't log during startup because the loggers don't exist - std::vector m_deferredWarnLogMessages; // log warning messages from startup - std::vector m_deferredErrorLogMessages; // log error messages from startup - - // deferred options are those that weren't set because they can't take effect immediately - // they are used when writing out the new config file. - std::map m_deferredOptions; - - OPT(size_t,configRewrite,0) - OPT(uniFile::filenameType,confFile,"") - - OPT(uniFile::filenameType,logFile,DEFAULT_LOG) // file for logging - OPT(uniFile::filenameType,realLogFile,DEFAULT_LOG) // file for logging - - OPT(bool,screenLog,true) // log to screen - OPT(bool,log,true) // do I log? - OPT(int,logRotates,5) // hwo many backups to keep when doing a log rotate? - OPT(bool,logArchive,false) // backup rotated files which would otherwise be deleted - OPT(int,rotateInterval,86400) // interval between log file rotations (24 hours) - // if set to 0 then we won't rotate any of the files - - OPT(int,portBase,8000) // listen port - OPT(int,publicPort,-1) // listen port for firehose - workaround for firehose hosts running on port 8000 - // but need to effectively be seen as bound to port 80 - allowing all to work ok - OPT(int,portLegacy,-1) // legacy port override/disable - OPT(uniString::utf8,alternatePorts,(uniString::utf8)"") // alternate port(s) for client only connections - comma separated string - OPT(bool,nameLookups,false) // do internet reverse lookups - - OPT(uniString::utf8,sslCertificateFile,""); - OPT(uniString::utf8,sslCertificateKeyFile,""); - - OPT(int,autoDumpTime,30) // how long before an idle connection is dumped (in seconds). Zero means no timeout - OPT(int,maxHeaderLineSize,4096) // maximum size of an HTTP header line. Default is pretty arbitrary right now - // but should be at least as big as a u-vox packet, since we have to anaylize - // initial data bytes to determine protocol and type of connectee (source or client) - OPT(int,maxHeaderLineCount,100) // max headers lines in HTTP style exchange - OPT(uniString::utf8,password,(uniString::utf8)""); // password for broadcaster to connect - OPT(uniString::utf8,adminPassword,(uniString::utf8)""); // administrator password - - // buffer configuration options - OPT(int,bufferType,1) // 0 - fixed, 1 - adaptive - OPT(size_t,fixedBufferSize,524288) // size of buffer if fixed (gives ~32 seconds ~ 128kbps, 44.1kHz) - OPT(double,adaptiveBufferSize,16) // size of adaptive buffer in seconds - OPT(size_t,bufferHardLimit,16777216) // no more than this give or take a factor of two - - OPT(unsigned short,metaInterval,16384) // metadata interval for shoutcast 1 - OPT_MULTI(unsigned short,stream_metaInterval,16384) // per-stream override - - // special intro and backup files - OPT(uniFile::filenameType,introFile,"") - OPT(uniFile::filenameType,backupFile,"") - OPT(uniFile::filenameType,backupTitle,"") - OPT(int,backupLoop,0) - OPT(int,maxSpecialFileSize,30000000) - - OPT(int,adTestFileLoop,1) - OPT(uniFile::filenameType,adTestFile,"") - OPT(uniFile::filenameType,adTestFile2,"") - OPT(uniFile::filenameType,adTestFile3,"") - OPT(uniFile::filenameType,adTestFile4,"") - - OPT(uniFile::filenameType,artworkFile,"") - std::map m_artworkBody; - - OPT(uniString::utf8,uvoxCipherKey,uniString::utf8("foobar")) - - // w3c logs - OPT(bool,w3cEnable,true) - OPT(uniString::utf8,w3cLog,uniString::utf8("sc_w3c.log")) - - OPT(uniString::utf8,pidFile,uniString::utf8("sc_serv_$.pid")) - - // relaying - OPT(bool,allowRelay,true) // can other servers relay us. Based on Shoutcast user agent, not reliable - OPT(bool,allowPublicRelay,true) // relays can list themselves in yp - - OPT(short,maxHTTPRedirects,5) // max times we can redirect (http 3xx) - OPT(int,relayReconnectTime,5) // seconds to reconnect on relay failure - OPT(int,relayConnectRetries,0) // number of times we retry a relay request before throwing it away - // which if set as zero will keep retrying (excluding bitrate blocks) - - ////// stream configs - OPT_MULTI(size_t,stream_ID,DEFAULT_CLIENT_STREAM_ID) - OPT_MULTI(uniString::utf8,stream_authHash,(uniString::utf8)"") - OPT_MULTI(uniString::utf8,stream_path,(uniString::utf8)"") - OPT_MULTI(uniString::utf8,stream_relayURL,(uniString::utf8)"") - OPT_MULTI(uniString::utf8,stream_backupURL,(uniString::utf8)"") - - OPT_MULTI(uniString::utf8,stream_password,(uniString::utf8)"") - OPT_MULTI(uniString::utf8,stream_adminPassword,(uniString::utf8)"") - - OPT_MULTI(uniString::utf8,stream_publicServer,(uniString::utf8)"") // if "always" or "never" overrides public flag from source - OPT_MULTI(bool,stream_allowRelay,true) // can other servers relay us. Based on Shoutcast user agent, not reliable - OPT_MULTI(bool,stream_allowPublicRelay,true) // relays can list themselves in yp - - OPT_MULTI(int,stream_maxUser,0) // if set to a value greater than zero then we have per stream limits - OPT_MULTI(int,stream_maxBitrate,0) // if set to a value greater than zero then we have per stream limits - OPT_MULTI(int,stream_minBitrate,0) // if set to a value greater than zero then we have per stream limits - OPT_MULTI(bool,stream_ripOnly,false) // only addrs in rip file may connect - OPT_MULTI(int,stream_autoDumpTime,30) // how long before an idle connection is dumped (in seconds). Zero means no timeout - OPT_MULTI(int,stream_autoDumpSourceTime,7) // how long before an idle source connection is dumped (in seconds). Zero means no timeout - OPT_MULTI(bool,stream_autoDumpUsers,false) // if true, then users are dumped if source disconnects - OPT_MULTI(size_t,stream_listenerTime,0) // max time in minutes you can listen. 0 means no limit - - OPT_MULTI(int,stream_songHistory,10) // max song history to preserve - OPT_MULTI(uniString::utf8,stream_uvoxCipherKey,(uniString::utf8)"") - - OPT_MULTI(uniFile::filenameType,stream_logFile,""); // file for per mount logging - - OPT_MULTI(int,stream_adTestFileLoop,1) - OPT_MULTI(uniFile::filenameType,stream_adTestFile,"") - OPT_MULTI(uniFile::filenameType,stream_adTestFile2,"") - OPT_MULTI(uniFile::filenameType,stream_adTestFile3,"") - OPT_MULTI(uniFile::filenameType,stream_adTestFile4,"") - OPT_MULTI(uniFile::filenameType,stream_introFile,"") - OPT_MULTI(uniFile::filenameType,stream_backupFile,"") - OPT_MULTI(uniFile::filenameType,stream_backupTitle,"") - OPT_MULTI(int,stream_backupLoop,0) - - OPT_MULTI(int,stream_rateLimitWait,0) - - OPT_MULTI(uniFile::filenameType,stream_artworkFile,"") - - OPT_MULTI(uniFile::filenameType,stream_banFile,"") - OPT_MULTI(uniFile::filenameType,stream_ripFile,"") - OPT_MULTI(uniFile::filenameType,stream_agentFile,"") - OPT_MULTI(uniString::utf8,stream_w3cLog,(uniString::utf8)"") - - OPT_MULTI(uniString::utf8,stream_hideStats,(uniString::utf8)"") // hide /stats & /statistics as well as /index and /played public facing pages - OPT_MULTI(uniString::utf8,stream_redirectUrl,(uniString::utf8)"") // used with hideStats=all or if the stream version isn't specified - OPT_MULTI(uniString::utf8,stream_movedUrl,(uniString::utf8)"") // used to redirect a deemed dead stream (just in case) - - OPT(bool,requireStreamConfigs,false) // if true, then sources can only connect if stream configs have been defined - OPT(uniString::utf8,userId,"") - OPT(uniString::utf8,licenceId,"") - - // flash policy - OPT(int,flashPolicyServerPort,-1) // listen on port 843 for flash policy server request - OPT(uniFile::filenameType,flashPolicyFile,DEFAULT_FLASH_POLICY_FILE) - uniString::utf8 m_crossdomainStr; // used to hold a cached copy of the crossdomain.xml file - uniString::utf8 m_crossdomainStrGZ; // used to hold a cached copy of the gzipped crossdomain.xml file - uniString::utf8 m_shoutcastSWFStr; // used to hold a cached copy of the shoutcast.swf file - uniString::utf8 m_shoutcastSWFStrGZ; // used to hold a cached copy of the gzipped shoutcast.swf file - uniString::utf8 m_usedAlternatePorts; // used to hold a copy of the valid alternate ports in use - - ////// yp - OPT(int,ypTimeout,30) // yp timeout interval for requests - OPT(uniString::utf8,ypAddr,DEFAULT_YP_ADDRESS) - OPT(int,ypPort,80) - OPT(uniString::utf8,ypPath,"/yp2") - OPT(int,ypMaxRetries,10) // number of times we retry a yp request before throwing it away - OPT(int,ypReportInterval,5 * 60) // never touch any slower than this - OPT(int,ypMinReportInterval,10) // never touch any faster than this - OPT(uniString::utf8,publicServer,"default") // if "always" or "never" overrides public flag from source - - //// cdn behaviour - OPT(uniString::utf8,cdn,"") // if 'on' or 'always' then we enable all of the cdn modes (including YP pings for private streams) - // but use it to determine opt-in (via 'on') or opt-out (via 'always') - OPT_MULTI(int,cdn_master,-1) // this and the option below is used to control the behaviour of things - OPT_MULTI(int,cdn_slave,-1) - - //// stats - OPT(int,maxUser,512) // max clients - OPT(int,minBitrate,0) // min bitrate of source connections - if zero / not set then there is no limit - OPT(int,maxBitrate,0) // max bitrate of source connections - if zero / not set then there is no limit - OPT(uniString::utf8,hideStats,"") // hide /stats & /statistics as well as /index and /played public facing pages - OPT(uniString::utf8,redirectUrl,"") // used with hideStats=all or if the stream version isn't specified - - /// client behaviour - OPT(size_t,listenerTime,0) // max time in minutes you can listen. 0 means no limit - OPT(bool,autoDumpUsers,false) // if true, then users are dumped if source disconnects - OPT(uniString::utf8,srcIP,"") // bind addr for sources - OPT(uniString::utf8,destIP,"") // bind addr for clients - OPT(uniString::utf8,publicIP,"") // public address to use for the YP listing if the bind addr is not appropriate - OPT(uniString::utf8,titleFormat,"") // modifies icy-name - OPT(uniString::utf8,urlFormat,"") // modifies icy-url - - //// banning - OPT(uniFile::filenameType,banFile,"sc_serv.ban") - OPT(bool,saveBanListOnExit,true) // save on exiting - - //// rip - OPT(uniFile::filenameType,ripFile,"sc_serv.rip") - OPT(bool,saveRipListOnExit,true) // save on exiting - OPT(bool,ripOnly,false) // only addrs in rip file may connect - OPT(uniFile::filenameType,adminFile,"sc_serv.admin") - - /// agent - OPT(uniFile::filenameType,agentFile,"sc_serv.agent") - OPT(bool,saveAgentListOnExit,true) // save on exiting - OPT(bool,blockEmptyUserAgent,false) // if true, block the client connection if there is no user agent specified - - //// debugging - OPT(bool,webClientDebug,false) - OPT(bool,yp2Debug,false) - OPT(bool,shoutcastSourceDebug,false) - OPT(bool,uvox2SourceDebug,false) - OPT(bool,HTTPSourceDebug,false) - OPT(bool,streamDataDebug,false) - OPT(bool,microServerDebug,false) - OPT(bool,httpStyleDebug,false) - OPT(bool,shoutcast1ClientDebug,false) - OPT(bool,shoutcast2ClientDebug,false) - OPT(bool,HTTPClientDebug,false) - OPT(bool,flvClientDebug,false) - OPT(bool,m4aClientDebug,false) - - OPT(bool,relayDebug,false) - OPT(bool,relayShoutcastDebug,false) - OPT(bool,relayUvoxDebug,false) - OPT(bool,statsDebug,false) - OPT(bool,threadRunnerDebug,false) - - OPT(bool,logClients,true) - - OPT(int,songHistory,20) // max song history to preserve - - /// misc nonsense - OPT(uniString::utf8,unique,"$") // subsitution string for file names to mimic old sc_serv conf file behaviour - OPT(uniString::utf8,include,"") // include file placeholder - OPT(int,cpuCount,0) // cpu usage. zero is default - OPT(bool,clacks,true) // need i say more...? - OPT(bool,startInactive,false) // used to not start the relays on startup - OPT(bool,rateLimit,true); // if we do frame rate limiting or not - OPT(int,rateLimitWait,5); // if we do frame rate limiting, how many seconds before we enforce it fully - OPT(bool,useXFF,true); // if we use XFF (if available) for the listener address (and related actions) - OPT(bool,forceShortSends,false);// used for debugging streaming issues by introducing forced delays into sends - OPT(bool,adminNoWrap,false); // used for defaulting the admin listener page mode for wrapping or not - // wrapping the listener output list which might be handy for some users - - // used for customising the css of the index.html and admin pages - OPT(uniFile::filenameType,adminCSSFile,"v2") - uniString::utf8 m_styleCustomStr; // used to hold a cached copy of the custom css file - uniString::utf8 m_styleCustomStrGZ; // used to hold a cached copy of the gzipped custom css file - uniString::utf8 m_styleCustomHeader; // used to hold a cached copy of the gzipped custom css file - uniString::utf8 m_styleCustomHeaderGZ; // used to hold a cached copy of the gzipped custom css file - time_t m_styleCustomHeaderTime; // used to control the cache handling - - OPT(uniFile::filenameType,faviconFile,"") - OPT(uniFile::filenameType,faviconFileMimeType,"image/x-icon") - uniString::utf8 m_faviconBody; - uniString::utf8 m_faviconHeader; - uniString::utf8 m_faviconBodyGZ; // gzipped version - uniString::utf8 m_faviconHeaderGZ; // gzipped version - time_t m_favIconTime; // used to control the cache handling - - // used for returning robots.txt - OPT(uniFile::filenameType,robotstxtFile,"") - uniString::utf8 m_robotsTxtBody; - uniString::utf8 m_robotsTxtHeader; - uniString::utf8 m_robotsTxtBodyGZ; // gzipped version - uniString::utf8 m_robotsTxtHeaderGZ; // gzipped version - - uniString::utf8 m_certPath; - uniString::utf8 m_certFileBody; - - const bool _load(const uniFile::filenameType &file, const uniString::utf8 &uniqueStr, const bool parent) throw(); - int promptConfigFile() throw(); - - bool editConfigFileEntry(size_t sid, const uniFile::filenameType &filename, - const uniString::utf8 &authhash, const uniString::utf8 ¶m, - bool add, bool &handled, bool &idHandled, bool parent) throw(); - - // used for legacy handling of the relayport and relayserver options to sid=1 - uniString::utf8 m_legacyRelayPort; - uniString::utf8 m_legacyRelayServer; - - streamConfig& getPerStreamConfig(streamConfig& stream, const size_t sid, const bool useParent = true); - -public: - config() throw(); - ~config() throw(); - - static std::string logSectionName(); - - uniString::utf8 getCrossDomainFile(const bool compressed) throw(); - uniString::utf8 getIndexCSS(const bool compressed) throw(); - uniString::utf8 getShoutcastSWF(const bool compressed) throw(); - - const uniString::utf8 getStreamRedirectURL(const size_t streamID, const bool isStats, const bool homeSet, - const bool compress, const bool force = false) const throw(); - - int getRateLimitWait(const size_t streamID) const throw(); - - const int isBitrateDisallowed(const size_t streamID, const int bitrate, int &streamMinBitrate, int &streamMaxBitrate) const throw(); - - unsigned short getMetaInterval(const size_t streamID) const throw(); - int getBackupLoop(const size_t streamID) const throw(); - size_t getSongHistorySize(const size_t streamID) const throw(); - const int getAutoDumpTime(const size_t streamID = DEFAULT_SOURCE_STREAM) const throw(); - - const int getCPUCount() const throw(); - - const std::vector getRelayList(); - const std::vector getBackupUrl(const size_t streamID) throw(std::exception); - const uniString::utf8 getStreamHideStats(const size_t streamID) const; - - typedef std::map streams_t; - void getStreamConfigs(streams_t& streams, const bool useParent = true); - const bool getStreamConfig(streamConfig& stream, const size_t streamID); - - // handle updating stream configs on the fly (as applicable) - #define AUTH_HASH 0x1 - #define URL_PATH 0x2 - #define RELAY_URL 0x4 - #define MAX_USER 0x8 - #define SOURCE_PWD 0x10 - #define ADMIN_PWD 0x20 - #define PUBLIC_SRV 0x40 - #define ALLOW_RELAY 0x80 - #define ALLOW_PUBLIC_RELAY 0x100 - #define RIP_ONLY 0x200 - #define DUMP_TIME 0x400 - #define DUMP_USER 0x800 - #define LIST_TIME 0x1000 - #define SONG_HIST 0x2000 - #define CIPHER_KEY 0x4000 - #define INTRO_FILE 0x8000 - #define BACKUP_FILE 0x10000 - #define BAN_FILE 0x20000 - #define RIP_FILE 0x40000 - #define W3C_FILE 0x80000 - #define MAX_BITRATE 0x100000 - #define BACKUP_URL 0x200000 - #define HIDE_STATS 0x400000 - #define MOVED_URL 0x800000 - #define AGENT_FILE 0x1000000 - #define CDN_MASTER 0x2000000 - #define CDN_SLAVE 0x4000000 - #define ARTWORK_FILE 0x8000000 - #define BACKUP_LOOP 0x10000000 - #define BACKUP_TITLE 0x20000000 - #define MIN_BITRATE 0x40000000 - #define AD_TEST_FILE 0x80000000 - #define AD_TEST_FILE_LOOP 0x100000000ULL - #define RATE_LIMIT_WAIT 0x200000000ULL - #define METAINTERVAL 0x400000000ULL - #define AD_TEST_FILE_2 0x800000000ULL - #define AD_TEST_FILE_3 0x1000000000ULL - #define AD_TEST_FILE_4 0x2000000000ULL - - void addStreamConfig(config &readConfig, config::streamConfig) throw(std::exception); - __uint64 updateStreamConfig(config &readConfig, config::streamConfig update) throw(std::exception); - void removeStreamConfig(config::streamConfig) throw(std::exception); - - // deals with configuring all of the per-stream passwords, etc - static bool setupPasswords(const config::streams_t &) throw(std::exception); - - void setOption(uniString::utf8 key, uniString::utf8 value) throw(std::exception); - - bool load(const uniFile::filenameType &file, bool load = true) throw(); - bool rewriteConfigurationFile(bool minimal = true, bool messages = false, bool setup = false) const throw(std::exception); // throw on I/O error - uniString::utf8 dumpConfigFile() throw(); - - ////////////////////////////////////////////////////////////////////////////////////// - - const std::vector& deferredWarnLogMessages() const throw() { stackLock sml(m_lock); return m_deferredWarnLogMessages; } - const std::vector& deferredErrorLogMessages() const throw() { stackLock sml(m_lock); return m_deferredErrorLogMessages; } - - void clearDeferredWarnLogMessages() throw() { stackLock sml(m_lock); m_deferredWarnLogMessages.clear(); } - void clearDeferredErrorLogMessages() throw() { stackLock sml(m_lock); m_deferredErrorLogMessages.clear(); } - - /////////// interface for service templates - const std::vector fromArgs(const std::vector &cl) throw(); - bool getConsoleLogging() const throw(); - const uniFile::filenameType getFileLog() const throw(); - static uniString::utf8 getSystemLogConfigString() throw(); - static uniString::utf8 getVersionBuildStrings() throw(); - //////////////////////////////////////////////////////////////////////////// -}; - -#undef OPT -#undef OPT_MULTI - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/cpucount.cpp b/Src/Plugins/DSP/sc_serv3/cpucount.cpp deleted file mode 100644 index fc2a1156..00000000 --- a/Src/Plugins/DSP/sc_serv3/cpucount.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "cpucount.h" - -#ifdef _WIN32 -#include - -int cpucount() throw() -{ - SYSTEM_INFO sysinfo = {0}; - ::GetSystemInfo(&sysinfo); - - return sysinfo.dwNumberOfProcessors; -} -#endif - -#ifdef __APPLE_CC__ -#import -#import - -int cpucount() throw() -{ - int count = 0; - size_t size = sizeof(count); - - if (sysctlbyname("hw.ncpu",&count,&size,NULL,0)) return 1; - - return count; -} -#endif - -#if (defined PLATFORM_LINUX || defined PLATFORM_ARMv6 || defined PLATFORM_ARMv7) -#include -int cpucount() throw() -{ - return sysconf(_SC_NPROCESSORS_ONLN); -} -#endif - -#ifdef PLATFORM_BSD -#include -#include -#ifndef HW_AVAILCPU -#define HW_AVAILCPU 25 -#endif - -int cpucount() throw() -{ - int numCPU = 1; - int mib[4] = {0}; - size_t len = 0; - - /* set the mib for hw.ncpu */ - mib[0] = CTL_HW; - mib[1] = HW_AVAILCPU; // alternatively, try HW_NCPU; - - /* get the number of CPUs from the system */ - sysctl(mib, 2, &numCPU, &len, NULL, 0); - - if( numCPU < 1 ) - { - mib[1] = HW_NCPU; - sysctl( mib, 2, &numCPU, &len, NULL, 0 ); - - if( numCPU < 1 ) - { - numCPU = 1; - } - } - return numCPU; -} -#endif diff --git a/Src/Plugins/DSP/sc_serv3/cpucount.h b/Src/Plugins/DSP/sc_serv3/cpucount.h deleted file mode 100644 index c11e40ec..00000000 --- a/Src/Plugins/DSP/sc_serv3/cpucount.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once -#ifndef cpucount_H_ -#define cpucount_H_ - -// platform independent function to return number of logical processors -int cpucount() throw(); - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/deps/win32/include/sched.h b/Src/Plugins/DSP/sc_serv3/deps/win32/include/sched.h deleted file mode 100644 index ad0fb2ec..00000000 --- a/Src/Plugins/DSP/sc_serv3/deps/win32/include/sched.h +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Module: sched.h - * - * Purpose: - * Provides an implementation of POSIX realtime extensions - * as defined in - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2012 Pthreads-win32 contributors - * - * Homepage1: http://sourceware.org/pthreads-win32/ - * Homepage2: http://sourceforge.net/projects/pthreads4w/ - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * 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 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 in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ -#if !defined(_SCHED_H) -#define _SCHED_H - -#if defined(_MSC_VER) -# if _MSC_VER < 1300 -# define PTW32_CONFIG_MSVC6 -# endif -# if _MSC_VER < 1400 -# define PTW32_CONFIG_MSVC7 -# endif -#endif - -#undef PTW32_SCHED_LEVEL - -#if defined(_POSIX_SOURCE) -#define PTW32_SCHED_LEVEL 0 -/* Early POSIX */ -#endif - -#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 -#undef PTW32_SCHED_LEVEL -#define PTW32_SCHED_LEVEL 1 -/* Include 1b, 1c and 1d */ -#endif - -#if defined(INCLUDE_NP) -#undef PTW32_SCHED_LEVEL -#define PTW32_SCHED_LEVEL 2 -/* Include Non-Portable extensions */ -#endif - -#define PTW32_SCHED_LEVEL_MAX 3 - -#if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_SCHED_LEVEL) -#define PTW32_SCHED_LEVEL PTW32_SCHED_LEVEL_MAX -/* Include everything */ -#endif - - -#if defined(__GNUC__) && !defined(__declspec) -# error Please upgrade your GNU compiler to one that supports __declspec. -#endif - -/* - * When building the library, you should define PTW32_BUILD so that - * the variables/functions are exported correctly. When using the library, - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -#if !defined(PTW32_STATIC_LIB) -# if defined(PTW32_BUILD) -# define PTW32_DLLPORT __declspec (dllexport) -# else -# define PTW32_DLLPORT __declspec (dllimport) -# endif -#else -# define PTW32_DLLPORT -#endif - -/* - * The Open Watcom C/C++ compiler uses a non-standard calling convention - * that passes function args in registers unless __cdecl is explicitly specified - * in exposed function prototypes. - * - * We force all calls to cdecl even though this could slow Watcom code down - * slightly. If you know that the Watcom compiler will be used to build both - * the DLL and application, then you can probably define this as a null string. - * Remember that sched.h (this file) is used for both the DLL and application builds. - */ -#if !defined(PTW32_CDECL) -# define PTW32_CDECL __cdecl -#endif - -/* - * This is a duplicate of what is in the autoconf config.h, - * which is only used when building the pthread-win32 libraries. - */ - -#if !defined(PTW32_CONFIG_H) -# if defined(WINCE) -# define NEED_ERRNO -# define NEED_SEM -# endif -# if defined(__MINGW64__) -# define HAVE_STRUCT_TIMESPEC -# define HAVE_MODE_T -# elif defined(_UWIN) || defined(__MINGW32__) -# define HAVE_MODE_T -# endif -#endif - -/* - * - */ - -#include - -#if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX -#if defined(NEED_ERRNO) -#include "need_errno.h" -#else -#include -#endif -#endif /* PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX */ - -#if (defined(__MINGW64__) || defined(__MINGW32__)) || defined(_UWIN) -# if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX -/* For pid_t */ -# include -/* Required by Unix 98 */ -# include -# else - typedef int pid_t; -# endif -#else - /* [i_a] fix for using pthread_win32 with mongoose code, which #define's its own pid_t akin to typedef HANDLE pid_t; */ - #undef pid_t -# if defined(_MSC_VER) - typedef void *pid_t; -# else - typedef int pid_t; -# endif -#endif - -/* - * Microsoft VC++6.0 lacks these *_PTR types - */ -#if defined(_MSC_VER) && _MSC_VER < 1300 && !defined(PTW32_HAVE_DWORD_PTR) -typedef unsigned long ULONG_PTR; -typedef ULONG_PTR DWORD_PTR; -#endif - -/* Thread scheduling policies */ - -enum { - SCHED_OTHER = 0, - SCHED_FIFO, - SCHED_RR, - SCHED_MIN = SCHED_OTHER, - SCHED_MAX = SCHED_RR -}; - -struct sched_param { - int sched_priority; -}; - -/* - * CPU affinity - * - * cpu_set_t: - * Considered opaque but cannot be an opaque pointer - * due to the need for compatibility with GNU systems - * and sched_setaffinity() et.al. which include the - * cpusetsize parameter "normally set to sizeof(cpu_set_t)". - */ - -#define CPU_SETSIZE (sizeof(size_t)*8) - -#define CPU_COUNT(setptr) (_sched_affinitycpucount(setptr)) - -#define CPU_ZERO(setptr) (_sched_affinitycpuzero(setptr)) - -#define CPU_SET(cpu, setptr) (_sched_affinitycpuset((cpu),(setptr))) - -#define CPU_CLR(cpu, setptr) (_sched_affinitycpuclr((cpu),(setptr))) - -#define CPU_ISSET(cpu, setptr) (_sched_affinitycpuisset((cpu),(setptr))) - -#define CPU_AND(destsetptr, srcset1ptr, srcset2ptr) (_sched_affinitycpuand((destsetptr),(srcset1ptr),(srcset2ptr))) - -#define CPU_OR(destsetptr, srcset1ptr, srcset2ptr) (_sched_affinitycpuor((destsetptr),(srcset1ptr),(srcset2ptr))) - -#define CPU_XOR(destsetptr, srcset1ptr, srcset2ptr) (_sched_affinitycpuxor((destsetptr),(srcset1ptr),(srcset2ptr))) - -#define CPU_EQUAL(set1ptr, set2ptr) (_sched_affinitycpuequal((set1ptr),(set2ptr))) - -typedef union -{ - char cpuset[CPU_SETSIZE/8]; - size_t _align; -} cpu_set_t; - -#if defined(__cplusplus) -extern "C" -{ -#endif /* __cplusplus */ - -PTW32_DLLPORT int PTW32_CDECL sched_yield (void); - -PTW32_DLLPORT int PTW32_CDECL sched_get_priority_min (int policy); - -PTW32_DLLPORT int PTW32_CDECL sched_get_priority_max (int policy); - -PTW32_DLLPORT int PTW32_CDECL sched_setscheduler (pid_t pid, int policy); - -PTW32_DLLPORT int PTW32_CDECL sched_getscheduler (pid_t pid); - -/* Compatibility with Linux - not standard */ - -PTW32_DLLPORT int PTW32_CDECL sched_setaffinity (pid_t pid, size_t cpusetsize, cpu_set_t *mask); - -PTW32_DLLPORT int PTW32_CDECL sched_getaffinity (pid_t pid, size_t cpusetsize, cpu_set_t *mask); - -/* - * Support routines and macros for cpu_set_t - */ -PTW32_DLLPORT int PTW32_CDECL _sched_affinitycpucount (const cpu_set_t *set); - -PTW32_DLLPORT void PTW32_CDECL _sched_affinitycpuzero (cpu_set_t *pset); - -PTW32_DLLPORT void PTW32_CDECL _sched_affinitycpuset (int cpu, cpu_set_t *pset); - -PTW32_DLLPORT void PTW32_CDECL _sched_affinitycpuclr (int cpu, cpu_set_t *pset); - -PTW32_DLLPORT int PTW32_CDECL _sched_affinitycpuisset (int cpu, const cpu_set_t *pset); - -PTW32_DLLPORT void PTW32_CDECL _sched_affinitycpuand(cpu_set_t *pdestset, const cpu_set_t *psrcset1, const cpu_set_t *psrcset2); - -PTW32_DLLPORT void PTW32_CDECL _sched_affinitycpuor(cpu_set_t *pdestset, const cpu_set_t *psrcset1, const cpu_set_t *psrcset2); - -PTW32_DLLPORT void PTW32_CDECL _sched_affinitycpuxor(cpu_set_t *pdestset, const cpu_set_t *psrcset1, const cpu_set_t *psrcset2); - -PTW32_DLLPORT int PTW32_CDECL _sched_affinitycpuequal (const cpu_set_t *pset1, const cpu_set_t *pset2); - -/* - * Note that this macro returns ENOTSUP rather than - * ENOSYS as might be expected. However, returning ENOSYS - * should mean that sched_get_priority_{min,max} are - * not implemented as well as sched_rr_get_interval. - * This is not the case, since we just don't support - * round-robin scheduling. Therefore I have chosen to - * return the same value as sched_setscheduler when - * SCHED_RR is passed to it. - */ -#define sched_rr_get_interval(_pid, _interval) \ - ( errno = ENOTSUP, (int) -1 ) - - -#if defined(__cplusplus) -} /* End of extern "C" */ -#endif /* __cplusplus */ - -#undef PTW32_SCHED_LEVEL -#undef PTW32_SCHED_LEVEL_MAX - -#endif /* !_SCHED_H */ - diff --git a/Src/Plugins/DSP/sc_serv3/filenameMetadata.cpp b/Src/Plugins/DSP/sc_serv3/filenameMetadata.cpp deleted file mode 100644 index d335a5e4..00000000 --- a/Src/Plugins/DSP/sc_serv3/filenameMetadata.cpp +++ /dev/null @@ -1,681 +0,0 @@ -#include "filenameMetadata.h" -#include "metadata.h" -#include "stl/stringUtils.h" -#include "macros.h" -#include -#include -#include -#include -#include - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -/* - Overview of how it works: - - The setPattern() method looks at the pattern string and builds a stack of parseState objects. - Each of these objects are responsible for finding their associated pattern within a text range. - - parsing is done right to left. - - the parseState_optional object is used to encapsulate other state objects that are - optional (bracketed by [] in the pattern). -*/ - -class filenameMetadata::impl -{ - // to make unicode compatibility easier, we're just going to store things as utf32 - utf32 m_pattern; - utf32 m_data; - - // put the map will be in utf 8 - typedef map tokenMap_t; - tokenMap_t m_tokens; - - class parseState; - typedef list parseStack_t; - parseStack_t m_parseStack; - static void clearparseStack(parseStack_t &ps) throw() - { - while (!ps.empty()) - { - delete ps.back(); - ps.pop_back(); - } - } - - void clearparseStack() throw() { clearparseStack(m_parseStack); } - - ///////////// parse states ////////////////////////// - class parseState // virtual base - { - public: - typedef utf32::const_reverse_iterator range_e; - typedef pair range_t; - - virtual ~parseState() throw() {} - virtual range_t findRange(range_e rbegin, range_e rend) throw() { return make_pair(rbegin, rend); } - virtual void setFromRange(range_e /*rbegin*/, range_e /*rend*/) throw() {} - virtual void reportValue(tokenMap_t &/*tm*/) const throw() {} - virtual utf8 describe() const throw() = 0; // for diagnostics - virtual void reset() throw() {} - virtual bool optional() const throw() { return false; } - virtual bool finite() const throw() { return false; } // fixed width match - }; - - class parseState_optional: public parseState - { - parseStack_t m_parseStack; - - public: - parseState_optional(){} - ~parseState_optional() throw() { clearparseStack(m_parseStack); } - parseStack_t* stack() throw() { return &m_parseStack; } - - virtual bool optional() const throw() { return true; } - - virtual void reset() throw() - { - for_each(m_parseStack.begin(), m_parseStack.end(), mem_fun(&parseState::reset)); - } - - virtual utf8 describe() const throw() - { - utf8 result("["); - for (parseStack_t::const_iterator i = m_parseStack.begin(); i != m_parseStack.end(); ++i) - { - result += (*i)->describe(); - } - result = result + utf8("]"); - return result; - } - - virtual range_t findRange(range_e rbegin,range_e rend) throw() - { - const range_t NOTFOUND(make_pair(rend, rend)); - range_t result; - - reset(); - if (m_parseStack.empty()) - { - return NOTFOUND; - } - - parseStack_t::reverse_iterator s_cur = m_parseStack.rbegin(); - parseStack_t::reverse_iterator s_nxt = s_cur; - ++s_nxt; - - range_e data_start = rbegin; - range_e data_end = rend; - range_e last_restart = rbegin; - - bool first(true); - while (s_cur != m_parseStack.rend()) - { - if (data_start == data_end) - { - reset(); - return NOTFOUND; - } - - range_t curR(NOTFOUND); - range_t nxtR(NOTFOUND); - curR = (*s_cur)->findRange(data_start,data_end); - if (curR.first == data_end) - { - reset(); - return NOTFOUND; - } - if ((!first) && (curR.first != data_start)) - { - // must abut. Try moving forward again - reset(); - s_cur = m_parseStack.rbegin(); - s_nxt = s_cur; - ++s_nxt; - ++last_restart; - data_start = last_restart; - first = true; - continue; - } - if (first) - { - result.first = curR.first; - } - first = false; - - // don't do this if we have a single character state followed - // by anything (in particular, a string which eats all - if (curR.first + 1 != curR.second) - { - if (s_nxt != m_parseStack.rend()) - { - nxtR = (*s_nxt)->findRange(data_start,data_end); - } - if (nxtR.first < curR.second) - { - curR.second = nxtR.first; - } - } - (*s_cur)->setFromRange(curR.first,curR.second); - s_cur = s_nxt; - if (s_nxt != m_parseStack.rend()) - { - ++s_nxt; - } - data_start = curR.second; - } - result.second = data_start; - return result; - } - - virtual void setFromRange(utf32::const_reverse_iterator rbegin, utf32::const_reverse_iterator rend) throw() - { - findRange(rbegin, rend); // resets to restricted range if necessary - } - - virtual void reportValue(tokenMap_t &tm) const throw() - { - for (parseStack_t::const_iterator i = m_parseStack.begin(); i != m_parseStack.end(); ++i) - { - (*i)->reportValue(tm); - } - } - - virtual bool finite() const throw() - { - bool result = true; - for (parseStack_t::const_iterator i = m_parseStack.begin(); i != m_parseStack.end(); ++i) - { - result &= (*i)->finite(); - } - return result; - } - }; - - class parseState_char: public parseState - { - utf32::value_type m_char; - - public: - explicit parseState_char(utf32::value_type c) : m_char(c){} - virtual pair - findRange(utf32::const_reverse_iterator rbegin,utf32::const_reverse_iterator rend) throw() - { - for (utf32::const_reverse_iterator i = rbegin; i != rend; ++i) - { - if ((*i) == m_char) - { - return make_pair(i, i + 1); - } - } - return make_pair(rend,rend); - } - - virtual utf8 describe() const throw() - { - utf32 u32; u32.push_back(m_char); - return u32.toUtf8(); - } - - virtual bool finite() const throw() { return true; } - }; - - class parseState_stringSymbol: public parseState - { - utf8 m_symbolName; // can be empty for any string - utf32 m_value; - - public: - parseState_stringSymbol() throw(){} - explicit parseState_stringSymbol(const string &s) throw() : m_symbolName(s){} - ~parseState_stringSymbol() throw(){} - void reset() throw() { m_value.clear(); } - void setFromRange(utf32::const_reverse_iterator rbegin,utf32::const_reverse_iterator rend) throw() - { - if (!m_symbolName.empty()) - { - m_value.clear(); - m_value.insert(m_value.begin(),rbegin,rend); - reverse(m_value.begin(),m_value.end()); - m_value = stripWhitespace(m_value); - } - } - - virtual void reportValue(tokenMap_t &tm) const throw() - { - if (!m_symbolName.empty() && !m_value.empty()) - { - tm[m_symbolName] = m_value.toUtf8(); - } - } - - virtual utf8 describe() const throw() - { - if (m_symbolName.empty()) return utf8("*"); - return utf8("%") + m_symbolName; - } - }; - - class parseState_digits: public parseState - { - public: - parseState_digits() throw(){} - virtual range_t findRange(range_e rbegin,range_e rend) throw() - { - range_t result(make_pair(rend,rend)); - - bool got_start = false; - for (utf32::const_reverse_iterator i = rbegin; i != rend; ++i) - { - if (uniString::is_a_number(*i)) - { - if (!got_start) - { - got_start = true; - result.first = i; - } - } - else - { - if (got_start) - { - result.second = i; - return result; - } - } - } - return result; - } - - virtual utf8 describe() const throw() { return utf8("%#"); } - }; - - class parseState_year: public parseState - { - utf32 m_value; - - public: - parseState_year() throw(){} - ~parseState_year() throw(){} - void reset() throw() { m_value.clear(); } - virtual pair - findRange(utf32::const_reverse_iterator rbegin,utf32::const_reverse_iterator rend) throw() - { - int count = 4; - - pair result(make_pair(rend,rend)); - - bool got_start = false; - for (utf32::const_reverse_iterator i = rbegin; i != rend; ++i) - { - if (uniString::is_a_number(*i)) - { - if (!got_start) - { - got_start = true; - result.first = i; - } - count -= 1; - if (count == 0) - { - result.second = ++i; - return result; - } - } - else - { - if (got_start) - { - got_start = false; - result.first = rend; - } - } - } - return make_pair(rend,rend); - } - - void setFromRange(utf32::const_reverse_iterator rbegin,utf32::const_reverse_iterator rend) throw() - { - m_value.clear(); - m_value.insert(m_value.begin(),rbegin,rend); - reverse(m_value.begin(),m_value.end()); - } - - virtual void reportValue(tokenMap_t &tm) const throw() - { - if (!m_value.empty()) - { - tm[utf8(metadata::YEAR())] = m_value.toUtf8(); - } - } - - virtual utf8 describe() const throw() { return utf8("%YEAR"); } - virtual bool finite() const throw() { return true; } - }; - - class parseState_fixed: public parseState - { - utf32 m_value; - - public: - // fixed string - explicit parseState_fixed(const utf32 &val) throw() : m_value(val) {} - ~parseState_fixed() throw(){} - - virtual pair - findRange(utf32::const_reverse_iterator rbegin,utf32::const_reverse_iterator rend) throw() - { - assert(!m_value.empty()); - if (m_value.empty()) return make_pair(rend,rend); - - for (utf32::const_reverse_iterator i = rbegin; i != rend; ++i) - { - if ((*i) == (*(m_value.rbegin()))) - { - utf32::const_reverse_iterator t_i = i; - utf32::const_reverse_iterator v_i = m_value.rbegin(); - utf32::const_reverse_iterator v_i_end = m_value.rend(); - bool match(true); - for (; match && (v_i != v_i_end); ++t_i, ++v_i) - { - if ((t_i == rend) || ((*t_i) != (*v_i))) - { - match = false; - } - } - if (match) - { - return make_pair(i, i + m_value.size()); - } - } - } - return make_pair(rend,rend); - } - - virtual utf8 describe() const throw() - { - return m_value.toUtf8(); - } - - virtual bool finite() const throw() { return true; } - }; - - static string stringify(utf32::value_type v) throw() - { - if (v >= '0' && v <= 'z') return string(1,(string::value_type)v); - return tos((int)v); - } - -public: - - impl(){} - ~impl() throw() - { - clearparseStack(); - } - - void deleteToken(const utf8 &token) throw() - { - tokenMap_t::iterator i = m_tokens.find(token); - if (i != m_tokens.end()) m_tokens.erase(i); - } - - const tokenMap_t::size_type countTokens() const throw() { return m_tokens.size(); } - utf8& operator[](const utf8 &key) throw() { return m_tokens[key]; } - const map& getTokens() const throw() { return m_tokens; } - - void setPattern(const utf8 &pattern) throw(runtime_error) - { - parseState_optional *opt = 0; - parseStack_t *stack = &m_parseStack; - - try - { - utf32 fixedAccumulator; // fixed string value - - #define DUMPACCUMULATOR { if (!fixedAccumulator.empty()) { stack->push_back(new parseState_fixed(fixedAccumulator)); fixedAccumulator.clear(); } } - - clearparseStack(); - m_pattern.assign(pattern); - for (utf32::const_iterator i = m_pattern.begin(); i != m_pattern.end(); ++i) - { - if ((*i) == ']') - { - DUMPACCUMULATOR - if (!opt) throw runtime_error("Unmatched ']' in pattern"); - stack = &m_parseStack; - stack->push_back(opt); - opt = 0; - } - else if ((*i) == '[') - { - DUMPACCUMULATOR - if (opt) throw runtime_error("Optional sequences cannot be nested in pattern"); - opt = new parseState_optional; - stack = opt->stack(); - } - else if ((*i) == '%') - { - ++i; - if (i == m_pattern.end()) throw runtime_error("Bad pattern. Trailing %"); - switch (*i) - { - case 'N': DUMPACCUMULATOR stack->push_back(new parseState_stringSymbol(metadata::NAME())); break; - case 'G': DUMPACCUMULATOR stack->push_back(new parseState_stringSymbol(metadata::GENRE())); break; - case 'A': DUMPACCUMULATOR stack->push_back(new parseState_stringSymbol(metadata::ALBUM())); break; - case 'R': DUMPACCUMULATOR stack->push_back(new parseState_stringSymbol(metadata::ARTIST()));break; - case 'Y': DUMPACCUMULATOR stack->push_back(new parseState_year); break; - case '#': DUMPACCUMULATOR stack->push_back(new parseState_digits); break; - case '%': fixedAccumulator.push_back('%'); break; - default: throw runtime_error("Unknown symbol %" + stringify(*i)); - } - } - else if ((*i) == '*') - { - DUMPACCUMULATOR - stack->push_back(new parseState_stringSymbol); - } - else - { - fixedAccumulator.push_back(*i); - } - } - if (opt) - { - throw runtime_error("Unterminated optional sequence in pattern"); - } - DUMPACCUMULATOR - } - catch(...) - { - delete opt; - throw; - } - } - - static utf8 describeStackRange(parseStack_t::const_reverse_iterator begin,parseStack_t::const_reverse_iterator end) throw() - { - parseStack_t stck(begin,end); - reverse(stck.begin(),stck.end()); - utf8 result; - for (parseStack_t::const_iterator i = stck.begin(); i != stck.end(); ++i) - { - result = result + (*i)->describe(); - } - return result; - } - - static utf8 describeRemainingData(utf32::const_reverse_iterator begin,utf32::const_reverse_iterator end) throw() - { - utf32 u32(begin,end); - reverse(u32.begin(),u32.end()); - return u32.toUtf8(); - } - - void parse(const utf8 &data) throw(runtime_error) - { - m_data.assign(data); - - // beginning and end of data string - utf32::const_reverse_iterator data_start = m_data.rbegin(); - utf32::const_reverse_iterator data_end = m_data.rend(); - - // current and next object pointers from the parse stack - parseStack_t::reverse_iterator s_cur = m_parseStack.rbegin(); - parseStack_t::reverse_iterator s_nxt = s_cur; - ++s_nxt; - - while(s_cur != m_parseStack.rend()) - { - // if we haven't finished the parse stack, and we're out of data then it's an error - if (data_start == data_end) - { - throw runtime_error("Premature end of data (" + describeStackRange(s_cur,m_parseStack.rend()).hideAsString() + ")"); - } - - // we do one lookahead. Get the range match for the current parse object and - // the next parse object. Note that there is some added complexity due to optional objects - pair curR(make_pair(data_end,data_end)); - pair nxtR(make_pair(data_end,data_end)); - - // find widest possible match for current state - curR = (*s_cur)->findRange(data_start,data_end); - - // if no match, and the object is optional, just move on to the next (continue) - if ((curR.first == data_end) && (*s_cur)->optional()) - { - s_cur = s_nxt; - if (s_nxt != m_parseStack.rend()) - { - ++s_nxt; - } - continue; - } - - // if no match, but object is not optional, then we have an error - if (curR.first == data_end) - { - throw runtime_error("Parse error, symbol not found (" + describeStackRange(s_cur,m_parseStack.rend()).hideAsString() + ") (" + describeRemainingData(data_start,data_end).hideAsString() + ")"); - } - - // if match was not found at our current starting point, then we have an error - if (curR.first != data_start) - { - throw runtime_error("Parse error, data skipped to find symbol (" + describeStackRange(s_cur,m_parseStack.rend()).hideAsString() + ") (" + describeRemainingData(data_start,data_end).hideAsString() + ")"); - } - - // restrict match range by one lookahead. Do not do lookahead - // if our current state is a single character match - if (!(*s_cur)->finite()) //curR.first + 1 != curR.second) - { - // we must loop in case the followup objects are optional and we must - // continue to look ahead - while (true) - { - if (s_nxt == m_parseStack.rend()) break; - // to handle the case of two optional string elements in a row, we - // repeat this if the range of the current and follow up objects match by - // incrementing the start - nxtR = (*s_nxt)->findRange(data_start,data_end); - if ((nxtR.first == curR.first) && (!(*s_nxt)->finite())) - { - nxtR = (*s_nxt)->findRange(data_start+1,data_end); - } - if (nxtR.first < curR.second) - { - // lookahead object restricts range - curR.second = nxtR.first; - break; - } - if ((nxtR.first == data_end) && (nxtR.second == data_end) && (*s_nxt)->optional()) - { - // lookahead object not found and is optional. try the next - ++s_nxt; - } - else - { - // no restriction - break; - } - } - } - - // set value and advance to next parse object - (*s_cur)->setFromRange(curR.first,curR.second); - s_cur = s_nxt; - if (s_nxt != m_parseStack.rend()) - { - ++s_nxt; - } - data_start = curR.second; - } - if (data_start != data_end) - { - throw runtime_error("Data extends beyond pattern (" + describeRemainingData(data_start,data_end).hideAsString() + ")"); - } - - m_tokens.clear(); - for (parseStack_t::const_iterator i = m_parseStack.begin(); i != m_parseStack.end(); ++i) - { - (*i)->reportValue(m_tokens); - } - } -}; - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -filenameMetadata::filenameMetadata(): m_impl(0) -{ - m_impl = new filenameMetadata::impl; -} - -filenameMetadata::~filenameMetadata() throw() -{ - forget(m_impl); -} - -void filenameMetadata::setPattern(const utf8 &pattern) throw(exception) -{ - assert(m_impl); - if (!m_impl) throw logic_error(string(__FUNCTION__) + " internal impl object is null"); - m_impl->setPattern(pattern); -} - -void filenameMetadata::parse(const utf8 &data) throw(exception) -{ - assert(m_impl); - if (!m_impl) throw logic_error(string(__FUNCTION__) + " internal impl object is null"); - m_impl->parse(data); -} - -void filenameMetadata::deleteToken(const utf8 &token) throw(exception) -{ - assert(m_impl); - if (!m_impl) throw logic_error(string(__FUNCTION__) + " internal impl object is null"); - m_impl->deleteToken(token); -} - -const size_t filenameMetadata::countTokens() throw(exception) -{ - assert(m_impl); - if (!m_impl) throw logic_error(string(__FUNCTION__) + " internal impl object is null"); - return m_impl->countTokens(); -} - -utf8& filenameMetadata::operator[](const utf8 &key) throw(exception) -{ - assert(m_impl); - if (!m_impl) throw logic_error(string(__FUNCTION__) + " internal impl object is null"); - return m_impl->operator[](key); -} - -const map& filenameMetadata::getTokens() const throw(exception) -{ - assert(m_impl); - if (!m_impl) throw logic_error(string(__FUNCTION__) + " internal impl object is null"); - return m_impl->getTokens(); -} diff --git a/Src/Plugins/DSP/sc_serv3/filenameMetadata.h b/Src/Plugins/DSP/sc_serv3/filenameMetadata.h deleted file mode 100644 index 4b23f4cc..00000000 --- a/Src/Plugins/DSP/sc_serv3/filenameMetadata.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef filenameMetadata_H_ -#define filenameMetadata_H_ - -#include "unicode/uniString.h" -#include -#include - -class filenameMetadata -{ - class impl; - impl *m_impl; - -public: - filenameMetadata(); - ~filenameMetadata() throw(); - - void setPattern(const uniString::utf8 &pattern) throw(std::exception); - void parse(const uniString::utf8 &data) throw(std::exception); - void deleteToken(const uniString::utf8 &token) throw(std::exception); - const size_t countTokens() throw(std::exception); - uniString::utf8& operator[](const uniString::utf8 &key) throw(std::exception); - const std::map& getTokens() const throw(std::exception); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/global.cpp b/Src/Plugins/DSP/sc_serv3/global.cpp deleted file mode 100644 index 8671e227..00000000 --- a/Src/Plugins/DSP/sc_serv3/global.cpp +++ /dev/null @@ -1,1177 +0,0 @@ -#ifdef _WIN32 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0601 -#include -#endif -#include -#include "global.h" -#include "aolxml/aolxml.h" -#include "threadedRunner.h" -#include "w3cLog.h" -#include "file/fileUtils.h" -#include "services/stdServiceImpl.h" -#ifndef _WIN32 -#include -#endif - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -config gOptions; - -unsigned char appname_tmpbuf[] = -{ - (unsigned char)~'B', (unsigned char)~'a', (unsigned char)~'n', (unsigned char)~'a', (unsigned char)~'n', (unsigned char)~'a', (unsigned char)~'r', (unsigned char)~'a', (unsigned char)~'m', (unsigned char)~'a', 255, 0, -}; - -void tealike_crappy_code(unsigned long v[2], unsigned long k[4]) -{ - unsigned long y = v[0], z = v[1], sum = 0, /* set up */ - delta = 0x9e3779b9UL, n = 32 ; /* key schedule constant*/ - - while (n-- > 0) - { - /* basic cycle start */ - sum += delta; - y += ((z << 4) + k[0]) ^(z + sum) ^((z >> 5) + k[1]); - z += ((y << 4) + k[2]) ^(y + sum) ^((y >> 5) + k[3]); /* end cycle */ - } - v[0] = y; v[1] = z; -} - -const utf8 bob() -{ - static utf8 _bob; - if (_bob.empty()) - { - char* app_name = (char*)appname_tmpbuf; - tealike_crappy_code((unsigned long *)(app_name += 12), (unsigned long *)appname_tmpbuf); - for (int x = 0; x < 12; x ++) - { - appname_tmpbuf[x] ^= 255; - } - app_name -= 12; - _bob = app_name; - } - return _bob; -} - -static int gs_kill = false; -static int gs_postSetup = false; - -const int iskilled() throw() { return gs_kill; } -void setkill(int v) throw() -{ - gs_kill = v; - threadedRunner::wakeup(); -} - -const int isPostSetup() throw() { return gs_postSetup; } -void setPostSetup(int v) throw() { gs_postSetup = v; } - -utf8 MSG_ICY_HTTP401; -utf8 MSG_ICY200; -utf8 MSG_ICY_HTTP200; -utf8 MSG_UVOX_HTTP200; - -int MSG_ICY_HTTP401_LEN; - -const utf8::value_type* MSG_INVALIDPASSWORD = (const utf8::value_type*)"Invalid Password\r\n"; -const int MSG_INVALIDPASSWORD_LEN = (int)strlen(MSG_INVALIDPASSWORD); - -const utf8::value_type* MSG_VALIDPASSWORD = (const utf8::value_type*)"OK2\r\nicy-caps:11\r\n\r\n"; -const int MSG_VALIDPASSWORD_LEN = (int)strlen(MSG_VALIDPASSWORD); - -const utf8::value_type* MSG_HTTP_VALIDPASSWORD = (const utf8::value_type*)"HTTP/1.1 200 OK\r\n\r\n"; -const int MSG_HTTP_VALIDPASSWORD_LEN = (int)strlen(MSG_VALIDPASSWORD); - -const utf8::value_type* MSG_STREAMMOVED = (const utf8::value_type*)"Stream Moved\r\n"; -const int MSG_STREAMMOVED_LEN = (int)strlen(MSG_STREAMMOVED); - -const utf8::value_type* MSG_BADSTREAMID = (const utf8::value_type*)"Bad Stream ID\r\n"; -const int MSG_BADSTREAMID_LEN = (int)strlen(MSG_BADSTREAMID); - -const utf8::value_type* MSG_STREAMINUSE = (const utf8::value_type*)"Stream In Use\r\n"; -const int MSG_STREAMINUSE_LEN = (int)strlen(MSG_STREAMINUSE); - -const utf8::value_type* MSG_200 = (const utf8::value_type*)"HTTP/1.1 200 OK\r\nConnection:close\r\n\r\n"; - -const utf8::value_type* MSG_NO_CLOSE_200 = (const utf8::value_type*)"HTTP/1.1 200 OK\r\n" - "Content-Type:text/html;charset=utf-8\r\n"; - -const utf8::value_type* MSG_STD200 = (const utf8::value_type*)"HTTP/1.1 200 OK\r\n" - "Content-Type:text/html;charset=utf-8\r\n" - "Connection:close\r\n\r\n"; - -const utf8::value_type* MSG_HTTP400 = (const utf8::value_type*)("HTTP/1.1 400 Bad Request\r\nConnection:close\r\n\r\n"); - -const utf8::value_type* MSG_AUTHFAILURE401 = (const utf8::value_type*) - ("HTTP/1.1 401 Unauthorized\r\n" - "Connection:close\r\n" - "Server:Shoutcast DNAS\r\n" - "WWW-authenticate:basic realm=\"Shoutcast Server\"\r\n" - "Content-type:text/html;charset=utf-8\r\n\r\n"); - -const utf8::value_type* MSG_HTTP403 = (const utf8::value_type*)("HTTP/1.1 403 Service Forbidden\r\nConnection:close\r\n\r\n"); - -const utf8::value_type* MSG_HTTP404 = (const utf8::value_type*)("HTTP/1.1 404 Not Found\r\nConnection:close\r\n\r\n"); -const int MSG_HTTP404_LEN = (int)strlen(MSG_HTTP404); - -const utf8::value_type* MSG_HTTP405 = (const utf8::value_type*)("HTTP/1.1 405 Method Not Allowed\r\nAllow:GET\r\nConnection:close\r\n\r\n"); - -const utf8::value_type* MSG_HTTP503 = (const utf8::value_type*)("HTTP/1.1 503 Server limit reached\r\nConnection:close\r\n\r\n"); -const int MSG_HTTP503_LEN = (int)strlen(MSG_HTTP503); - -void constructMessageResponses() -{ - MSG_ICY_HTTP200 = utf8("HTTP/1.0 200 OK\r\n" - "icy-notice1:
This stream requires " - "Winamp
\r\n" - "icy-notice2:Shoutcast DNAS/" SERV_OSNAME " v" + - gOptions.getVersionBuildStrings() + "
\r\n" - "Accept-Ranges:none\r\n" - "Access-Control-Allow-Origin:*\r\n" - "Cache-Control:no-cache,no-store,must-revalidate,max-age=0\r\n" - "Connection:close\r\n"); - - MSG_UVOX_HTTP200 = utf8("HTTP/1.0 200 OK\r\n" - "Accept-Ranges:none\r\n" - "Access-Control-Allow-Origin:*\r\n" - "Cache-Control:no-cache,no-store,must-revalidate,max-age=0\r\n" - "Connection:close\r\n" - "Server:Ultravox/2.1 Shoutcast v" + gOptions.getVersionBuildStrings() + "/" SERV_OSNAME"\r\n" + - "Content-Type:misc/ultravox\r\n"); - - // this is only used for WMP which won't play the stream correctly when the in-stream - // metadata is being provided and we use the now standard HTTP response (added 2.4.3) - MSG_ICY200 = utf8("ICY 200 OK\r\n" - "icy-notice1:
This stream requires " - "Winamp
\r\n" - "icy-notice2:Shoutcast DNAS/" SERV_OSNAME " v" + - gOptions.getVersionBuildStrings() + "
\r\n" - "Connection:close\r\n"); - - MSG_ICY_HTTP401 = utf8("HTTP/1.0 401 Unauthorized\r\n" // Service Unavailable - "icy-notice1:
Shoutcast DNAS/" SERV_OSNAME " v" + - gOptions.getVersionBuildStrings() + "
\r\n" - "icy-notice2:The resource requested is currently unavailable
\r\n" - "Connection:close\r\n\r\n"); - MSG_ICY_HTTP401_LEN = (int)MSG_ICY_HTTP401.size(); -} - -utf8 g_userAgentBase = "Ultravox/2.1 ""Shoutcast Server "/**/; // user agent for sc_serv2 - // comment out for testing -utf8 g_userAgent; -time_t g_upTime = 0; - -const bool isUserAgentRelay(const utf8 &user_agent) throw() -{ - if (!user_agent.empty()) - { - return ((user_agent.find(utf8("shoutcast")) != utf8::npos) && - (user_agent != utf8("shoutcast directory tester")) && - (user_agent != utf8("relay")) && - (user_agent != utf8("icecast"))); - } - return false; -} - -const bool isUserAgentOfficial(const utf8 &user_agent) throw() -{ - if (!user_agent.empty()) - { - return ((user_agent == utf8("shoutcast directory tester")) || - (user_agent.find(utf8("shoutcast-to-dnas message sender")) == 0)); - } - return false; -} - -const utf8 redirect(const utf8 &url, const bool compress) throw() -{ - utf8 header = "HTTP/1.1 302 Found\r\n" - "Content-Type:text/html;charset=utf-8\r\n" - "Location:" + url + "\r\n"; - utf8 body = "Redirect" - "Click here for redirect." - ""; - if (compress && compressData(body)) - { - header += "Content-Encoding:gzip\r\n"; - } - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - return header + body; -} - -const utf8 urlLink(const utf8 &url, const utf8 &text, const bool embed) throw() -{ - // so the pages have a better chance of wrapping - // we'll attempt to insert to give a hint. - utf8 wbrUrl = stripHTTPprefix((!text.empty() ? text : url)), fixedUrl; - vector parts = tokenizer(wbrUrl, '/'); - for (vector::const_iterator i = parts.begin(); i != parts.end(); ++i) - { - fixedUrl += (i == parts.begin() ? "" : "/") + aolxml::escapeXML((*i)); - } - - wbrUrl.clear(); - parts = tokenizer(fixedUrl, '.'); - for (vector::const_iterator i = parts.begin(); i != parts.end(); ++i) - { - wbrUrl += (i == parts.begin() ? "" : ".") + (*i); - } - - return "" + wbrUrl + ""; -} - -const utf8 http302(const utf8 &url) throw() -{ - return "HTTP/1.1 302 Found\r\n" - "Content-Type:text/html;charset=utf-8\r\n" - "Location:" + url + "\r\n\r\n" - "RedirectClick HERE for redirect."; -} - -const utf8 addWBR(const utf8 &str) throw() -{ - if (!str.empty()) - { - // this allows browsers to word break the string on small displays - // and is aimed for user agent strings, hence / and ( to break on - utf8 wbrIdent, fixedIdent; - vector parts = tokenizer(str, '/'); - for (vector::const_iterator i = parts.begin(); i != parts.end(); ++i) - { - wbrIdent += (i == parts.begin() ? "" : "/") + aolxml::escapeXML((*i)); - } - - parts = tokenizer(wbrIdent, '('); - for (vector::const_iterator i = parts.begin(); i != parts.end(); ++i) - { - fixedIdent += (i == parts.begin() ? "" : "(") + (*i); - } - - return fixedIdent; - } - return str; -} - -utf8 getfooterStr() -{ - return ""; -} - -const utf8 randomId(utf8 &temp) -{ - temp.clear(); - - // construct a secondary temp id for this - // action for use after the check happened - for (int i = 0; i < 8; i++) - { - temp.append(utf8(tos(rand() % 10))); - } - return temp; -} - -utf8 getStreamListeners(const size_t sid, const bool nowrap, const int fh) -{ - return ""; -} - -utf8 getHTML5Remover() -{ - return ""; -} - -utf8 getIEFlexFix() -{ - return ""; -} - -utf8 g_IPAddressForClients; // address clients will connect to -u_short g_portForClients = 0; // port clients will connect to, generally portBase -int g_legacyPort = -1; // port legacy v1 sources will connect to, or not - -// attempt to compress everything in one go though -// only use if its smaller than the original data. -const bool compressData(utf8 &body) -{ - if (!body.empty()) - { - z_stream stream = {0}; - - const uInt size = (uInt)body.size(); - stream.next_in = (Bytef*)body.data(); - stream.avail_in = size; - - char *m_outMsg = new char[size * 2]; - stream.next_out = (Bytef*)m_outMsg; - stream.avail_out = size * 2; - - // set windowBits to 31 to allow gzip encoded output - if (deflateInit2(&stream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 31, 8, Z_DEFAULT_STRATEGY) == Z_OK) - { - int ret = deflate(&stream, Z_FINISH); - deflateEnd(&stream); - if (ret == Z_STREAM_END) - { - // if it's bigger than we started with then there's no - // sensible reason to return the compressed data block - if (stream.total_out < size) - { - body = utf8(m_outMsg, stream.total_out); - delete [] m_outMsg; - return true; - } - } - } - delete [] m_outMsg; - } - return false; -} - -const bool compressDataStart(utf8 &body, z_stream *stream, Bytef* name, const bool local) -{ - if (!stream || body.empty()) - { - return false; - } - - stream->zalloc = Z_NULL; - stream->zfree = Z_NULL; - stream->opaque = Z_NULL; - - // set windowBits to 31 to allow gzip encoded output - if (deflateInit2(stream, (local ? Z_BEST_COMPRESSION : Z_DEFAULT_COMPRESSION), Z_DEFLATED, 31, 8, Z_DEFAULT_STRATEGY) != Z_OK) - { - return false; - } - - if (local) - { - gz_header head = {0}; - head.text = 1; - head.name = head.comment = name; - head.time = (uLong)::time(NULL); - deflateSetHeader(stream, &head); - } - - return (compressDataCont(body, stream) != 0); -} - -const int compressDataCont(utf8 &body, z_stream *stream) -{ - #define CHUNK 1024 - static utf8 body2; - body2.clear(); - static unsigned char out[CHUNK] = {0}; - int ret = Z_OK; - uInt start = (uInt)body.size(), have = 0, pos = 0; - - do - { - if (start - pos > 0) - { - if (have == 0) - { - stream->next_in = (Bytef*)body.data(); - pos += (stream->avail_in = min(CHUNK, (int)start)); - have = start - stream->avail_in; - } - else - { - stream->next_in = (Bytef*)&body[pos]; - pos += (stream->avail_in = min(CHUNK, (int)have)); - have = have - stream->avail_in; - } - } - - do - { - stream->avail_out = CHUNK; - stream->next_out = out; - ret = deflate(stream, Z_PARTIAL_FLUSH); - body2 += utf8(out, (CHUNK - stream->avail_out)); - if (!stream->avail_in) - { - break; - } - } while (stream->avail_out == 0); - } while (ret != Z_BUF_ERROR); - - if (!body2.empty()) - { - body = body2; - } - return stream->total_out; -} - -void compressDataFinish(utf8 &body, z_stream *stream) -{ - if (stream) - { - #define CHUNK 1024 - static utf8 body2; - body2.clear(); - static unsigned char out[CHUNK] = {0}; - stream->avail_out = CHUNK; - stream->next_out = out; - deflate(stream, Z_FINISH); - body2 = utf8(out, (CHUNK - stream->avail_out)); - if (!body2.empty()) - { - body = body2; - } - } -} - -const bool compressDataEnd(z_stream *stream) -{ - return (stream && (deflateEnd(stream) == Z_OK)); -} - -const utf8 loadLocalFile(uniFile::filenameType fn, const utf8& logPrefix, const size_t sizeLimit) -{ - utf8 body; - if (!fn.empty()) - { - size_t fileSize = uniFile::fileSize(fn); - if (fileSize && (!sizeLimit || fileSize <= sizeLimit)) - { - FILE *f = uniFile::fopen(fn, "rb"); - if (f) - { - size_t alloc = fileSize + 1; - utf8::value_type *buf = new utf8::value_type[alloc]; - memset(buf, 0, sizeof(utf8::value_type) * alloc); - ::fread(buf, 1, fileSize, f); - ::fclose(f); - - body = utf8(buf,fileSize); - delete [] buf; - } - } - else if (fileSize) - { - WLOG(logPrefix + "Unable to load `" + fn + "' as it is over the allowed size limit (" + tos(sizeLimit) + " bytes)"); - } - } - return body; -} - -#ifdef _WIN32 -static const char *abb_weekdays[] = { - "Sun", - "Mon", - "Tue", - "Wed", - "Thu", - "Fri", - "Sat", - NULL -}; - -static const char *abb_month[] = { - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec", - NULL -}; - -/* - * tm_year is relative this year - */ -const int tm_year_base = 1900; - -inline int match_string(const char **buf, const char **strs) -{ - for (int i = 0; (strs && strs[i] != NULL); ++i) { - size_t len = (strs && strs[i] ? strlen(strs[i]) : 0); - if (len && strncmp(*buf, strs[i], len) == 0) { - *buf += len; - return i; - } - } - return -1; -} - -// stripped down version which only processes against '%a, %d %b %Y %H:%M:%S' -// which is only used on the Windows builds as it's native for other targets -char *strptime(const char *buf, const char *format, struct tm *timeptr) -{ - char c; - - for (; (c = *format) != '\0'; ++format) - { - char *s = 0; - - if (isspace (c)) - { - while (isspace (*buf)) ++buf; - } - else if (c == '%' && format[1] != '\0') - { - int ret; - c = *++format; - if (c == 'E' || c == 'O') c = *++format; - switch (c) - { - case 'a': - { - ret = match_string (&buf, abb_weekdays); - if (ret < 0) return NULL; - timeptr->tm_wday = ret; - break; - } - case 'b': - { - ret = match_string (&buf, abb_month); - if (ret < 0) return NULL; - timeptr->tm_mon = ret; - break; - } - case 'd': - { - ret = strtol (buf, &s, 10); - if (s == buf) return NULL; - timeptr->tm_mday = ret; - buf = s; - break; - } - case 'H': - { - ret = strtol (buf, &s, 10); - if (s == buf) return NULL; - timeptr->tm_hour = ret; - buf = s; - break; - } - case 'M': - { - ret = strtol (buf, &s, 10); - if (s == buf) return NULL; - timeptr->tm_min = ret; - buf = s; - break; - } - case 'S': - { - ret = strtol (buf, &s, 10); - if (s == buf) return NULL; - timeptr->tm_sec = ret; - buf = s; - break; - } - case 'Y': - { - ret = strtol (buf, &s, 10); - if (s == buf) return NULL; - timeptr->tm_year = ret - tm_year_base; - buf = s; - break; - } - case '\0': - { - --format; - /* FALLTHROUGH */ - } - case '%': - { - if (*buf == '%') ++buf; - else return NULL; - break; - } - default: - { - if (*buf == '%' || *++buf == c) ++buf; - else return NULL; - break; - } - } - } - else - { - if (*buf == c) ++buf; - else return NULL; - } - } - return (char *)buf; -} -#endif - -const time_t readRFCDate(const utf8& str) -{ - struct tm tmdate = {0}; - if (strptime(str.toANSI().c_str(), "%a, %d %b %Y %H:%M:%S", &tmdate)) - { - #ifdef _WIN32 - return _mkgmtime(&tmdate); - #else - return timegm(&tmdate); - #endif - } - return 0; -} - -const utf8 getRFCDate(const time_t use) -{ - char buf[1024] = {0}; - const time_t now = ::time(NULL); - struct tm tm = *gmtime((use ? &use : &now)); - const size_t size = strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S GMT", &tm); - return (size > 0 ? utf8(buf, size) : (utf8)""); -} - -const utf8 timeString(const time_t t, const bool slim) throw() -{ - __int64 sec = t; - __int64 min = sec / 60; - sec -= min * 60; - __int64 hours = min / 60; - min -= hours * 60; - - if (slim) - { - char buf[24] = {0}; - snprintf(buf, sizeof(buf), "%02lld:%02u:%02u", hours, (unsigned int)min, (unsigned int)sec); - return buf; - } - else - { - utf8 result; - __int64 days = hours / 24; - hours -= days * 24; - const __int64 years = days / 365; - days -= years * 365; - - if (years) result += tos(years) + " year" + (years != 1 ? "s" : "") + " "; - if (days) result += tos(days) + " day" + (days != 1 ? "s" : "") + " "; - if (hours) result += tos(hours) + " hour" + (hours != 1 ? "s" : "") + " "; - if (min) result += tos(min) + " minute" + (min != 1 ? "s" : "") + " "; - if (sec) result += tos(sec) + " second" + (sec != 1 ? "s" : ""); - return stripWhitespace(result); - } -} - -class jsonEscapes: public map -{ -public: - jsonEscapes() - { - (*this)['\\'] = "\\\\"; - (*this)['/'] = "\\/"; - (*this)['\"'] = "\\\""; - (*this)['\b'] = "\\b"; - (*this)['\f'] = "\\f"; - (*this)['\n'] = "\\n"; - (*this)['\r'] = "\\r"; - (*this)['\t'] = "\\t"; - } -}; - -static const jsonEscapes gsJSONEscapes; - -const utf8 escapeJSON(const utf8 &s) throw() -{ - string result; - const string::size_type siz = s.size(); - for (string::size_type x = 0; x < siz; ++x) - { - jsonEscapes::const_iterator i = gsJSONEscapes.find(s[x]); - if (i != gsJSONEscapes.end()) - { - result += (*i).second; - } - else - { - result += s[x]; - } - } - return result; -} - -void rotatew3cFiles(utf8 files) -{ - // w3c logging (global) - if (gOptions.w3cEnable()) - { - if (files == "w3c" || files == "") - { - w3cLog::rotate_log(gOptions.w3cLog()); - } - } - - // w3c logging (per stream) - if (files == "w3c" || files == "") - { - config::streams_t streams; - gOptions.getStreamConfigs(streams); - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - if (gOptions.read_stream_w3cLog((*i).first)) - { - w3cLog::rotate_log(gOptions.stream_w3cLog((*i).first),(*i).first); - } - } - } -} - -utf8 &fixSongMetadata(utf8& metadata, int& trigger) -{ - utf8::size_type pos = metadata.find((unsigned char *)"Advert:", 0, 7); - - if (pos == utf8::npos) - pos = metadata.find((unsigned char *)"Advert!", 0, 7); - - if (!metadata.empty() && (pos == 0)) - { - trigger = 1; - - // got a first matching block - metadata.erase (0, 7); - - // look for an end block - metadata = stripWhitespace(metadata); - - // check for it being empty after stripping out non-alpha - // characters so we can show what is sent to the listener - if (stripAlphaDigit(metadata).empty()) - { - metadata.clear(); - } - } - return metadata; -} - -const utf8 getCurrentSong(utf8 currentSong) -{ - int trigger = 0; - utf8 &song = fixSongMetadata(currentSong, trigger); - if (trigger) - { - if (song.empty()) - { - song = "" + utf8(trigger == 2 ? "Test " : "") + "Advert Trigger"; - } - else - { - song = "" + utf8(trigger == 2 ? "Test " : "") + "Advert Trigger:  " + aolxml::escapeXML(song) + ""; - } - } - else - { - if (song.empty()) - { - song = "Empty Title"; - } - else - { - song = aolxml::escapeXML(song); - } - } - - return song; -} - -const utf8 stripHTTPprefix(const utf8& addr) -{ - if (!addr.empty()) - { - utf8::size_type pos = addr.find(utf8("://")); - if (pos != utf8::npos) - { - return addr.substr(pos + 3); - } - } - return addr; -} - -const bool isAddress(const utf8& addr) -{ - if (!addr.empty()) - { - if (addr.find(utf8(".")) != utf8::npos) - { - return true; - } - } - return false; -} - -const bool extractPassword(utf8 &dj_password, utf8 &dj_name, int &streamID) -{ - if (!dj_password.empty()) - { - const vector tokens = tokenizer(dj_password, ':'); - // if 2 or 3 then we've got user:password or password:#sid or - // user:password:#sid so we need to check for which version - if (tokens.size() >= 2) - { - if (tokens[1].size() > 0) - { - // this is user:password:#sid or user:password - if (tokens[1].find(utf8("#")) != 0) - { - dj_password = tokens[1]; - dj_name = tokens[0]; - - if (tokens.size() == 3) - { - if (tokens[2].size() > 1) - { - if (tokens[2].find(utf8("#")) == 0) - { - streamID = atoi((const char *)tokens[2].c_str()+1); - } - } - } - } - // this could be password:#sid - else - { - streamID = atoi((const char *)tokens[1].c_str()+1); - dj_password = tokens[0]; - } - return true; - } - } - } - return false; -} - -#ifdef _WIN32 - -const utf8 errMessage() throw() -{ - LPVOID lpMsgBuf = NULL; - ::FormatMessageW( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR) &lpMsgBuf, - 0, - NULL - ); - if (lpMsgBuf) - { - utf32 u32((const wchar_t*)lpMsgBuf); - const utf8 result = stripWhitespace(u32.toUtf8()); - ::LocalFree(lpMsgBuf); - return result; - } - return "Unknown error"; -} - -#else -#include -#include -#include "stl/stringUtils.h" -#include - -const utf8 errMessage() throw() -{ - const int e = errno; - const utf8 b = strerror(e); - return (!b.empty() ? utf8(b) : tos(e)); -} - -#endif - -#ifdef _WIN32 -#define _WS2DEF_ -#define _WINSOCK2API_ -#endif -#include "threadedRunner.h" -const int getStreamBitrate(const httpHeaderMap_t &headers) -{ - const int bitrate = mapGet(headers, "icy-br", 0); - if (!bitrate) - { - // try to find a bitrate if not provided by looking at the possible Icecast info header - const utf8 info = mapGet(headers, "ice-audio-info", utf8()); - if (!info.empty()) - { - vector blocks = tokenizer(info, ';'); - for (vector::const_iterator i = blocks.begin(); i != blocks.end(); ++i) - { - vector pairs = tokenizer((*i), '='); - if (pairs.size() == 2) - { - utf8 key = toLower(stripWhitespace(pairs[0])); - if (!key.empty()) - { - // should just be "ice-bitrate" but seen some servers use "bitrate" - if ((key == "bitrate") || (key == "ice-bitrate")) - { - return atoi((const char *)stripWhitespace(pairs[1]).c_str()); - } - } - } - } - } - } - return bitrate; -} - -const int getStreamSamplerate(const httpHeaderMap_t &headers) -{ - const int samplerate = mapGet(headers, "icy-sr", 0); - if (!samplerate) - { - // try to find a bitrate if not provided by looking at the possible Icecast info header - const utf8 info = mapGet(headers, "ice-audio-info", utf8()); - if (!info.empty()) - { - vector blocks = tokenizer(info, ';'); - for (vector::const_iterator i = blocks.begin(); i != blocks.end(); ++i) - { - vector pairs = tokenizer((*i), '='); - if (pairs.size() == 2) - { - utf8 key = toLower(stripWhitespace(pairs[0])); - if (!key.empty()) - { - if (key == "samplerate") - { - return atoi((const char *)stripWhitespace(pairs[1]).c_str()); - } - } - } - } - } - } - return samplerate; -} - -const int getHTTPRequestDetails(const string &firstLine, string &request, string &url, string &protocolAndVersion) -{ - const vector parts = tokenizer(firstLine, ' '); - if (!parts.empty()) - { - int state = 0, partsCount = (int)parts.size(); - switch (partsCount) - { - case 3: - { - request = parts[0]; - url = parts[1]; - protocolAndVersion = parts[2]; - state = partsCount; - } - break; - case 2: - { - request = parts[0]; - url = parts[1]; - // this allows things like old v1 sc_trans to send - // title updates without failing (like v1 allowed) - protocolAndVersion = "HTTP/1.0"; - state = 3; - } - break; - case 1: - { - request = parts[0]; - state = partsCount; - } - break; - default: - { - // if we're here then it's likely that it's an - // incorrectly encoded request and we'll need - // to re-combine to make the 'url' not cludge - // the expected data for 'protocolAndVersion'. - request = parts[0]; - for (int i = 1; i < partsCount - 1; i++) - { - url += (i != 1 ? " " : "") + parts[i]; - } - protocolAndVersion = parts[partsCount - 1]; - state = 3; - } - break; - } - return state; - } - return 0; -} - -const utf8 fixMimeType(const utf8& mimeType) -{ - if (mimeType.empty() || (mimeType == "mp3") || (mimeType == "audio/mp3")) - { - return "audio/mpeg"; - } - if (mimeType == "audio/aac") - { - return "audio/aacp"; - } - return mimeType; -} - -const int detectAutoDumpTimeout(time_t &cur_time, const time_t lastActivityTime, - const utf8& msg, const bool debug, - const size_t streamID) throw(runtime_error) -{ - const int autoDumpTime = gOptions.getAutoDumpTime(streamID); - cur_time = ::time(NULL); - if ((autoDumpTime > 0) && ((cur_time - lastActivityTime) >= autoDumpTime)) - { - throwEx((debug ? (msg + " (" + tos(cur_time) + " " + - tos(lastActivityTime) + " [" + - tos(cur_time - lastActivityTime) + "])") : (utf8)"")); - } - return autoDumpTime; -} - -const utf8 sampleRateStr(const int sr) -{ - switch (sr) - { - case 88200: - { - return "88.2 kHz"; - } - case 44100: - { - return "44.1 kHz"; - } - case 22050: - { - return "22.05 kHz"; - } - case 11025: - { - return "11.025 kHz"; - } - case 7350: - { - return "7.35 kHz"; - } - default: - { - // 96, 64, 48, 32, 24, 16, 12, 8 - return (sr > 0 ? tos(sr / 1000) : "unknown") + " kHz"; - } - } -} - -const __uint64 time_now_ms() -{ -#ifdef _WIN32 - FILETIME ft = {0}; - ::GetSystemTimeAsFileTime(&ft); - - __uint64 t = ((__uint64)(ft.dwHighDateTime) << 32) | ft.dwLowDateTime; - - t -= 116444736000000000LL; // convert epoch as there's this - // many 100ns between 1601 & 1970 - t /= 10000; // convert to milliseconds as this is - // based on the number of 100-nanosecond - // intervals since January 1, 1601 (UTC) - return t; -#else - struct timeval now; - gettimeofday(&now, NULL); - return (((__uint64)now.tv_sec) * 1000) + (now.tv_usec / 1000); -#endif -} - -const bool isRemoteAddress(const utf8 &addr) -{ - return (!addr.empty() && - (addr.find(utf8("127.")) != 0) && - (addr.find(utf8("10.")) != 0) && - (addr.find(utf8("192.168.")) != 0) && - (addr.find(utf8("192.0.0.")) != 0) && - (addr.find(utf8("198.18.")) != 0) && - (addr.find(utf8("198.19.")) != 0) && - (toLower(addr).find(utf8("localhost")) != 0)); -} diff --git a/Src/Plugins/DSP/sc_serv3/global.h b/Src/Plugins/DSP/sc_serv3/global.h deleted file mode 100644 index 6f2065f0..00000000 --- a/Src/Plugins/DSP/sc_serv3/global.h +++ /dev/null @@ -1,218 +0,0 @@ -#pragma once -#ifndef global_H_ -#define global_H_ - -#include "config.h" -#include "versions.h" -#include -#include - -// #define INCLUDE_BACKUP_STREAMS 1 -// #define INCLUDE_SSL_CERTS 1 - -#define EL "\n" - -#ifdef _WIN32 -#define getpid _getpid -#define MAXHOSTNAMELEN 256 -#endif -#ifndef MAXHOSTNAMELEN -#ifndef HOST_NAME_MAX -#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX -#endif -#define MAXHOSTNAMELEN HOST_NAME_MAX -#endif - -extern config gOptions; -extern size_t gFF_fix; - -// manage killed state -const int iskilled() throw(); -void setkill(int v) throw(); - -// manage post-setup handling -const int isPostSetup() throw(); -void setPostSetup(int v) throw(); - -// helper template to throw an exception with a utf8 stream -template inline void throwEx(const char *msg) throw(T) { throw T(msg); } -template inline void throwEx(const uniString::utf8 &msg) throw(T) { throw T(msg.hideAsString()); } -template inline void throwEx(const std::string &msg) throw(T) { throw T(msg); } - -// subclass used to distinguish between error messages that are already labeled -// with [] and those that aren't -class tagged_error: public std::runtime_error -{ -public: - explicit tagged_error(const std::string &s):runtime_error(s){} -}; - - -struct parserInfo -{ - unsigned long m_mask; - unsigned long m_pattern; - unsigned int m_samplerate; - int m_version; - int m_bitrate; - unsigned m_frameCount; - unsigned m_reduce; - float m_duration; - bool m_inUse; - std::string m_description; - - virtual int verifyFrame (const unsigned char *buf, unsigned int len) = 0; - virtual const std::string &getDescription() const { return m_description; } - virtual const char *getVersionName() const = 0; - - parserInfo(unsigned long mask = 0, unsigned long v = 0) { m_mask = mask; m_pattern = v; m_samplerate = m_bitrate = 0; m_inUse = false; m_frameCount = m_reduce = 0; m_duration = 0.0; m_version = 0; } - virtual int getUvoxType() = 0; - virtual ~parserInfo() {} -}; - -/////////////// various strings ///////////////////////////// - -void constructMessageResponses(); - -extern const uniString::utf8::value_type* MSG_INVALIDPASSWORD; -extern const int MSG_INVALIDPASSWORD_LEN; - -extern const uniString::utf8::value_type* MSG_VALIDPASSWORD; -extern const int MSG_VALIDPASSWORD_LEN; - -extern const uniString::utf8::value_type* MSG_HTTP_VALIDPASSWORD; -extern const int MSG_HTTP_VALIDPASSWORD_LEN; - -extern const uniString::utf8::value_type* MSG_BADSTREAMID; -extern const int MSG_BADSTREAMID_LEN; - -extern const uniString::utf8::value_type* MSG_STREAMINUSE; -extern const int MSG_STREAMINUSE_LEN; - -extern const uniString::utf8::value_type* MSG_STREAMMOVED; -extern const int MSG_STREAMMOVED_LEN; - -extern uniString::utf8 MSG_ICY_HTTP401; -extern uniString::utf8 MSG_ICY200; -extern uniString::utf8 MSG_ICY_HTTP200; -extern uniString::utf8 MSG_UVOX_HTTP200; - -extern int MSG_ICY_HTTP401_LEN; - -extern const uniString::utf8::value_type* MSG_AUTHFAILURE401; - -extern const uniString::utf8::value_type* MSG_200; -extern const uniString::utf8::value_type* MSG_NO_CLOSE_200; -extern const uniString::utf8::value_type* MSG_STD200; - -extern const uniString::utf8::value_type* MSG_HTTP400; - -extern const uniString::utf8::value_type* MSG_HTTP403; - -extern const uniString::utf8::value_type* MSG_HTTP404; -extern const int MSG_HTTP404_LEN; - -extern const uniString::utf8::value_type* MSG_HTTP405; - -extern const uniString::utf8::value_type* MSG_HTTP503; -extern const int MSG_HTTP503_LEN; - -extern uniString::utf8 g_userAgentBase; // user agent for sc_serv2 -extern uniString::utf8 g_userAgent; // user agent for sc_serv2 - -extern time_t g_upTime; -const uniString::utf8 timeString(const time_t t, const bool slim = false) throw(); - -const bool isUserAgentRelay(const uniString::utf8 &user_agent) throw(); -const bool isUserAgentOfficial(const uniString::utf8 &user_agent) throw(); - -const uniString::utf8 redirect(const uniString::utf8 &url, bool compress) throw(); -const uniString::utf8 urlLink(const uniString::utf8 &url, const uniString::utf8 &text = "", const bool embed = false) throw(); - -const uniString::utf8 http302(const uniString::utf8 &url) throw(); - -const uniString::utf8 addWBR(const uniString::utf8 &str) throw(); - -uniString::utf8 getfooterStr(); -uniString::utf8 getHTML5Remover(); -uniString::utf8 getIEFlexFix(); -uniString::utf8 getStreamListeners(const size_t sid, const bool nowrap, const int fh); - -extern uniString::utf8 g_IPAddressForClients; // address clients will connect to -extern u_short g_portForClients; // port clients will connect to, generally portBase -extern int g_legacyPort; // port legacy v1 sources will connect to, or not - -const bool reloadConfig(int force); -void reloadBanLists(); -void reloadRipLists(); -void reloadAdminAccessList(); -void reloadAgentLists(); -void rotatew3cFiles(uniString::utf8 files); - -const uniString::utf8 loadLocalFile(uniFile::filenameType fn, const uniString::utf8& logPrefix = "", const size_t sizeLimit = 0); - -const uniString::utf8 escapeJSON(const uniString::utf8 &s) throw(); - -// creates GZIP (RFC 1952) encoded output as -// either one go or in blocks for logs, etc -#include -const bool compressData(uniString::utf8 &body); -const bool compressDataStart(uniString::utf8 &body, z_stream *stream, Bytef* name = (Bytef*)"sc_serv.log\0", bool local = true); -const int compressDataCont(uniString::utf8 &body, z_stream *stream); -void compressDataFinish(uniString::utf8 &body, z_stream *stream); -const bool compressDataEnd(z_stream *stream); - - -// used for getting and setting modified dates on relevant http responses -// set use = 0 for current time, otherwise pass in a time_t as needed -const uniString::utf8 getRFCDate(const time_t use); -const time_t readRFCDate(const uniString::utf8& str); -#ifdef _WIN32 -char *strptime(const char *buf, const char *format, struct tm *timeptr); -#endif -const uniString::utf8 getStreamPath(const size_t sid, const bool for_public = false); - -const bool isCDNMaster(size_t sid); -const bool isCDNSlave(size_t sid); - -#ifndef _WIN32 -#define localtime_s(x,y) localtime_r(y,x) -#else -#define snprintf _snprintf -#endif - -// return system error string -const uniString::utf8 errMessage() throw(); - -const uniString::utf8 bob(); - -void printUpdateMessage(); - -extern uniString::utf8 listenerId; -const uniString::utf8 randomId(uniString::utf8 &temp); - -const uniString::utf8 getCurrentSong(uniString::utf8 currentSong); -const uniString::utf8 stripHTTPprefix(const uniString::utf8& addr); - -const bool isAddress(const uniString::utf8& addr); - -const bool extractPassword(uniString::utf8 &dj_password, uniString::utf8 &dj_name, int &streamID); - -typedef std::map httpHeaderMap_t; -const int getStreamBitrate(const httpHeaderMap_t &headers); -const int getStreamSamplerate(const httpHeaderMap_t &headers); -const int getHTTPRequestDetails(const std::string &firstLine, std::string &request, - std::string &url, std::string &protocolAndVersion); -const uniString::utf8 fixMimeType(const uniString::utf8& mimeType); - -const uniString::utf8 sampleRateStr(const int sr); - -const int detectAutoDumpTimeout(time_t &cur_time, const time_t lastActivityTime, - const uniString::utf8& msg, const bool debug, - const size_t streamID = DEFAULT_SOURCE_STREAM) throw(std::runtime_error); - -const __uint64 time_now_ms(); - -const bool isRemoteAddress(const uniString::utf8 &addr); - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/icy.ico b/Src/Plugins/DSP/sc_serv3/icy.ico deleted file mode 100644 index ba0bb6d7..00000000 Binary files a/Src/Plugins/DSP/sc_serv3/icy.ico and /dev/null differ diff --git a/Src/Plugins/DSP/sc_serv3/libcurl_building.txt b/Src/Plugins/DSP/sc_serv3/libcurl_building.txt deleted file mode 100644 index 2cd06c23..00000000 --- a/Src/Plugins/DSP/sc_serv3/libcurl_building.txt +++ /dev/null @@ -1,43 +0,0 @@ ------------------------------------------------------------------------------------------------------- - -OpenSSL -------- -Linux / BSD / Mac OS X / Raspbian - -./config no-ssl2 no-ssl3 no-unit-test no-shared - - -Windows - -Note: Use "Visual Studio 2008 Command Prompt" -build-openssl.bat build x86 static release -build-openssl.bat build x86 static debug - -Note: Use "Visual Studio 2008 x64 Win64 Command Prompt" -build-openssl.bat build x64 static release -build-openssl.bat build x64 static debug - -The generated lib files are created in build\openssl-x[86|64]-static-[release|debug]-vs2008\lib - ------------------------------------------------------------------------------------------------------- - -libcurl -------- -Need to ensure that --with-ssl is set to the correct version of openssl being used otherwise we'll have inconsistencies in the generated libraries :o( -(and not to use my folder path) - -Linux / BSD (SSL) - change the openssl path as needed - -./configure --with-ssl=/home/dro/Desktop/sc_serv3/openssl --disable-shared --disable-rtsp --disable-verbose --disable-dict --disable-file --disable-ftp --disable-gopher --disable-imap --disable-pop3 --disable-smtp --disable-telnet --disable-tftp --without-libidn --disable-smb --disable-dependency-tracking - - -Mac OS X (SSL) - change the openssl path as needed - -./configure --with-ssl=/Users/dro/Desktop/sc_serv3/openssl --disable-shared --disable-rtsp --disable-verbose --disable-dict --disable-file --disable-ftp --disable-gopher --disable-imap --disable-pop3 --disable-smtp --disable-telnet --disable-tftp --without-libidn --disable-ldap --disable-ldaps --disable-smb --disable-dependency-tracking - - -Raspbian (SSL) - change the openssl path as needed - -./configure --with-ssl=/home/pi/sc_serv3/openssl --disable-shared --disable-rtsp --disable-verbose --disable-dict --disable-file --disable-ftp --disable-gopher --disable-imap --disable-pop3 --disable-smtp --disable-telnet --disable-tftp --without-libidn --disable-ldap --disable-rtmp --disable-scp --disable-sftp --without-libssh2 --without-librtmp --disable-smb --disable-dependency-tracking - -Note: may also need to do 'apt-get install libcurl4-openssl-dev' first so that libcurl will see that there's a valid OpenSSL setup, otherwise HTTPS support will not build. diff --git a/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/ARMv6/libexpat.a b/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/ARMv6/libexpat.a deleted file mode 100644 index 6ca029f7..00000000 Binary files a/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/ARMv6/libexpat.a and /dev/null differ diff --git a/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/ARMv7/libexpat.a b/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/ARMv7/libexpat.a deleted file mode 100644 index 91505b28..00000000 Binary files a/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/ARMv7/libexpat.a and /dev/null differ diff --git a/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/BSD/libexpat.a b/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/BSD/libexpat.a deleted file mode 100644 index 7994b76c..00000000 Binary files a/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/BSD/libexpat.a and /dev/null differ diff --git a/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/Darwin/libexpat.a b/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/Darwin/libexpat.a deleted file mode 100644 index 5b003776..00000000 Binary files a/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/Darwin/libexpat.a and /dev/null differ diff --git a/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/Linux_i686/libexpat.a b/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/Linux_i686/libexpat.a deleted file mode 100644 index 58672792..00000000 Binary files a/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/Linux_i686/libexpat.a and /dev/null differ diff --git a/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/Linux_x86_64/libexpat.a b/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/Linux_x86_64/libexpat.a deleted file mode 100644 index d24c5d8d..00000000 Binary files a/Src/Plugins/DSP/sc_serv3/libs/Aol_XML/Linux_x86_64/libexpat.a and /dev/null differ diff --git a/Src/Plugins/DSP/sc_serv3/main.cpp b/Src/Plugins/DSP/sc_serv3/main.cpp deleted file mode 100644 index 3b167b49..00000000 --- a/Src/Plugins/DSP/sc_serv3/main.cpp +++ /dev/null @@ -1,1213 +0,0 @@ -#ifdef _WIN32 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0601 -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include -#include "services/stdServiceImpl.h" -#include "file/fileUtils.h" -#include "global.h" -#include "threadedRunner.h" -#include "protocol_relay.h" -#include "w3cLog.h" -#include "yp2.h" -#include "updater.h" -#include "auth.h" -#include "streamData.h" -#include "adminList.h" -#include "banList.h" -#include "ripList.h" -#include "agentList.h" -#include "cpucount.h" -#include "stats.h" -#include "bandwidth.h" -#include "cache.h" - -#ifdef _WIN32 -#define _WSPIAPI_H_ -#endif -//#include - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define LOGNAME "[MAIN] " - -#ifdef _WIN32 -#include -static void win32SocketSetup() throw(runtime_error) -{ - WSADATA wsaData = {0}; - WORD wVersionRequested = MAKEWORD( 2, 2 ); - int err = WSAStartup(wVersionRequested, &wsaData); - if (err != 0) - { - throw runtime_error("Could not find usable Winsock DLL"); - } - - /* Confirm that the WinSock DLL supports 2.2.*/ - /* Note that if the DLL supports versions greater */ - /* than 2.2 in addition to 2.2, it will still return */ - /* 2.2 in wVersion since that is the version we */ - /* requested. */ - - if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) - { - /* Tell the user that we could not find a usable */ - /* WinSock DLL. */ - WSACleanup(); - throw runtime_error("Could not find appropriate winsock dll version"); - } - /* The WinSock DLL is acceptable. Proceed. */ - - // if we can detect WSAPoll(..) then we'll use that over - // select which means Vista+ should be similar to Linux. - HINSTANCE ws2_32 = GetModuleHandle(TEXT("WS2_32.DLL")); - if (ws2_32 != NULL) - { - typedef INT (WSAAPI *LPFN_WSAPOLL)(LPWSAPOLLFD fdarray, ULONG nfds, INT timeout); - extern LPFN_WSAPOLL fnWSAPoll; - fnWSAPoll = (LPFN_WSAPOLL)GetProcAddress(ws2_32, "WSAPoll"); - } -} - -static void win32SocketCleanup() throw() -{ - WSACleanup(); -} -#else -int _kbhit(void) -{ - struct termios oldt, newt; - tcgetattr(STDIN_FILENO, &oldt); - newt = oldt; - newt.c_lflag &= ~(ICANON | ECHO); - tcsetattr(STDIN_FILENO, TCSANOW, &newt); - int oldf = fcntl(STDIN_FILENO, F_GETFL, 0); - fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK); - - int ch = getchar(); - tcsetattr(STDIN_FILENO, TCSANOW, &oldt); - fcntl(STDIN_FILENO, F_SETFL, oldf); - - return (ch != EOF); -} -#endif - -void scheduleRelay(const config::streamConfig &info) throw() -{ - // only attempt to run if not indicated as having moved - if(gOptions.stream_movedUrl(info.m_streamID).empty()) - { - threadedRunner::scheduleRunnable(new protocol_relay(info)); - } -} - -utf8 getLogFile(utf8 fileName) -{ -#ifdef _WIN32 - // this will fill in the default log path as required - wchar_t s_defaultFileName[MAX_PATH] = {0}; - ExpandEnvironmentStringsW(DEFAULT_LOGW, s_defaultFileName, MAX_PATH); - utf8 m_defaultFilename(utf32(s_defaultFileName).toUtf8()), m_fileName = fileName; - - HANDLE m_file = ::CreateFileW(m_fileName.toWString().c_str(),GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); - if (m_file == INVALID_HANDLE_VALUE) - { - m_file = ::CreateFileW(m_defaultFilename.toWString().c_str(),GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); - if (m_file == INVALID_HANDLE_VALUE) - { - uniFile::filenameType fallbackFilename("%temp%\\sc_serv_" + tos(getpid()) + ".log"); - wchar_t s_fallbackFileName[MAX_PATH] = {0}; - ExpandEnvironmentStringsW(fallbackFilename.toWString().c_str(), s_fallbackFileName, MAX_PATH); - utf8 m_fallbackFilename(utf32(s_fallbackFileName).toUtf8()); - - m_file = ::CreateFileW(m_fallbackFilename.toWString().c_str(),GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); - if (m_file != INVALID_HANDLE_VALUE) - { - forgetHandleInvalid(m_file); - } - else - { - m_fileName = m_fallbackFilename; - } - } - else - { - m_fileName = m_defaultFilename; - } - } -#else - utf8 m_defaultFilename = gOptions.logFile_Default(), m_fileName = fileName; - - int m_file = ::open(m_fileName.hideAsString().c_str(),O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - if (m_file == -1) - { - m_file = ::open(m_defaultFilename.hideAsString().c_str(),O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - if (m_file == -1) - { - uniFile::filenameType fallbackFilename("/tmp/sc_serv_" + tos(getpid()) + ".log"); - m_file = ::open(fallbackFilename.hideAsString().c_str(),O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - if (m_file == -1) - { - throw runtime_error("Logger could not open the log file \"" + m_fileName.hideAsString() + "\" for writing [" + errMessage().hideAsString() + "]. Check the directory exists and another instance is not already running."); - } - else - { - m_fileName = fallbackFilename; - } - } - else - { - m_fileName = m_defaultFilename; - } - } -#endif - return m_fileName; -} - -// event triggers for main loop -static vector s_ControlEvents; - -class sc_serv2_service -{ - // log messages that have been stuffed in config objects deferred list. - // this only need be called at startup, to display messages that were created during - // system initialization, but could not be displayed because the loggers didn't yet exist. - static void logDeferredMessages() - { - const vector &deferred_error_log_messages(gOptions.deferredErrorLogMessages()); - for (vector::const_iterator i = deferred_error_log_messages.begin(); i != deferred_error_log_messages.end(); ++i) - { - ELOG((*i).hideAsString()); - } - - const vector &deferred_warn_log_messages(gOptions.deferredWarnLogMessages()); - for (vector::const_iterator i = deferred_warn_log_messages.begin(); i != deferred_warn_log_messages.end(); ++i) - { - WLOG((*i).hideAsString()); - } - - gOptions.clearDeferredErrorLogMessages(); - gOptions.clearDeferredWarnLogMessages(); - } - -public: - static void addCustomLogElements() {} - sc_serv2_service() {} - - // main application loop - static int go(stdServiceBase &base) throw() - { - g_upTime = ::time(NULL); - g_userAgent = g_userAgentBase + gOptions.getVersionBuildStrings(); - #ifdef _WIN32 - bool win32_socket_cleanup_required(false); - #endif - int mainResult = 0; // result of main loop - utf8 pidFn; - vector runners; - - try - { -runserver: -#ifdef CONFIG_BUILDER - bool builderMode = (gOptions.confFile() == "builder" || gOptions.confFile() == "-b"); - bool setupMode = (gOptions.confFile() == "setup" || gOptions.confFile() == "-s" || builderMode); -#else - bool setupMode = (gOptions.confFile() == "setup" || gOptions.confFile() == "-s"); -#endif - bool gotConfig = (!gOptions.confFile().empty() && uniFile::fileExists(gOptions.confFile())); - // look for sc_serv.conf or sc_serv.ini to emulate v1 DNAS behaviour as - // too many people cannot get on with having to specify a config file :( - if (gotConfig == false && setupMode == false) - { - utf8 currentLogFile = gOptions.logFile(); - - #ifdef _WIN32 - vector fileList = fileUtil::directoryFileList(gStartupDirectory.toWString() + L"sc_serv.ini", L"", true, true); - vector fileListConf = fileUtil::directoryFileList(gStartupDirectory.toWString() + L"sc_serv.conf", L"", true, true); - #else - vector fileList = fileUtil::directoryFileList(gStartupDirectory.hideAsString() + "sc_serv.ini", ""); - vector fileListConf = fileUtil::directoryFileList(gStartupDirectory.hideAsString() + "sc_serv.conf", ""); - #endif - - if (!fileList.empty()) - { - fileList.insert(fileList.end(), fileListConf.begin(),fileListConf.end()); - } - else - { - fileList = fileListConf; - } - - if (!fileList.empty()) - { - #ifdef _WIN32 - utf32 u32file(fileList[0]); - utf8 u8f(u32file.toUtf8()); - gotConfig = gOptions.load(u8f); - #else - gotConfig = gOptions.load(fileList[0]); - #endif - } - - // if these do not match then we need to update the log file being used - // as otherwise it reports the wrong thing on the admin pages, etc - if (gOptions.logFile() != currentLogFile) - { - base.startNormalLog(false); - } - } - - if (isPostSetup() == false) - { - if (gOptions.screenLog()) - { - base.startScreenLog(); - } - // during initial startup some messages are produced but cannot be logged because - // the loggers do not yet exist. These are in the deferred list. At this point they - // can be safely logged - logDeferredMessages(); - - gOptions.m_certPath = fileUtil::getFullFilePath(gStartupDirectory + "cacert.pem"); - if (!uniFile::fileExists(gOptions.m_certPath)) - { - WLOG(LOGNAME "Cannot find `" + gOptions.m_certPath + "'"); - WLOG(LOGNAME "Without `cacert.pem' the DNAS may not be able to contact the Directory"); - WLOG(LOGNAME "The latest can be downloaded from `http://curl.haxx.se/ca/cacert.pem'" + eol()); - } - - #ifdef _WIN32 - ILOG("*********************" + - string(!sDaemon ? "***************************" : "<>") + - "*********************"); - #else - ILOG("*********************" + - string(!sDaemon ? "***************************" : "<>") + - "*********************"); - #endif - ILOG("** Shoutcast Distributed Network Audio Server (DNAS) **"); - ILOG("** Copyright (C) 2014-2023 Radionomy SA, All Rights Reserved **"); - if (gotConfig == false && setupMode == false) - { - ILOG("** Use \"sc_serv [filename]\" to specify a config file **"); - } - ILOG("*********************************************************************"); - utf8 version = gOptions.getVersionBuildStrings(); -#if defined(_DEBUG) || defined(DEBUG) - version += "[DBUG]"; -#endif - ILOG(LOGNAME "Shoutcast DNAS/" SERV_OSNAME " v" + version + " (" __DATE__ ")"); - ILOG(LOGNAME "PID: " + tos(getpid())); - } - if (gotConfig) - { - ILOG(LOGNAME "Saving log output to `" + fileUtil::getFullFilePath(gOptions.realLogFile()) + "'"); - ILOG(LOGNAME "Automatic log rotation " + (!gOptions.rotateInterval() ? utf8("disabled") : utf8("interval: ") + timeString(gOptions.rotateInterval()))); - ILOG(LOGNAME "Loaded config from `" + fileUtil::getFullFilePath(gOptions.confFile()) + "'"); - } - else - { - uniFile::filenameType oldLogFile = gOptions.logFile(); - // if we get to this state then to make things easier, we attempt to offer - // some possible configuration files to attempt to load as the config file - int mode = (setupMode ? 2 : gOptions.promptConfigFile()); - if (mode <= 0) - { - if (mode == -1) - { - ELOG(LOGNAME "Aborting as no valid config files could be found."); - throwEx(LOGNAME "Try running setup mode to create a valid config file."); - } - else if (mode == -2) - { - throwEx(LOGNAME "Aborting at user request."); - } - else - { - if (!gOptions.confFile().empty() && !uniFile::fileExists(gOptions.confFile())) - { - throwEx(LOGNAME "Passed config file does not exist (check the file path exists)"); - } - else - { - throwEx(LOGNAME "No config file passed"); - } - } - } - else if (mode == 1) - { - // if these do not match then we need to update the log file being used - utf8 newLogFile = getLogFile(gOptions.logFile()); - if (newLogFile != oldLogFile) - { - uniString::utf8 file = newLogFile.substr(0,gOptions.logFile().rfind(fileUtil::getFilePathDelimiter())).c_str(); - if ((file == newLogFile) || fileUtil::directoryExists(fileUtil::onlyPath(newLogFile))) - { - #ifdef _WIN32 - // see if we can create the file, if not then just keep using the temp folder for the log file as we know it's ok - HANDLE m_file = ::CreateFileW(newLogFile.toWString().c_str(),GENERIC_WRITE, - FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); - if (m_file != INVALID_HANDLE_VALUE) - { - gOptions.setOption(utf8("reallogfile"), newLogFile); - forgetHandleInvalid(m_file); - base.startNormalLog(true); - } - // make sure it's showing the correct log file - else - { - // this will fill in the default log path as required - wchar_t m_fileName[MAX_PATH] = {0}; - ExpandEnvironmentStringsW(DEFAULT_LOGW, m_fileName, MAX_PATH); - utf8 log(utf32(m_fileName).toUtf8()); - gOptions.setOption(utf8("logfile"), log); - gOptions.setOption(utf8("reallogfile"), log); - ILOG(LOGNAME "Logger keeping log file as `" + fileUtil::getFullFilePath(log) + "'"); - ILOG(LOGNAME "Check you have write permissions for the folder(s) set in the config file."); - } - #else - // see if we can create the file, if not then just keep using the temp folder for the log file as we know it's ok - int m_file = ::open(newLogFile.hideAsString().c_str(),O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - if (m_file != -1) - { - ::close(m_file); - gOptions.setOption(utf8("reallogfile"), newLogFile); - base.startNormalLog(true); - } - // make sure it's showing the correct log file - else - { - // this will fill in the default log path as required - utf8 log(DEFAULT_LOG); - gOptions.setOption(utf8("logfile"), log); - gOptions.setOption(utf8("reallogfile"), log); - ILOG(LOGNAME "Logger keeping log file as `" + fileUtil::getFullFilePath(log) + "'"); - ILOG(LOGNAME "Check you have write permissions for the folder(s) set in the config file."); - } - #endif - } - else - { - throwEx(LOGNAME "Log file path does not exist (check the folder path exists)"); - } - } - - ILOG(LOGNAME "Saving log output to `" + fileUtil::getFullFilePath(gOptions.realLogFile()) + "'"); - ILOG(LOGNAME "Automatic log rotation " + (!gOptions.rotateInterval() ? utf8("disabled") : - utf8("interval: ") + timeString(gOptions.rotateInterval()))); - ILOG(LOGNAME "Loaded config from `" + fileUtil::getFullFilePath(gOptions.confFile()) + "'"); - } - else if (mode == 2) - { - if (setupMode) - { -#ifdef CONFIG_BUILDER - if (!builderMode) - { -#endif - ILOG(LOGNAME "Entering setup mode - Open 127.0.0.1:8000/setup in a"); - ILOG(LOGNAME "browser on the same machine the DNAS was started on"); -#ifdef CONFIG_BUILDER - } - else - { - ILOG(LOGNAME "Entering builder mode - Open 127.0.0.1:8000/builder in"); - ILOG(LOGNAME "a browser on the same machine the DNAS was started on"); - } -#endif - ILOG(LOGNAME "if the browser does not automatically open the page."); - ILOG(LOGNAME "If working remotely then replace 127.0.0.1 with the"); - ILOG(LOGNAME "IP / address of the remote system to use this mode."); - } - - // attempt to open the setup / builder page on the system's browser i.e. kiss option - #ifdef _WIN32 -#ifdef CONFIG_BUILDER - if (!builderMode) - { -#endif - ::system("start http://127.0.0.1:8000/setup"); -#ifdef CONFIG_BUILDER - } - else - { - ::system("start http://127.0.0.1:8000/builder"); - } -#endif - #else -#ifdef CONFIG_BUILDER - if (!builderMode) - { -#endif - ::system("(if(which xdg-open > /dev/null)then(xdg-open http://127.0.0.1:8000/setup)elif(which gnome-open > /dev/null)then(gnome-open http://127.0.0.1:8000/setup)fi)&>/dev/null"); -#ifdef CONFIG_BUILDER - } - else - { - ::system("(if(which xdg-open > /dev/null)then(xdg-open http://127.0.0.1:8000/builder)elif(which gnome-open > /dev/null)then(gnome-open http://127.0.0.1:8000/builder)fi)&>/dev/null"); - } -#endif - #endif - - #ifdef _WIN32 - win32SocketSetup(); - win32_socket_cleanup_required = true; - #endif - - threadedRunner *tr = new threadedRunner; - runners.push_back(tr); - tr->start(); - - threadedRunner::scheduleRunnable(new microServer("", gOptions.portBase(), - (microServer::AllowableProtocols_t)(P_WEB_SETUP), - microServer::L_MISC)); - - s_ControlEvents.push_back(serviceMain::sStop); - while (!iskilled()) - { - #if defined(_WIN32) && defined(_WIN64) - if (WaitForMultipleObjects((DWORD)s_ControlEvents.size(), &(s_ControlEvents[0]), 0, 1000) == WAIT_OBJECT_0) - #else - if (WaitForMultipleObjects(s_ControlEvents.size(), &(s_ControlEvents[0]), 0, 1000) == WAIT_OBJECT_0) - #endif - { - // stop signal - setkill(1); - break; - } - } - - if (iskilled() == 2) - { - ILOG(LOGNAME "Stopping setup mode. Preparing for broadcasting..."); - } - else - { - ILOG(LOGNAME "Stopping setup mode. Shutting down..."); - } - - for (vector::const_iterator i = runners.begin(); i != runners.end(); ++i) - { - (*i)->stop(); - (*i)->join(); - delete (*i); - } - runners.clear(); - - #ifdef _WIN32 - if (win32_socket_cleanup_required) - { - win32SocketCleanup(); - } - #endif - - s_ControlEvents.clear(); - - // if we get here, we effectively restart the server post-setup - if (iskilled() == 2) - { - #ifdef _WIN32 - gOptions.load(gStartupDirectory + "sc_serv.conf"); - #else - gOptions.load(gStartupDirectory.hideAsString() + "sc_serv.conf"); - #endif - setPostSetup(true); - setkill(0); - goto runserver; - } - setkill(0); - return mainResult; - } - } - - // just make sure that we can do this else we need to abort - if (curl_global_init(CURL_GLOBAL_DEFAULT) != CURLE_OK) - { - throwEx(LOGNAME "Unable to load libcurl & / or its dependencies - cannot continue."); - } - - config::streams_t streams; - gOptions.getStreamConfigs(streams); - // the old sc_serv had two sets of passwords, mimic this - if (gOptions.adminPassword().empty()) - { - WLOG(gOptions.logSectionName() + "A dedicated `adminpassword' should be specified in the configuration."); - WLOG(gOptions.logSectionName() + "Legacy handling has been enabled to map `adminpassword' to `password'."); - WLOG(gOptions.logSectionName() + "This is not deemed safe and `adminpassword' should be directly set."); - gOptions.setOption(utf8("adminpassword"), gOptions.password()); - } - else - { - // otherwise if explicitly set as the same then we abort - if (gOptions.adminPassword() == gOptions.password()) - { - throwEx(gOptions.logSectionName() + "You must specify different passwords for `adminpassword' and `password'."); - } - } - - - // abort no matter what as without passwords we can be at risk - if (gOptions.adminPassword().empty() && gOptions.password().empty()) - { - throwEx(gOptions.logSectionName() + "You must specify a password for `adminpassword' and `password'."); - } - - if (!streams.empty()) - { - if (gOptions.setupPasswords(streams)) - { - // if there was any error on the passwords then we need to abort - // so it can be fixed. important if using multi-stream hosting! - throwEx(gOptions.logSectionName() + "Check the stream configurations above or ensure `adminpassword' and `password' have been set."); - } - } - else - { - // if there are no stream configs and no main password - // then we'll also need to abort as that's not allowed - if (gOptions.password().empty()) - { - throwEx(gOptions.logSectionName() + "You must specify a password for `password'."); - } - } - - - if (!gOptions.cdn().empty()) - { - ILOG(LOGNAME "CDN " + utf8(gOptions.cdn() == "on" ? "opt-in" : "opt-out") + " mode enabled -> ensure all stream(s) are properly configured"); - } - - const int cpu_count = gOptions.getCPUCount(); // check options - ILOG(LOGNAME "Calculated CPU count is " + tos(cpucount()) + " -> " + (cpu_count == cpucount() ? "using " + - utf8(cpu_count > 1 ? "all" : "the") + " available CPU" + (cpu_count > 1 ? "s" : "") : - tos(cpu_count) + " CPU" + (cpu_count > 1 ? "s" : "") + " specified to be used")); -#ifndef _WIN32 - rlimit rlim = {0}; - if(!getrlimit(RLIMIT_NOFILE, &rlim)) - { - ILOG(LOGNAME "Limited to " + tos(rlim.rlim_cur) + " file descriptors [relates to ulimit -n]"); - } -#endif - // calculate defaults for yp - // if 'publicport' is not the same as 'portbase' - // then we use it instead of the normal portbase - g_portForClients = ((gOptions.publicPort() != -1 && (gOptions.publicPort() != gOptions.portBase())) ? gOptions.publicPort() : gOptions.portBase()); - - // before anything else starts up we'll start this as needed - metrics::metrics_apply(gOptions); - auth::init(); - - // load any SSL certificates - threadedRunner::SSL_init(); - - #ifdef _WIN32 - win32SocketSetup(); - win32_socket_cleanup_required = true; - #endif - - ILOG(LOGNAME "Starting " + tos(cpu_count) + " network thread" + (cpu_count > 1 ? "s" : "")); - - for (int x = 0; x < cpu_count; ++x) - { - threadedRunner *tr = new threadedRunner; - runners.push_back(tr); - tr->start(); - } - - constructMessageResponses(); - - // w3c logging - if (gOptions.w3cEnable()) - { - w3cLog::open(gOptions.w3cLog()); - } - - // load geoIP database if able to be found - /*{ - static utf8 dir = gStartupDirectory; - char path[1024] = {0}; - GeoIP_setup_custom_directory(strncpy(path, (char*)dir.hideAsString().c_str(), sizeof(path))); - GeoIP * gi = GeoIP_new(GEOIP_MEMORY_CACHE); - if(gi != NULL) - { - ILOG(LOGNAME "Loaded GeoIP database - Ban and Reserve by country is enabled"); - const char* returnedCountry, - * ips[] = {"58.218.199.227","77.76.181.71","87.104.93.85","195.238.117.56", - "114.244.60.232","108.52.34.116","91.121.164.186","78.46.75.50", - "62.75.139.39","172.17.200.143","205.188.215.228","82.30.80.183" - }; - for (int ip = 0; ip < sizeof(ips)/sizeof(ips[0]); ip++) - { - utf8 details; - returnedCountry = GeoIP_country_code_by_addr(gi, ips[ip]); - details = (returnedCountry ? returnedCountry : utf8("UNKNOWN")); - returnedCountry = GeoIP_country_name_by_addr(gi, ips[ip]); - details += " (" + (returnedCountry ? returnedCountry : utf8("UNKNOWN")) + ")"; - WLOG(details); - } - - GeoIP_delete(gi); - } - }*/ - - // load up stream branding artwork - gOptions.m_artworkBody[0] = loadLocalFile(fileUtil::getFullFilePath(gOptions.artworkFile()), LOGNAME, 523872/*32 x (16384 - 6 - 6 - 1)*/); - - // load up ban file - g_banList.load(gOptions.banFile(),0); - - // load up rip file - g_ripList.load(gOptions.ripFile(),0); - - // load up admin access file - g_adminList.load(gOptions.adminFile()); - - // load up agent file - g_agentList.load(gOptions.agentFile(),0); - - // per-stream options - gOptions.getStreamConfigs(streams); - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - // w3c logging - if (gOptions.read_stream_w3cLog((*i).first)) - { - w3cLog::open(gOptions.stream_w3cLog((*i).first),(*i).first); - } - - // load up ban file - if (gOptions.read_stream_banFile((*i).first)) - { - g_banList.load(gOptions.stream_banFile((*i).first),(*i).first); - } - - // load up rip file - if (gOptions.read_stream_ripFile((*i).first)) - { - g_ripList.load(gOptions.stream_ripFile((*i).first),(*i).first); - } - - // load up agent file - if (gOptions.read_stream_agentFile((*i).first)) - { - g_agentList.load(gOptions.stream_agentFile((*i).first),(*i).first); - } - - // load up stream branding artwork - if (gOptions.read_stream_artworkFile((*i).first)) - { - gOptions.m_artworkBody[(*i).first] = loadLocalFile(fileUtil::getFullFilePath(gOptions.stream_artworkFile((*i).first)), LOGNAME, 523872/*32 x (16384 - 6 - 6 - 1)*/); - } - } - - utf8 srcBindAddr = stripHTTPprefix(stripWhitespace(gOptions.srcIP())); - utf8 destBindAddr = metrics::metrics_verifyDestIP(gOptions, false); - - if (g_IPAddressForClients.empty()) - { - char s[MAXHOSTNAMELEN] = {0}; // paranoia - if (!::gethostname(s, MAXHOSTNAMELEN - 1)) - { - // changed to not throw (build 43) as this will still run correctly - // and has caused a number of users to go back to v1 unnecessarily. - g_IPAddressForClients = socketOps::hostNameToAddress(s, g_portForClients); - } - } - else - { - utf8 addr = socketOps::hostNameToAddress(destBindAddr.hideAsString().c_str()); - if (!addr.empty()) - { - destBindAddr = addr; - } - /*hostent *host; - if ((host = ::gethostbyname((const char *)destBindAddr.c_str())) != NULL){ - destBindAddr = (inet_ntoa(*( (struct in_addr *)host->h_addr))); - }*/ - } - - if (!srcBindAddr.empty()) - { - utf8 addr = socketOps::hostNameToAddress(srcBindAddr.hideAsString().c_str()); - if (!addr.empty()) - { - srcBindAddr = addr; - } - /*hostent *host; - if ((host = ::gethostbyname((const char *)srcBindAddr.c_str())) != NULL){ - srcBindAddr = (inet_ntoa(*( (struct in_addr *)host->h_addr))); - }*/ - } - - // for legacy sources (with optional portbase override / disable) - g_legacyPort = ((gOptions.portLegacy() != gOptions.portBase() + 1) && (gOptions.portLegacy() != -1) ? - gOptions.portLegacy() : gOptions.portBase() + 1); - - // if src and dst are same we configure ourselves a bit differently - if ((srcBindAddr == destBindAddr) || - (inet_addr((const char *)srcBindAddr.c_str()) == inet_addr((const char *)destBindAddr.c_str()))) - { - // for clients and sources - threadedRunner::scheduleRunnable(new microServer(srcBindAddr.hideAsString(), gOptions.portBase(), - (microServer::AllowableProtocols_t)(P_SHOUTCAST1CLIENT | P_SHOUTCAST2CLIENT | - P_SHOUTCAST1SOURCE | P_SHOUTCAST2SOURCE | P_WEB), - (microServer::ListenTypes_t)(microServer::L_SOURCE | microServer::L_CLIENT))); - } - else - { - // changed in b71 as it's possible to specify a destip which does not correctly bind but the - // value of destip could be correct and able to work in all other areas e.g. via listen.pls - // so if there is an issue with the destip specific bind, then attempt a destip==srcip bind - microServer *r = 0; - try - { - // for clients - // changed in b79 - r = new microServer(destBindAddr.hideAsString(), gOptions.portBase(), - (microServer::AllowableProtocols_t)(P_SHOUTCAST1CLIENT | P_SHOUTCAST2CLIENT | P_SHOUTCAST1SOURCE | P_WEB), - (microServer::ListenTypes_t)(microServer::L_SOURCE | microServer::L_CLIENT)); - threadedRunner::scheduleRunnable(r); - - // for sources - threadedRunner::scheduleRunnable(new microServer(srcBindAddr.hideAsString(), gOptions.portBase(), - (microServer::AllowableProtocols_t)(P_SHOUTCAST1SOURCE | P_SHOUTCAST2SOURCE | P_WEB), - microServer::L_SOURCE)); - } - catch(const exception &ex) - { - if (r == 0) - { - WLOG(ex.what()); - } - - try - { - // for clients and sources - threadedRunner::scheduleRunnable(new microServer(srcBindAddr.hideAsString(), gOptions.portBase(), - (microServer::AllowableProtocols_t)(P_SHOUTCAST1CLIENT | P_SHOUTCAST2CLIENT | - P_SHOUTCAST1SOURCE | P_SHOUTCAST2SOURCE | P_WEB), - (microServer::ListenTypes_t)(microServer::L_SOURCE | microServer::L_CLIENT))); - } - catch(const exception &exx) - { - // changed in b79 - // if we get to here, if we've been able to bind at least on the destip - // but the srcip bind fails then attempt to allow v2 sources on destip. - if (r != 0) - { - r->updateProtocols((microServer::AllowableProtocols_t)(P_SHOUTCAST1CLIENT | P_SHOUTCAST2CLIENT | - P_SHOUTCAST1SOURCE | P_SHOUTCAST2SOURCE | P_WEB), - (microServer::ListenTypes_t)(microServer::L_SOURCE | microServer::L_SOURCE2), gOptions.portBase()); - } - else - { - throwEx(exx.what()); - } - } - } - } - - if (g_legacyPort > 0) - { - // for v1 sources - threadedRunner::scheduleRunnable(new microServer(srcBindAddr.hideAsString(), g_legacyPort, - (microServer::AllowableProtocols_t)(P_SHOUTCAST1SOURCE), - microServer::L_SOURCE)); - } - else - { - ILOG("[MICROSERVER] Legacy v1 source support not enabled"); - } - - // for flash policy file server - if (gOptions.flashPolicyServerPort() != -1) - { - threadedRunner::scheduleRunnable(new microServer(srcBindAddr.hideAsString(), gOptions.flashPolicyServerPort(), - (microServer::AllowableProtocols_t)(P_FLASHPOLICYFILE), microServer::L_FLASH)); - } - else - { - ILOG("[MICROSERVER] Flash policy file server not enabled"); - } - - // and finally look at adding any extra client ports e.g. so you can run on 80 - // and 8000 and anything else for clients that cannot connect to the main port - if (!gOptions.alternatePorts().empty()) - { - vector tokens = tokenizer(gOptions.alternatePorts(), ','); - for (size_t tok = 0; tok < tokens.size(); tok++) - { - u_short port = (u_short)atoi(tokens[tok].hideAsString().c_str()); - // make sure we're only allowing a valid port number and it isn't already been registered - if (port && (port != gOptions.portBase()) && (port != g_portForClients)) - { - microServer *r = 0; - try - { - r = new microServer(srcBindAddr.hideAsString(), port, - (microServer::AllowableProtocols_t)(P_SHOUTCAST1CLIENT | P_SHOUTCAST2CLIENT), - (microServer::ListenTypes_t)(microServer::L_CLIENT_ALT)); - threadedRunner::scheduleRunnable(r); - gOptions.m_usedAlternatePorts += "," + tokens[tok]; - } - catch(const exception &ex) - { - if (r == 0) - { - WLOG(ex.what()); - WLOG("[MICROSERVER] Alternate client connections on port " + tokens[tok] + " will not work"); - } - } - } - else - { - if (port != gOptions.portBase() && port != g_portForClients) - { - WLOG("[MICROSERVER] Skipping `" + tokens[tok] + "' as it is an invalid alternate client port"); - } - else - { - WLOG("[MICROSERVER] Skipping alternate port " + tokens[tok] + " as it is already a used port"); - } - } - } - } - - if (gOptions.pidFile().empty() || (gOptions.pidFile() == "sc_serv_$.pid")) - { - pidFn = gStartupDirectory + "sc_serv_" + tos(gOptions.portBase()) + ".pid"; - } - else if (!gOptions.pidFile().empty()) - { - pidFn = gOptions.pidFile(); - } - - if (!pidFn.empty()) - { - FILE *f = uniFile::fopen(pidFn, "wb"); - if (f) - { - try - { - utf8 s(tos(getpid()) + eol()); - if (fwrite(s.c_str(),1,s.size(),f) != s.size()) - { - ELOG(LOGNAME "I/O error writing PID file `" + fileUtil::getFullFilePath(pidFn) + "'"); - } - } - catch(...) - { - if (f) - { - ::fclose(f); - } - ELOG(LOGNAME "Error writing to PID file `" + fileUtil::getFullFilePath(pidFn) + "'"); - } - if (f) - { - ::fclose(f); - } - } - else - { - ELOG(LOGNAME "Could not open PID file `" + fileUtil::getFullFilePath(pidFn) + - "' for writing (" + errMessage().hideAsString() + ")"); - } - } - - // schedule relays - if (!gOptions.startInactive()) - { - vector relayList(gOptions.getRelayList()); - if (!relayList.empty()) - { - for_each(relayList.begin(), relayList.end(), scheduleRelay); - } - } - - //threadedRunner::scheduleRunnable(new yp2); - threadedRunner::scheduleRunnable(new updater); - - s_ControlEvents.push_back(serviceMain::sStop); -#ifndef _WIN32 - s_ControlEvents.push_back(serviceMain::sWINCH); - s_ControlEvents.push_back(serviceMain::sHUP); - s_ControlEvents.push_back(serviceMain::sUSR1); - s_ControlEvents.push_back(serviceMain::sUSR2); -#endif - -#ifdef OPEN_PORT_CHECKER - //BOOL CheckPortTCP(short int dwPort , char*ipAddressStr) - { - struct sockaddr_in client; - int sock; - - client.sin_family = AF_INET; - client.sin_port = htons(gOptions.portBase()-1000); - //client.sin_addr.s_addr = inet_addr(g_IPAddressForClients/*destBindAddr*/.hideAsString().c_str()/*"127.0.0.1"); - client.sin_addr.s_addr = inet_addr("192.168.2.3"/*"127.0.0.1"*/); - - sock = (int) socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - ELOG(g_IPAddressForClients + ":" + tos(gOptions.portBase()) + /*destBindAddr*/ + " " + tos(connect(sock, (struct sockaddr *) &client,sizeof(client)) == 0)); - } -#endif - - while (!iskilled()) - { - metrics::metrics_wakeup(); - - #if defined(_WIN32) && defined(_WIN64) - int waitResult = WaitForMultipleObjects((DWORD)s_ControlEvents.size(),&(s_ControlEvents[0]),0,1000); - #else - int waitResult = WaitForMultipleObjects(s_ControlEvents.size(),&(s_ControlEvents[0]),0,1000); - #endif - switch (waitResult) - { - // stop signal - case WAIT_OBJECT_0: - { - setkill(true); - // remove the pid file on successful exit - if (!pidFn.empty() && uniFile::fileExists(pidFn)) - { - uniFile::unlink(pidFn); - } - break; - } -#ifdef _WIN32 - case WAIT_OBJECT_0+1: // admin server - break; - - case WAIT_OBJECT_0+2: // main msg loop - break; -#else - case WAIT_OBJECT_0+1: // winch - { - // reserved, banned and blocked user agent list(s) reload - reloadBanLists(); - reloadRipLists(); - reloadAdminAccessList(); - reloadAgentLists(); - break; - } - case WAIT_OBJECT_0+2: // hup - { - ILOG(LOGNAME "Rotating log and W3C files [PID: " + tos(getpid()) + "]"); - ROTATE; - printUpdateMessage(); - rotatew3cFiles("w3c"); - ILOG(LOGNAME "Rotated log and W3C files [PID: " + tos(getpid()) + "]"); - break; - } - case WAIT_OBJECT_0+3: // usr1 - { - // config reload - reloadConfig(false); - break; - } - case WAIT_OBJECT_0+4: // usr2 - { - // forced config reload - reloadConfig(true); - break; - } - case WAIT_OBJECT_0+5: // admin server - break; - - case WAIT_OBJECT_0+6: // main msg loop - break; -#endif - default: - { - } - } - } - - ILOG(LOGNAME "Exiting threads..."); - if (gOptions.configRewrite()) - { - gOptions.rewriteConfigurationFile((gOptions.configRewrite() == 1), true); - } - } - catch(const exception &ex) - { - ELOG(ex.what()); - mainResult = -2; - } - catch(...) - { - ELOG(LOGNAME "Unknown exception caught"); - mainResult = -1; - } - - if (stats::getTotalUniqueListeners() > 0) - { - ILOG(LOGNAME "Terminating listeners..."); - stats::kickAllClients(0, true); - } - - // Stop all sources and wait up to ten seconds for everything to clear out - const streamData::streamIDs_t streamIds = streamData::getStreamIds(true); - if (!streamIds.empty()) - { - ILOG(LOGNAME "Terminating sources..."); - for (streamData::streamIDs_t::const_iterator i = streamIds.begin(); i != streamIds.end(); ++i) - { - // kick source off system - streamData::killStreamSource((*i)); - } - } - - if (yp2::requestsInQueue()) - { - ILOG(LOGNAME "Running Directory cleanup..."); - // now wait for YP to clear out - for (int x = 0; (x < 100); ++x) - { - if (yp2::requestsInQueue()) - { - safe_sleep(0, 10000); - } - else - { - break; - } - } - } - - for (vector::const_iterator i = runners.begin(); i != runners.end(); ++i) - { - (*i)->stop(); - (*i)->join(); - delete (*i); - } - - runners.clear(); - metrics::metrics_wakeup(true); - metrics::metrics_stop(); - auth::cleanup(); - - // general files to save - if (gOptions.saveBanListOnExit()) - { - g_banList.save(gOptions.banFile(),0); - } - - if (gOptions.saveRipListOnExit()) - { - g_ripList.save(gOptions.ripFile(),0); - } - - if (gOptions.saveAgentListOnExit()) - { - g_agentList.save(gOptions.agentFile(),0); - } - - if (gOptions.w3cEnable()) - { - w3cLog::close(0); - } - - // per-stream files to save - config::streams_t streams; - gOptions.getStreamConfigs(streams); - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - if (gOptions.saveBanListOnExit()) - { - if (gOptions.read_stream_banFile((*i).first) && !gOptions.stream_banFile((*i).first).empty()) - { - g_banList.save(gOptions.stream_banFile((*i).first),(*i).first); - } - } - - if (gOptions.saveRipListOnExit()) - { - if (gOptions.read_stream_ripFile((*i).first) && !gOptions.stream_ripFile((*i).first).empty()) - { - g_ripList.save(gOptions.stream_ripFile((*i).first),(*i).first); - } - } - - if (gOptions.saveAgentListOnExit()) - { - if (gOptions.read_stream_agentFile((*i).first) && !gOptions.stream_agentFile((*i).first).empty()) - { - g_agentList.save(gOptions.stream_agentFile((*i).first),(*i).first); - } - } - - if (gOptions.read_stream_w3cLog((*i).first)) - { - w3cLog::close((*i).first); - } - } - - #ifdef _WIN32 - if (win32_socket_cleanup_required) - { - win32SocketCleanup(); - } - #endif - - s_ControlEvents.clear(); - DeleteAllCaches(); - - stats::getFinalStats(); - bandWidth::getFinalAmounts(); - utf8 t = timeString(::time(NULL) - g_upTime); - ILOG(LOGNAME + (t.empty() ? "Shutdown" : "Shutdown after " + t + " running") + eol()); - - curl_global_cleanup(); - -/*#ifdef _WIN32 - { - wchar_t buf[MAX_PATH] = L"\""; - STARTUPINFO si = {sizeof(si), }; - PROCESS_INFORMATION pi; - GetModuleFileName(NULL, buf + 1, sizeof(buf) - 1); - wcsncat(buf, L"\"", MAX_PATH); - CreateProcess(NULL, buf, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); - } -#else -#endif*/ - - // if we're in 'user' mode then if there was an exception - // we'll not immediately abort and instead keep things on - // display so it's easier for noobs, etc to see the error - if (!sDaemon && gOptions.screenLog() && (mainResult < 0)) - { - ILOG(LOGNAME "Press any key to continue . . ."); - while(!_kbhit()) {} - #ifdef _WIN32 - // do this so we consume the input which - // as we already have a custom _kbhit() - // on non-Windows already does it for us - _getch(); - #endif - } - return mainResult; - } -}; - -// create the appropriate handler for the app/daemon/service framework -int sm_main(const vector &args) throw() -{ -#ifdef _WIN32 - stdServiceWin32 s("Shoutcast DNAS"); -#else - stdServiceUnix s; -#endif - return s.sm_main(args); -} diff --git a/Src/Plugins/DSP/sc_serv3/manifest.xml b/Src/Plugins/DSP/sc_serv3/manifest.xml deleted file mode 100644 index 436c2df7..00000000 --- a/Src/Plugins/DSP/sc_serv3/manifest.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - SHOUTcast DNAS 2.4.3 Build 187 - - - - - - - - \ No newline at end of file diff --git a/Src/Plugins/DSP/sc_serv3/manifest64.xml b/Src/Plugins/DSP/sc_serv3/manifest64.xml deleted file mode 100644 index 7dcc9720..00000000 --- a/Src/Plugins/DSP/sc_serv3/manifest64.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - SHOUTcast DNAS 2.4.3 Build 187 - - - - - - - - \ No newline at end of file diff --git a/Src/Plugins/DSP/sc_serv3/messagefile.h b/Src/Plugins/DSP/sc_serv3/messagefile.h deleted file mode 100644 index 4a0518fb..00000000 --- a/Src/Plugins/DSP/sc_serv3/messagefile.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// Values are 32 bit values laid out as follows: -// -// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 -// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 -// +---+-+-+-----------------------+-------------------------------+ -// |Sev|C|R| Facility | Code | -// +---+-+-+-----------------------+-------------------------------+ -// -// where -// -// Sev - is the severity code -// -// 00 - Success -// 01 - Informational -// 10 - Warning -// 11 - Error -// -// C - is the Customer code flag -// -// R - is a reserved bit -// -// Facility - is the facility code -// -// Code - is the facility's status code -// -// -// Define the facility codes -// - - -// -// Define the severity codes -// - - -// -// MessageId: MSG_CMD_ERR -// -// MessageText: -// -// %1 -// -#define MSG_CMD_ERR 0xC0000001L - diff --git a/Src/Plugins/DSP/sc_serv3/messagefile.mc b/Src/Plugins/DSP/sc_serv3/messagefile.mc deleted file mode 100644 index f7caddb6..00000000 --- a/Src/Plugins/DSP/sc_serv3/messagefile.mc +++ /dev/null @@ -1,6 +0,0 @@ -MessageId=0x1 -Severity=Error -SymbolicName=MSG_CMD_ERR -Language=English -%1 -. diff --git a/Src/Plugins/DSP/sc_serv3/metadata.cpp b/Src/Plugins/DSP/sc_serv3/metadata.cpp deleted file mode 100644 index df55d841..00000000 --- a/Src/Plugins/DSP/sc_serv3/metadata.cpp +++ /dev/null @@ -1,459 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include "metadata.h" -#include "aolxml/aolxml.h" -#include "filenameMetadata.h" -#include "file/fileUtils.h" -#include "stl/stringUtils.h" -#include "services/stdServiceImpl.h" -#include "streamData.h" - -using namespace std; -using namespace stringUtil; -using namespace uniString; - -metadata::metadata(const metadata &m) -{ - copy(m); -} - -metadata& metadata::operator=(const metadata &m) -{ - copy(m); - return *this; -} - -void metadata::clear() throw() -{ - for (keyValueMap_t::const_iterator i = m_keyValueMap.begin(); i != m_keyValueMap.end(); ++i) - { - delete (*i).second; - } - m_keyValueMap.clear(); -} - -void metadata::copy(const metadata &m) throw() -{ - clear(); - for (keyValueMap_t::const_iterator i = m.m_keyValueMap.begin(); i != m.m_keyValueMap.end(); ++i) - { - if ((*i).second) - { - m_keyValueMap.insert(make_pair((*i).first,(*i).second->clone())); - } - } -} - -metadata::~metadata() throw() -{ - clear(); -} - -// remove all values for key -void metadata::removeValue(const string &key) throw() -{ - keyValueMap_t::iterator i = m_keyValueMap.find(key); - while (i != m_keyValueMap.end()) - { - delete (*i).second; - m_keyValueMap.erase(i); - i = m_keyValueMap.find(key); - } -} - -bool metadata::valueExists(const string &key) const throw() -{ - return (m_keyValueMap.find(key) != m_keyValueMap.end()); -} - -//// only returns first one found -const metadata::metaValue_base* metadata::getValue(const string &key) const throw() -{ - keyValueMap_t::const_iterator i = m_keyValueMap.find(key); - return (i == m_keyValueMap.end() ? 0 : (*i).second); -} - -//// only returns first one found -utf8 metadata::getValueAsString(const std::string &key) const throw() -{ - static utf8 empty; - - const metaValue_base *mv = getValue(key); - return (mv ? mv->toString() : empty); -} - -void metadata::setValue(const string &key,metadata::metaValue_base *value) throw() -{ - m_keyValueMap.insert(make_pair(key,value)); -} - -utf8 metadata::safeXML(const string &tag,const metaValue_base *m) throw() -{ - static utf8 empty; - if (!m) return empty; - return m->toXML(tag); -} - -utf8 metadata::safeString(const metaValue_base *m) throw() -{ - static utf8 empty; - if (!m) return empty; - return m->toString(); -} - -bool metadata::noMeaningfulMetadata() const throw() -{ - return (m_keyValueMap.find(NAME()) == m_keyValueMap.end()); -} - -bool metadata::get_replayGain(double &gain) const throw() -{ - pair mdrange = m_keyValueMap.equal_range("TXXX"); - for (keyValueMap_t::const_iterator i = mdrange.first; i != mdrange.second; ++i) - { - metadata::metaValue *md = dynamic_cast *>((*i).second); - if (md) - { - ID3V2::userText_t ut = md->value(); - if (ut.m_id == "replaygain_track_gain" || ut.m_id == "REPLAYGAIN_TRACK_GAIN") - { - gain = atof((const char *)ut.m_text.c_str()); - return true; - } - } - } - return false; -} - -bool metadata::get_replayGain() const throw() -{ - double g; - return get_replayGain(g); -} - -const utf8 METADATA(""); -const utf8 E_METADATA(""); -#ifdef XML_DEBUG -static const utf8 EOL(eol()); -#else -static const utf8 EOL(""); -#endif - -// new xml for shoutcast -utf8 metadata::toXML() const throw() -{ - utf8 o; - o += "" + EOL; - o += METADATA + EOL; - for (keyValueMap_t::const_iterator i = m_keyValueMap.begin(); i != m_keyValueMap.end(); ++i) - { - o += safeXML((*i).first,(*i).second) + EOL; - } - o += E_METADATA + EOL; - return o; -} - -utf8 metadata::toXML_fromFilename(const uniFile::filenameType &filename,const uniFile::filenameType &url,const utf8 &pattern) throw() -{ - utf8 o; - - o += "" + EOL; - o += METADATA + EOL; - - bool patternWorked(false); - try - { - filenameMetadata fm; - fm.setPattern(pattern); - fm.parse(filename); - const std::map&m = fm.getTokens(); - for (map::const_iterator i = m.begin(); i != m.end(); ++i) - { - o += "<" + (*i).first + ">" + (*i).second.escapeXML() + "" + EOL; - } - patternWorked = true; - } - catch(.../*const exception &ex*/) - { - } - - if (!patternWorked) - { - try - { - string str = string(filename.toANSI(true)); - utf8 song = asciiToUtf8(str); - - filenameMetadata fm; - fm.setPattern(pattern); - fm.parse(song); - const std::map&m = fm.getTokens(); - for (map::const_iterator i = m.begin(); i != m.end(); ++i) - { - o += "<" + (*i).first + ">" + (*i).second.escapeXML() + "" + EOL; - } - patternWorked = true; - } - catch(.../*const exception &ex*/) - { - //ELOG(string("[METADATA] Failure converting filename to metadata ") + ex.what()); - } - } - - if (!patternWorked) - { - o += ""; - - utf8 us = fileUtil::stripSuffix(filename); - // remove path based on delimiter for Unix (/) Win32 (\) or MacOS (:) - us = fileUtil::stripPath(us,utf8("/")); - us = fileUtil::stripPath(us,utf8("\\")); - us = fileUtil::stripPath(us,utf8(":")); - o += us.escapeXML(); - o += "" + EOL; - } - - if (!url.empty()) - { - utf8 u = url; - if ((u.find(utf8("://")) == utf8::npos) && - (u.find(utf8("&")) != 0) && - u.find(utf8("DNAS/streamart?sid=")) == utf8::npos && - u.find(utf8("DNAS/playingart?sid=")) == utf8::npos) - { - u = "http://" + u; - } - o += "" + u.escapeXML() + "" + EOL; - } - - o += E_METADATA + EOL; - return o; -} - -utf8 metadata::toFixedString(const uniFile::filenameType &filename) throw() -{ - utf8 o; - - bool patternWorked(false); - try - { - filenameMetadata fm; - fm.setPattern("%N"); - fm.parse(filename); - const std::map&m = fm.getTokens(); - for (map::const_iterator i = m.begin(); i != m.end(); ++i) - { - o = (*i).second; - } - patternWorked = true; - } - catch(.../*const exception &ex*/) - { - } - - if (!patternWorked) - { - try - { - string str = string(filename.toANSI(true)); - utf8 song = asciiToUtf8(str); - - filenameMetadata fm; - fm.setPattern("%N"); - fm.parse(song); - const std::map&m = fm.getTokens(); - for (map::const_iterator i = m.begin(); i != m.end(); ++i) - { - o = (*i).second; - } - patternWorked = true; - } - catch(.../*const exception &ex*/) - { - //ELOG(string("[METADATA] Failure converting filename to metadata ") + ex.what()); - } - } - - if (!patternWorked) - { - o = filename; - } - - return o; -} - -uniString::utf8 metadata::convert_3902_to_shoutcast1(const uniString::utf8 &d, const streamID_t id) throw (std::runtime_error) -{ - utf8 o; - aolxml::node *n = 0; - try - { - n = aolxml::node::parse(d.hideAsString()); - utf8 artist = aolxml::subNodeText(n, "/metadata/" + ARTIST(), (utf8)""); - utf8 name = aolxml::subNodeText(n, "/metadata/" + NAME(), (utf8)""); - - if (!artist.empty()) - { - if (!o.empty()) - { - o += " - "; - } - o += artist; - } - if (!name.empty()) - { - if (!o.empty()) - { - o += " - "; - } - o += name; - } - - if (!streamData::validateTitle(o)) - { - WLOG("[ADMINCGI sid=" + tos(id) + "] Title update rejected - value not allowed: " + o); - o.clear(); - } - - o = "StreamTitle='" + o + "';"; - - aolxml::node::nodeList_t nodes = aolxml::node::findNodes(n,"/metadata/extension/title"); - if (!nodes.empty()) - { - for (aolxml::node::nodeList_t::const_iterator i = nodes.begin(); i != nodes.end(); ++i) - { - if (*i) - { - // skip the first element as that is the current song and not what we want to get - int seq = atoi((*i)->findAttributeString("seq").c_str()); - if (seq == 2) - { - utf8 next = ((*i)->pcdata()); - if (streamData::validateTitle(next)) - { - o += "StreamNext='" + next + "';"; - } - break; - } - } - } - } - - utf8 url = aolxml::subNodeText(n, "/metadata/" + URL(), (utf8)""); - if (!url.empty()) - { - utf8::size_type pos = url.find(utf8("://")); - if (pos == utf8::npos) - { - url = "http://" + url; - } - - o += "StreamUrl='" + url + "';"; - } - } - catch(const exception &ex) - { - forget(n); - throw std::runtime_error(ex.what()); - } - forget(n); - return o; -} - -uniString::utf8 metadata::get_song_title_from_3902(const uniString::utf8 &d) -{ - utf8 o; - utf8 result; - aolxml::node *n = 0; - try - { - n = aolxml::node::parse(d.hideAsString()); - utf8 artist = aolxml::subNodeText(n, "/metadata/" + ARTIST(), (utf8)""); - utf8 name = aolxml::subNodeText(n, "/metadata/" + NAME(), (utf8)""); - - if (!artist.empty()) - { - if (!result.empty()) result += " - "; - result += artist; - } - if (!name.empty()) - { - if (!result.empty()) result += " - "; - result += name; - } - } - catch(const exception &ex) - { - forget(n); - throw std::runtime_error(ex.what()); - } - forget(n); - return result; -} - -uniString::utf8 metadata::get_XX_from_3902(const uniString::utf8& node, const uniString::utf8 &d, - const uniString::utf8 &old) throw (std::runtime_error) -{ - utf8 result; - aolxml::node *n = 0; - try - { - n = aolxml::node::parse(d.hideAsString()); - result = aolxml::subNodeText(n, utf8("/metadata/" + node).hideAsString(), old); - } - catch(const exception &ex) - { - forget(n); - throw std::runtime_error(ex.what()); - } - forget(n); - return result; -} - -std::vector metadata::get_nextsongs_from_3902(const uniString::utf8 &d, - std::vector& oldSongList, - const bool first) throw (std::runtime_error) -{ - aolxml::node *n = 0; - std::vector nextSongList; - - try - { - n = aolxml::node::parse(d.hideAsString()); - aolxml::node::nodeList_t nodes = aolxml::node::findNodes(n,"/metadata/extension/title"); - if(!nodes.empty()) - { - for (aolxml::node::nodeList_t::const_iterator i = nodes.begin(); i != nodes.end(); ++i) - { - if (*i) - { - // skip the first element as that is the current song and not what we want to hold - int seq = atoi((*i)->findAttributeString("seq").c_str()); - if ((seq > 1 && !first) || (first && seq == 2)) - { - nextSongList.push_back((*i)->pcdata()); - } - if (first) - { - break; - } - } - } - } - else - { - // if there are no nodes then as this could be from a stream-specific metadata - // update then we need to preserve the existing list so it's not cleared out. - forget(n); - return oldSongList; - } - } - catch(const exception &ex) - { - forget(n); - throw std::runtime_error(ex.what()); - } - forget(n); - return nextSongList; -} diff --git a/Src/Plugins/DSP/sc_serv3/metadata.h b/Src/Plugins/DSP/sc_serv3/metadata.h deleted file mode 100644 index b3bb289c..00000000 --- a/Src/Plugins/DSP/sc_serv3/metadata.h +++ /dev/null @@ -1,151 +0,0 @@ -#pragma once -#ifndef metadata_H_ -#define metadata_H_ - -#include -#include "ID3miniParsers.h" -#include "unicode/uniFile.h" - -// metadata class. Mostly just a container for key/value pairs -// stored ala ID3V2. Some helper functions also to aid in -// ID3V1 mapping -/* - metadata strings are stored in utf8 format -*/ -class metadata -{ -public: - // The metadata values are polymorphic since they may contain all sorts of differnt - // types of information depending on the specific tag. All you can do with them - // is clone them or convert them to xml - class metaValue_base - { - public: - virtual ~metaValue_base(){} - virtual metaValue_base* clone() const throw() = 0; - virtual metaValue_base* clone(const std::vector &s) const = 0; - virtual uniString::utf8 toXML(const std::string &tag) const throw() = 0; - virtual uniString::utf8 toString() const throw() = 0; - }; - - // templatized subclass of metaValue_base. You instantiate this with a class or - // struct of your creation that represents the specific data for a tag. - // The most interesting part is the constructor. You must provide - // an overload in the ID3V2 space (see ID3miniParsers.h) of the function - // fromStringList() which loads your struct from a list of unicode strings. A string - // list is adequate to represent all data coming out of ID3V2. Even binary hunks which - // get base64 encoded before being passed in a list to your constructor. - template - class metaValue: public metaValue_base - { - T m_value; - std::vector m_originalStringList; - - public: - metaValue() {} - metaValue(const T &v, const std::vector &slist) : m_value(v), m_originalStringList(slist) {} - metaValue(const std::vector &slist) : m_originalStringList(slist) - { - ID3V2::fromStringList(slist,m_value); - } - virtual metaValue_base* clone() const throw() - { return new metaValue(m_originalStringList); } - virtual metaValue_base* clone(const std::vector &slist) const // clone with new data - { return new metaValue(slist); } - virtual uniString::utf8 toString() const throw() - { return ID3V2::toString(m_value); } - virtual uniString::utf8 toXML(const std::string &tag) const throw() - { return ID3V2::toXML(uniString::utf8(tag),m_value); } - const T& value() const throw() { return m_value; } - }; - -private: - typedef std::multimap keyValueMap_t; - keyValueMap_t m_keyValueMap; - - // make a copy of this object. Necessary because data is allocated on heap - void copy(const metadata &m) throw(); - -public: - metadata() { m_keyValueMap.clear(); } - // force our private copy() to be called in all copy scenarios - metadata(const metadata &m); - metadata& operator=(const metadata &m); - ///////// - - ~metadata() throw(); - void clear() throw(); - bool empty() const throw() { return m_keyValueMap.empty(); } - - // return true if a particular value exists at least once - bool valueExists(const std::string &key) const throw(); - // note: setValue() takes ownership of the 'value' parameter. This will - // add another key/value pair. Since we have a multimap, existing values of "key" are - // not replaced. - void setValue(const std::string &key,metaValue_base* value) throw(); - void removeValue(const std::string &key) throw(); // remove all values for key - - // only returns first one found - const metaValue_base* getValue(const std::string &key) const throw(); - - // returns a string representation of first instance found - uniString::utf8 getValueAsString(const std::string &key) const throw(); - - // V1 mappings - static const std::string& NAME() throw() { static const std::string k("TIT2"); return k; } - static const std::string& ARTIST() throw() { static const std::string k("TPE1"); return k; } - static const std::string& ALBUM() throw() { static const std::string k("TALB"); return k; } - static const std::string& YEAR() throw() { static const std::string k("TYER"); return k; } - static const std::string& COMMENT() throw() { static const std::string k("COMM"); return k; } - static const std::string& GENRE() throw() { static const std::string k("TCON"); return k; } - - // other mappings (flac/ogg/internal etc) - static const std::string& COMPOSER() throw() { static const std::string k("TCOM"); return k; } - static const std::string& PUBLISHER() throw() { static const std::string k("TPUB"); return k; } - static const std::string& TRACKNUMBER() throw() { static const std::string k("TRCK"); return k; } - static const std::string& DISKNUMBER() throw() { static const std::string k("TPOS"); return k; } - static const std::string& ALBUMARTIST() throw() { static const std::string k("TPE2"); return k; } - static const std::string& BAND() throw() { static const std::string k("TPE2"); return k; } - static const std::string& PERFORMER() throw() { static const std::string k("TPE2"); return k; } - static const std::string& CONDUCTOR() throw() { static const std::string k("TPE3"); return k; } - static const std::string& BEATSPERMINUTE() throw() { static const std::string k("TBPM"); return k; } - static const std::string& LYRICS() throw() { static const std::string k("USLT"); return k; } - static const std::string& ENCODERSETTINGS() throw() { static const std::string k("TSSE"); return k; } - static const std::string& RATING() throw() { static const std::string k("POPM"); return k; } - static const std::string& PICTURE() throw() { static const std::string k("APIC"); return k; } - static const std::string& CUSTOMTEXT() throw() { static const std::string k("TXXX"); return k; } - static const std::string& VERSION() throw() { static const std::string k("TPE4"); return k; } - static const std::string& COPYRIGHT() throw() { static const std::string k("TCOP"); return k; } - static const std::string& LICENSE() throw() { static const std::string k("TOWN"); return k; } - static const std::string& ISRC() throw() { static const std::string k("TSRC"); return k; } - - static const std::string& DJ() throw() { static const std::string k("DJ"); return k; } - static const std::string& URL() throw() { static const std::string k("URL"); return k; } - - // output xml. "safe" functions deal with null value scenario without barfing - static uniString::utf8 safeXML(const std::string &tag,const metaValue_base *m) throw(); - static uniString::utf8 safeString(const metaValue_base *m) throw(); - - uniString::utf8 toXML() const throw(); - - static uniString::utf8 toXML_fromFilename(const uniFile::filenameType &filename, - const uniFile::filenameType &url, - const uniString::utf8 &pattern) throw(); - static uniString::utf8 toFixedString(const uniFile::filenameType &filename) throw(); - - bool get_replayGain(double &gain) const throw(); // return true if value found - bool get_replayGain() const throw(); // same, but just the return value - bool noMeaningfulMetadata() const throw(); // return true if metadata is empty, or stuff in there is not - // useful for user (like replaygain). - - typedef size_t streamID_t; - static uniString::utf8 convert_3902_to_shoutcast1(const uniString::utf8 &d, const streamID_t id) throw(std::runtime_error); - static uniString::utf8 get_song_title_from_3902(const uniString::utf8 &d); - static uniString::utf8 get_XX_from_3902(const uniString::utf8& node, const uniString::utf8 &d, const uniString::utf8 &old) throw(std::runtime_error); - static std::vector get_nextsongs_from_3902(const uniString::utf8 &d, std::vector& oldSongList, bool first = false) throw(std::runtime_error); -}; - -extern const uniString::utf8 METADATA; -extern const uniString::utf8 E_METADATA; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/metrics.cpp b/Src/Plugins/DSP/sc_serv3/metrics.cpp deleted file mode 100644 index 8cb2e1a3..00000000 --- a/Src/Plugins/DSP/sc_serv3/metrics.cpp +++ /dev/null @@ -1,1249 +0,0 @@ -/* metrics,c routines for sending client details to external server */ - -#include -#include -#include -#include -#include -#include - -#include "bandwidth.h" -#include "metrics.h" -#include "protocol_shoutcastClient.h" -#include "stats.h" -#include "config.h" -#include "services/stdServiceImpl.h" -#include "file/fileUtils.h" -#include "webNet/urlUtils.h" -#include "aolxml/aolxml.h" - - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define LOGNAME "METRICS" -#define DEBUG_LOG(...) do { if (gOptions.adMetricsDebug()) DLOG(__VA_ARGS__); } while (0) - -namespace metrics -{ -#if 0 -#define METRICS_LICENCE_URL "http://www.google.com" -#define LICENCE_RESP "\ -\ - \ - \ - \ - \ - \ - \ -\ -" -#else -#define METRICS_LICENCE_URL "https://dnas-licensing.shoutcast.com/registration/" -#endif - class service; - - struct metrics_info - { - httpHeaderMap_t vars; - utf8 url; - size_t id; - unsigned int match; - streamData::streamID_t sid; - int group; - int mode; - metrics_info() : id(0), sid(0), group(0), mode(0) { match = 0; } - }; - - struct metrics_data - { - utf8 post; - utf8 url; - virtual int post_callback() { return 0; } - virtual int failed_callback() { return 0; } - size_t id; - int group; - time_t m_schedule; - int flags; - streamData::streamID_t sid; - - metrics_data () : id(0), group(0), m_schedule((time_t)0), flags(0), sid(0) {} - metrics_data (metrics_info &info) : id(0), group(0), m_schedule((time_t)0), flags(0) { sid = info.sid; } - virtual ~metrics_data() {} - - virtual const char *name() { return "metrics"; } - }; - - struct parse_response_data : public metrics_data - { - stringstream m_ss; - size_t m_length; - - parse_response_data() : metrics_data(), m_length(0) {} - parse_response_data(metrics_info &info) : metrics_data(info), m_length(0) {} - - virtual int post_callback() = 0; - virtual int failed_callback() { WLOG ("failed " + utf8(name()) + " attempt with " + m_ss.str(), LOGNAME, sid); m_ss.str(""); return 0; } - }; - - - struct licence_data : public parse_response_data - { - licence_data() {;} - licence_data (metrics_info &info) : parse_response_data (info) {;} - const char *name() { return "licence"; } - - int post_callback(); - void handleURLs (aolxml::node *root); - void checkURLNode (aolxml::node *root, const char *ref, service_t s); - }; - - - struct YP_data : public parse_response_data - { - YP_data (metrics_info &info) : parse_response_data (info) {;} - - const char *name() { return "YP"; } - int post_callback(); - }; - - -// libcurl related stuff - -#ifdef CURLOPT_PASSWDFUNCTION -/* make sure that prompting at the console does not occur */ -static int my_getpass(void *client, char *prompt, char *buffer, int buflen) -{ - buffer[0] = '\0'; - return 0; -} -#endif - -static int handle_returned_header(void * ptr, size_t size, size_t nmemb, void *stream) -{ - int amount = (int)(size * nmemb); -#if defined(_DEBUG) || defined(DEBUG) - metrics_data *entry = (metrics_data *)stream; - DEBUG_LOG (utf8(entry->name()) + " header [" + utf8 ((const char*)ptr, amount>2 ? amount-2 : 0) + "]", LOGNAME); -#endif - bandWidth::updateAmount(bandWidth::AUTH_AND_METRICS, amount); - return amount; -} - - -static int handle_returned_data(void * ptr, size_t size, size_t nmemb, void * /*stream*/) -{ - int amount = (int)(size * nmemb); -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG ("Body " + tos (amount) + ":" + utf8 ((const char*)ptr, amount), LOGNAME); -#endif - bandWidth::updateAmount(bandWidth::AUTH_AND_METRICS, amount); - return amount; -} - - -static size_t handle_licence_body (void *ptr, size_t size, size_t nmemb, void *stream) -{ - licence_data *entry = (licence_data *)stream; - size_t length = size * nmemb; - if (entry->m_ss) - { - if (entry->m_length > 20000) - { - WLOG ("response for was too large, ignoring for now"); - return 0; - } - //DLOG ("Adding " + tos (length) + ":" + utf8 ((const char*)ptr, length)); - entry->m_ss.write ((const char*)ptr, length); - entry->m_length += length; - } - - bandWidth::updateAmount (bandWidth::ADVERTS, length); - return length; -} - - - - time_t g_metrics_updated = 0, g_recheck_services = 0; - AOL_namespace::mutex g_serversLock; - utf8 g_licence_DID = ""; - static short int g_uniqueMetricsId = 0; - -const short int getMetricsClientId() -{ - return ++g_uniqueMetricsId; -} - - -class service -{ -protected: - int m_queueCount; - const short int m_id; - unsigned short m_flags; - CURL *m_curl; - string desc; - bool in_use; - bool running; - utf8 url; - const time_t updated; - time_t stop_time; - utf8 main_post; - list queue; - - virtual void resetURL (utf8 &new_url) - { - if (new_url == "") - return; - url = new_url; - m_curl = webClient::setupCurlDefaults (m_curl, LOGNAME, url, 5L); - curl_easy_setopt (m_curl, CURLOPT_HEADERFUNCTION, handle_returned_header); - curl_easy_setopt (m_curl, CURLOPT_WRITEFUNCTION, handle_returned_data); -#ifdef CURLOPT_PASSWDFUNCTION - curl_easy_setopt (m_curl, CURLOPT_PASSWDFUNCTION, my_getpass); -#endif - } - -public: - - friend void addToServices(metrics_info &info); - friend void metrics_stop(); - - service(short int in_type, const char *in_url, const string in_desc) : m_id(getMetricsClientId()), in_use(false), running(true), - updated(g_metrics_updated), stop_time(0) - { - httpHeaderMap_t vars; - m_flags = in_type; - m_queueCount = 0; - url = in_url; - desc = in_desc; - m_curl = NULL; - - resetURL (url); - - vars["server"] = "Shoutcast v" + gOptions.getVersionBuildStrings(); - vars["port"] = tos(g_portForClients); - main_post = encodeVariables(vars); - DEBUG_LOG ("using " + url + " : " + main_post, in_desc.c_str()); - } - - virtual ~service(void) - { - metrics_cleanup(); - curl_easy_cleanup (m_curl); - } - - virtual metrics_data *metrics_node(metrics_info &info) { return new metrics_data (info); } - virtual int failedEntry (metrics_data *) { return 0; } - - int addEntry (metrics_info &info); - void metrics_cleanup(void); - - static THREAD_FUNC process(void* arg); -}; - - -class licenceService : public service -{ - int m_initial; - time_t m_nextCheck; // for licence - - void addCheckup(time_t when); - metrics_data *metrics_node (metrics_info &info) { return new licence_data (info); } - - void resetURL (utf8 &new_url) - { - //DLOG ("in reset url with " + new_url); - if (new_url == "") - return; - url = new_url; - m_curl = webClient::setupCurlDefaults (m_curl, LOGNAME, url, 5L); - curl_easy_setopt (m_curl, CURLOPT_HEADERFUNCTION, handle_returned_header); - curl_easy_setopt (m_curl, CURLOPT_WRITEFUNCTION, handle_licence_body); -#ifdef CURLOPT_PASSWDFUNCTION - curl_easy_setopt (m_curl, CURLOPT_PASSWDFUNCTION, my_getpass); -#endif - } - -public: - - licenceService() : service (METRIC_LICENCE, "", "licence") - { - m_initial = 0; - m_nextCheck = (time_t)0; - utf8 s = METRICS_LICENCE_URL; - resetURL (s); - addCheckup (::time(NULL)); - } - - int failedEntry (metrics_data *entry) - { - if (entry->sid == 0) // assume licence checker - { - if (entry->flags & 1) - return -1; // no licence, so no retry - int retry = -1; - m_initial++; - if (m_initial == 1) - retry = 1; - else if (m_initial == 2) - { - retry = 10; - } - else if (m_initial == 3) - //retry = 60; - addCheckup (::time(NULL) + 60); - else - { - m_initial = 0; - addCheckup (::time(NULL) + 3600); - } - return retry; - } - return 0; - } -}; - - -class ypService : public service -{ - void resetURL (utf8 &new_url) - { - //DLOG ("in reset url with " + new_url); - if (new_url == "") - return; - url = new_url; - m_curl = webClient::setupCurlDefaults (m_curl, LOGNAME, url, 15L, 4L); - curl_easy_setopt (m_curl, CURLOPT_HEADERFUNCTION, handle_returned_header); - curl_easy_setopt (m_curl, CURLOPT_WRITEFUNCTION, handle_licence_body); -#ifdef CURLOPT_PASSWDFUNCTION - curl_easy_setopt (m_curl, CURLOPT_PASSWDFUNCTION, my_getpass); -#endif - } - -public: - - ypService() : service (METRIC_YP, METRICS_YP_URL, "YP") { resetURL (url); } - - metrics_data *metrics_node(metrics_info &info) { return new YP_data (info); } - - int failedEntry (metrics_data *entry) - { - if (entry->flags) - return -1; - entry->flags |= 1; - return 15; - } -}; - - -list servers; - - -int service::addEntry(metrics_info &info) -{ - httpHeaderMap_t &vars = info.vars; - bool start_thread = false, queue_it = false; - - if (vars.empty()) - { - if (running && (g_metrics_updated > updated)) - { - DEBUG_LOG("Service " + tos(m_id) + " expired, start clean up", LOGNAME, (size_t)info.sid); - running = false; - } - - if ((running == false) && queue.empty()) - { - DEBUG_LOG ("[METRICS] service to be removed, " + desc); - return -1; // trigger a service removal - } - start_thread = true; - } - - if (stop_time == 0 && start_thread == false) - { - if (running && queue.size() < gOptions.metricsMaxQueue()) - queue_it = true; - } - if (info.mode || queue_it) - { - metrics_data *copy = metrics_node(info); - copy->id = info.id; - copy->sid = info.sid; - copy->post = encodeVariables(vars); - copy->url = info.url; - start_thread = true; - if (info.mode == 2) - queue.push_front(copy); - else - queue.push_back(copy); - m_queueCount++; - DEBUG_LOG("[METRICS sid=" + tos(copy->sid) + "] Added " + utf8(desc) + " details to queue [count: " + tos(queue.size()) + "]", LOGNAME, copy->sid); - } - - if ((in_use == false) && start_thread && !queue.empty()) - { - in_use = true; - SimpleThread(service::process, this); - } - return 0; -} - -void service::metrics_cleanup() -{ - if (!queue.empty()) - { - DEBUG_LOG("Purging " + tos(queue.size()) + " entries from " + tos(m_id), LOGNAME); - - while (!queue.empty()) - { - list::iterator to_go = queue.begin(); - metrics_data *m = *to_go; - //DLOG ("erasing metric for " + m->post); - queue.erase(to_go); - delete m; - m = NULL; - } - } -} - -THREAD_FUNC service::process(void* arg) -{ - try - { - service* m_service = reinterpret_cast(arg); - if (m_service) - { - g_serversLock.lock(); - - if (m_service->stop_time) - { - time_t diff = ::time(NULL) - m_service->stop_time; - - if (diff > (12 * 3600)) // drop after 12 hours of no response - { - m_service->metrics_cleanup(); - m_service->in_use = false; - g_serversLock.unlock(); - return 0; - } - DEBUG_LOG ("[METRICS] time since stopping " + tos ((long)diff)); - } - if (m_service->queue.size() < 5) - { - // allow for a build up of metrics over a small time, saves excessive thread creation - g_serversLock.unlock(); - safe_sleep (0, 80); - g_serversLock.lock(); - } - - int count = 0; - int try_later = 0; - time_t stop_time = (time_t)0; - - while (1) - { - utf8 post; - char errormsg[CURL_ERROR_SIZE] = {0}; - - if (m_service->m_queueCount <= try_later) - { - if (count) - DEBUG_LOG ("[METRICS] run queue " + m_service->desc + " complete"); - break; - } - - metrics_data *entry = m_service->queue.front(); - m_service->queue.pop_front(); - m_service->m_queueCount--; - if (entry->m_schedule > 0 && entry->m_schedule > time(NULL)) - { - m_service->queue.push_back (entry); - m_service->m_queueCount++; - try_later++; - continue; - } - g_serversLock.unlock(); - - if (entry->url.empty() == false) - m_service->resetURL (entry->url); // update the URL - - bool failed = false; - - if (entry->post.empty()) - { - if (entry->url.empty()) - DLOG ("empty Post/URL update on " + m_service->desc, LOGNAME); - } - else - { - CURLcode ret = CURLE_FAILED_INIT; - - if (m_service->m_curl) - { - post = entry->post + "&" + m_service->main_post; - -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(m_service->desc + utf8(" POST body: " + post), LOGNAME, entry->sid); -#endif - - curl_easy_setopt (m_service->m_curl, CURLOPT_ERRORBUFFER, errormsg); - curl_easy_setopt (m_service->m_curl, CURLOPT_HEADERDATA, entry); - curl_easy_setopt (m_service->m_curl, CURLOPT_WRITEDATA, entry); - curl_easy_setopt (m_service->m_curl, CURLOPT_POSTFIELDSIZE, post.size()); - curl_easy_setopt (m_service->m_curl, CURLOPT_POSTFIELDS, post.c_str()); - ret = curl_easy_perform (m_service->m_curl); - ++count; - } - - if (ret != CURLE_OK) - { - ELOG("Request failed on " + m_service->desc + " with " - + (errormsg[0] ? errormsg : curl_easy_strerror(ret)), LOGNAME, entry->sid); - failed = true; - } - else - { - long response_code = 0; - curl_easy_getinfo (m_service->m_curl, CURLINFO_RESPONSE_CODE, &response_code); - if (response_code >= 200 && response_code < 300) - { - entry->post_callback(); - stop_time = 0; - } - else - { - ELOG("Request failed on " + m_service->desc + " with code " + tos (response_code)); - entry->failed_callback(); - failed = true; - } - } - } - if (failed && !iskilled()) // a failed metric, and server still running - { - int delay = m_service->failedEntry (entry); - - if (stop_time == 0) - stop_time = ::time(NULL); - if (delay >= 0) // do we drop this one? < 0 something else is done, else put back on queue - { - g_serversLock.lock(); - m_service->queue.push_front (entry); - m_service->m_queueCount++; - - if (delay == 0) - { - m_service->stop_time = stop_time; - break; - } - - g_serversLock.unlock(); - DLOG ("sleeping for " + tos (delay) + "s on " + m_service->desc); - safe_sleep (delay, 0); - g_serversLock.lock(); - continue; - } - } - - delete entry; - entry = NULL; - g_serversLock.lock(); - m_service->stop_time = stop_time; - } // while - - m_service->in_use = false; - g_serversLock.unlock(); - } - } - catch(exception &e) - { - service* m_service = reinterpret_cast(arg); - DLOG ("abort in metric " + m_service->desc + ", " + e.what()); - safe_sleep (0,500); - if (m_service) - { - g_serversLock.lock(); - m_service->in_use = false; - g_serversLock.unlock(); - } - } - return 0; -} - - -void addToServices(metrics_info &info) -{ - g_serversLock.lock(); - list ::iterator it = servers.begin(); - - while (it != servers.end()) - { - service &s = **it; - // DLOG ("Applying metric to " + s.desc + "(" + tos((long)s.flags) + ", " + tos((long)info.match) + ")"); - if ((s.m_flags & info.match) && s.addEntry(info) < 0) - { - list ::iterator to_go = it; - service *s = *it; - ++it; - servers.erase(to_go); - delete s; - s = NULL; - } - else - { - ++it; - } - } - g_serversLock.unlock(); -} - - -// assume only called from one thread. -void metrics_wakeup(bool force) -{ - time_t now = ::time(NULL); - metrics_info info; - info.match = METRIC_AUDIENCE | METRIC_ADVERT | METRIC_LICENCE | METRIC_YP; - if ((now > g_recheck_services) || force) - { - if (force) - { - g_recheck_services = now + 60; - } - info.match |= METRIC_AUDIENCE | METRIC_ADVERT; - - g_recheck_services = now + 60; // next recheck in case stalled metrics - } - addToServices(info); -} - - -void metrics_listener_new(const protocol_shoutcastClient &client) -{ - const streamData *sd = client.m_streamData; - if (sd && !sd->radionomyID().empty()) - { - metrics_info info; - const streamData::streamInfo &stream = sd->getInfo(); - - info.vars["action"] = "listener_add"; - info.vars["tstamp"] = tos(::time(NULL)); - info.vars["host"] = sd->streamPublicIP(); - info.vars["radionomyid"] = info.vars["ref"] = sd->radionomyID(); - info.vars["client"] = tos(client.m_unique); - info.vars["group"] = tos(client.getGroup()); - info.vars["ip"] = client.m_clientAddr; - info.vars["srvid"] = stream.m_serverID; - info.vars["mount"] = getStreamPath(client.m_streamID); - info.vars["agent"] = client.m_userAgent; - info.vars["referer"] = client.m_referer; - info.vars["bitrate"] = tos(sd->streamBitrate()); - info.vars["codec"] = sd->streamContentType(); - info.vars["contr"] = client.getContainer(); - - info.id = client.m_unique; - info.sid = client.m_streamID; - info.match = METRIC_AUDIENCE; - - addToServices(info); - } -} - -void metrics_listener_drop(const protocol_shoutcastClient &client) -{ - const streamData *sd = client.m_streamData; - if (sd && !sd->radionomyID().empty()) - { - metrics_info info; - const streamData::streamInfo &stream = sd->getInfo(); - time_t now = ::time(NULL); - - info.vars["action"] = "listener_remove"; - info.vars["tstamp"] = tos(now); - info.vars["host"] = sd->streamPublicIP(); - info.vars["radionomyid"] = info.vars["ref"] = sd->radionomyID(); - info.vars["client"] = tos(client.m_unique); - info.vars["ip"] = client.m_clientAddr; - info.vars["srvid"] = stream.m_serverID; - info.vars["mount"] = getStreamPath(client.m_streamID); - info.vars["duration"] = tos(now - client.m_startTime); - info.vars["agent"] = client.m_userAgent; - info.vars["referer"] = client.m_referer; - info.vars["bitrate"] = tos(sd->streamBitrate()); - info.vars["codec"] = sd->streamContentType(); - info.vars["contr"] = client.getContainer(); - - info.id = client.m_unique; - info.sid = client.m_streamID; - info.match = METRIC_AUDIENCE; - - addToServices(info); - } -} - - -void metrics_adListener (const protocol_shoutcastClient &client, const adSummary &summary) -{ - metrics_info info; - const streamData::streamInfo &stream = summary.sd->getInfo(); - - info.vars["action"] = "listener_admetric"; - info.vars["tstamp"] = tos(summary.tstamp); - info.vars["host"] = summary.sd->streamPublicIP(); - info.vars["radionomyid"] = info.vars["ref"] = summary.sd->radionomyID(); - info.vars["srvid"] = stream.m_serverID; - info.vars["id"] = summary.id; - info.vars["mount"] = summary.path.hideAsString(); - info.vars["client"] = tos(client.getUnique()); - info.vars["group"] = tos(client.getGroup()); - info.vars["sent"] = tos (client.getAdAccess().total_processed); - info.vars["started"] = tos (client.getAdAccess().start_time); - - info.mode = 1; - info.sid = summary.sid; - info.match = METRIC_ADVERT; - - addToServices(info); -} - - -void metrics_advert_started (const adSummary &summary) -{ - metrics_info info; - const streamData::streamInfo &stream = summary.sd->getInfo(); - - info.vars["action"] = "ad_trigger"; - info.vars["tstamp"] = tos(summary.tstamp); - info.vars["host"] = summary.sd->streamPublicIP(); - info.vars["radionomyid"] = info.vars["ref"] = summary.sd->radionomyID(); - info.vars["srvid"] = stream.m_serverID; - info.vars["mount"] = summary.path.hideAsString(); - info.vars["id"] = summary.id; - info.vars["listeners"] = tos(summary.count); - info.vars["bitrate"] = tos(summary.sd->streamBitrate()); - info.vars["codec"] = summary.sd->streamContentType(); - - info.mode = 1; - info.sid = summary.sid; - info.match = METRIC_ADVERT; - - addToServices(info); -} - - -void metrics_advert_stats(const adSummary &summary) -{ - metrics_info info; - const streamData::streamInfo &stream = summary.sd->getInfo(); - - info.vars["action"] = "ad_metric"; - info.vars["tstamp"] = tos(summary.tstamp); - info.vars["host"] = summary.sd->streamPublicIP(); - info.vars["radionomyid"] = info.vars["ref"] = summary.sd->radionomyID(); - info.vars["srvid"] = stream.m_serverID; - info.vars["id"] = summary.id; - info.vars["mount"] = summary.path.hideAsString(); - info.vars["group"] = tos(summary.group); - info.vars["file"] = summary.name; - if (summary.missing) - info.vars["missing"] = (summary.failed ? "failed" : "timeout"); - else - info.vars["listeners"] = tos(summary.count); - info.vars["bitrate"] = tos(summary.sd->streamBitrate()); - info.vars["codec"] = summary.sd->streamContentType(); - - info.mode = 1; - info.sid = summary.sid; - info.match = METRIC_ADVERT; - - addToServices(info); -} - - -static bool _filled_info_notify (metrics_info &info, const streamID_t sid, const utf8& radionomyID, - const utf8& serverID, const utf8& publicip, time_t tm = ::time(NULL)) -{ - if (radionomyID.empty() || serverID.empty() || publicip.empty()) - return false; - - info.vars["action"] = iskilled() ? "shutdown" : "reset"; - info.vars["tstamp"] = tos ((long)tm); - info.vars["host"] = publicip; - info.vars["radionomyid"] = info.vars["ref"] = radionomyID; - info.vars["srvid"] = serverID; - info.vars["mount"] = getStreamPath(sid); - - info.sid = sid; - info.match = METRIC_NOTIFICATION; - info.mode = 2; - return true; -} - -void metrics_stream_down (const streamID_t sid, const utf8& radionomyID, - const utf8& serverID, const utf8& publicip, time_t tm) -{ - metrics_info info; - if (_filled_info_notify (info, sid, radionomyID, serverID, publicip)) - { - info.vars["action"] = iskilled() ? "shutdown" : "stopped"; - info.vars["started"] = tos(tm); - addToServices(info); - } -} - -void metrics_stream_up (const streamID_t sid, const utf8& radionomyID, - const utf8& serverID, const utf8& publicip, time_t tm) -{ - metrics_info info; - if (_filled_info_notify (info, sid, radionomyID, serverID, publicip)) - { - info.vars["action"] = iskilled() ? "shutdown" : "reset"; - addToServices(info); - } -} - - -utf8 metrics_verifyDestIP(config &conf, bool full, uniString::utf8 url) -{ - // we'll try to set this where possible but it depends on 'destip' or 'publicip' - // being set in order for us to have something to be able to be used by the YP - utf8 destBindAddr = stripWhitespace((url.empty() ? (full && !conf.publicIP().empty() ? conf.publicIP() : conf.destIP()) : url)); - destBindAddr = stripHTTPprefix(destBindAddr); - - // with full then we're wanting to filter out some of the values - // since this is then used for the public reponses / YP details - if (full) - { - // cleanup things and only provide what should be valid i.e. nothing from a private network - // and not send this even if provided just means the YP server will use the connection's IP - if (isRemoteAddress(destBindAddr)) - { - return destBindAddr; - } - return ""; - } - // otherwise we just return the cleaned version as-is - // since it'll allow for use in normal bindings, etc - return destBindAddr; -} - -utf8 createGuid() -{ -#ifdef _WIN32 -#define rand_r(x) rand() -#else - static unsigned int seed = time(NULL); -#endif - std::stringstream ss; - for (int i = 0; i < 30; i++) - ss << std::hex << (unsigned int)(rand_r(&seed) % 16); - return ss.str(); -} - - -#ifdef _MSC_VER -utf8 getWindowsRegKey (bool newone = false) -{ - wchar_t *subKey = L"Software\\Microsoft\\Cryptography"; - HKEY hKey; - - LONG nError = RegOpenKeyEx (HKEY_LOCAL_MACHINE, subKey, 0, KEY_READ, &hKey); - if (nError == ERROR_FILE_NOT_FOUND) - { -#if 0 - // maybe try to create a local guid to read from. - subkey = L"Software\\SHOUTcast"; - nError = RegOpenKeyEx (HKEY_LOCAL_MACHINE, subKey, 0, KEY_READ, &hKey); - if (nError == ERROR_FILE_NOT_FOUND) - { - // create one and put id in there - nError = RegCreateKeyEx (HKEY_LOCAL_MACHINE, subKey, NULL, NULL, REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL, &hKey, NULL); - if (nError == ERROR_FILE_NOT_FOUND) - return ""; - - string guid = createGuid (); - DWORD dwSize = lstrlen(&guid[0]) * sizeof(TCHAR); - nError = RegSetValueEx (hKey, lpValue, NULL, REG_SZ, (unsigned char *)&guid[0], dwSize); - return guid; - } -#else - return ""; -#endif - } - char buff[100]; - DWORD rdwSize = sizeof (buff); - DWORD dwType = REG_SZ; - nError = RegQueryValueExA (hKey, "MachineGuid", NULL, &dwType, (unsigned char*)buff, &rdwSize); - RegCloseKey (hKey); - return (nError) ? "" : buff; -} -#endif - - -void hashDID (utf8 &ident) -{ - // uses openssl for hashing a machine/installation Id - unsigned char digest[SHA256_DIGEST_LENGTH]; - - SHA256((unsigned char*)&ident[0], ident.size(), (unsigned char*)&digest); - - std::stringstream ss; - for(int i = 0; i < SHA256_DIGEST_LENGTH; i++) - ss << std::hex << (unsigned int)digest[i]; - g_licence_DID = ss.str(); - DLOG ("ident is " + ident + ", DID is " + g_licence_DID); -} - - -void metricsCheckDID () -{ - if (g_licence_DID.empty() == false) - return; - - utf8 s = "DIDC"; // Dnas ID Code - do - { -#ifdef _WIN32 - utf8 key = getWindowsRegKey(); - if (key.empty() == false) - { - s += key; - break; - } -#endif -#ifdef PLATFORM_LINUX - ifstream myfile ("/etc/machine-id"); - if (myfile.is_open()) - { - string line; - getline (myfile, line); - s += line; - break; - } -#endif - // get random sequence if all else fails - ILOG ("failed to get a static unique number, falling back to random sequence"); - s += createGuid(); - } while (0); - - // append conf bits to string. XXXX[-publicip]-baseport - s += "-"; - s += tos(gOptions.portBase()); - utf8 p = gOptions.publicIP(); - if (p.empty() == false) - { - s += "-"; - s += p; - } - hashDID (s); -} - - -void metrics_apply(config &conf) -{ - bool same = (metrics_verifyDestIP(conf) == metrics_verifyDestIP(gOptions)); - if (!same || servers.empty()) - { - if (!same) - { - metrics_stop(); - } - - DEBUG_LOG(utf8(same ? "Adding" : "Updating") + " metrics details", LOGNAME); - metricsCheckDID (); - - service *s = new service (METRIC_AUDIENCE, METRICS_AUDIENCE_URL, "audience"); - servers.push_front(s); - - s = new service (METRIC_ADVERT, METRICS_ADVERTS_URL, "adservice"); - servers.push_front(s); - - s = new service (METRIC_NOTIFICATION, METRICS_RESET_URL, "notification"); - servers.push_front(s); - -#ifndef LICENCE_FREE - s = new licenceService (); - servers.push_front(s); -#endif - - s = new ypService (); - servers.push_front(s); - } -} - - -void metrics_stop() -{ - g_serversLock.lock(); - if (!servers.empty()) - { - int loop = 50; - while (loop > 0) - { - list ::iterator it = servers.begin(); - if (it == servers.end()) - { - break; - } - - service *s = *it; - if (s) - { - if (s->in_use) - { - loop--; - g_serversLock.unlock(); - safe_sleep(0, 100); // thread active so wait and try again - g_serversLock.lock(); - continue; - } - } - - servers.erase(it); - - if (s) - { - delete s; - s = NULL; - } - } - } - g_serversLock.unlock(); -} - - -// called near the start of the stream and each metadata update. -// -void updateMeta (const metaInfo &meta) -{ - metrics_info info; - utf8 uid = gOptions.userId (); - - utf8 ah = gOptions.stream_authHash (meta.m_sid); - if (ah.empty()) - return; - info.vars ["uid"] = uid; - info.vars ["ah"] = ah; - info.vars ["did"] = g_licence_DID; - info.vars ["tstamp"] = tos (time(NULL)); - - info.vars ["private"] = tos(meta.m_private ? 1 : 0); - info.vars ["sid"] = tos(meta.m_sid); - info.vars ["format"] = meta.m_format; - info.vars ["audience"] = tos (stats::getUserCount (meta.m_sid)); - info.vars ["maxlisteners"] = tos(meta.m_maxListeners); - info.vars ["currentsong"] = meta.m_song; - info.vars ["bitrate"] = tos(meta.m_bitrate); - info.vars ["mount"] = getStreamPath (meta.m_sid); - info.vars ["samplerate"] = tos (meta.m_samplerate); - info.vars ["verinfo"] = meta.m_version; - info.vars ["agent"] = meta.m_agent; - info.vars ["sourceip"] = meta.m_sourceIP; - info.vars ["publicip"] = gOptions.publicIP(); - info.vars ["publicport"] = tos (gOptions.publicPort()); - info.vars ["secure"] = tos (threadedRunner::isSSLCapable() ? 1 : 0); - - stats::statsData_t data; - stats::getStats (meta.m_sid, data); - info.vars ["peaklisteners"] = tos(data.peakListeners); - - info.match = METRIC_YP; - info.sid = meta.m_sid; - info.mode = 1; - DLOG ("push to YP requested \"" + meta.m_song + "\"", LOGNAME, meta.m_sid); - addToServices(info); -} - - -void licence_data::checkURLNode (aolxml::node *root, const char *ref, service_t s) -{ - aolxml::node *n = aolxml::node::findNode (root, ref); - if (n) - { - utf8 url = n->findAttributeString ("url"); - if (url.empty() == false) - { - metrics_info info; - info.url = url; - info.match = s; - info.mode = 2; - addToServices (info); - } - } -} - - -void licence_data::handleURLs (aolxml::node *root) -{ - if (root == NULL) - return; - checkURLNode (root, "/SHOUTCAST/METRICS", METRIC_AUDIENCE); - checkURLNode (root, "/SHOUTCAST/METRICSAD", METRIC_ADVERT); - checkURLNode (root, "/SHOUTCAST/YP", METRIC_YP); - - aolxml::node *n = aolxml::node::findNode (root, "/SHOUTCAST/AUTH"); - if (n) - { - utf8 s = n->findAttributeString ("url"); - if (s.empty() == false) - { - auth::g_authURL = s; - auth::updateServices (); - } - } -} - - -int licence_data::post_callback () -{ - vector<__uint8> v; -#ifdef LICENCE_RESP - utf8 s = LICENCE_RESP; - v.assign (&s[0], &s[s.size()]); -#else - v.reserve (m_ss.tellp()); - std::copy (std::istreambuf_iterator( m_ss ), std::istreambuf_iterator(), std::back_inserter(v)); -#endif - - aolxml::node *n = NULL, *root = NULL; - do - { - if (v.empty()) - break; -#if defined(_DEBUG) || defined(DEBUG) - //DLOG ("response size is " + tos (v.size())); - DEBUG_LOG ("Licence body " + tos (v.size()) + ":" + utf8 ((const char*)&v[0], v.size()), LOGNAME); -#endif - root = aolxml::node::parse (&v[0], v.size()); - if (root) - n = aolxml::node::findNode (root, "/SHOUTCAST/FUNCTION"); - if (n == NULL) - { - ILOG ("license parse failed, skipping", LOGNAME); - break; - } - - utf8 s = n->findAttributeString ("level"); - if (s == "10") - { - ILOG ("detected paying offer", LOGNAME); - streamData::streamInfo::m_allowSSL_global = 1; - streamData::streamInfo::m_allowAllFormats_global = 1; - streamData::streamInfo::m_allowBackupURL_global = 1; - streamData::streamInfo::m_allowMaxBitrate_global = 0; - break; - } - ILOG ("free offer only", LOGNAME); - streamData::streamInfo::m_allowSSL_global = 0; - streamData::streamInfo::m_allowAllFormats_global = 0; - streamData::streamInfo::m_allowBackupURL_global = 0; - streamData::streamInfo::m_allowMaxBitrate_global = 128; - } while (0); - - handleURLs (root); - - forget (root); - return 0; -} - - -// Called at server start and every hour. -void licenceService::addCheckup (time_t when) -{ - // eg http://dnas-services.shoutcast.com:8500/registration/?lid=2&debug=yes - // eg https://dnas-services.shoutcast.com/registration/?lid=2&debug=yes - httpHeaderMap_t vars; - bool licenceMissing = true; - utf8 s = gOptions.userId(); - - if (s.empty()) - return; - vars ["uid"] = s; - s = gOptions.licenceId(); - if (s.empty() == false) - { - vars ["lid"] = s; - licenceMissing = false; - } - - vars ["did"] = g_licence_DID; - vars ["tstamp"] = tos (time(NULL)); - - licence_data *copy = new licence_data(); - - copy->post = encodeVariables(vars); - copy->m_schedule = when; - if (licenceMissing) - copy->flags |= 1; - - g_serversLock.lock(); - queue.push_front (copy); - m_queueCount++; - g_serversLock.unlock(); -} - - -int YP_data::post_callback () -{ - vector<__uint8> v; - v.reserve (m_ss.tellp()); - std::copy (std::istreambuf_iterator( m_ss ), std::istreambuf_iterator(), std::back_inserter(v)); - - aolxml::node *n = NULL, *root = NULL; - do - { - //DLOG ("response size is " + tos (v.size())); - if (v.empty()) - break; -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG ("YP Body " + tos (v.size()) + ":" + utf8 ((const char*)&v[0], v.size()), name(), sid); -#endif - root = aolxml::node::parse (&v[0], v.size()); - if (root) - n = aolxml::node::findNode (root, "/response"); - if (n == NULL) - { - ILOG ("response invalid, skipping", name(), sid); - break; - } - int code = aolxml::subNodeText(n, "/response/statusCode", 400); - if (code != 200) - { - utf8 msg = aolxml::subNodeText(n, "/response/statusText", (utf8)""); - if (msg != (utf8)"") - WLOG ("response returned " + tos(code) + ", " + msg, name(), sid); - break; - } - n = aolxml::node::findNode (root, "/response/data"); - if (n == NULL) - { - ILOG ("No special settings from YP for stream " + tos(sid), name(), sid); - break; - } - yp2::stationInfo info; - info.m_advertMode = aolxml::subNodeText(n, "/response/data/admode", 0); - info.m_streamTitle = aolxml::subNodeText(n, "/response/data/stationname", (utf8)""); - info.m_stationID = aolxml::subNodeText(n, "/response/data/stationid", (utf8)""); - info.m_serverID = aolxml::subNodeText(n, "/response/data/serverid", (utf8)""); - info.m_radionomyID = aolxml::subNodeText(n, "/response/data/callsign", (utf8)""); - info.m_responseCode = code; - info.m_advertType = aolxml::subNodeText(n, "/response/data/advert/type", (utf8)"fixed"); - info.m_advertTrigger = aolxml::subNodeText(n, "/response/data/advert/trigger", (utf8)"meta"); - - streamData *sd = streamData::accessStream (sid); - if (sd) - { - sd->YP2_updateInfo (info); - sd->releaseStream(); - } - ILOG ("Stream #" + tos(sid) + " has been updated on the Shoutcast Directory.", name(), sid); - - } while (0); - - forget (root); - return 0; -} - -} // namespace diff --git a/Src/Plugins/DSP/sc_serv3/metrics.h b/Src/Plugins/DSP/sc_serv3/metrics.h deleted file mode 100644 index f324beaa..00000000 --- a/Src/Plugins/DSP/sc_serv3/metrics.h +++ /dev/null @@ -1,101 +0,0 @@ -/* metrics.h external interface to metric processing */ - -#ifndef _METRICS_H -#define _METRICS_H - -#include "unicode/uniString.h" - -class protocol_shoutcastClient; -class streamData; -class config; - -#if 1 -#define METRICS_AUDIENCE_URL "https://metrics.shoutcast.com/metrics" -#define METRICS_ADVERTS_URL "https://ads.shoutcast.com/dnas" -#define TARGETSPOT_URL "https://ads.shoutcast.com/dnas" -#define METRICS_YP_URL "https://dnas-services.shoutcast.com/yp/" -#else -#define METRICS_AUDIENCE_URL "http://localhost:9001" -#define METRICS_ADVERTS_URL "http://localhost:9001/dnas" -#define TARGETSPOT_URL "http://localhost/~karl/mapping1.php" -#endif -#define METRICS_RESET_URL "https://metrics.radionomy.com/connections/closednas" - - -namespace metrics -{ - typedef size_t streamID_t; - typedef enum { - METRIC_AUDIENCE = 1, - METRIC_ADVERT = 2, - METRIC_NOTIFICATION = 4, - METRIC_LICENCE = 8, - METRIC_YP = 16 - } service_t; - - struct adSummary - { - streamID_t sid; - bool sendRest; - bool failed; - bool missing; - uniString::utf8 path; - time_t tstamp; - const char *name; - int count; - std::string id; - size_t group; - streamData *sd; - - adSummary() : sid(1), tstamp(0), name(0), count(0), group(0) { sd = NULL; sendRest = failed = missing = false; } - }; - - struct metaInfo - { - streamID_t m_sid; - bool m_private; - unsigned int m_audience; - unsigned int m_maxListeners; - unsigned int m_bitrate; - unsigned int m_samplerate; - uniString::utf8 m_version; - uniString::utf8 m_song; - uniString::utf8 m_format; - uniString::utf8 m_agent; - uniString::utf8 m_publicIP; - uniString::utf8 m_sourceIP; - }; - - void metrics_init(); - void metrics_stop(); - void metrics_apply(config &conf); - - // new listener triggers - void metrics_listener_new(const protocol_shoutcastClient &client); - - // exiting listener triggers - void metrics_listener_drop(const protocol_shoutcastClient &client); - - void metrics_adListener (const protocol_shoutcastClient &client, const adSummary &summary); - - void metrics_advert_started (const adSummary &summary); - - void metrics_advert_stats(const adSummary &summary); - - typedef unsigned yp2SessionKey; - - void metrics_stream_down (const streamID_t sid, const uniString::utf8& radionomyID, - const uniString::utf8& serverID, const uniString::utf8& publicip, time_t tm); - - void metrics_stream_up (const streamID_t sid, const uniString::utf8& radionomyID, - const uniString::utf8& serverID, const uniString::utf8& publicip, time_t tm); - - // periodic wakeup for any stalled metrics - void metrics_wakeup(bool force = false); - - void updateMeta (const metaInfo &meta); - - uniString::utf8 metrics_verifyDestIP(config &conf, bool full = true, uniString::utf8 url = ""); -} - -#endif /* _METRICS_H */ diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/file/fileUtils.cpp b/Src/Plugins/DSP/sc_serv3/nmrCommon/file/fileUtils.cpp deleted file mode 100644 index 941746d2..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/file/fileUtils.cpp +++ /dev/null @@ -1,232 +0,0 @@ -#ifdef _WIN32 -#include -#else -#include -#endif -#include "fileUtils.h" -#include "stl/stringUtils.h" -#include "services/stdServiceImpl.h" -#include -#include "../../global.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -bool fileUtil::convertOSFilePathDelimiter(uniString::utf8 &value) throw() -{ - bool converted = false; - if (!value.empty()) - { - #ifdef _WIN32 - const uniString::utf8& replaceFilePathDelimiter("/"); - #else - const uniString::utf8& replaceFilePathDelimiter("\\"); - #endif - - uniString::utf8::size_type pos = value.find(replaceFilePathDelimiter); - if (pos != uniString::utf8::npos) converted = true; - while (pos != uniString::utf8::npos) - { - value.replace(pos,1,getFilePathDelimiter()); - pos = value.find(replaceFilePathDelimiter); - } - } - return converted; -} - -#ifdef _WIN32 - -uniFile::filenameType fileUtil::getFullFilePath(const uniFile::filenameType &partial_path) throw() -{ - wchar_t resolved_path[MAX_PATH] = {0}; - - uniString::utf32 u32(partial_path); - std::wstring u16; - u32.toUtf16(u16); - - if (_wfullpath(resolved_path, u16.c_str(), MAX_PATH)) - { - return utf32(resolved_path).toUtf8(); - } - return partial_path; -} - -bool fileUtil::fileExists(const uniFile::filenameType &fullPath) throw() -{ - uniString::utf32 u32(fullPath); - std::wstring u16; - u32.toUtf16(u16); - - HANDLE hPF = ::CreateFileW(u16.c_str(), 0, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); - if (hPF == INVALID_HANDLE_VALUE) - { - return false; - } - ::CloseHandle(hPF); - return true; -} - -bool fileUtil::directoryExists(const uniFile::filenameType &fullPath) throw() -{ - WIN32_FIND_DATAW fd = {0}; - - uniString::utf32 u32(fullPath); - std::wstring u16; - u32.toUtf16(u16); - - wstring path = u16.substr(0, u16.rfind(L"\\")); - HANDLE h = ::FindFirstFileW(path.c_str(), &fd); - if (h != INVALID_HANDLE_VALUE) - { - ::FindClose(h); - } - - return (h != INVALID_HANDLE_VALUE); -} - -vector fileUtil::directoryFileList(const wstring &pattern, const wstring ¤tPath, bool fullPaths, bool preserveCase) throw() -{ - vector result; - WIN32_FIND_DATAW fd = {0}; - wstring search = pattern; - - if (search.empty()) - { - return result; - } - - // look at the path and see if it's been setup correctly i.e has a .\ on the front for relative searches - if (!((search[1] == ':' && search[2] == '\\') || - (search[0] == '\\' && search[1] == '\\') || - (search[0] == '.' && search[1] == '\\') || - (search[0] == '.' && search[1] == '.' && search[2] == '\\'))) - { - if (!currentPath.empty()) - { - search = currentPath + search; - } - else - { - search = gStartupDirectory.toWString() + search; - } - } - - wstring path = search.substr(0,search.rfind(L"\\")); - HANDLE h = ::FindFirstFileW(search.c_str(),&fd); - if (h != INVALID_HANDLE_VALUE) - { - do - { - if (fullPaths) - { - if (preserveCase) - { - result.push_back((path + L"\\" + fd.cFileName)); - } - else - { - result.push_back(toLower(path + L"\\" + fd.cFileName)); - } - } - else - { - if (preserveCase) - { - result.push_back((fd.cFileName)); - } - else - { - result.push_back(toLower(wstring(fd.cFileName))); - } - } - } - while(::FindNextFileW(h,&fd)); - } - - if (h != INVALID_HANDLE_VALUE) - { - ::FindClose(h); - } - - return result; -} - -#else - -#include -#include -#include - -utf8 fileUtil::getFullFilePath(const uniFile::filenameType &partial_path) throw() -{ - char resolved_path[MAXPATHLEN + 1] = {0}; - if (realpath(partial_path.hideAsString().c_str(), resolved_path)) - { - return utf8(resolved_path); - } - return partial_path; -} - -bool fileUtil::fileExists(const uniFile::filenameType &fullPath) throw() -{ - struct stat sbuf; - return (::stat(fullPath.hideAsString().c_str(),&sbuf) ? false : true); -} - -bool fileUtil::directoryExists(const uniFile::filenameType &fullPath) throw() -{ - glob_t gt; - bool found = false; - - if (glob(fullPath.hideAsString().c_str(),GLOB_NOSORT,0,>) == 0) - { - found = true; - } - - globfree(>); - return found; -} - -std::vector fileUtil::directoryFileList(const std::string &pattern, const std::string ¤tPath) throw() -{ - vector result; - - glob_t gt; - - string search = pattern; - - if (search.empty()) - { - return result; - } - - // look at the path and see if it's been setup correctly i.e has a ./ on the front for relative searches - if (!((search[0] == '\\' && search[1] == '\\') || - (search[0] == '/') || - (search[0] == '.' && search[1] == '/') || - (search[0] == '.' && search[1] == '.' && search[2] == '/'))) - { - if (!currentPath.empty()) - { - search = currentPath + search; - } - else - { - search = string("./") + search; - } - } - - if (glob(search.c_str(),GLOB_NOSORT,0,>) == 0) - { - for (size_t x = 0; x < gt.gl_pathc; ++x) - { - result.push_back(gt.gl_pathv[x]); - } - } - - globfree(>); - return result; -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/file/fileUtils.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/file/fileUtils.h deleted file mode 100644 index 12a1d419..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/file/fileUtils.h +++ /dev/null @@ -1,117 +0,0 @@ -#pragma once -#ifndef _fileUtils_H_ -#define _fileUtils_H_ - -#include -#include -#include -#include "unicode/uniString.h" -#include "unicode/uniFile.h" - -namespace fileUtil -{ - #ifdef _WIN32 - const char filePathDelimiter='\\'; - #else - const char filePathDelimiter='/'; - #endif - - static uniString::utf8 getFilePathDelimiter() - { - #ifdef _WIN32 - return (uniString::utf8)"\\"; - #else - return (uniString::utf8)"/"; - #endif - } - - //******************************************** - //* stripPath - //* - //* remove the path from a filename - //******************************************** - template - S stripPath(const S &s,const S &delim) throw() - { - typename S::size_type pos = s.find_last_of(delim); - if (pos == S::npos) return s; - if (pos == s.size() -1) return S(); - return s.substr(pos+1); - } - - template - S stripPath(const S &s) throw() - { - return fileUtil::stripPath(s,S(1,(typename S::value_type)fileUtil::filePathDelimiter)); - } - - template - S onlyPath(const S &s,const S &delim) throw() - { - typename S::size_type pos = s.find_last_of(delim); - if (pos == S::npos) return S(); - return s.substr(0,pos+1); - } - - template - S onlyPath(const S &s) throw() - { - return fileUtil::onlyPath(s,S(1,(typename S::value_type)fileUtil::filePathDelimiter)); - } - - template - S mustEndIn(const S &s,typename S::value_type c) throw() - { - return ((s.empty() || ((*(s.rbegin())) != c)) ? (s+c) : s); - } - - template - S stripSuffix(const S &s,const S &delim) throw() - { - return s.substr(0,s.rfind(delim)); - } - - template - S stripSuffix(const S &s) throw() - { - return fileUtil::stripSuffix(s,S(1,(typename S::value_type)'.')); - } - - template - S getSuffix(const S &s,const S &delim) throw() - { - S empty; - typename S::size_type pos = s.rfind(delim); - if (pos == S::npos) - return empty; - return s.substr(pos+1); - } - - template - S getSuffix(const S &s) throw() - { - return fileUtil::getSuffix(s,S(1,(typename S::value_type)'.')); - } - - //////////// - - // return true if a file exists - bool fileExists(const uniFile::filenameType &fullPath) throw(); - - // return true if a directory exists - bool directoryExists(const uniFile::filenameType &fullPath) throw(); - - // get list of all files that match a pattern - #ifdef _WIN32 - std::vector directoryFileList(const std::wstring &pattern, const std::wstring ¤tPath, - bool fullPaths, bool preserveCase = false) throw(); - #else - std::vector directoryFileList(const std::string &pattern, const std::string ¤tPath) throw(); - #endif - - bool convertOSFilePathDelimiter(uniString::utf8 &value) throw(); - - uniFile::filenameType getFullFilePath(const uniFile::filenameType &partial) throw(); -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/intTypes.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/intTypes.h deleted file mode 100644 index ffaaeb36..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/intTypes.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef intTypes_H_ -#define intTypes_H_ - -#if defined(__APPLE_CC__) | defined(PLATFORM_BSD) -#include -#else -#ifndef WIN32 -#include -#endif -#endif - -#ifndef WIN32 -// these are defined under windows -typedef char __int8; -typedef short __int16; -typedef int __int32; -typedef long long __int64; -#endif - -typedef unsigned char __uint8; -typedef unsigned short __uint16; -typedef unsigned int __uint32; -typedef unsigned long long __uint64; - -#ifdef __cplusplus - - -#undef ByteSwap32 -#undef ByteSwap16 -#undef ByteSwap -#undef bs16 -#undef bs32 -#undef bs -#undef bs16s -#undef bs16u -#undef bs32s -#undef bs32u - -inline __uint32 ByteSwap32u (__uint32 nLongNumber) -{ - return (((nLongNumber&0x000000FF)<<24)+((nLongNumber&0x0000FF00)<<8)+ - ((nLongNumber&0x00FF0000)>>8)+((nLongNumber&0xFF000000)>>24)); -} - -inline __uint16 ByteSwap16u (__uint16 nValue) -{ - return (((nValue>> 8)) | (nValue << 8)); - -} - -inline __int16 ByteSwap16s(__int16 nValue) { return ByteSwap16u(nValue); } -inline __int32 ByteSwap32s(__int32 nValue) { return ByteSwap32u(nValue); } - -inline __uint16 ByteSwap(__uint16 nValue) { return ByteSwap16u(nValue); } -inline __uint32 ByteSwap(__uint32 nValue) { return ByteSwap32u(nValue); } -inline __int16 ByteSwap(__int16 nValue) { return ByteSwap16u(nValue); } -inline __int32 ByteSwap(__int32 nValue) { return ByteSwap32u(nValue); } - -#ifdef __BYTE_ORDER - -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define bs16(x) (x) -#define bs16s(x) (x) -#define bs16u(x) (x) -#define bs32(x) (x) -#define bs32s(x) (x) -#define bs32u(x) (x) -#define bs(x) (x) -#else -#if __BYTE_ORDER == __BIG_ENDIAN -#define bs16(x) ByteSwap16u(x) -#define bs16s(x) ByteSwap16s(x) -#define bs16u(x) ByteSwap16u(x) -#define bs32(x) ByteSwap32u(x) -#define bs32s(x) ByteSwap32s(x) -#define bs32u(x) ByteSwap32u(x) -#define bs(x) ByteSwap(x) -#else -//#error "No endian defined (__BYTE_ORDER)" -#endif -#endif - -#else - -#ifdef BYTE_ORDER - -#if BYTE_ORDER == LITTLE_ENDIAN -#define bs16(x) (x) -#define bs16s(x) (x) -#define bs16u(x) (x) -#define bs32(x) (x) -#define bs32s(x) (x) -#define bs32u(x) (x) -#define bs(x) (x) -#else -#if BYTE_ORDER == BIG_ENDIAN -#define bs16(x) ByteSwap16u(x) -#define bs16s(x) ByteSwap16s(x) -#define bs16u(x) ByteSwap16u(x) -#define bs32(x) ByteSwap32u(x) -#define bs32s(x) ByteSwap32s(x) -#define bs32u(x) ByteSwap32u(x) -#define bs(x) ByteSwap(x) -#else -//#error "No endian defined (BYTE_ORDER)" -#endif -#endif - -#else - -//#error "Neither __BYTE_ORDER or BYTE_ORDER is defined" -#endif -#endif - -#endif - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/macros.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/macros.h deleted file mode 100644 index 60ac48ef..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/macros.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef _commonmacros_H_ -#define _commonmacros_H_ - -#ifndef NDEBUG -#define DIAG(x) OutputDebugString(x); -#else -#define DIAG(x) -#endif - -/** - * The __TODO__ macro provides a way to notate source code in a way that the - * compiler will recognize and print out the file and line number in the Build - * window. This should be used like so: - * - * #pragma message(__TODO__"Message here") - */ -#define __TODO_STR2__(str) #str -#define __TODO_STR__(str) __TODO_STR2__(str) -#define __TODO__ __FILE__ "(" __TODO_STR__(__LINE__)") : TODO: " - -/* nocopy macros makes an uncopyable object use as follows - class foobar - { - nocopy(foobar) - - public: - // other methods here - }; -*/ -#define nocopy(c) private: c(const c &/*v*/) { ASSERT(0); } c& operator=(const c &/*v*/) { ASSERT(0); return *this;} - -// various forget macros that delete objects and zero them out safely. -#define forget(x) { if (x) { delete x; x = 0; } } -#define forgetArray(x) { if (x) { delete [] x; x = 0; } } -#define safeRelease(x) { if (x) { x->Release(); x = 0; } } -#define forgetHandleNULL(x) { if (x) { ::CloseHandle(x); x = NULL; } } - -#ifdef WIN32 -#define forgetHandleInvalid(x) { if (x != INVALID_HANDLE_VALUE) ::CloseHandle(x); x = INVALID_HANDLE_VALUE; } -#define forgetGDIObject(x) { if (x) ::DeleteObject(x); x = NULL; } -#define forgetGDIIcon(x) { if (x) ::DestroyIcon(x); x = NULL; } - -#ifdef HRESULT -// I do this so often, I turned it into a macro -struct bad_hresult -{ - HRESULT err; - bad_hresult(HRESULT herr): err(herr){} -}; -#endif - -#define checkCOMReturn(x) { HRESULT err = x; if (FAILED(err)) return err; } -#define checkCOMThrow(x) { HRESULT err = x; if (FAILED(err)) throw bad_hresult(err); } -#endif - -// so I don't have to include nsvlib.h all the time -#ifndef NSV_MAKETYPE -#define NSV_MAKETYPE(A,B,C,D) ((A) | ((B)<<8) | ((C)<<16) | ((D)<<24)) -#endif - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/memory/refPtr.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/memory/refPtr.h deleted file mode 100644 index 2650e7f6..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/memory/refPtr.h +++ /dev/null @@ -1,181 +0,0 @@ -#ifndef refPtr_H_ -#define refPtr_H_ - -#include "threading/thread.h" -#ifdef WIN32 -#include -#else -#include -#endif - -#ifndef WIN32 -#ifndef _ASSERTE -#define _ASSERTE(x) assert(x) -#endif -#endif - -/* - Intrusive reference counted pointer template. - - The class to be reference counted must implement - - void refIncrement() const // increment the reference count - int refDecrement() const // decrement the reference count and return the new value. - - Yes, the methods are const. This provides maximum flexibility. - Obviously the reference counted values must be mutable for this to work. - - Two predefined bases are provided. - - refCountBase - non locking base for single threaded scenarios - refCountBaseMT - locking base for multi threaded scenarios - -*/ - -// base class for single threaded reference count objects -class refCountBase -{ -template friend class refPtr; -public: - /// return the number of references to this object (useful for debugging) - int refCount() const { return m_refCount; } - -protected: - refCountBase() : m_refCount(0) {} - virtual ~refCountBase() - { - // make sure nobody has deleted this directly with delete - _ASSERTE(m_refCount == 0); - } - -private: - mutable int m_refCount; - - void refIncrement() const { _ASSERTE(m_refCount >= 0); ++m_refCount; } - - int refDecrement() const { _ASSERTE(m_refCount > 0); return --m_refCount; } -}; - -// base class for multi threaded reference count objects -class refCountBaseMT -{ -template friend class refPtr; -public: - /// return the number of references to this object (useful for debugging) - int refCount() const - { - stackLock sl(m_lock); - return m_refCount; - } - -protected: - refCountBaseMT() : m_refCount(0) {} - virtual ~refCountBaseMT() - { - // make sure nobody has deleted this directly with delete - _ASSERTE(m_refCount == 0); - } - -private: - mutable int m_refCount; - mutable AOL_namespace::mutex m_lock; - - void refIncrement() const - { - stackLock sl(m_lock); - _ASSERTE(m_refCount >= 0); - ++m_refCount; - } - - int refDecrement() const - { - stackLock sl(m_lock); - _ASSERTE(m_refCount > 0); - return --m_refCount; - } -}; - -template class refPtr -{ -public: - typedef T *pointer_t; - - // construction - refPtr() : m_object(NULL) {} - - refPtr(const refPtr &rhs) : m_object(rhs.m_object) - { - if (m_object) - m_object->refIncrement(); - } - - refPtr(T *object) : m_object(object) - { - if (m_object) - m_object->refIncrement(); - } - - ~refPtr() - { - if (m_object && (m_object->refDecrement() == 0)) - delete m_object; - } - - // asignment - refPtr &operator=(const refPtr &rhs) - { - if (m_object != rhs.m_object) - { - if (m_object && (m_object->refDecrement() == 0)) - delete m_object; - m_object = rhs.m_object; - if (m_object) - m_object->refIncrement(); - } - return *this; - } - - /// test if pointers are the same - inline bool operator==(const refPtr &rhs) const - { - return m_object == rhs.m_object; - } - - inline bool operator==(void *nl) const - { - return m_object == nl; - } - - /// test if pointers are not the same - inline bool operator!=(const refPtr &rhs) const - { - return m_object != rhs.m_object; - } - - inline bool operator!=(void *nl) const - { - return m_object != nl; - } - - // dereferencing - T *operator->() const { _ASSERTE(m_object); return (T *)m_object; } - T &operator*() const { _ASSERTE(m_object); return *((T *)m_object); } - operator T *() const { return (T *)m_object; } - - /// explicit get - do NOT delete this pointer! - T *get() const { return (T *)m_object; } - - /* these member templates allows conversion of this smart pointer to - other smart pointers in the parent hierarchy. This simulates up-casting - the pointer to a base */ - template - operator refPtr() { return refPtr((T *)m_object); } - - template - operator const refPtr() const { return refPtr((T *)m_object); } - -private: - T *m_object; -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/baseOptions.cpp b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/baseOptions.cpp deleted file mode 100644 index b1445cba..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/baseOptions.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "baseOptions.h" -#include "stl/stringUtils.h" -#ifdef _WIN32 -#include "win32/rezFuncs.h" -#else -#include "unixversion.h" -#endif - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -bool baseOptions::toBool(const utf8 &s) throw() -{ - if (s.empty()) return true; - utf8 ss = toLower(s); - return (s[0] == 't' || s[0] == '1' || s[0] == 'y'); -} - -const vector baseOptions::fromArgs(const vector &cl) throw() -{ - vector unused; - - for (vector::const_iterator i = cl.begin(); i != cl.end(); ++i) - { - utf8::size_type colon_pos = (*i).find(utf8(":")); - if (colon_pos != utf8::npos) - { - utf8 key = (*i).substr(0,colon_pos); - utf8 value = (*i).substr(colon_pos+1); - if (key == "flog") - { - m_fileLog = value; - } - else if (key == "clog") - { - m_consoleLogging = toBool(value); - } - else - { - unused.push_back(*i); - } - } - else - { - unused.push_back(*i); - } - } - - return unused; -} - -utf8 baseOptions::getVersionBuildStrings() throw() -{ -#ifdef _WIN32 - static utf8 version; - if (version.empty()) - { - getVersionInfo(version); - } -#else - static utf8 version; - if (version.empty()) - { - for (int x = 0; x < VENT; ++x) - { - if (x) - { - version += "."; - } - version += tos(PRODUCTVERSION[x]); - } - } -#endif - return version; -} diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/baseOptions.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/baseOptions.h deleted file mode 100644 index 96d96dbe..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/baseOptions.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once -#ifndef baseOptions_H_ -#define baseOptions_H_ - -#include -#include -#include "unicode/uniFile.h" -#include "services/logger.h" - -struct baseOptions -{ - uniFile::filenameType m_fileLog; - bool m_consoleLogging; - - // convert a string to a boolean - static bool toBool(const uniString::utf8 &s) throw(); - - // process command line options. Options are key:value pairs. All unprocessed - // options are returned - const std::vector fromArgs(const std::vector &cl) throw(); - - const uniFile::filenameType &getFileLog() const throw() { return m_fileLog; } - bool getConsoleLogging() const throw() { return m_consoleLogging; } - #ifdef _WIN32 - static uniString::utf8 getSystemLogConfigString() throw() { return AOL_logger::systemLogger_element::panicConfiguration(); } - #else - static uniString::utf8 getSystemLogConfigString() throw() { return "";} - #endif - static uniString::utf8 getVersionBuildStrings() throw(); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/logger.cpp b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/logger.cpp deleted file mode 100644 index 3e8bf438..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/logger.cpp +++ /dev/null @@ -1,966 +0,0 @@ -#include "logger.h" -#include -#include -#include "stl/functors.h" -#include "file/fileUtils.h" -#include "stl/stringUtils.h" -#include "macros.h" -#include "../../global.h" - -#ifndef _WIN32 -#include -#include -#include -#include -#endif - -#ifdef _WIN32 -#define __F__ __FUNCTION__ -#else -#define __F__ string(__PRETTY_FUNCTION__) + -#endif - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -//////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////// LOGGER ELEMENTS /////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef _WIN32 -//////////// Win32 File Logger - -inline uniFile::filenameType AOL_logger::fileLogger_element::make_backup_log(const uniFile::filenameType &filename,int which) throw() -{ - return fileUtil::stripSuffix(filename) + "_" + - tobs(which) + "." - + fileUtil::getSuffix(filename); -} - -uniFile::filenameType AOL_logger::fileLogger_element::make_archive_log() throw() -{ - SYSTEMTIME sysTime = {0}; - ::GetLocalTime(&sysTime); - wchar_t d[100] = {0}, t[100] = {0}; - ::GetDateFormatW(LOCALE_SYSTEM_DEFAULT,0,&sysTime,_T("yyyy'_'MM'_'dd"),d,99); - ::GetTimeFormatW(LOCALE_SYSTEM_DEFAULT,0,&sysTime,_T("HH'_'mm'_'ss"),t,99); - return tos((const wchar_t *)d) + "_" + tos((const wchar_t *)t); -} - -void AOL_logger::fileLogger_element::rotate() throw() -{ - m_lastRolloverTime = ::time(NULL); - - if (m_file == INVALID_HANDLE_VALUE || m_first == false) - { - return; - } - - // close the log - forgetHandleInvalid(m_file); - - // rotate - for (int x = m_numFileBackups; x > 0; --x) - { - uniFile::filenameType dest = make_backup_log(m_fileName,x); - - // archive the log file about to be removed into a gz file - if (m_numFileBackups > 0 && x == m_numFileBackups && m_archiveFileBackups) - { - uniFile::filenameType archive = dest; - utf8::size_type pos = archive.rfind(utf8("_"+tos(m_numFileBackups))); - if ((pos != utf8::npos) && (uniFile::fileSize(dest) > 0)) - { - archive = (dest.substr(0,pos) + utf8("_log_" + make_archive_log() + ".gz")); - - HANDLE m_archive = ::CreateFileW(archive.toWString().c_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (m_archive != INVALID_HANDLE_VALUE) - { - DWORD written(0); - utf8 out; - z_stream m_stream = {0}; - - if (uniFile::fileSize(dest) > 0) - { - FILE* m_logFile = uniFile::fopen(dest,"rb"); - if (m_logFile != NULL) - { - bool started = false; - while (!feof(m_logFile)) - { - std::vector m_logFileBuffer; - const size_t BUFSIZE(1024*16); - m_logFileBuffer.clear(); - m_logFileBuffer.resize(BUFSIZE + 1); - size_t amt = fread(&(m_logFileBuffer[0]), 1, BUFSIZE, m_logFile); - if (amt > 0) - { - out = utf8(&(m_logFileBuffer[0]), amt); - if (started == false) - { - compressDataStart(out, &m_stream); - started = true; - } - else - { - compressDataCont(out, &m_stream); - } - ::WriteFile(m_archive, out.c_str(), (DWORD)out.size(), &written, NULL); - } - } - - compressDataFinish(out, &m_stream); - ::WriteFile(m_archive, out.c_str(), (DWORD)out.size(), &written, NULL); - - compressDataEnd(&m_stream); - - ::fclose(m_logFile); - forgetHandleInvalid(m_archive); - - // no need to keep any 0-byte files - // this is just incase of weirdness - if (!uniFile::fileSize(archive)) - { - uniFile::unlink(archive); - } - } - else - { - forgetHandleInvalid(m_archive); - uniFile::unlink(archive); - } - } - } - } - } - ::DeleteFileW(dest.toWString().c_str()); - ::MoveFileW( - ((x-1) ? make_backup_log(m_fileName,(x-1)).toWString().c_str() - : m_fileName.toWString().c_str()), - dest.toWString().c_str()); - } - - // open new log - m_file = ::CreateFileW(m_fileName.toWString().c_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); -} - -AOL_logger::fileLogger_element::fileLogger_element(const uniFile::filenameType &filename, const uniFile::filenameType &defaultFilename, - bool &useDefaultPath, int backups, bool archive, int rolloverInterval, size_t SID) throw(exception) - - : m_fileName(filename), m_file(INVALID_HANDLE_VALUE), m_lastRolloverTime(0), m_rolloverInterval(rolloverInterval), m_numFileBackups(backups), - m_archiveFileBackups(archive), m_first(false), m_SID(SID) -{ - // this will fill in the default log path as required - wchar_t s_defaultFileName[MAX_PATH] = {0}; - ExpandEnvironmentStringsW(defaultFilename.toWString().c_str(), s_defaultFileName, MAX_PATH); - utf8 m_defaultFilename(utf32(s_defaultFileName).toUtf8()); - - useDefaultPath = false; - m_file = ::CreateFileW(m_fileName.toWString().c_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (m_file == INVALID_HANDLE_VALUE) - { - m_file = ::CreateFileW(m_defaultFilename.toWString().c_str(),GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (m_file == INVALID_HANDLE_VALUE) - { - uniFile::filenameType fallbackFilename("%temp%\\sc_serv_" + tos(getpid()) + ".log"); - wchar_t s_fallbackFileName[MAX_PATH] = {0}; - ExpandEnvironmentStringsW(fallbackFilename.toWString().c_str(), s_fallbackFileName, MAX_PATH); - utf8 m_fallbackFilename(utf32(s_fallbackFileName).toUtf8()); - m_file = ::CreateFileW(m_fallbackFilename.toWString().c_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (m_file == INVALID_HANDLE_VALUE) - { - throw runtime_error("Logger could not open the log file \"" + m_fileName.hideAsString() + "\" for writing [" + errMessage().hideAsString() + "]. Check the directory exists and another instance is not already running."); - } - else - { - m_fileName = m_fallbackFilename; - } - } - else - { - m_fileName = m_defaultFilename; - } - } - - ::SetFilePointer(m_file,0,0,FILE_END); // seek to end - if (m_fileName == m_defaultFilename) - { - useDefaultPath = true; - } - - gOptions.setOption(utf8("reallogfile"), m_fileName); - - // using this to prevent rotating empty log files on startup - m_first = fileUtil::fileExists(m_fileName.hideAsString()); - if (m_first && !uniFile::fileSize(m_fileName)) - { - m_first = false; - } - - rotate(); -} - -AOL_logger::fileLogger_element::~fileLogger_element() throw() -{ - forgetHandleInvalid(m_file); -} - -void AOL_logger::fileLogger_element::log(message &m) throw(exception) -{ - time_t t = ::time(NULL); - if (t < m_lastRolloverTime || (((t - m_lastRolloverTime) > m_rolloverInterval) && m_rolloverInterval)) - { - rotate(); - rotatew3cFiles("w3c"); - } - if (m.m_alreadyLogged) - return; - if (m_SID != m.m_streamID && m_SID) - { - return; - } - m.m_alreadyLogged = true; - m_first = true; - - utf8 ss = m.getTimestamp() + "\t" + m.typeAsStr(); - const utf8 &msg = m.getMsg(); - - if (msg[0] != '[') - { - const char *section = m.fromSection(); - if (section) - { - bool wrap = (section[0] == '[') ? false : true; - size_t ID = m.getID(); - if (wrap) - { - ss += "\t["; - ss += section; - if (ID > 0) - { - ss += " sid="; - ss += tos(ID); - } - ss += "] "; - } - else - { - ss += "\t"; - ss += section; - // if (ID > 0) - // ss += " ID present "; - } - } - else - ss += "\t"; - } - else - ss += "\t"; - - const map *fields = m.getFields(); - if (fields) - { - for (map::const_iterator i = fields->begin(); i != fields->end(); ++i) - { - if (!(*i).first.empty()) - { - if (!(*i).second.empty()) - { - ss += "\t" + (*i).second; - } - else - { - return; - } - } - } - } - ss += msg; - ss += eol(); - - if (m_file == INVALID_HANDLE_VALUE) - { - throw runtime_error(__F__ " Error writing to log file " + m_fileName.hideAsString()); - } - - DWORD written(0); - if ((!::WriteFile(m_file, ss.c_str(), (DWORD)ss.size(), &written, NULL)) || (written != ss.size())) - { - throw runtime_error(__F__ " Error writing to log file " + m_fileName.hideAsString()); - } -} - -#else - -/////////// Unix File Logger - -uniFile::filenameType AOL_logger::fileLogger_element::make_backup_log(const uniFile::filenameType &filename,int which) throw() -{ - return fileUtil::stripSuffix(filename) + "_" + tos(which) + "." + fileUtil::getSuffix(filename); -} - -uniFile::filenameType AOL_logger::fileLogger_element::make_archive_log() throw() -{ - char buf[256] = {0}; - struct tm ttm; - time_t ttt; - ::time(&ttt); - ::strftime(buf, 255, "%Y_%m_%d_%H_%M_%S", ::localtime_r(&ttt, &ttm)); - return buf; -} - -void AOL_logger::fileLogger_element::rotate() throw() -{ - m_lastRolloverTime = ::time(NULL); - - if ((m_file == -1) || (m_first == false)) - { - return; - } - - // close the log - ::close(m_file); - m_file = -1; - - // rotate - for (int x = m_numFileBackups; x > 0; --x) - { - uniFile::filenameType dest = make_backup_log(m_fileName,x); - - // archive the log file about to be removed into a gz file - if (m_numFileBackups > 0 && x == m_numFileBackups && m_archiveFileBackups) - { - uniFile::filenameType archive = dest; - utf8::size_type pos = archive.rfind(utf8("_"+tos(m_numFileBackups))); - if ((pos != utf8::npos) && (uniFile::fileSize(dest) > 0)) - { - archive = (dest.substr(0,pos) + utf8("_log_" + make_archive_log() + ".gz")); - - int m_archive = ::open(archive.hideAsString().c_str(),O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - if (m_archive != -1) - { - utf8 out; - z_stream m_stream = {0}; - - if (uniFile::fileSize(dest) > 0) - { - FILE* m_logFile = uniFile::fopen(dest,"rb"); - if (m_logFile != NULL) - { - bool started = false; - while (!feof(m_logFile)) - { - std::vector m_logFileBuffer; - const size_t BUFSIZE(1024*16); - m_logFileBuffer.clear(); - m_logFileBuffer.resize(BUFSIZE + 1); - size_t amt = fread(&(m_logFileBuffer[0]), 1, BUFSIZE, m_logFile); - if (amt > 0) - { - out = utf8(&(m_logFileBuffer[0]), amt); - if (started == false) - { - compressDataStart(out, &m_stream); - started = true; - } - else - { - compressDataCont(out, &m_stream); - } - ::write(m_archive,out.c_str(),out.size()); - } - } - - compressDataFinish(out, &m_stream); - ::write(m_archive,out.c_str(),out.size()); - - compressDataEnd(&m_stream); - - ::fclose(m_logFile); - ::close(m_archive); - - // no need to keep any 0-byte files - // this is just incase of weirdness - if (!uniFile::fileSize(archive)) - { - uniFile::unlink(archive); - } - } - else - { - ::close(m_archive); - uniFile::unlink(archive); - } - } - } - } - } - - ::remove(dest.hideAsString().c_str()); - ::rename( - ((x-1) ? make_backup_log(m_fileName,(x-1)).hideAsString().c_str() - : m_fileName.hideAsString().c_str()), - dest.hideAsString().c_str()); - } - - // open new log - m_file = ::open(m_fileName.hideAsString().c_str(),O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); -} - -AOL_logger::fileLogger_element::fileLogger_element(const uniFile::filenameType &filename, - const uniFile::filenameType &defaultFilename, - bool &useDefaultPath, int backups, - bool archive, int rolloverInterval, size_t SID) throw(exception): - m_fileName(filename), m_file(-1), m_lastRolloverTime(0), - m_rolloverInterval(rolloverInterval), m_numFileBackups(backups), - m_archiveFileBackups(archive), m_first(false), m_SID(SID) -{ - umask(0); - useDefaultPath = false; - m_file = ::open(filename.hideAsString().c_str(),O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - if (m_file == -1) - { - if (SID == 0) - m_file = ::open (defaultFilename.hideAsString().c_str(),O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - if (m_file == -1) - { - uniFile::filenameType fallbackFilename("/tmp/sc_serv_" + tos(getpid()) + ".log"); - m_file = ::open(fallbackFilename.hideAsString().c_str(),O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - if (m_file == -1) - { - throw runtime_error("Logger could not open the log file \"" + m_fileName.hideAsString() + "\" for writing [" + errMessage().hideAsString() + "]. Check the directory exists and another instance is not already running."); - } - else - { - m_fileName = fallbackFilename; - } - } - else - { - m_fileName = defaultFilename; - } - } - - if (m_fileName == defaultFilename) - { - useDefaultPath = true; - } - - gOptions.setOption(utf8("reallogfile"), m_fileName); - - // using this to prevent rotating empty log files on startup - m_first = fileUtil::fileExists(m_fileName.hideAsString()); - if (m_first && !uniFile::fileSize(m_fileName)) - { - m_first = false; - } - - rotate(); -} - -AOL_logger::fileLogger_element::~fileLogger_element() throw() -{ - if (m_file != -1) - ::close(m_file); - m_file = -1; -} - -void AOL_logger::fileLogger_element::log(message &m) throw(exception) -{ - time_t t = ::time(NULL); - if (t < m_lastRolloverTime || (((t - m_lastRolloverTime) > m_rolloverInterval) && m_rolloverInterval)) - { - rotate(); - rotatew3cFiles("w3c"); - } - if (m.m_alreadyLogged) - return; - if (m_SID != m.m_streamID && m_SID) - { - return; - } - m.m_alreadyLogged = true; - m_first = true; - - utf8 ss = m.getTimestamp() + "\t" + m.typeAsStr(); - const utf8 &msg = m.getMsg(); - - if (msg[0] != '[') - { - const char *section = m.fromSection(); - if (section) - { - bool wrap = (section[0] == '[') ? false : true; - size_t ID = m.getID(); - if (wrap) - { - ss += "\t["; - ss += section; - if (ID > 0) - { - ss += " sid="; - ss += tos(ID); - } - ss += "] "; - } - else - { - ss += "\t"; - ss += section; - // if (ID > 0) - // ss += " ID present "; - } - } - else - ss += "\t"; - } - else - ss += "\t"; - - const map *fields = m.getFields(); - if (fields) - { - for (map::const_iterator i = fields->begin(); i != fields->end(); ++i) - { - if (!(*i).first.empty()) - { - if (!(*i).second.empty()) - { - ss += "\t" + (*i).second; - } - else - { - return; - } - } - } - ss += " "; - } - ss += msg; - ss += eol(); - - if (m_file == -1) - { - throw runtime_error(__F__ " Error writing to log file " + m_fileName.hideAsString()); - } - - if (::write(m_file,ss.c_str(),ss.size()) == -1) - { - throw runtime_error(__F__ " Error writing to log file " + m_fileName.hideAsString()); - } -} - -#endif - -#ifdef _WIN32 -//////// Win32 console logger - -AOL_logger::consoleLogger_element::consoleLogger_element() throw(exception) : m_stdoutConsole(NULL), m_stderrConsole(NULL) -{ - ::AllocConsole(); - ::SetConsoleOutputCP(65001); // utf-8 - ::SetConsoleCP(CP_UTF8);//65001); - - m_stdoutConsole = ::GetStdHandle(STD_OUTPUT_HANDLE); - m_stderrConsole = ::GetStdHandle(STD_ERROR_HANDLE); - - if ((!m_stdoutConsole) || (!m_stderrConsole)) - { - throw runtime_error("Logger could not open console"); - } -} - -AOL_logger::consoleLogger_element::~consoleLogger_element() throw() -{ - if (m_stdoutConsole != NULL) - { - ::FreeConsole(); - m_stdoutConsole = NULL; - m_stderrConsole = NULL; - } -} - -void AOL_logger::consoleLogger_element::log(message &m) throw(exception) -{ - static const DWORD maxLogLine=2048; - - utf8 ss = m.getTimestamp() + "\t" + m.typeAsStr(); - - const utf8 &msg = m.getMsg(); - if (msg[0] != '[') - { - const char *section = m.fromSection(); - if (section) - { - bool wrap = (section[0] == '[') ? false : true; - size_t ID = m.getID(); - if (wrap) - { - ss += "\t["; - ss += section; - if (ID > 0) - { - ss += " sid="; - ss += tos(ID); - } - ss += "] "; - } - else - { - ss += "\t"; - ss += section; - // if (ID > 0) - // ss += " ID present "; - } - } - else - ss += "\t"; - } - else - ss += "\t"; - - const map *fields = m.getFields(); - if (fields) - { - for (map::const_iterator i = fields->begin(); i != fields->end(); ++i) - { - if (!(*i).first.empty()) - { - if (!(*i).second.empty()) - { - ss += "\t" + (*i).second; - } - else - { - return; - } - } - } - } - - ss += m.getMsg(); - ss += eol(); - - HANDLE h = (m.getType() == AOL_logger::message::BM_ERROR ? m_stderrConsole : m_stdoutConsole); - if (h != INVALID_HANDLE_VALUE) - { - // see if we need to colour the output - only used for errors and warnings - AOL_logger::message::message_t type = m.getType(); - bool painted = false; - CONSOLE_SCREEN_BUFFER_INFO csbiInfo = {0}; - WORD wOldColorAttrs = 0; - if (type != AOL_logger::message::BM_INFO && GetConsoleScreenBufferInfo(h, &csbiInfo)) - { - wOldColorAttrs = csbiInfo.wAttributes; - - // red for error, yellow for warnings, green for debug, blue for update - if (type == AOL_logger::message::BM_ERROR) - { - painted = true; - SetConsoleTextAttribute(h, FOREGROUND_RED | FOREGROUND_INTENSITY); - } - else if (type == AOL_logger::message::BM_WARNING) - { - painted = true; - SetConsoleTextAttribute(h, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY); - } - else if (type == AOL_logger::message::BM_DEBUG) - { - painted = true; - SetConsoleTextAttribute(h, FOREGROUND_GREEN); - } - else if (type == AOL_logger::message::BM_UPDATE) - { - painted = true; - SetConsoleTextAttribute(h, FOREGROUND_BLUE); - } - } - - // utf8 sometimes returns a size that does not match input - DWORD written(0); - DWORD amtToWrite = (DWORD)ss.size(); - bool truncated = false; - if (amtToWrite > maxLogLine) - { - amtToWrite = maxLogLine; - truncated = true; - } - - if (truncated) - { - utf8 truncateMsg = m.getTimestamp() + "\t" + ((char)message::BM_WARNING) + "\t[MAIN] Next line is truncated" + eol(); - ::WriteFile(h,truncateMsg.c_str(),(DWORD)truncateMsg.size(),&written,NULL); - written = 0; - } - - if (::WriteFile(h,ss.c_str(),amtToWrite,&written,NULL)) - { - if (truncated) - { - // eol - written = 0; - ::WriteFile(h,eol().c_str(),(DWORD)eol().size(),&written,NULL); - } - } - - // revert the colouring if we needed to change it - if (painted) - { - SetConsoleTextAttribute(h, wOldColorAttrs); - } - } -} - -#else -/////// Unix console logger - -AOL_logger::consoleLogger_element::consoleLogger_element() throw(exception) : - m_stdoutConsole(STDOUT_FILENO), m_stderrConsole(STDERR_FILENO) -{ - if ((m_stdoutConsole == -1) || (m_stderrConsole == -1)) - { - throw runtime_error("Logger could not open console"); - } -} - -AOL_logger::consoleLogger_element::~consoleLogger_element() throw() -{ - m_stdoutConsole = m_stderrConsole = -1; -} - -void AOL_logger::consoleLogger_element::log(message &m) throw(exception) -{ - utf8 sc = ""; - // see if we need to colour the output - only used for errors, warnings and debugs - AOL_logger::message::message_t type = m.getType(); - if (type != AOL_logger::message::BM_INFO) - { - // red for error, yellow for warnings, green for debug, blue for update - if (type == AOL_logger::message::BM_ERROR) - { - sc = "\033[01;31m"; - } - else if (type == AOL_logger::message::BM_WARNING) - { - sc = "\033[01;33m"; - } - else if (type == AOL_logger::message::BM_DEBUG) - { - sc = "\033[0;32m"; - } - else if (type == AOL_logger::message::BM_UPDATE) - { - sc = "\033[0;34m"; - } - } - - utf8 ss = sc + m.getTimestamp() + "\t" + m.typeAsStr(); - const utf8 &msg = m.getMsg(); - if (msg[0] != '[') - { - const char *section = m.fromSection(); - if (section) - { - bool wrap = (section[0] == '[') ? false : true; - size_t ID = m.getID(); - if (wrap) - { - ss += "\t["; - ss += section; - if (ID > 0) - { - ss += " sid="; - ss += tos(ID); - } - ss += "] "; - } - else - { - ss += "\t"; - ss += section; - // if (ID > 0) - // ss += " ID present "; - } - } - else - ss += "\t"; - } - else - ss += "\t"; - const map *fields = m.getFields(); - if (fields) - { - for (map::const_iterator i = fields->begin(); i != fields->end(); ++i) - { - if (!(*i).first.empty()) - { - if (!(*i).second.empty()) - { - ss += "\t" + (*i).second; - } - else - { - return; - } - } - } - } - - ss += m.getMsg(); - ss += eol() + (!sc.empty() ? "\033[0m" : ""); - - int console = (m.getType() == AOL_logger::message::BM_ERROR ? m_stderrConsole : m_stdoutConsole); - - if (console != -1) - { - ::write(console,ss.c_str(),ss.size()); - } -} -#endif - -#ifdef _WIN32 - -// Win32 system logger -void AOL_logger::systemLogger_element::registerEventLog(const utf8 &log_object_name, - const uniFile::filenameType &fullExePath) throw() -{ - HKEY key = NULL; - DWORD disposition = 0; - - wstring regEntry = L"System\\CurrentControlSet\\Services\\EventLog\\Application\\"; - regEntry += log_object_name.toWString(); - - LONG err = ::RegCreateKeyExW(HKEY_LOCAL_MACHINE, regEntry.c_str(), 0, NULL, - REG_OPTION_NON_VOLATILE, KEY_WRITE, 0, &key, &disposition); - - if (err == ERROR_SUCCESS) - { - DWORD ts = 1; - wstring widePath = fullExePath.toWString(); - ::RegSetValueExW(key,L"EventMessageFile",0,REG_SZ,(const BYTE *)widePath.c_str(),(DWORD)((fullExePath.size() + 1) * 2)); - ::RegSetValueExW(key,L"TypesSupported",0,REG_DWORD,(const BYTE *)&ts,sizeof(ts)); - ::RegCloseKey(key); - } -} - -AOL_logger::systemLogger_element::systemLogger_element(const utf8 &log_object_name, - const uniFile::filenameType &fullExePath, - const utf8 &loggerConfigString) throw(exception) - : m_systemLog(NULL), m_loggerConfigString(loggerConfigString) -{ - registerEventLog(log_object_name,fullExePath); - m_systemLog = ::RegisterEventSourceW(NULL, // uses local computer - log_object_name.toWString().c_str()); // source name - if (m_systemLog == NULL) - { - throw runtime_error("Could not register the event source for the system logs."); - } -} - -AOL_logger::systemLogger_element::~systemLogger_element() throw() -{ - if (m_systemLog != NULL) - { - ::DeregisterEventSource(m_systemLog); - m_systemLog = NULL; - } -} - -static WORD charToLogType(char c) throw() -{ - if (c == 'E') - { - return EVENTLOG_ERROR_TYPE; - } - if (c == 'W') - { - return EVENTLOG_WARNING_TYPE; - } - if (c == 'I') - { - return EVENTLOG_INFORMATION_TYPE; - } - return 0; -} - -static WORD messageTypeToLogType(AOL_logger::message::message_t t, const utf8 &configString) throw() -{ - if (configString.size() < 5) - { - return EVENTLOG_ERROR_TYPE; - } - - switch (t) - { - case AOL_logger::message::BM_INFO: - { - return charToLogType(configString[3]); - } - case AOL_logger::message::BM_WARNING: - { - return charToLogType(configString[2]); - } - case AOL_logger::message::BM_ERROR: - { - return charToLogType(configString[0]); - } - case AOL_logger::message::BM_DEBUG: - { - return charToLogType(configString[4]); - } - } - return 0; -} - -void AOL_logger::systemLogger_element::log(message &m) throw(exception) -{ - if (m_systemLog == NULL) - { - throw runtime_error(__F__ " Error writing to system log"); - } - - const map *fields = m.getFields(); - - utf8 ss; - if (fields) - { - for (map::const_iterator i = fields->begin(); i != fields->end(); ++i) - { - if (!(*i).first.empty()) - { - if (!(*i).second.empty()) - { - ss += (!ss.empty() ? "\t" : "") + (*i).second; - } - else - { - return; - } - } - } - } - ss += m.getMsg(); - if (!ss.empty()) - { - utf32 u32(stripWhitespace(ss)); - utf16 u16(u32.toUtf16(true)); - - const wchar_t *s = (const wchar_t *)u16.c_str(); - WORD et = messageTypeToLogType(m.getType(), m_loggerConfigString); - if (et) - { - ::ReportEventW(m_systemLog, // event log handle - et, // event type - 0, // category 0 - ((DWORD)0xC0000001L), // event identifier - NULL, // no user security identifier - 1, // one substitution string - 0, // no data - &s, // pointer to string array - NULL); - } - } -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/logger.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/logger.h deleted file mode 100644 index 1cd634de..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/logger.h +++ /dev/null @@ -1,461 +0,0 @@ -#pragma once -#ifndef logger_H_ -#define logger_H_ - -#ifdef _WIN32 -#include -#include -#endif -#include -#include -#include -#include -#include -#include "unicode/uniFile.h" -#include "stl/stringUtils.h" -#include "stl/functors.h" -#include "threading/messageThread.h" -#include "unicode/uniFile.h" - -namespace AOL_logger -{ - /* - A function object, used in conjunction with the messageThread template to create a - thread safe logging entity which runs on it's own thread. - - The logger is meant to be run in the context of a messageThread object like so: - - extern messageThread *gLog; - - You post messages using the postMessage method from the messageThread class - - gLog->postMessage(whatever); - - The E (logger element) type has the following requirements - - 1) Must be a heap element that can be deleted. - 2) An install() method which is called when the element becomes part of - the logging system. Install may throw an exception - 3) An uninstall() mehod which is called when before the log element is - destroyed by the logger system. It MUST NOT throw an exception. - - The M (message) type has the following requirements - - 1) Must support a static makeError(const uniString::utf8 &s) throw() for - constructing an error message - 2) Must have - bool done() const throw() - which returns true to indicate it's a message to shutdown the logger - 3) Any other signatures required by the logger element - */ - - class message; - template class logger_element; - - template > - class logger - { - // NOTE: logger takes ownership of the elements and deletes them - // when done. - private: - std::vector m_elements; - - void uninstallElements() throw() - { - std::for_each(m_elements.begin(), m_elements.end(), std::mem_fun(&E::uninstall)); - } - - public: - typedef M message_t; - - // constructors. If the constructor succeeds (does not throw), then this - // logger object has posession of the elements, and will delete them - // itself. - logger() throw() {} - - // create the logger with a single element. An exception - // means that the element was not added. The logger has not taken - // posession of the element and it's up to the caller to delete it. - explicit logger(E *e) throw(std::exception) - { - addElement(e); - } - - // create the logger from a container of elements. If the install() method - // of any element throws, then this constructor will throw. All methods that - // were installed() will be uninstalled() but NO elements will be deleted. Thatt - // is up to the caller. - template - logger(ITER first,ITER last) throw (std::exception) - { - try - { - addElement(first, last); - } - catch(...) - { - uninstallElements(); - m_elements.clear(); - throw; - } - } - - ///////////////////////// - - // destructor - ~logger() throw() - { - uninstallElements(); - std::for_each(m_elements.begin(), m_elements.end(), stlx::delete_fntr); - } - - // warning... there is no lock protection. Do not add a logger element - // while the thread is running - void addElement(E *e) throw(std::exception) - { - // note: element is not added to internal list if install() throws - e->install(); - m_elements.push_back(e); - } - - // if any element throws, then all the ones passed in will be uninstalled if - // they were installed, and no objects in the list will be taken posession of - template - void addElement(ITER first, ITER last) throw(std::exception) - { - std::vector tmp; - try - { - for (ITER i = first; i != last; ++i) - { - (*i)->install(); - tmp.push_back(*i); - } - } - catch(...) - { - for (typename std::vector::const_iterator i = tmp.begin(); i != tmp.end(); ++i) - { - (*i)->uninstall(); - } - throw; - } - m_elements.insert(m_elements.end(), tmp.begin(), tmp.end()); - } - - ////////////////////////////////////////////////////// - - // main dispatch loop - bool operator()(M &m) throw() - { - if (m.done()) // if this is the done message, exit the loop - { - return false; - } - - if (m.rotate()) - { - for (typename std::vector::const_iterator i = m_elements.begin(); i != m_elements.end(); ++i) - { - (*i)->rotate(); - } - return true; - } - - for (typename std::vector::const_iterator i = m_elements.begin(); i != m_elements.end(); ++i) - { - try - { - (*i)->log(m); - } - catch (const std::exception &ex) - { - // on an exception, create an error message and dispatch it to everyone - // via their 'NOTHROW' handler - M mex = M::makeError(ex.what()); - for (typename std::vector::const_iterator ix = m_elements.begin(); ix != m_elements.end(); ++ix) - { - (*ix)->logNOTHROW(mex); - } - } - } - return true; - } - }; - -/////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////// Here is a basic set of elements you can use /////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////// - - class fileLogger_element; - - // the message class - class message - { - public: - typedef enum - { - BM_DONE, - BM_ROTATE, - BM_ERROR = 'E', - BM_WARNING = 'W', - BM_INFO = 'I', - BM_DEBUG = 'D', - BM_UPDATE = 'U' - } message_t; - - size_t m_streamID; - private: - //uniString::utf8 m_typeStr; - friend class AOL_logger::fileLogger_element; - - uniString::utf8 m_timestamp; - std::map *m_fields; - uniString::utf8 m_msg; - const char *m_section; - message_t m_type; - bool m_alreadyLogged; - - static uniString::utf8 timeStamp() throw() - { -#ifdef _WIN32 - SYSTEMTIME lastTime = {0}; - wchar_t d[100] = {0}, t[100] = {0}; - uniString::utf8 lastMsg; - - SYSTEMTIME sysTime = {0}; - ::GetLocalTime(&sysTime); - - ::GetDateFormatW(LOCALE_SYSTEM_DEFAULT, 0, &sysTime, _T("yyyy'-'MM'-'dd"), d, 99); - ::GetTimeFormatW(LOCALE_SYSTEM_DEFAULT, 0, &sysTime, _T("HH':'mm':'ss"), t, 99); - lastMsg = stringUtil::tos((const wchar_t *)d) + " " + stringUtil::tos((const wchar_t *)t); - return lastMsg; -#else - char buf[32] = {0}; - - struct tm ttm; - time_t ttt = ::time(NULL); - ::strftime(buf, sizeof (buf), "%Y-%m-%d %H:%M:%S", ::localtime_r(&ttt, &ttm)); - return buf; -#endif - } - - message (const message_t m, const uniString::utf8 &msg, const char *section = NULL, size_t id = 0) - : m_streamID(id), m_timestamp(timeStamp()), m_fields(NULL), m_msg(msg), m_section(section), m_type(m), m_alreadyLogged(false) { } - - message(const message_t m, const char *msg, const char *section = NULL, size_t id = 0) - : m_streamID(id), m_timestamp(timeStamp()), m_fields(NULL), m_msg(msg), m_section(section), m_type(m), m_alreadyLogged(false) { } - - message(const message_t m, const char *section = NULL, size_t id = 0, const std::map *fields = NULL) - : m_streamID(id), m_timestamp(timeStamp()), m_section(section), m_type(m), m_alreadyLogged(false) - { - if (fields) - m_fields = new std::map (*fields); - } - - public: - inline bool done() const throw() { return (m_type == BM_DONE); } - inline bool rotate() const throw() { return (m_type == BM_ROTATE); } - - inline message_t getType() const throw() { return m_type; } - inline void setType(message_t m) { m_type = m; } - inline const uniString::utf8 &getTimestamp() const throw() { return m_timestamp; } - inline const std::map *getFields() const throw() { return m_fields; } - inline const char *fromSection() const throw() { return m_section; } - inline const uniString::utf8 &getMsg() const throw() { return m_msg; } - inline size_t getID() const throw() { return m_streamID; } - - static message makeDone() throw() { return message(BM_DONE); } - static message makeRotate() throw() { return message(BM_ROTATE); } - static message makeUpdate (const std::map *f) throw() { return message(BM_UPDATE,NULL,0,f); } - static message makeDebug (const std::map *f) throw() { return message(BM_DEBUG,NULL,0,f); } - static message makeInfo (const std::map *f) throw() { return message(BM_INFO,NULL,0,f); } - - static message makeUpdate (const uniString::utf8 &s) throw() { std::map f; f["msg"] = s; return message(BM_UPDATE,NULL,0,&f); } - - static message makeDebug (const uniString::utf8 &s, const char *sct = NULL, size_t id = 0) throw() { return message(BM_DEBUG,s,sct,id); } - static message makeDebug (const char *s, const char *sct = NULL, size_t id = 0) throw() { return message(BM_DEBUG,s,sct,id); } - - static message makeInfo (const uniString::utf8 &s, const char *sct = NULL, size_t id = 0) throw() { return message(BM_INFO,s,sct,id); } - static message makeInfo (const char *s, const char *sct = NULL, size_t id = 0) throw() { return message(BM_INFO,s,sct,id); } - - static message makeWarning (const uniString::utf8 &s, const char *sct = NULL, size_t id = 0) throw() { return message(BM_WARNING,s,sct,id); } - static message makeWarning (const char *s, const char *sct = NULL, size_t id = 0) throw() { return message(BM_WARNING,s,sct,id); } - - static message makeError (const uniString::utf8 &s, const char *sct = NULL, size_t id = 0) throw() { return message(BM_ERROR,s,sct,id); } - static message makeError (const char *s, const char *sct = NULL, size_t id = 0) throw() { return message(BM_ERROR,s,sct,id); } - - const char *typeAsStr() const - { - const char *str; - switch (m_type) - { - case BM_INFO: str = "INFO"; break; - case BM_ERROR: str = "ERROR"; break; - case BM_WARNING: str = "WARN"; break; - case BM_DEBUG: str = "DEBUG"; break; - case BM_UPDATE: str = "UPDATE"; break; - default: str = ""; break; - } - return str; - } - }; - - // a base virtual message class for use by the logger - template - class logger_element - { - protected: - // the message class used by the logger - - private: - virtual void install() throw(std::exception) = 0; - virtual void log(M &m) throw(std::exception) = 0; - virtual void logNOTHROW(M &m) throw() { try { log(m); } catch(...){} } - virtual void uninstall() throw() = 0; - virtual void rotate() throw() {} - - public: - virtual ~logger_element() throw() {} - friend class AOL_logger::logger >; - }; - -//////////////////////////////////////////////////////////////////////////////////// -///////////////////////// WIN32 ELEMENTS /////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////// - -#ifdef _WIN32 - // Win32 file logger - class fileLogger_element: public logger_element - { - private: - uniFile::filenameType m_fileName; - HANDLE m_file; - time_t m_lastRolloverTime; - const int m_rolloverInterval; - const int m_numFileBackups; - const bool m_archiveFileBackups; - bool m_first; - size_t m_SID; - - void rotate() throw(); - - virtual void install() throw(std::exception){} - virtual void log(AOL_logger::message &m) throw(std::exception); - virtual void uninstall() throw(){} - - static uniFile::filenameType make_backup_log(const uniFile::filenameType &filename, int which) throw(); - static uniFile::filenameType make_archive_log() throw(); - - public: - fileLogger_element(const uniFile::filenameType &filename, - const uniFile::filenameType &defaultFilename, - bool &useDefaultPath, int backups, - bool archive, int rolloverInterval, size_t SID = 0) throw(std::exception); - ~fileLogger_element() throw(); - }; - - class consoleLogger_element: public logger_element - { - private: - HANDLE m_stdoutConsole; - HANDLE m_stderrConsole; - - virtual void install() throw(std::exception){} - virtual void log(AOL_logger::message &m) throw(std::exception); - virtual void uninstall() throw(){} - - public: - consoleLogger_element() throw(std::exception); - ~consoleLogger_element() throw(); - }; - - class systemLogger_element: public logger_element - { - private: - HANDLE m_systemLog; - const uniString::utf8 m_loggerConfigString; - - void registerEventLog(const uniString::utf8 &log_object_name, - const uniFile::filenameType &fullExePath) throw(); - - virtual void install() throw(std::exception){} - virtual void uninstall() throw() {} - virtual void log(AOL_logger::message &m) throw(std::exception); - - public: - systemLogger_element(const uniString::utf8 &log_object_name, - const uniFile::filenameType &fullExePath, - const uniString::utf8 &loggerConfigString) throw(std::exception); - ~systemLogger_element() throw(); - static uniString::utf8 panicConfiguration() throw() { return "EEW Z"; } - }; - -#else // Unix - - ////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////// Unix ELEMENTS /////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////////////////////// - - class fileLogger_element: public logger_element - { - private: - uniFile::filenameType m_fileName; - int m_file; - time_t m_lastRolloverTime; - const int m_rolloverInterval; - const int m_numFileBackups; - const bool m_archiveFileBackups; - bool m_first; - size_t m_SID; - - void rotate() throw(); - - virtual void install() throw(std::exception){} - virtual void log(AOL_logger::message &m) throw(std::exception); - virtual void uninstall() throw(){} - - static uniFile::filenameType make_backup_log(const uniFile::filenameType &filename,int which) throw(); - static uniFile::filenameType make_archive_log() throw(); - - public: - fileLogger_element(const uniFile::filenameType &filename, - const uniFile::filenameType &defaultFilename, - bool &useDefaultPath, int backups, - bool archive, int rolloverInterval, size_t SID = 0) throw(std::exception); - ~fileLogger_element() throw(); - }; - - class consoleLogger_element: public logger_element - { - private: - int m_stdoutConsole; - int m_stderrConsole; - - virtual void install() throw(std::exception){} - virtual void log(AOL_logger::message &m) throw(std::exception); - virtual void uninstall() throw(){} - - public: - consoleLogger_element() throw(std::exception); - ~consoleLogger_element() throw(); - }; - - // unix system logger (not implemented) - class systemLogger_element: public logger_element - { - private: - virtual void install() throw(std::exception){} - virtual void uninstall() throw() {} - virtual void log(const AOL_logger::message &/*m*/) throw(std::exception){} - - public: - explicit systemLogger_element(const uniString::utf8 &/*srcName*/) throw(){} - ~systemLogger_element() throw(){} - }; - - #endif - typedef messageThread > > stdLog_t; -} // namespace AOLLogger - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/messagefile.mc b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/messagefile.mc deleted file mode 100644 index 8b3a4be8..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/messagefile.mc +++ /dev/null @@ -1,7 +0,0 @@ -MessageId=0x1 -Severity=Error -SymbolicName=MSG_CMD_ERR -Language=English -%1 - - diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/serviceMain.cpp b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/serviceMain.cpp deleted file mode 100644 index 915cbb3d..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/serviceMain.cpp +++ /dev/null @@ -1,876 +0,0 @@ -#include "serviceMain.h" -#include -#include -#include -#include "expat.h" -#include "stl/stringUtils.h" -#include "services/stdServiceImpl.h" -#include "../../versions.h" -#include "../../global.h" -#ifdef _WIN32 -#include "win32/rezFuncs.h" -#include -#include -#else -#ifdef PLATFORM_LINUX -#include "../stacktrace/StackTrace.h" -#endif -#include -#include "unixversion.h" -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef __APPLE_CC__ -#include -#include "file/fileUtils.h" -#endif -#endif - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#ifndef _WIN32 -#define TRUE true -#define FALSE false -#endif - -// are we running as a daemon or service -bool sDaemon = false; - -event serviceMain::sStop(TRUE); -#ifndef _WIN32 -event serviceMain::sWINCH(FALSE); -event serviceMain::sHUP(FALSE); -event serviceMain::sUSR1(FALSE); -event serviceMain::sUSR2(FALSE); -#endif - -#ifdef _WIN32 -static SERVICE_STATUS_HANDLE ssh=NULL; // does not have to be closed - -BOOL WINAPI _console_handler(DWORD fdwCtrlType) -{ - switch (fdwCtrlType) - { - // Handle the CTRL+C signal. - case CTRL_CLOSE_EVENT: - case CTRL_BREAK_EVENT: - case CTRL_C_EVENT: - { - _SetEvent(serviceMain::sStop); - return TRUE; - } - default: - { - return FALSE; - } - } -} - -#else -#ifdef PLATFORM_LINUX -static void custom_signal_handler(int signum) -{ - signal(signum, SIG_DFL); - // http://sourceforge.net/p/stacktrace/code/HEAD/tree/ - // ensure we building with -rdynamic so this works ok - - static char buf[256] = {0}; - static time_t last_ttt; - - struct tm ttm; - time_t ttt = ::time(NULL); - if (ttt != last_ttt) - { - last_ttt = ttt; - ::strftime(buf, 255, "%Y-%m-%d %H:%M:%S", ::localtime_r(&ttt, &ttm)); - } - - FILE *fp = freopen(("/tmp/sc_serv_segfault_" + tos(getpid()) + ".log").c_str(), "w", stderr); - fprintf(stderr, "Shoutcast DNAS/" SERV_OSNAME " v%s (" __DATE__ ")\n" - "An unrecoverable error (%d) has occurred @ %s.\n\n", - gOptions.getVersionBuildStrings().hideAsString().c_str(), signum, buf); - stacktrace::displayCurrentStackTrace(/*-1U, 0*/); - fflush(fp); - kill(getpid(), signum); -} -#endif -unsigned sigWatcher() -{ - while (::WaitForSingleObject(serviceMain::sStop,0) != WAIT_OBJECT_0) - { - sigset_t catchset; - sigemptyset(&catchset); - sigaddset(&catchset,SIGPIPE); - sigaddset(&catchset,SIGTERM); - sigaddset(&catchset,SIGHUP); - sigaddset(&catchset,SIGINT); - sigaddset(&catchset,SIGQUIT); - sigaddset(&catchset,SIGTSTP); // ^Z allow this - sigaddset(&catchset,SIGCHLD); - sigaddset(&catchset,SIGWINCH); - sigaddset(&catchset,SIGUSR1); - sigaddset(&catchset,SIGUSR2); - - //struct timespec ts; - //ts.tv_sec = 1; - //ts.tv_nsec = 0; - //apple is missing sigtimed wait. - int err = 0; - if (::sigwait(&catchset,&err)) - { - err = SIGTERM; - } - - switch (err) - { - case SIGTERM: case SIGINT: case SIGQUIT: case SIGTSTP: - { - _SetEvent(serviceMain::sStop); - break; - } - case SIGHUP: - { - _SetEvent(serviceMain::sHUP); - break; - } - case SIGWINCH: - { - _SetEvent(serviceMain::sWINCH); - break; - } - case SIGUSR1: - { - _SetEvent(serviceMain::sUSR1); - break; - } - case SIGUSR2: - { - _SetEvent(serviceMain::sUSR2); - break; - } - } - } - return 0; -} - -// We need access to this for Apple, because we don't have sigtimedwait(). This means there -// circumstances when we need access to this thread so we can signal it and force sigwait() to exit -Tthread gSigWatcherThread(sigWatcher); - -#endif - -#ifdef _WIN32 -int run_install(const vector &args) throw(); -int run_uninstall(const vector &args) throw(); -int run_run(const vector &args) throw(std::exception); -int run_daemon(const vector &args) throw(std::exception); -#else -int run_run(const vector &args, const vector &arg) throw(std::exception); -int run_daemon(const vector &args, const vector &arg) throw(std::exception); - -int blockSignals() throw() -{ - return thread_CORE::standard_signal_block(); -} -#endif - - -uniString::utf8 getVersionBuildStrings() throw() -{ -#ifdef _WIN32 - static utf8 version = ""; - if (version.empty()) - { - getVersionInfo(version); - } -#else - static utf8 version = ""; - if (version.empty()) - { - for (int x = 0; x < VENT; ++x) - { - if (x) version += "."; - version += tos(PRODUCTVERSION[x]); - } - } -#endif -#ifdef LICENCE_FREE - version += " no-licence-check"; -#endif - return version; -} - -#ifdef _WIN32 -int do__main(vector &args) throw(std::exception) -#else -int do__main(vector &args, vector &arg) throw(std::exception) -#endif -{ - if (!args.empty()) - { - utf8 s = toLower(args.front()); - - if (s == "--version" || s == "-v") - { - XML_Expat_Version expat = XML_ExpatVersionInfo(); - printf("%s", utf8("Shoutcast DNAS/" SERV_OSNAME " v" + getVersionBuildStrings() + - " (" __DATE__ ") " + utf8(curl_version()) + " expat/" + - tos(expat.major) + "." + tos(expat.minor) + "." + tos(expat.micro) + -//#ifdef _WIN32 -// " pthread-win32/" PTW32_VERSION_STR "-mod" + -//#endif - eol()).toANSI().c_str()); - return 0; - } - - if (s == "--help" || s == "/?") - { - #ifdef _WIN32 - #define SC_SERV_END ".exe" - #else - #define SC_SERV_END "" - #endif - - printf("%s", utf8("*********************************************************************" + eol()).toANSI().c_str()); - printf("%s", utf8("** Shoutcast Distributed Network Audio Server (DNAS) **" + eol()).toANSI().c_str()); - printf("%s", utf8("** Copyright (C) 2014-2023 Radionomy SA, All Rights Reserved **" + eol()).toANSI().c_str()); - printf("%s", utf8("*********************************************************************" + eol()).toANSI().c_str()); - printf("%s", utf8(eol() + "Usage: sc_serv" SC_SERV_END " [OPTION] [PARAMETERS]... [conf]" + eol()).toANSI().c_str()); - - printf("%s", utf8(eol() + "\t[conf] - File path to the configuration file (this can be" + - eol() + "\t\t relative or absolute) [optional]" + eol()).toANSI().c_str()); - - printf("%s", utf8(eol() + "\t\t If not specified then sc_serv.conf / sc_serv.ini" + - eol() + "\t\t in the same folder will be automatically loaded." + eol()).toANSI().c_str()); - - printf("%s", utf8(eol() + "Options:").toANSI().c_str()); - - printf("%s", utf8(eol() + "\t-s, setup\t\tRun the DNAS in setup mode for" + eol() + - "\t\t\t\tcreating a basic configuration" + eol()).toANSI().c_str()); -#ifdef CONFIG_BUILDER - printf("%s", utf8(eol() + "\t-b, builder\t\tRun the DNAS in builder mode for" + eol() + - "\t\t\t\tcreating an advanced configuration" + eol()).toANSI().c_str()); -#endif - printf("%s", utf8(eol() + "\t-v, --version\t\tDisplay version information" + eol()).toANSI().c_str()); - printf("%s", utf8(eol() + "\t/?, --help\t\tDisplay this information" + eol()).toANSI().c_str()); - - #ifdef _WIN32 - printf("%s", utf8(eol() + eol() + "Service Options:" + eol()).toANSI().c_str()); - - printf("%s", utf8(eol() + "\tinstall [servicename] [username] [password] [conf]" + eol()).toANSI().c_str()); - - printf("%s", utf8(eol() + "\t\tservicename - Unique name for the service install" + eol() + - "\t\t\t if the default is not appropriate or" + eol() + - "\t\t\t needing multiple services [optional]" + eol() + - "\t\t\t Default is: \"Shoutcast DNAS Service\"" + eol()).toANSI().c_str()); - printf("%s", utf8(eol() + "\t\tusername - User under which to run the service as" + eol() + - "\t\t\t or '0' for the local system [optional]" + eol()).toANSI().c_str()); - printf("%s", utf8(eol() + "\t\tpassword - Password for user or '0' for the local" + eol() + - "\t\t\t system or with no password [optional]" + eol()).toANSI().c_str()); - printf("%s", utf8(eol() + "\t\tconf - File path to the configuration file either" + eol() + - "\t\t as a full or relative path [optional]" + eol()).toANSI().c_str()); - printf("%s", utf8(eol() + "\texample:" + eol() + "\t\tsc_serv.exe install" + eol() + - "\t\tor" + eol() + "\t\tsc_serv.exe install sc_serv" + eol() + - "\t\tor" + eol() + "\t\tsc_serv.exe install sc_serv 0 0 sc_serv.conf" + - eol()).toANSI().c_str()); - - printf("%s", utf8(eol() + eol() + "\tuninstall [servicename]" + eol()).toANSI().c_str()); - printf("%s", utf8(eol() + "\t\tservicename - Name used to install the service or" + eol() + - "\t\t\t leave blank for default [optional]" + eol()).toANSI().c_str()); - printf("%s", utf8(eol() + "\texample:" + eol() + "\t\tsc_serv.exe uninstall" + eol() + - "\t\tor" + eol() + "\t\tsc_serv.exe uninstall sc_serv" + eol() + eol()).toANSI().c_str()); - #else - #define SC_SERV_FILE "sc_serv" - printf("%s", utf8(eol() + "Daemon Options:" + eol()).toANSI().c_str()); - printf("%s", utf8(eol() + "\tdaemon [conf]\t\tRun the DNAS in daemon mode " + eol()).toANSI().c_str()); - #endif - XML_Expat_Version expat = XML_ExpatVersionInfo(); - printf("%s", utf8(eol() + eol() + "Built with: " + utf8(curl_version()) + - " expat/" + tos(expat.major) + "." + tos(expat.minor) + "." + - tos(expat.micro) + eol()).toANSI().c_str()); - return 0; - } - - if (s == "install") - { - #ifdef _WIN32 - args.erase(args.begin()); - return run_install(args); - #else - cerr << "install is not supported on this platform" << endl; - return -1; - #endif - } - - if (s == "uninstall") - { - #ifdef _WIN32 - args.erase(args.begin()); - return run_uninstall(args); - #else - cerr << "uninstall is not supported on this platform" << endl; - return -1; - #endif - } - - if (s == "daemon") - { - args.erase(args.begin()); - #ifdef _WIN32 - return run_daemon(args); - #else - return run_daemon(args, arg); - #endif - } - } - -#ifdef _WIN32 - return run_run(args); -#else - return run_run(args, arg); -#endif -} - -int main(int argc, char* argv[]) throw(std::exception) -{ - int result = 0; - try - { - vector args; - - // convert args to vector of strings - for (int x = 1; x < argc; ++x) - { - args.push_back(argv[x]); - } - - // grab the calling program param as - // will be needed to ensure relative - // path handling will work correctly -#ifdef _WIN32 - result = do__main(args); -#else - vector arg; - arg.push_back(argv[0]); - result = do__main(args, arg); -#endif - } - catch(const std::exception &err) - { - printf("%s", (std::string(LIBRARY_LOG_TAG) + "Exception in main: " + err.what()).c_str()); - } - return result; -} - -///////////////////////////////////////////////////// - -// surround by quotes -#ifdef _WIN32 -static wstring quote(const wstring &s) throw() -{ - return wstring(L"\"") + s + wstring(L"\""); -} - -int run_install(const vector &args) throw() -{ - int result = -1; - - SC_HANDLE schSCManager = 0; - SC_HANDLE schService = 0; - - try - { - wstring serviceName = (!args.empty() ? args[0].toWString().c_str() : L"Shoutcast DNAS Service"); - wstring account = (args.size() > 2 ? (args[1] == "0" ? L"" : args[1].toWString()) : L""); - wstring password = (args.size() > 3 ? (args[2] == "0" ? L"" : args[2].toWString()) : L""); - - const size_t SIZ(2048); - wchar_t nameBuffer[SIZ+2] = {0}; - ::GetModuleFileNameW(0,nameBuffer,SIZ); - - schSCManager = ::OpenSCManagerW(NULL, // local machine - NULL, // ServicesActive database - SC_MANAGER_ALL_ACCESS); // full access rights - - if (schSCManager == NULL) - { - if (GetLastError() == ERROR_ACCESS_DENIED) - { - throw runtime_error("Aborting service install due to a lack of required permissions.\n\n" - "Ensure you are using an Administrator Command Prompt or that you have administrator access to be able to install a service."); - } - else - { - static char error[512]; - snprintf(error, sizeof(error), - "Aborting service install due to OpenSCManager(..) failure.\n\nError code: %d\n[%s]", - GetLastError(), errMessage().c_str()); - throw runtime_error(error); - } - } - - wstring cmdString = quote(nameBuffer) + L" " + quote(L"daemon") + L" " + quote(serviceName); - if (args.size() > 4) cmdString += L" " + quote(args[3].toWString()); - - schService = ::CreateServiceW( - schSCManager, // SCManager database - serviceName.c_str(), // name of service - serviceName.c_str(), // service name to display - SERVICE_ALL_ACCESS, // desired access - SERVICE_WIN32_OWN_PROCESS, // service type - SERVICE_DEMAND_START, // start type - SERVICE_ERROR_NORMAL, // error control type - cmdString.c_str(), - NULL, // no load ordering group - NULL, // no tag identifier - NULL, // no dependencies - (account == L"" ? NULL : account.c_str()), // LocalSystem account - (password == L"" ? NULL : password.c_str())); // no password - - if (schService == NULL) - { - int err = GetLastError(); - static char error[512]; - snprintf(error, sizeof(error), - "Aborting service install due to CreateService(..) failure.\n\nError code: %d\n[%s]%s", - err, errMessage().c_str(), - (err == ERROR_SERVICE_EXISTS ? "\n\nCheck the service name has not already been used." : - (err == ERROR_SERVICE_MARKED_FOR_DELETE ? "\n\nCheck the previous service instance has been completely stopped." : ""))); - throw runtime_error(error); - } - else - { - SERVICE_DESCRIPTION schServiceDesc; - schServiceDesc.lpDescription = L"Shoutcast DNAS Server (sc_serv) v2"; - ChangeServiceConfig2(schService, SERVICE_CONFIG_DESCRIPTION, &schServiceDesc); - } - ::CloseServiceHandle(schService); - ::CloseServiceHandle(schSCManager); - - result = 0; - } - catch(const exception &ex) - { - ::MessageBox(0,tows(ex.what()).c_str(),L"Shoutcast DNAS Error",MB_OK|MB_ICONEXCLAMATION); - if (schService) - ::CloseServiceHandle(schService); - if (schSCManager) - ::CloseServiceHandle(schSCManager); - } - catch(...) - { - ::MessageBox(0,L"Unknown exception",L"Shoutcast DNAS Error",MB_OK); - if (schService) - ::CloseServiceHandle(schService); - if (schSCManager) - ::CloseServiceHandle(schSCManager); - } - - return result; -} - -///////////////////////////////////////////////////// - -int run_uninstall(const vector &args) throw() -{ - int result = -1; - - SC_HANDLE schSCManager = 0; - SC_HANDLE service = 0; - try - { - schSCManager = ::OpenSCManagerW(NULL, // local machine - NULL, // ServicesActive database - SC_MANAGER_ALL_ACCESS); // full access rights - - if (schSCManager == NULL) - { - if (GetLastError() == ERROR_ACCESS_DENIED) - { - throw runtime_error("Aborting service uninstall due to a lack of required permissions.\n\n" - "Ensure you are using an Administrator Command Prompt or that you have administrator access to be able to uninstall a service."); - } - else - { - static char error[512]; - snprintf(error, sizeof(error), - "Aborting service uninstall due to OpenSCManager(..) failure.\n\nError code: %d\n[%s]", - GetLastError(), errMessage().c_str()); - throw runtime_error(error); - } - } - - service = ::OpenServiceW(schSCManager, (!args.empty() ? args[0].toWString().c_str() : L"Shoutcast DNAS Service"), DELETE); - if (!service) - { - int err = GetLastError(); - static char error[512]; - snprintf(error, sizeof(error), - "Aborting service uninstall due to OpenService(..) failure.\n\nError code: %d\n[%s]%s", - err, errMessage().c_str(), - (err == ERROR_SERVICE_DOES_NOT_EXIST ? "\n\nCheck the service has not already been uninstalled and the\n" - "service name matches what was used to register the service." : "")); - throw runtime_error(error); - } - - if (!::DeleteService(service)) - { - int err = GetLastError(); - static char error[512]; - snprintf(error, sizeof(error), - "Aborting service uninstall due to DeleteService(..) failure.\n\nError code: %d\n[%s]%s", - err, errMessage().c_str(), - (err == ERROR_SERVICE_DOES_NOT_EXIST ? "\n\nCheck the service has not already been removed and that the\n" - "service name matches what was used to register the service." : - (err == ERROR_SERVICE_MARKED_FOR_DELETE ? "\n\nCheck the previous service instance has been completely stopped." : ""))); - throw runtime_error(error); - } - - ::CloseServiceHandle(service); - ::CloseServiceHandle(schSCManager); - - result = 0; - } - catch(const exception &ex) - { - ::MessageBox(0,tows(ex.what()).c_str(),L"Shoutcast DNAS Error",MB_OK|MB_ICONEXCLAMATION); - if (service) - { - ::CloseServiceHandle(service); - } - if (schSCManager) - { - ::CloseServiceHandle(schSCManager); - } - } - catch(...) - { - if (service) - ::CloseServiceHandle(service); - if (schSCManager) - ::CloseServiceHandle(schSCManager); - } - - return result; -} -#endif - -///////////////////////////////////////////////////// -static vector gServiceArgs; - -#ifdef _WIN32 - -// Wraps SetServiceStatus. -void SetTheServiceStatus(DWORD dwCurrentState, DWORD dwWin32ExitCode, - DWORD dwCheckPoint, DWORD dwWaitHint) -{ - SERVICE_STATUS ss; // Current status of the service. - - // Disable control requests until the service is started. - if (dwCurrentState == SERVICE_START_PENDING) - ss.dwControlsAccepted = 0; - else - ss.dwControlsAccepted = - SERVICE_ACCEPT_STOP|SERVICE_ACCEPT_SHUTDOWN; - // Other flags include SERVICE_ACCEPT_PAUSE_CONTINUE - // and SERVICE_ACCEPT_SHUTDOWN. - - // Initialize ss structure. - ss.dwServiceType = SERVICE_WIN32_OWN_PROCESS; - ss.dwServiceSpecificExitCode = 0; - ss.dwCurrentState = dwCurrentState; - ss.dwWin32ExitCode = dwWin32ExitCode; - ss.dwCheckPoint = dwCheckPoint; - ss.dwWaitHint = dwWaitHint; - - // Send status of the service to the Service Controller. - ::SetServiceStatus(ssh, &ss); -} - -static void WINAPI service_ctrl(DWORD dwCtrlCode) -{ - DWORD dwState = SERVICE_RUNNING; - - switch (dwCtrlCode) - { - case SERVICE_CONTROL_STOP: - dwState = SERVICE_STOP_PENDING; - break; - - case SERVICE_CONTROL_SHUTDOWN: - dwState = SERVICE_STOP_PENDING; - break; - - case SERVICE_CONTROL_INTERROGATE: - break; - - default: - break; - } - - // Set the status of the service. - SetTheServiceStatus(dwState, NO_ERROR, 0, 0); - - // Tell service_main thread to stop. - if ((dwCtrlCode == SERVICE_CONTROL_STOP) || - (dwCtrlCode == SERVICE_CONTROL_SHUTDOWN)) - { - _SetEvent(serviceMain::sStop); - } -} - -static void WINAPI service_main(DWORD dwArgc, LPTSTR *lpszArgv) -{ - try - { - // Register the service ctrl handler. - //if (dwArgc == 0) - if (gServiceArgs.empty()) - { - throw runtime_error("service_main - no name"); - } - ssh = ::RegisterServiceCtrlHandler(lpszArgv[0],(LPHANDLER_FUNCTION)service_ctrl); - if (!ssh) - { - throw runtime_error("RegisterServiceCtrlHandler returned NULL"); - } - // The service has started. - SetTheServiceStatus(SERVICE_RUNNING, 0, 0, 0); - - vector args(gServiceArgs.begin() + 1,gServiceArgs.end()); - - #ifdef _WIN32 - ::SetConsoleCtrlHandler(_console_handler,TRUE); - #else - gSigWatcherThread.start(); - #endif - - sm_main(args); - - #ifndef _WIN32 - ::pthread_kill(gSigWatcherThread,SIGTERM); - gSigWatcherThread.join(); - #endif - - // Stop the service. - OutputDebugString(TEXT("SetTheServiceStatus, SERVICE_STOPPED\n")); - SetTheServiceStatus(SERVICE_STOPPED, NO_ERROR, 0, 0); - } - catch(...) - { - SetTheServiceStatus(SERVICE_STOPPED, ::GetLastError(), 0, 0); - } -} - -#endif - -#ifdef _WIN32 -int run_daemon(const vector &args) throw(std::exception) -#else -int run_daemon(const vector &args, const vector &arg) throw(std::exception) -#endif -{ - sDaemon = true; - - gServiceArgs = args; - _ResetEvent(serviceMain::sStop); - -#ifdef _WIN32 - SERVICE_TABLE_ENTRY ste[] = - {{TEXT("Shoutcast DNAS"),(LPSERVICE_MAIN_FUNCTION)service_main}, {NULL, NULL}}; - - gStartupDirectory = utf32(getfwd()).toUtf8(); - - if (!::StartServiceCtrlDispatcher(ste)) - { - static TCHAR error[512]; - _snwprintf(error, sizeof(error), - TEXT("Error code for StartServiceCtrlDispatcher: %u [%hs].\n"), - GetLastError(), errMessage().c_str()); - MessageBox (NULL, error, NULL, MB_SERVICE_NOTIFICATION); - return -1; - } - return 0; - -#else - pid_t pid; - if ((pid = fork()) < 0) - { - return -1; - } - else if (pid != 0) - { - cout << "sc_serv2 going daemon with PID [" << tos(pid) << "]" << endl; - exit(0); // parent goes away - } - // child continues - setsid(); - gStartupDirectory = getfwd((const char*)&(arg[0])); - - blockSignals(); - gSigWatcherThread.start(); - - int result = sm_main(args); - - ::pthread_kill(gSigWatcherThread,SIGTERM); - gSigWatcherThread.join(); - - return result; -#endif -} - -////////////////////////////////////////////////////// -#ifdef _WIN32 -wchar_t* getfwd() throw() -{ - // determine the actual location of ourselves and use as needed - static wchar_t fwd[MAX_PATH]; - if (!fwd[0]) - { - GetModuleFileNameW(NULL, fwd, ARRAYSIZE(fwd)); - - // this is needed for the service mode - // so simpler to set it here than later - gStartupPath = utf32(fwd).toUtf8(); - - PathRemoveFileSpecW(fwd); - PathAddBackslashW(fwd); - - // this mirrors existing Windows handling despite - // other 2.4.2 changes needing to be made for it. - SetCurrentDirectory(fwd); - } - return fwd; -} -#else -char* getfwd(const char* argv) throw() -{ - // determine the actual location of ourselves and use as needed - static char fwd[MAXPATHLEN + 1]; - if (!fwd[0]) - { - // first attempt to use readlink(..) as per the platform build - #if (defined PLATFORM_LINUX || defined PLATFORM_ARMv6 || defined PLATFORM_ARMv7) - if(readlink("/proc/self/exe", fwd, sizeof(fwd) - 1) == -1) - #endif - #ifdef PLATFORM_BSD - if(readlink("/proc/curproc/file", fwd, sizeof(fwd) - 1) == -1) - #endif - #ifdef __APPLE_CC__ - uint32_t fwdSize = sizeof(fwd); - if(!_NSGetExecutablePath(fwd, &fwdSize)) - #endif - { - #ifdef __APPLE_CC__ - // for this, we get the full program path which can include symlinks - // so this will adjust it all so as to get a clean path and then to - // strip off the program file name (also included) so we match all of - // the other OS versions of this method so it will work consistently. - strncpy(fwd, fileUtil::onlyPath(fileUtil::getFullFilePath(string(fwd))).hideAsString().c_str(), sizeof(fwd) - 1); - #endif - - // now look at argv for a / in it - if (strchr(argv, '/')) - { - // if it starts with a / it's absolute so just use - if (argv[0] == '/') - { - strncpy(fwd, argv, sizeof(fwd) - 1); - } - // otherwise attempt to append to the cwd - // only risk is if the cwd changed onload - else - { - if (getcwd(fwd, sizeof(fwd) - 1)) - { - int len = sizeof(fwd) - strlen(fwd); - strncat(fwd, argv, min(len - 1, (int)sizeof(fwd) - 1)); - } - // and if that doesn't work then set - // it as / and behave like older builds - else - { - strncpy(fwd, "/", sizeof(fwd) - 1); - } - } - } - } - else - { - char tmp[MAXPATHLEN + 1] = {0}; - strncpy(fwd, strncpy(tmp, dirname(fwd), sizeof(tmp) - 1), sizeof(fwd) - 1); - } - - // must be slash terminated - size_t fwd_len = strlen(fwd); - if (fwd_len && (fwd_len < (sizeof(fwd) - 1)) && fwd[fwd_len - 1] != '/') - { - strncat(fwd, "/", sizeof(fwd) - 1); - } - } - - return fwd; -} -#endif - -#ifdef _WIN32 -int run_run(const vector &args) throw(std::exception) -#else -int run_run(const vector &args, const vector &arg) throw(std::exception) -#endif -{ -#ifdef _WIN32 - ::SetConsoleCtrlHandler(_console_handler,TRUE); - gStartupDirectory = utf32(getfwd()).toUtf8(); -#else - if (blockSignals()) - { - cerr << "pthread_sigmask failed in run_run()" << endl; exit(-1); - } - gSigWatcherThread.start(); - -#ifdef PLATFORM_LINUX - struct sigaction sa; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = custom_signal_handler; - sigaction(SIGSEGV, &sa, NULL); - sigaction(SIGABRT, &sa, NULL); - sigaction(SIGFPE, &sa, NULL); -#endif - - gStartupDirectory = getfwd((const char*)&(arg[0])); -#endif - - int result = 0; - try - { - result = sm_main(args); - } - catch(const std::runtime_error &err) - { - printf("%s", (std::string(LIBRARY_LOG_TAG) + "Exception in main: " + err.what()).c_str()); - } - catch(const std::exception &err) - { - printf("%s", (std::string(LIBRARY_LOG_TAG) + "Exception in main: " + err.what()).c_str()); - } - catch(...) - { - printf("%s", (std::string(LIBRARY_LOG_TAG) + "Unknown exception in main()").c_str()); - } - -#ifndef _WIN32 - ::pthread_kill(gSigWatcherThread,SIGTERM); - gSigWatcherThread.join(); -#endif - - return result; -} diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/serviceMain.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/serviceMain.h deleted file mode 100644 index f6ed4134..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/serviceMain.h +++ /dev/null @@ -1,72 +0,0 @@ -#pragma once -#ifndef serviceMain_H_ -#define serviceMain_H_ - -#ifdef _WIN32 -#include -#endif -#include -#include -#include "threading/thread.h" -#include "unicode/uniFile.h" -#include "../../versions.h" - -/* - Class to encapsulate command line or service based launching. - convention is that the first parameter will determine the action - taken, either "install" (install service) "uninstall" (uninstall service) - "daemon" (run as windows service or unix daemon) or "run" (run as application). - If the keyword is missing then "run" is assumed. - - if action is "install" then you must provide the following arguments - - servicename logon password .... application arguments ..... - - for example - - pm.exe install procmgr myaccount mypassword param1 param2 param3 - - To use the default account and password you use a zero - - pm.exe install procmgr 0 0 param1 param2 - - if action is "uninstall" then you must provide the following arguments - - servicename - - This only deals with process services. -*/ - -class serviceMain -{ -public: - static event sStop; // if this is signaled, the service must stop. You must monitor this variable -#ifndef _WIN32 - static event sHUP; // other unix signals - static event sWINCH; - static event sUSR1; - static event sUSR2; -#endif -}; - -extern int main(int argc, char* argv[]) throw(std::exception); - -// you must define this guy: -extern int sm_main(const std::vector &args) throw(); - -#ifdef _WIN32 -BOOL WINAPI _console_handler(DWORD fdwCtrlType); -wchar_t* getfwd() throw(); -#else -int blockSignals() throw(); -char* getfwd(const char* argv) throw(); -#endif - -#ifndef _WIN32 -// We need access to this for Apple, because we don't have sigtimedwait(). This means there -// circumstances when we need access to this thread so we can signal it and force sigwait() to exit - -extern Tthread gSigWatcherThread; -#endif - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/stdServiceImpl.cpp b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/stdServiceImpl.cpp deleted file mode 100644 index fcc61279..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/stdServiceImpl.cpp +++ /dev/null @@ -1,164 +0,0 @@ -#include "stdServiceImpl.h" -#include "file/fileUtils.h" -#include "stl/stringUtils.h" - -using namespace std; -using namespace stringUtil; -using namespace uniString; - -AOL_logger::stdLog_t *gLog = 0; -uniFile::filenameType gStartupDirectory; -uniFile::filenameType gStartupPath; - -// shutdown the logger -void stdServiceBase::stopLog() throw() -{ - if (!gLog) return; - //ILOG(LIBRARY_LOG_TAG "Logger shutdown"); - gLog->postMessage(AOL_logger::message::makeDone()); // logger shutdown message - gLog->join(); // wait for logger to stop - forget(gLog); -} - -// start log in minimal panic mode -void stdServiceBase::startPanicLog() throw() -{ - stopLog(); - try - { - gLog = new AOL_logger::stdLog_t; - addPanicLogElements(); - gLog->start(); - } - catch(...){} -} - -// start log in normal mode -void stdServiceBase::startNormalLog(bool partial) throw(std::runtime_error) -{ - if (partial == false) - { - stopLog(); - } - try - { - if (partial == false) - { - gLog = new AOL_logger::stdLog_t; - } - addNormalLogElements(partial); - gLog->start(); - if (partial == false) - { - //ILOG(LIBRARY_LOG_TAG "Logger startup"); - } - else - { - ILOG("[MAIN] Logger updating log file to use"); - } - } - catch(...) - { - forget(gLog); - throw; - } -} - - -// start log in normal mode -void stdServiceBase::startScreenLog() throw() -{ - try - { - addConsoleLogElements(); - } - catch(...){} -} - -void stdServiceBase::postloop() throw() -{ - comUninit(); - _SetEvent(serviceMain::sStop); -} - -///// main entry point to primary flow of control (after daemon nonsense, Win32 service nonsense, etc). -int stdServiceBase::sm_main(const vector &args) throw() -{ - int result = -1; - try - { - preloop(/* args */); // moved to preflight so logger can be reconfigured on internal restart - result = loop(args); // will only throw during preflight - } - catch(const exception &err) - { - panic(err.what()); - } - catch(...) - { - panic("Unknown exception"); - } - postloop(); - return result; -} - -#ifdef _WIN32 -////////////////////////////////////////////////////////////////////////////// -//////////////////////// win32 specific /////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -void stdServiceWin32generic::comInit() throw(exception) -{ - if (FAILED(CoInitialize(NULL))) - { - throw runtime_error("CoInitialize failure"); - } -} - -void stdServiceWin32generic::comUninit() throw() -{ - CoUninitialize(); -} - -// panic occurs when an error happens before the loggers -// are brought up. -void stdServiceWin32generic::panic(const utf8 &errM) throw() -{ - wstring err_m(errM.toWString()); - if (!sDaemon) - { - ::MessageBox(0,err_m.c_str(),L"SHOUTcast DNAS Error",MB_OK|MB_ICONEXCLAMATION); - } - - // try to build the event logger - if (FAILED(CoInitialize(NULL))) - { - return; - } - - try - { - startPanicLog(); - ELOG(LIBRARY_LOG_TAG + errM); - stopLog(); - } - catch(...){} - CoUninitialize(); -} - -#else -////////////////////////////////////////////////////////////////////////////// -//////////////////////// unix specific /////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -void stdServiceUnixgeneric::panic(const utf8 &errM) throw() -{ - try - { - startPanicLog(); - ELOG(LIBRARY_LOG_TAG + errM); - stopLog(); - } - catch(...){} -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/stdServiceImpl.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/stdServiceImpl.h deleted file mode 100644 index aa3b2c7c..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/stdServiceImpl.h +++ /dev/null @@ -1,322 +0,0 @@ -#pragma once -#ifndef stdServiceImpl_H_ -#define stdServiceImpl_H_ - -#include -#include -#include -#include - -#include "serviceMain.h" -#include "logger.h" -#include "../../config.h" - -#ifdef _WIN32 -#define __F__ __FUNCTION__ -#else -#define __F__ string(__PRETTY_FUNCTION__) + -#endif - -#define LIBRARY_LOG_TAG "<***> " - -extern AOL_logger::stdLog_t *gLog; -extern uniFile::filenameType gStartupDirectory; -extern uniFile::filenameType gStartupPath; -extern config gOptions; - -// are we running as a daemon or service -extern bool sDaemon; - -#define ELOG(...) do { if (gLog) gLog->postMessage(AOL_logger::message::makeError(__VA_ARGS__)); } while (0) -#define WLOG(...) do { if (gLog) gLog->postMessage(AOL_logger::message::makeWarning(__VA_ARGS__)); } while (0) -#define ILOG(...) do { if (gLog) gLog->postMessage(AOL_logger::message::makeInfo(__VA_ARGS__)); } while (0) -#define DLOG(...) do { if (gLog) gLog->postMessage(AOL_logger::message::makeDebug(__VA_ARGS__)); } while (0) -#define ULOG(...) do { if (gLog) gLog->postMessage(AOL_logger::message::makeUpdate(__VA_ARGS__)); } while (0) -#define ROTATE do { if (gLog) gLog->postMessage(AOL_logger::message::makeRotate()); } while (0) - -#define HUP_SIGNAL 45 - -class stdServiceBase -{ -protected: - virtual ~stdServiceBase() throw(){} - virtual void addPanicLogElements() throw(std::exception) = 0; - virtual void addConsoleLogElements() throw(std::exception) = 0; - virtual void addNormalLogElements(bool partial) throw(std::exception) = 0; - virtual void preloop() throw(std::exception) = 0; - virtual int loop(const std::vector &args) throw(std::exception) = 0; - - void base_preloop() throw(std::exception) - { - comInit(); - } - - virtual void postloop() throw(); - - static void preflight(const std::vector &args) throw(std::exception) - { - // get cmd line settings - const std::vector leftover(gOptions.fromArgs(args)); - if (!leftover.empty()) - { - uniString::utf8 s; - for (std::vector::const_iterator i = leftover.begin(); i != leftover.end(); ++i) - { - s += (*i) + " "; - } - throw std::runtime_error(std::string(LIBRARY_LOG_TAG) + "Bad cmd line parameters: `" + s.hideAsString() + "'"); - } - } - - template - int base_loop(const std::vector &args) throw(std::exception) - { - int result = -1; - bool done(false); - while (!done) - { - _ResetEvent(serviceMain::sStop); - - try - { - preflight(args); - startNormalLog(false); - result = APP().go(*this); - } - catch(const std::exception &err) - { - printf("%s", (std::string(LIBRARY_LOG_TAG) + "Exception in main: " + err.what()).c_str()); - done = true; - } - catch(...) - { - printf("%s", (std::string(LIBRARY_LOG_TAG) + "Unknown exception in main()").c_str()); - done = true; - } - - stopLog(); - if (result != HUP_SIGNAL) - { - done = true; - } - } - return result; - } - -public: - virtual void comInit() throw(std::exception) = 0; - virtual void comUninit() throw() = 0; - virtual void stopLog() throw(); - virtual void startNormalLog(bool partial) throw(std::runtime_error); - virtual void startScreenLog() throw(); - virtual void startPanicLog() throw(); - virtual void panic(const uniString::utf8 &errM) throw() = 0; - int sm_main(const std::vector &args) throw(); -}; - -#ifdef _WIN32 -// stuff that doesn't require templates -class stdServiceWin32generic: public stdServiceBase -{ -public: - virtual void comInit() throw(std::exception); - virtual void comUninit() throw(); - virtual void panic(const uniString::utf8 &errM) throw(); -}; - -template -class stdServiceWin32: public stdServiceWin32generic -{ -protected: - uniString::utf8 m_serviceName; - - virtual void addPanicLogElements() throw(std::exception) - { - gLog->addElement(new AOL_logger::systemLogger_element(m_serviceName, gStartupPath, AOL_logger::systemLogger_element::panicConfiguration())); - } - - virtual void addConsoleLogElements() throw(std::exception) - { - _ASSERTE(gLog); - - AOL_logger::consoleLogger_element *c = 0; - - try - { - if (gOptions.getConsoleLogging()) - { - gLog->addElement(c = new AOL_logger::consoleLogger_element()); - c = 0; - } - } - catch(...) - { - forget(c); - throw; - } - - // handler must be set after console is created - if (!sDaemon && (gOptions.getConsoleLogging())) - { - ::SetConsoleCtrlHandler(_console_handler,TRUE); - } - } - - // start log in normal mode (may throw) - virtual void addNormalLogElements(bool partial) throw(std::exception) - { - _ASSERTE(gLog); - - AOL_logger::fileLogger_element *f = 0; - AOL_logger::systemLogger_element *s = 0; - - try - { - APP::addCustomLogElements();// give app opportunity to add special elements - if (!gOptions.getFileLog().empty()) - { - if (partial == true) - { - gLog->postMessage(AOL_logger::message::makeDone()); // logger shutdown message - gLog->join(); - } - bool m_useDefault = false; - gLog->addElement(f = new AOL_logger::fileLogger_element(gOptions.getFileLog(), gOptions.logFile_Default(), - m_useDefault, gOptions.logRotates(), - gOptions.logArchive(), gOptions.rotateInterval())); - if (m_useDefault) - { - wchar_t m_defaultFileName[MAX_PATH] = {0}; - ExpandEnvironmentStringsW(DEFAULT_LOGW, m_defaultFileName, MAX_PATH); - gOptions.setOption(uniString::utf8("logfile"), uniString::utf32(m_defaultFileName).toUtf8()); - } - - f = 0; - } - if ((partial == false) && sDaemon) - { - gLog->addElement(s = new AOL_logger::systemLogger_element(m_serviceName, gStartupPath, - gOptions.getSystemLogConfigString())); - s = 0; - } - } - catch(...) - { - forget(f); - forget(s); - throw; - } - - // handler must be set after console is created - if ((partial == false) && !sDaemon && (gOptions.getConsoleLogging())) - { - ::SetConsoleCtrlHandler(_console_handler,TRUE); - } - } - - virtual void preloop() throw(std::exception) { stdServiceBase::base_preloop(); } - virtual int loop(const std::vector &args) throw(std::exception) { return stdServiceBase::base_loop(args); } - -public: - explicit stdServiceWin32(const std::string &serviceName):m_serviceName(serviceName){} -}; - -#else - -// stuff that doesn't require templates -class stdServiceUnixgeneric: public stdServiceBase -{ -public: - virtual void comInit() throw(std::exception){} - virtual void comUninit() throw(){} - virtual void panic(const uniString::utf8 &errM) throw(); -}; - -template -class stdServiceUnix: public stdServiceUnixgeneric -{ -protected: - virtual void addPanicLogElements() throw(std::exception) - { - gLog->addElement(new AOL_logger::consoleLogger_element()); - } - - virtual void addConsoleLogElements() throw(std::exception) - { - assert(gLog); - - AOL_logger::consoleLogger_element *c = 0; - - try - { - if (gOptions.getConsoleLogging()) - { - gLog->addElement(c = new AOL_logger::consoleLogger_element()); - c = 0; - } - } - catch(...) - { - forget(c); - throw; - } - } - - // start log in normal mode (may throw) - virtual void addNormalLogElements(bool partial) throw(std::exception) - { - assert(gLog); - - AOL_logger::fileLogger_element *f = 0; - - try - { - APP::addCustomLogElements(); // give app an opporunity to add special loggers - if (!gOptions.getFileLog().empty()) - { - if (partial == true) - { - gLog->postMessage(AOL_logger::message::makeDone()); // logger shutdown message - gLog->join(); - } - size_t sid; - size_t count = gOptions.count_stream_logFile(); - int i; - - for (i = 0; i < count; ++i) - { - sid = 0; - uniString::utf8 fn = gOptions.fetchMulti (gOptions.stream_logFile_map(), i, "", &sid); - bool m_useDefault = false; - f = new AOL_logger::fileLogger_element (fn, fn, m_useDefault, gOptions.logRotates(), - gOptions.logArchive(), gOptions.rotateInterval(), sid); - gLog->addElement (f); - } - - bool m_useDefault = false; - gLog->addElement(f = new AOL_logger::fileLogger_element(gOptions.getFileLog(), gOptions.logFile_Default(), - m_useDefault, gOptions.logRotates(), - gOptions.logArchive(), gOptions.rotateInterval())); - if (m_useDefault) - { - gOptions.setOption(uniString::utf8("logfile"),gOptions.logFile_Default()); - } - f = 0; - } - } - catch(...) - { - forget(f); - throw; - } - } - - virtual void preloop() throw(std::exception) { stdServiceBase::base_preloop(); } - virtual int loop(const std::vector &args) throw(std::exception) { return stdServiceBase::base_loop(args); } - -public: - stdServiceUnix() throw(){} -}; -#endif - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/GNUmakefile b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/GNUmakefile deleted file mode 100644 index b66827ec..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/GNUmakefile +++ /dev/null @@ -1,78 +0,0 @@ -default: release - -CXX=gcc - -CXXFLAGS_DEBUG= -g -D_REENTRANT -D_INC_PROCESS -Wall -Wno-unused-function -Wno-sign-compare -Werror - -CXXFLAGS_RELEASE= -D_REENTRANT -D_INC_PROCESS -DNDEBUG -Wall -Wno-unused-function -Wno-sign-compare -Werror - -INCLUDES= \ - -I. \ - -I.. \ - -I../.. - -HEADER_FILES= \ - $(wildcard *.h) \ - $(wildcard ../*.h) \ - -SOURCE_FILES= \ - $(wildcard *.cpp) \ - $(wildcard ../*.cpp) \ - $(wildcard ../../threading/thread.cpp) \ - $(wildcard ../../file/fileUtils.cpp) - -OBJECT_FILES= \ - $(addsuffix .o,$(basename $(notdir $(SOURCE_FILES)))) - -DEBUG_OBJECTS= \ - $(addprefix debug/,$(OBJECT_FILES)) - -RELEASE_OBJECTS= \ - $(addprefix release/,$(OBJECT_FILES)) - -debug/%.o: ../../threading/%.cpp $(HEADER_FILES) - $(CXX) $(CXXFLAGS_DEBUG) $(INCLUDES) -c $< -o $@ - -release/%.o: ../../threading/%.cpp $(HEADER_FILES) - $(CXX) $(CXXFLAGS_RELEASE) $(INCLUDES) -c $< -o $@ - -debug/%.o: ../../file/%.cpp $(HEADER_FILES) - $(CXX) $(CXXFLAGS_DEBUG) $(INCLUDES) -c $< -o $@ - -release/%.o: ../../file/%.cpp $(HEADER_FILES) - $(CXX) $(CXXFLAGS_RELEASE) $(INCLUDES) -c $< -o $@ - -debug/%.o: ../%.cpp $(HEADER_FILES) - $(CXX) $(CXXFLAGS_DEBUG) $(INCLUDES) -c $< -o $@ - -release/%.o: ../%.cpp $(HEADER_FILES) - $(CXX) $(CXXFLAGS_RELEASE) $(INCLUDES) -c $< -o $@ - -debug/%.o: %.cpp $(HEADER_FILES) - $(CXX) $(CXXFLAGS_DEBUG) $(INCLUDES) -c $< -o $@ - -release/%.o: %.cpp $(HEADER_FILES) - $(CXX) $(CXXFLAGS_RELEASE) $(INCLUDES) -c $< -o $@ - -releasedir: - -mkdir -p release - -debugdir: - -mkdir -p debug - -release/test: $(RELEASE_OBJECTS) - $(CXX) $(CXXFLAGS_RELEASE) $(RELEASE_OBJECTS) -lrt -lsocket -lnsl -lpthread -lstdc++ -lz -lm - -debug/test: $(DEBUG_OBJECTS) - $(CXX) $(CXXFLAGS_DEBUG) $(DEBUG_OBJECTS) -lrt -lsocket -lnsl -lpthread -lstdc++ -lz -lm - -release: releasedir $(RELEASE_OBJECTS) release/test - -debug: debugdir $(DEBUG_OBJECTS) debug/test - -clean: - rm -rf release - rm -rf debug - -all: release debug - diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/main.cpp b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/main.cpp deleted file mode 100644 index cfd204cf..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/main.cpp +++ /dev/null @@ -1,169 +0,0 @@ -#include "stdServiceImpl.h" - -using namespace std; - -#ifndef WIN32 -#define DWORD int -#define TRUE true -#define FALSE false -#endif - -static bool valToBool(const string &s) throw() -{ - if (s.empty()) return false; - return (s[0] == '1' || s[0] == 't' || s[0] == 'T' || s[0] == 'y' || s[0] == 'Y'); -} - -class options -{ -public: - string m_name; - string m_fileLog; - bool m_consoleLogging; - - vector fromArgs(const vector &args) throw() - { - vector unused; - - for(vector::const_iterator i = args.begin(); i != args.end(); ++i) - { - string::size_type colon_pos = (*i).find(":"); - if (colon_pos != string::npos) - { - string key = (*i).substr(0,colon_pos); - string value= (*i).substr(colon_pos+1); - if (key == "name") { m_name = value; } - else if (key == "clog") { m_consoleLogging = valToBool(value); } - else if (key == "flog") { m_fileLog = value; } - else - { - unused.push_back(*i); - } - } - else - { - unused.push_back(*i); - } - } - - return unused; - } - - string logText() const throw() - { - ostringstream o; - o << endl; - o << "name = " << m_name << endl; - o << "file log = " << m_fileLog << endl; - o << "console logging = " << m_consoleLogging << endl; - return o.str(); - } -}; - -options gOptions; - -class testService -{ -private: - bool m_done; - int m_goResult; - -public: - explicit testService(stdServiceBase &b) : - m_done(false), - m_goResult(0){} - - int go(stdServiceBase &b) throw(exception) - { - DLOG(__F__ ""); - - m_goResult = 0; - bool comInitialized = false; - - try - { - b.comInit(); - - // event loop (until done) - while (!m_done) - { - event dummyEvent(TRUE); - HANDLE evts[2]; - DWORD evtCount = 0; - - evts[evtCount++] = serviceMain::sStop; -// evts[evtCount++] = m_webServer.getRequestQueueEvent();//m_webServer.getCommandSignal(); - - //wait for a single from the webserver or console abort and take action - DWORD waitResult = ::WaitForMultipleObjects(evtCount,evts,FALSE,250); - -// gProcessTable.update(); - switch(waitResult) - { - case WAIT_OBJECT_0: - { - ILOG("Ctrl+C application termination"); - m_done = true; - break; - } -// case WAIT_OBJECT_0+1: -// { -// DLOG("Got a web event"); -// handleWebEvent(); -// break; -// } - default: - { -// if (m_perfmon) -// { -// time_t ttt = time(NULL); -// m_perfmon->updateEPOCH(ttt); -// m_perfmon->updateAppCounter(gProcessTable.countRunning()); -// } - - //DLOG("PM: Got a periodic event"); - // periodic event -// if (gProcessTable.isIdle()) -// { -// if (m_QuitWhenIdle) -// { -// m_done = true; -// m_goResult = 0; -// } -// else if (m_HUPWhenIdle) -// { -// m_done = true; -// m_goResult = HUP_SIGNAL; -// } -// } - break; - } - } - } - b.comUninit(); - comInitialized = false; - ::SetEvent(serviceMain::sStop); - } - catch(...) - { - ELOG(__F__ " Caught an exception"); - if (comInitialized) - { - b.comUninit(); - } - ::SetEvent(serviceMain::sStop); - throw; - } - return m_goResult; - } -}; - -int sm_main(const vector &args) throw() -{ -#ifdef WIN32 - stdServiceWin32 s("testService"); -#else - stdServiceUnix s; -#endif - return s.sm_main(args); -} diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/messagefile.mc b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/messagefile.mc deleted file mode 100644 index 8b3a4be8..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/messagefile.mc +++ /dev/null @@ -1,7 +0,0 @@ -MessageId=0x1 -Severity=Error -SymbolicName=MSG_CMD_ERR -Language=English -%1 - - diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/resource.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/resource.h deleted file mode 100644 index d6780c17..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/resource.h +++ /dev/null @@ -1,14 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by test.rc - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/test.rc b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/test.rc deleted file mode 100644 index 0d0fd098..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/test.rc +++ /dev/null @@ -1,101 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,1,0,0 - PRODUCTVERSION 0,1,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "FileDescription", "test Application" - VALUE "FileVersion", "0, 1, 0, 0" - VALUE "InternalName", "test" - VALUE "LegalCopyright", "Copyright (C) 2005" - VALUE "OriginalFilename", "test.exe" - VALUE "ProductName", " test Application" - VALUE "ProductVersion", "0, 1, 0, 0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/test.sln b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/test.sln deleted file mode 100644 index 15c8dadf..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/test.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcproj", "{07D71318-C429-4ED4-A42C-C1A3FC2C40C5}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {07D71318-C429-4ED4-A42C-C1A3FC2C40C5}.Debug.ActiveCfg = Debug|Win32 - {07D71318-C429-4ED4-A42C-C1A3FC2C40C5}.Debug.Build.0 = Debug|Win32 - {07D71318-C429-4ED4-A42C-C1A3FC2C40C5}.Release.ActiveCfg = Release|Win32 - {07D71318-C429-4ED4-A42C-C1A3FC2C40C5}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/test.vcproj b/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/test.vcproj deleted file mode 100644 index bb2de619..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/services/test/test.vcproj +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/stacktrace/StackTrace.cpp b/Src/Plugins/DSP/sc_serv3/nmrCommon/stacktrace/StackTrace.cpp deleted file mode 100644 index d78fa9a1..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/stacktrace/StackTrace.cpp +++ /dev/null @@ -1,868 +0,0 @@ -#ifdef PLATFORM_LINUX -#if !defined(__APPLE__) && !defined(_GNU_SOURCE) -# define _GNU_SOURCE // enable dladdr and getline -#endif - -#include "StackTrace.h" -#include - -#if defined(__APPLE__) // need atos -# if defined(STACKTRACE_USE_BACKTRACE) -# include // to record the backtrace addresses -# endif -// for display: -# include // forkpty to make a pseudo-terminal for atos -# include // set pseudo-terminal to raw mode -# include // test whether atos has responded yet - -#elif defined(STACKTRACE_USE_BACKTRACE) -# include // to record the backtrace addresses -// for display: -# include // dladdr() -# include // realpath() -# include -# if defined(__GNUC__) && defined(__cplusplus) -# include // demangling -# include -# endif -# if defined(__linux__) -# include -# endif -#endif - -#ifdef __cplusplus -# include -# include -# include -#else -# include -# include -# include -#endif - -#ifdef ST_UNUSED -#elif defined(__GNUC__) && __GNUC__>3 -//! portable access to compiler hint not to warn if a function argument is ignored (goes in argument list) -# define ST_UNUSED(x) UNUSED_##x __attribute__((unused)) -//! portable access to compiler hint not to warn if a function argument is ignored (goes at beginning of function body) -# define ST_BODY_UNUSED(x) /*no body necessary*/ - -#elif defined(__LCLINT__) -//! portable access to compiler hint not to warn if a function argument is ignored (goes in argument list) -# define ST_UNUSED(x) /*@unused@*/ x -//! portable access to compiler hint not to warn if a function argument is ignored (goes at beginning of function body) -# define ST_BODY_UNUSED(x) /*no body necessary*/ - -#else -//! portable access to compiler hint not to warn if a function argument is ignored (goes in argument list) -# define ST_UNUSED(x) UNUSED_##x -//! portable access to compiler hint not to warn if a function argument is ignored (goes at beginning of function body) -# define ST_BODY_UNUSED(x) (void)UNUSED_##x /* ugly hack to avoid warning */ -#endif - -#ifdef __cplusplus -namespace stacktrace { -#endif /* __cplusplus */ - -int unrollStackFrame(struct StackFrame* curFrame, struct StackFrame* nextFrame) { - if(curFrame==NULL) - return 0; - curFrame->caller=NULL; - if(nextFrame==NULL) - return 0; - - -#ifdef STACKTRACE_USE_BACKTRACE - - if(curFrame->packedRA==NULL) - return 0; // don't have current frame - if(*curFrame->packedRAUsed<=curFrame->depth+1) { - // last element - if(curFrame!=nextFrame) { - nextFrame->packedRA = NULL; - nextFrame->packedRAUsed = nextFrame->packedRACap = NULL; - } - return 0; - } - if(curFrame!=nextFrame) { - nextFrame->packedRA = curFrame->packedRA; - nextFrame->packedRAUsed = curFrame->packedRAUsed; - nextFrame->packedRACap = curFrame->packedRACap; - nextFrame->depth = curFrame->depth; // will be incremented below - } - nextFrame->ra = (*nextFrame->packedRA)[++(nextFrame->depth)]; - curFrame->caller=nextFrame; - return 1; - -#else - - void* nsp=NULL; - machineInstruction * nra=NULL; - -#if defined(__i386__) || defined(__x86_64__) || defined(__amd64__) - if(curFrame->sp==NULL) - return 0; - if(((void**)curFrame->sp)-1==NULL) - return 0; - nsp=((void***)curFrame->sp)[-1]; - if(nsp==NULL) - return 0; - nsp=(void**)nsp+1; //move from frame pointer to stack pointer of previous frame - nra=*((machineInstruction**)curFrame->sp); - if(nsp<=curFrame->sp) { - fprintf(stderr,"stacktrace::unrollStackFrame(sp=%p,ra=%p) directed to invalid next frame: (sp=%p,ra=%p)\n",curFrame->sp,curFrame->ra,nsp,nra); - return 0; - } -# ifdef DEBUG_STACKTRACE - if(curFrame->debug) - printf("( %p %p ) -> { %p %p }\n",curFrame->sp,curFrame->ra,nsp,nra); - nextFrame->debug=curFrame->debug; -# endif - nextFrame->sp=nsp; - nextFrame->ra=nra; - curFrame->caller=nextFrame; - return 1; -#endif -#ifdef __POWERPC__ - if(curFrame->sp==NULL) - return 0; - if(*(void**)curFrame->sp==NULL) - return 0; - nsp=*(void**)curFrame->sp; - nra=((machineInstruction**)nsp)[2]; - if(nsp<=curFrame->sp) { - fprintf(stderr,"stacktrace::unrollStackFrame(sp=%p,ra=%p) directed to invalid next frame: (sp=%p,ra=%p)\n",curFrame->sp,curFrame->ra,nsp,nra); - return 0; - } -# ifdef DEBUG_STACKTRACE - if(curFrame->debug) - printf("( %p %p ) -> { %p %p }\n",curFrame->sp,curFrame->ra,nsp,nra); - nextFrame->debug=curFrame->debug; -# endif - nextFrame->sp=nsp; - nextFrame->ra=nra; - curFrame->caller=nextFrame; - return 1; -#endif -#if defined(__MIPSEL__) || defined(__MIPS__) /* we're running on PLATFORM_APERIOS */ - if(curFrame->sp==NULL) - return 0; - /* Have to scan through intructions being executed because stack pointer is not stored directly on the stack */ - machineInstruction * ins; - const machineInstruction * INS_BASE=(const machineInstruction *)0x2000; // lowest valid memory address? - -#ifdef __PIC__ - ins = reinterpret_cast(curFrame->gp-curFrame->ra); -#else - ins = curFrame->ra; -#endif - // find previous return address - for(; ins>=INS_BASE; ins--) { - // gcc will always save the return address with the instruction - // sw ra, offset(sp) - // - // the high word in this case is sw sp ra - if ( ( *ins & 0xffff0000 ) == 0xafbf0000 ) - { - // the low word is the offset from sp - int offset = *ins & 0x000ffff; - - // in case things went horribly awry, don't deref the non-aligned ptr - if (offset & 0x3) - return 0; - - nra = *reinterpret_cast((char*)curFrame->sp + offset); - break; // now search for stack pointer - } - - //it appears the aperios stub entry functions always begin with "ori t0,ra,0x0" - //if we hit one of these, return 0, because we can't unroll any more - //(or at least, I don't know how it returns from these... there's no return statements!) - if ( *ins == 0x37e80000 ) { -# ifdef DEBUG_STACKTRACE - if(curFrame->debug) - printf("( %p %p %p ) -> { kernel? }\n",curFrame->sp,curFrame->ra,curFrame->gp); -# endif - return 0; - } - } - // find previous stack pointer - for(; ins>=INS_BASE; ins--) { - // gcc will always change the stack frame with the instruction - // addiu sp,sp,offset - // - // at the beginning of the function the offset will be negative since the stack grows - // from high to low addresses - // - // first check the high word which will be instruction + regs in this case (I-type) - if ( ( *ins & 0xffff0000 ) == 0x27bd0000 ) { - // the offset is in the low word. since we're finding occurrence at the start of the function, - // it will be negative (increase stack size), so sign extend it - int offset = ( *ins & 0x0000ffff ) | 0xffff0000; - - // in case things went horribly awry, don't deref the non-aligned ptr - if (offset & 0x3) - return 0; - - nsp = (char*)curFrame->sp - offset; - break; - } - } - - - if(ins>=INS_BASE) { - if(nsp<=curFrame->sp) { -#ifdef __PIC__ - fprintf(stderr,"stacktrace::unrollStackFrame(sp=%p,ra=%p,gp=%p) directed to invalid next frame: (sp=%p,ra=%p,gp=%p)\n",curFrame->sp,(void*)curFrame->ra,(void*)curFrame->gp,nsp,nra,(void*)(reinterpret_cast(nsp)[4])); -#else - fprintf(stderr,"stacktrace::unrollStackFrame(sp=%p,ra=%p) directed to invalid next frame: (sp=%p,ra=%p)\n",curFrame->sp,(void*)curFrame->ra,nsp,nra); -#endif - return 0; - } - -#ifdef __PIC__ -# ifdef DEBUG_STACKTRACE - if(curFrame->debug) - printf("( %p %p %p ) -> { %p %p %p }\n",curFrame->sp,curFrame->ra,curFrame->gp,nsp,nra,reinterpret_cast(nsp)[4]); - nextFrame->debug=curFrame->debug; -# endif - // I'm not actually sure this is a valid stop criteria, but in testing, - // after this it seems to cross into some kind of kernel code. - // (We get a really low gp (0x106), although a fairly normal nra, and then go bouncing - // around in memory until we hit sp=0x80808080, ra=0x2700, which seems to be the 'real' last frame) - //if(reinterpret_cast(nra)>reinterpret_cast(nsp)[4]) - //return 0; - //instead of this however, now we check for the ori t0,ra,0 statement, and reuse previous gp below - - nextFrame->sp=nsp; - //not sure how valid this is either: - if(reinterpret_cast(nra)>reinterpret_cast(nsp)[4]) { - nextFrame->gp = curFrame->gp; - } else { - nextFrame->gp = reinterpret_cast(nsp)[4]; // gp is stored 4 words from stack pointer - } - nextFrame->ra = nextFrame->gp-reinterpret_cast(nra); -#else -# ifdef DEBUG_STACKTRACE - if(curFrame->debug) - printf("( %p %p ) -> { %p %p }\n",curFrame->sp,curFrame->ra,nsp,nra); - nextFrame->debug=curFrame->debug; -# endif - nextFrame->sp=nsp; - nextFrame->ra=nra; -#endif /* __PIC__ */ - curFrame->caller=nextFrame; - return 1; - } -#ifdef __PIC__ -# ifdef DEBUG_STACKTRACE - if(curFrame->debug) - printf("( %p %p %p ) -> { %p %p --- }\n",curFrame->sp,curFrame->ra,curFrame->gp,nsp,nra); -# endif -#else -# ifdef DEBUG_STACKTRACE - if(curFrame->debug) - printf("( %p %p ) -> { %p %p }\n",curFrame->sp,curFrame->ra,nsp,nra); -# endif -#endif - return 0; -#endif -#endif /* backtrace */ -} - -#ifdef STACKTRACE_USE_BACKTRACE -static int growAlloc(struct StackFrame* frame) { - void** r = (void**)realloc(*frame->packedRA, *frame->packedRACap * sizeof(void*) * 2); - if(r==NULL) - return 0; - *frame->packedRACap *= 2; - *frame->packedRA = r; - return 1; -} -#endif - -#ifdef STACKTRACE_USE_BACKTRACE -const size_t MIN_CAP=50; -static void allocBacktraceRegion(struct StackFrame* frame, size_t /*cap*/) { - /*if(cap < MIN_CAP) - cap=MIN_CAP;*/ - frame->packedRACap = (size_t*)malloc(sizeof(size_t)); - *frame->packedRACap = MIN_CAP; - frame->packedRAUsed = (size_t*)malloc(sizeof(size_t)); - *frame->packedRAUsed = 0; - frame->packedRA = (void***)malloc(sizeof(void**)); - *frame->packedRA = (void**)malloc(*frame->packedRACap * sizeof(void*)); - //printf("Allocated %p\n",*frame->packedRA); -} - -static void freeBacktraceRegion(struct StackFrame* frame) { - //printf("Freeing %p\n",*frame->packedRA); - free(frame->packedRACap); - frame->packedRACap = NULL; - free(frame->packedRAUsed); - frame->packedRAUsed = NULL; - free(*frame->packedRA); - *frame->packedRA=NULL; - free(frame->packedRA); - frame->packedRA=NULL; -} -#endif - -void getCurrentStackFrame(struct StackFrame* frame) { -#ifdef STACKTRACE_USE_BACKTRACE - - // first call? allocate the storage area - if(frame->packedRA==NULL) - allocBacktraceRegion(frame,MIN_CAP); - - // call backtrace, if we hit the capacity, grow the buffer and try again - do { - *frame->packedRAUsed = backtrace(*frame->packedRA, *frame->packedRACap); - } while(*frame->packedRAUsed==*frame->packedRACap && growAlloc(frame)); - - // if we used an oversized buffer, shrink it back down - if(*frame->packedRACap > *frame->packedRAUsed*2 && *frame->packedRACap>MIN_CAP) { - unsigned int newsize = *frame->packedRAUsed * 3 / 2; - if(newsize < MIN_CAP) - newsize = MIN_CAP; - void** r = (void**)realloc(*frame->packedRA, newsize * sizeof(void*) * 2); - if(r!=NULL) { - *frame->packedRACap = newsize; - *frame->packedRA = r; - } - } - frame->depth=1; - -#else - - void** csp=NULL; - machineInstruction* cra=NULL; - -#ifdef __POWERPC__ - __asm __volatile__ ("mr %0,r1" : "=r"(csp) ); // get the current stack pointer - __asm __volatile__ ("mflr %0" : "=r"(cra) ); // get the current return address -#endif /* __POWERPC__ */ - -#if defined(__MIPSEL__) || defined(__MIPS__) -#ifdef __PIC__ - size_t cgp=0; - __asm __volatile__ ("move %0,$gp" : "=r"(cgp) ); //get the gp register so we can compute link addresses -#endif /* __PIC__ */ - __asm __volatile__ ("move %0,$sp" : "=r"(csp) ); // get the current stack pointer - __asm __volatile__ ("jal readepc; nop; readepc: move %0,$ra" : "=r"(cra) ); // get the current return address -#endif /* __MIPSEL__ */ - -#if defined(__i386__) - __asm __volatile__ ("movl %%ebp,%0" : "=m"(csp) ); // get the caller's stack pointer - csp++; //go back one to really be a stack pointer - //__asm __volatile__ ("movl (%%esp),%0" : "=r"(cra) ); // get the caller's address - cra=*((machineInstruction**)csp); - csp=((void***)csp)[-1]+1; -#endif /* __i386__ */ - -// basically the same as i386, but movq instead of movl, and rbp instead of ebp -#if defined(__x86_64__) || defined(__amd64__) - __asm __volatile__ ("movq %%rbp,%0" : "=m"(csp) ); // get the caller's stack pointer - csp++; //go back one to really be a stack pointer - //__asm __volatile__ ("movq (%%rsp),%0" : "=r"(cra) ); // get the caller's address - cra=*((machineInstruction**)csp); - csp=((void***)csp)[-1]+1; -#endif /* amd64/x86_64 */ - - frame->sp=csp; -#if defined(__PIC__) && (defined(__MIPSEL__) || defined(__MIPS__)) - frame->ra=cgp-reinterpret_cast(cra); - frame->gp=cgp; -#else - frame->ra=cra; -#endif /* __PIC__ */ - -#if !defined(__i386__) && !defined(__x86_64__) && !defined(__amd64__) - //with ia-32 it was more convenient to directly provide caller, so don't need to unroll - //otherwise we actually want to return *caller's* frame, so unroll once - unrollStackFrame(frame,frame); -#endif /* not __i386__ */ -#endif /* backtrace */ -} - -void freeStackTrace(struct StackFrame* frame) { -#ifdef STACKTRACE_USE_BACKTRACE - if(frame!=NULL && frame->packedRA!=NULL) { - freeBacktraceRegion(frame); - } -#endif - while(frame!=NULL) { - struct StackFrame * next=frame->caller; - free(frame); - if(frame==next) - return; - frame=next; - } -} - -struct StackFrame* allocateStackTrace(unsigned int size) { - struct StackFrame * frame=NULL; - while(size--!=0) { - struct StackFrame * prev = (struct StackFrame *)malloc(sizeof(struct StackFrame)); - memset(prev, 0, sizeof(*prev)); -#ifdef STACKTRACE_USE_BACKTRACE - if(frame==NULL) { - allocBacktraceRegion(prev,size); - } else { - prev->packedRA = frame->packedRA; - prev->packedRAUsed = frame->packedRAUsed; - prev->packedRACap = frame->packedRACap; - } - prev->depth = size-1; -#endif - prev->caller=frame; - frame=prev; - } - return frame; -} - - -struct StackFrame * recordStackTrace(unsigned int limit/*=-1U*/, unsigned int skip/*=0*/) { - if(limit==0) - return NULL; - struct StackFrame * cur = allocateStackTrace(1); -#ifdef DEBUG_STACKTRACE - cur->debug=0; -#endif - getCurrentStackFrame(cur); - for(; skip!=0; skip--) - if(!unrollStackFrame(cur,cur)) { - freeStackTrace(cur); - return NULL; - } - struct StackFrame * prev = (struct StackFrame *)malloc(sizeof(struct StackFrame)); - memset(prev, 0, sizeof(*prev)); -#ifdef DEBUG_STACKTRACE - prev->debug=0; -#endif - - unrollStackFrame(cur,prev); //unroll once more for the current frame -#ifdef STACKTRACE_USE_BACKTRACE - memset(cur,0,sizeof(*cur)); // clear cur, prev is now responsible for packedRA allocation -#endif - freeStackTrace(cur); - cur=prev; - - for(--limit; limit!=0; limit--) { - struct StackFrame * next = (struct StackFrame *)malloc(sizeof(struct StackFrame)); - memset(next, 0, sizeof(*next)); -#ifdef DEBUG_STACKTRACE - next->debug=0; -#endif - if(!unrollStackFrame(prev,next)) { - // reached end of trace - free(next); - prev->caller=NULL; //denotes end was reached - return cur; - } - prev=next; - } - // reaching here implies limit was reached - prev->caller=prev; //denotes limit was reached - return cur; -} - -struct StackFrame * recordOverStackTrace(struct StackFrame* frame, unsigned int skip) { - struct StackFrame * cur = allocateStackTrace(1); -#ifdef DEBUG_STACKTRACE - cur->debug=0; -#endif - if(frame==NULL) - return frame; - getCurrentStackFrame(cur); - for(; skip!=0; skip--) - if(!unrollStackFrame(cur,cur)) { - freeStackTrace(cur); - return frame; - } -#ifdef STACKTRACE_USE_BACKTRACE - if(frame->packedRA!=NULL) - freeBacktraceRegion(frame); -#endif - unrollStackFrame(cur,frame); //unroll once more for the current frame -#ifdef STACKTRACE_USE_BACKTRACE - memset(cur,0,sizeof(*cur)); // clear cur, frame is now responsible for packedRA allocation -#endif - freeStackTrace(cur); - - for(; frame->caller!=NULL && frame->caller!=frame; frame=frame->caller) { - struct StackFrame *ans=frame->caller; //don't lose remainder of free list if we hit the end - if(!unrollStackFrame(frame,frame->caller)) { - return ans; // reached end of trace - } - } - // reaching here implies limit was reached - frame->caller=frame; //denotes limit was reached - return NULL; -} - - -#ifdef __APPLE__ -// use atos to do symbol lookup, can lookup non-dynamic symbols and also line numbers -/*! This function is more complicated than you'd expect because atos doesn't flush after each line, - * so plain pipe() or socketpair() won't work until we close the write side. But the whole point is - * we want to keep atos around so we don't have to reprocess the symbol table over and over. - * What we wind up doing is using forkpty() to make a new pseudoterminal for atos to run in, - * and thus will use line-buffering for stdout, and then we can get each line. */ -static void atosLookup(unsigned int depth, void* ra) { - static int fd=-1; - int isfirst=0; - - if(fd==-1) { - struct termios opts; - cfmakeraw(&opts); // have to set this first, otherwise queries echo until child kicks in - pid_t child = forkpty(&fd,NULL,&opts,NULL); - if(child<0) { - perror("Could not forkpty for atos call"); - return; - } - if(child==0) { - //sleep(3); - char pidstr[50]; - snprintf(pidstr,50,"%d",getppid()); - execlp("atos","atos","-p",pidstr,(char*)0); - //snprintf(pidstr,50,"atos -p %d",getppid()); - //execlp("sh","sh","-i","-c",pidstr,(char*)0); - fprintf(stderr,"Could not exec atos for stack trace!\n"); - _exit(1); - } - isfirst=1; - } - - { - char q[50]; - size_t qlen = snprintf(q,50,"%p\n",ra); - //printf("query: %.*s",50,q); - write(fd,q,qlen); - } - - if(isfirst) { - // atos can take a while to parse symbol table on first request, which is why we leave it running - // if we see a delay, explain what's going on... - int err; - struct timeval tv = {3,0}; - fd_set fds; - FD_ZERO(&fds); - FD_SET(fd,&fds); - err = select(fd+1,&fds,NULL,NULL,&tv); - if(err<0) - perror("select for atos output"); - if(err==0) // timeout - printf("Generating... first call takes some time for 'atos' to cache the symbol table.\n"); - } - - { - const unsigned int MAXLINE=1024; - char line[MAXLINE]; - size_t nread=0; - char c='x'; - while(c!='\n' && nread=cmdlen) { - fprintf(stderr, "[ERR addr2line command grew? %d vs %lu]\n",cmdused,(unsigned long)cmdlen); - free(cmd); - return -1; - } - FILE* look=popen(cmd,"r"); - free(cmd); - if(look==NULL) { - fprintf(stderr, "[Missing addr2line]\n"); - return -1; - } - if(getline(func,funclen,look)<=0) { - pclose(look); - return -1; - } - if(getline(srcfile,srcfilelen,look)<=0) { - pclose(look); - return -1; - } - pclose(look); - char* nl = strrchr(*func,'\n'); - if(nl!=NULL) - *nl='\0'; - nl = strrchr(*srcfile,'\n'); - if(nl!=NULL) - *nl='\0'; - return 0; -} - -static void displayRelPath(FILE* os, const char * wd, const char* path) { - unsigned int same=0,i=0; - for(i=0; path[i]!='\0'; ++i) { - if(wd[i]=='/') - same=i+1; - else if(wd[i]=='\0') { - same=i; - break; - } else if(wd[i]!=path[i]) - break; - } - if(wd[same]=='\0') - ++same; - else if(same>1) { - // really want to be relative to source tree root, don't bother with ..'s - /*for(i=same; wd[i]!='\0'; ++i) - if(wd[i]=='/') - fprintf(os,"../"); - fprintf(os,"../");*/ - } - fprintf(os,"%s",&path[same]); -} -#endif - -//! attempts to read symbol information and displays stack trace header -static void beginDisplay() { -#ifdef STACKTRACE_USE_BACKTRACE - //fprintf(stderr,"Stack Trace:\n"); -#elif defined(PLATFORM_APERIOS) - fprintf(stderr,"Run trace_lookup:"); -#elif defined(__APPLE__) - fprintf(stderr,"backtrace_symbols() unavailable, try 'atos' to make human-readable backtrace (-p %d):",getpid()); -#else - fprintf(stderr,"backtrace_symbols() unavailable, try addr2line or tools/trace_lookup to make human-readable backtrace:"); -#endif -} - -#ifdef __APPLE__ -static void displayStackFrame(unsigned int depth, const struct StackFrame* frame) { - atosLookup(depth,(void*)frame->ra); -} -#elif defined(STACKTRACE_USE_BACKTRACE) -static void displayStackFrame(unsigned int depth, const struct StackFrame* frame) { - void* ra = (void*)frame->ra; - Dl_info sym; - memset(&sym,0,sizeof(Dl_info)); - int dlres = dladdr(frame->ra, &sym); - - int isExe = (sym.dli_fname==NULL); // if lib unknown, assume static linkage, implies executable -# ifdef __linux__ - // detect if /proc/self/exe points to sym.dli_fname - if(!isExe && sym.dli_fname[0]!='\0') { - struct stat exeStat; - struct stat libStat; - if(stat("/proc/self/exe",&exeStat)!=0) { - perror(" stat /proc/self/exe"); - } else if(stat(sym.dli_fname,&libStat)!=0) { - perror(" stat lib"); - } else { - isExe = (exeStat.st_dev==libStat.st_dev && exeStat.st_ino==libStat.st_ino); - } - } -# endif - - if(dlres==0 || sym.dli_sname==NULL) { - if(sym.dli_fname==NULL || sym.dli_fname[0]=='\0') { - fprintf(stderr,"%4u [non-dynamic symbol @ %p]",depth,ra); - fprintf(stderr," (has offset %p in unknown library)\n",sym.dli_fbase); - } else { - // use addr2line for static function lookup - const void* const off = (isExe) ? ra : (void*)((size_t)ra-(size_t)sym.dli_fbase); - char* srcfile=NULL, *func=NULL; - size_t srcfilelen=0, funclen=0; - if(addr2lineLookup(sym.dli_fname,off,&srcfile,&srcfilelen,&func,&funclen)==0) { - fprintf(stderr,"%4u %s",depth,(strlen(func)==0) ? "[unknown symbol]" : func); - if(!isExe) { - const char * base = strrchr(sym.dli_fname,'/'); - fprintf(stderr," (%s)",(base==NULL)?sym.dli_fname:base+1); - } - if(strcmp(srcfile,"??:0")!=0) { - fprintf(stderr," "); - char * wd = getcwd(NULL,0); - if(wd==NULL) { - perror("getcwd"); - return; - } - fprintf(stderr,"("); - displayRelPath(stderr,wd,srcfile); - fprintf(stderr,")"); - free(wd); - } - fprintf(stderr,"\n"); - } - free(srcfile); - free(func); - } - return; - } else { - const char * dispFmt="%4d %s +%#lx"; -# ifdef __cplusplus - fprintf(stderr,dispFmt,depth,demangle(sym.dli_sname).c_str(),(size_t)ra-(size_t)sym.dli_saddr); -# else - fprintf(stderr,dispFmt,depth,sym.dli_sname,(size_t)ra-(size_t)sym.dli_saddr); -# endif - } - - if(sym.dli_fname==NULL || sym.dli_fname[0]=='\0') { - fprintf(stderr," (%p, offset %p in unknown lib)\n",ra,sym.dli_fbase); - return; - } else if(isExe) { - // don't bother listing executable name, just show return address - // ...or since the symbol name and offset imply the return address, just skip it - //fprintf(stderr," (%p)",ra); - } else { - // ra is meaningless in dynamically loaded libraries... address space layout randomization (ASLR) - // just show library name - const char * base = strrchr(sym.dli_fname,'/'); - fprintf(stderr," (%s)",(base==NULL)?sym.dli_fname:base+1); - } - - // now do file and line number lookup of function via addr2line - const void* const off = (isExe) ? ra : (void*)((size_t)ra-(size_t)sym.dli_fbase); - char* srcfile=NULL, *func=NULL; - size_t srcfilelen=0, funclen=0; - if(addr2lineLookup(sym.dli_fname,off,&srcfile,&srcfilelen,&func,&funclen)==0 && strcmp(srcfile,"??:0")!=0) { - fprintf(stderr," "); - char * wd = getcwd(NULL,0); - if(wd==NULL) { - perror("getcwd"); - return; - } - fprintf(stderr,"("); - displayRelPath(stderr,wd,srcfile); - fprintf(stderr,")"); - free(wd); - } - fprintf(stderr,"\n"); - free(srcfile); - free(func); -} -#else -static void displayStackFrame(unsigned int ST_UNUSED(depth), const struct StackFrame* frame) { - ST_BODY_UNUSED(depth); - fprintf(stderr," %p",(void*)frame->ra); -} -#endif - -//! releases symbol information used during display -static void completeDisplay(int isend) { -#if defined(STACKTRACE_USE_BACKTRACE) -#endif - if(!isend) - fprintf(stderr," ...\n"); -} - -void displayCurrentStackTrace(unsigned int limit/*=-1U*/, unsigned int skip/*=0*/) { - struct StackFrame * cur = allocateStackTrace(1); -#ifdef DEBUG_STACKTRACE - cur->debug=0; -#endif - unsigned int i; - int more; - if(limit==0) - return; - getCurrentStackFrame(cur); - //printf(" initial (%p\t%p\t%p)\n",cur.ra,cur.sp,*(void**)cur.sp); - beginDisplay(); - for(; skip!=0; skip--) { - if(!unrollStackFrame(cur,cur)) { - completeDisplay(1); - return; - } - //printf(" skip (%p\t%p\t%p)\n",cur.ra,cur.sp,*(void**)cur.sp); - } - for(i=0; (more=unrollStackFrame(cur,cur)) && icaller!=frame; i++) { - displayStackFrame(i,frame); - frame=frame->caller; - } - if(frame!=NULL) - displayStackFrame(i+1,frame); - completeDisplay(frame==NULL); -} - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/*! @file - * @brief Implements functionality for performing stack traces - * @author ejt (Generalized and implementation for non-MIPS platforms) - * @author Stuart Scandrett (original inspiration, Aperios/MIPS stack operations) - * - * $Author: ejtttje $ - * $Name: $ - * $Revision: 1.2 $ - * $State: Exp $ - * $Date: 2009/11/20 00:50:23 $ - */ -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/stacktrace/StackTrace.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/stacktrace/StackTrace.h deleted file mode 100644 index fe79f863..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/stacktrace/StackTrace.h +++ /dev/null @@ -1,135 +0,0 @@ -#ifndef INCLUDED_StackTrace_h_ -#define INCLUDED_StackTrace_h_ - -#ifdef __APPLE__ -# include -#endif -// Aperios and Mac OS X 10.4 and prior need the "manual" unroll; otherwise assume execinfo.h and backtrace() are available -#if !defined(PLATFORM_APERIOS) && (!defined(__APPLE__) || defined(MAC_OS_X_VERSION_10_5)) -# define STACKTRACE_USE_BACKTRACE -#endif - -#ifndef __cplusplus -# include - -#else -# include -//! Holds the C-style interface for the stack trace routines -namespace stacktrace { -extern "C" { -#endif /* __cplusplus */ - -typedef int machineInstruction; //!< typedef in case type needs to change on other platforms (i.e. long for 64 bit architectures?) - -//! Stores information about a single stack frame -struct StackFrame { - -#ifdef STACKTRACE_USE_BACKTRACE - //! pointer to array of return addresses, shared by all StackFrames in the list - void*** packedRA; - //! pointer to number of entries available at #packedRA - size_t* packedRAUsed; - //! pointer to size of array at #packedRA - size_t* packedRACap; - //! entry in #packedRA corresponding to this frame - size_t depth; - //! return address, points to instruction being executed within current frame - void* ra; -#else - //! stack pointer, points to end of stack frame - void * sp; - -# if defined(__PIC__) && (defined(__MIPSEL__) || defined(__MIPS__)) - //! return address, points to instruction being executed within current frame - /*! Note that this is the address that is being returned to by the @e sub-function, - * @e not the address that this frame itself is returning to. - * When executing position independent code (PIC), this is the address relative - * to #gp. In other words, subtract this from #gp to get current memory address, - * or subtract from the binary's _gp symbol to get link-time address (for looking up file/line) */ - size_t ra; - - //! global offset used in position independent code (PIC) - /*! subtract #ra from this to get the actual run-time memory address of the instruction */ - size_t gp; - -# else - //! return address, points to instruction being executed within current frame - /*! Note that this is the address that is being returned to by the @e sub-function, - * @e not the address that this frame itself is returning to. */ - machineInstruction * ra; -# endif /* __PIC__ */ - -# ifdef DEBUG_STACKTRACE - //! if DEBUG_STACKTRACE is defined, this field is available which, if non-zero, will cause debugging info to be displayed on each unroll - int debug; -# endif -#endif - - //! points to the caller's stack frame (stack frame of function which called this one), may be NULL or self-referential at end of list - /*! a self-referential value indicates the frame is not the last on the stack, but is the last recorded. */ - struct StackFrame * caller; - -}; - - -//! stores information about the caller's stack frame into @a frame -void getCurrentStackFrame(struct StackFrame* frame); - -//! stores information about the caller to @a curFrame into @a nextFrame -/*! @return 0 if error occurred (i.e. bottom of the stack), non-zero upon success - * @a nextFrame @e can be the same instance as @a curFrame, will update in place. - * @a curFrame->caller will be set to @a nextFrame. */ -int unrollStackFrame(struct StackFrame* curFrame, struct StackFrame* nextFrame); - -//! frees a list of StackFrames, such as is returned by recordStackTrace -void freeStackTrace(struct StackFrame* frame); - -//! preallocates a stack trace of a particular size (doesn't actually perform a stack trace, merely allocates the linked list) -/*! this is a good idea if you want to do a stack trace within an exception handler, which might have been triggered by running out of heap */ -struct StackFrame* allocateStackTrace(unsigned int size); - -//! dumps stored stack trace to stderr -void displayStackTrace(const struct StackFrame* frame); - -#ifndef __cplusplus - -//! dumps current stack trace to stderr, up to @a limit depth and skipping the top @a skip frames -/*! pass -1U for limit to request unlimited trace, and 0 to start with the function calling recordStackTrace */ -void displayCurrentStackTrace(unsigned int limit, unsigned int skip); - -//! repeatedly calls unrollStackFrame() until the root frame is reached or @a limit is hit, skipping the top @a skip frames -/*! pass -1U for limit to request unlimited trace, and 0 to start with the function calling recordStackTrace */ -struct StackFrame * recordStackTrace(unsigned int limit, unsigned int skip); -//! repeatedly calls unrollStackFrame() until the root frame is reached or end of @a frame list is hit, skipping the top @a skip frames -/*! This is handy for reusing previously allocated frames, returns the unused portion (if return value equals @a frame, none were used -- implies never cleared @a skip) */ -struct StackFrame * recordOverStackTrace(struct StackFrame* frame, unsigned int skip); - -#else /* __cplusplus */ - -//! dumps current stack trace to stderr, up to @a limit depth and skipping the top @a skip frames -/*! pass -1U for limit to request unlimited trace, and 0 to start with the function calling recordStackTrace */ -void displayCurrentStackTrace(unsigned int limit=-1U, unsigned int skip=0); - -//! repeatedly calls unrollStackFrame() until the root frame is reached or @a limit is hit, skipping the top @a skip frames -/*! pass -1U for limit to request unlimited trace, and 0 to start with the function calling recordStackTrace */ -struct StackFrame * recordStackTrace(unsigned int limit=-1U, unsigned int skip=0); -//! repeatedly calls unrollStackFrame() until the root frame is reached or end of @a frame list is hit, skipping the top @a skip frames -/*! This is handy for reusing previously allocated frames, returns the unused portion (if return value equals @a frame, none were used -- implies never cleared @a skip) */ -struct StackFrame * recordOverStackTrace(struct StackFrame* frame, unsigned int skip=0); - -} -} - -#endif /* __cplusplus */ - -/*! @file - * @brief Describes functionality for performing stack traces - * @author ejt (Creator) - * - * $Author: ejtttje $ - * $Name: $ - * $Revision: 1.2 $ - * $State: Exp $ - * $Date: 2009/11/20 00:50:23 $ - */ -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/stl/functors.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/stl/functors.h deleted file mode 100644 index fb8c53da..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/stl/functors.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once -#ifndef functors_H_ -#define functors_H_ - -namespace stlx -{ - template - void delete_fntr(T *t) - { - if (t) - { - try - { - delete t; - t = 0; - } - catch(...) - { - } - } - } -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/stl/stlx.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/stl/stlx.h deleted file mode 100644 index 89ec3a9c..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/stl/stlx.h +++ /dev/null @@ -1,324 +0,0 @@ -#pragma once -#ifndef _stlx_H_ -#define _stlx_H_ - -#include - -namespace stlx { - -template -struct triple -{ - typedef Type1 first_type; - typedef Type2 second_type; - typedef Type3 third_type; - Type1 first; - Type2 second; - Type3 third; - triple(){} - triple(const Type1& __Val1, const Type2& __Val2,const Type3& __Val3) - :first(__Val1),second(__Val2),third(__Val3){} - template - triple(const triple& _Right) - :first(_Right.first),second(_Right.second),third(_Right.third){} -}; - -template - triple make_triple( - Type1 _Val1, - Type2 _Val2, - Type3 _Val3 - ) - { return triple(_Val1,_Val2,_Val3); } - -/// templates which allow STL iterations using a class and it's method -/// (as opposed to mem_fun which requires the container class to hold the -/// class and it's method -/// -/// ie -/// -/// vector a -/// B b; -/// for_each(a.begin(),a.end(),class_method_ref(b,B::foo)) -/// -/// this will invoke b.foo(a) for each element. - -template -class class_method_functor: public std::unary_function -{ - typedef Result (T::*methodType)(P s); - T *m_class; - methodType m_method; -public: - class_method_functor(T *c,methodType m):m_class(c),m_method(m){} - Result operator()(P s) { return (m_class->*m_method)(s); } -}; - -template -class class_method_functor_const: public std::unary_function -{ - typedef Result (T::*methodType)(P s) const; - const T *m_class; - methodType m_method; -public: - class_method_functor_const(const T *c,methodType m):m_class(c),m_method(m){} - Result operator()(P s) const { return (m_class->*m_method)(s); } -}; - -template -class class_method_ref_functor: public std::unary_function -{ - typedef Result (T::*methodType)(P s); - T &m_class; - methodType m_method; -public: - class_method_ref_functor(T &c,methodType m):m_class(c),m_method(m){} - Result operator()(P s) { return (m_class.*m_method)(s); } -}; - -template -class class_method_ref_functor_const: public std::unary_function -{ - typedef Result (T::*methodType)(P s) const; - const T &m_class; - methodType m_method; -public: - class_method_ref_functor_const(const T &c,methodType m):m_class(c),m_method(m){} - Result operator()(P s) const { return (m_class.*m_method)(s); } -}; - -template -class class_method_functor1: public std::binary_function -{ - typedef Result (T::*methodType)(P s,PP ss); - T *m_class; - methodType m_method; -public: - class_method_functor1(T *c,methodType m):m_class(c),m_method(m){} - Result operator()(P s,PP ss) { return (m_class->*m_method)(s,ss); } -}; - -template -class class_method_functor1_const: public std::binary_function -{ - typedef Result (T::*methodType)(P s,PP ss) const; - const T *m_class; - methodType m_method; -public: - class_method_functor1_const(const T *c,methodType m):m_class(c),m_method(m){} - Result operator()(P s,PP ss) const { return (m_class->*m_method)(s,ss); } -}; - -template -class class_method_ref_functor1: public std::binary_function -{ - typedef Result (T::*methodType)(P s,PP ss); - T &m_class; - methodType m_method; -public: - class_method_ref_functor1(T &c,methodType m):m_class(c),m_method(m){} - Result operator()(P s,PP ss) { return (m_class.*m_method)(s,ss); } -}; - -template -class class_method_ref_functor1_const: public std::binary_function -{ - typedef Result (T::*methodType)(P s,PP ss) const; - const T &m_class; - methodType m_method; -public: - class_method_ref_functor1_const(const T &c,methodType m):m_class(c),m_method(m){} - Result operator()(P s,PP ss) const { return (m_class.*m_method)(s,ss); } -}; - -template - class_method_functor - class_method(T *c,Result (T::*m)(P s)) - { return class_method_functor(c,m); } - -template - class_method_functor_const - class_method(const T *c,Result (T::*m)(P s) const) - { return class_method_functor_const(c,m); } - -template - class_method_ref_functor - class_method_ref(T &c,Result (T::*m)(P s)) - { return class_method_ref_functor(c,m); } - -template - class_method_ref_functor_const - class_method_ref(const T &c,Result (T::*m)(P s) const) - { return class_method_ref_functor_const(c,m); } - -template - class_method_functor1 - class_method(T *c,Result (T::*m)(P s,PP ss)) - { return class_method_functor1(c,m); } - -template - class_method_functor1_const - class_method(const T *c,Result (T::*m)(P s,PP ss) const) - { return class_method_functor1_const(c,m); } - -template - class_method_ref_functor1 - class_method_ref(T &c,Result (T::*m)(P s,PP ss)) - { return class_method_ref_functor1(c,m); } - -template - class_method_ref_functor1_const - class_method_ref(const T &c,Result (T::*m)(P s,PP ss) const) - { return class_method_ref_functor1_const(c,m); } - -/////////////////////////////////////////////////////////// -/* - Allows search matches on members - - class foo - { - string m_memberToMatchOn; - }; - - vector myList; - find_if(myList.begin(),m_myList.end(), - member_match(string("hello"),&foo::m_memberToMatchOn)); - -*/ -//////////////////////////////////////////////////////////// -template -class member_match_functor -{ -private: - T m_value; - T (OBJ::*m_member); -public: - member_match_functor(const T &s,T OBJ::*m):m_value(s),m_member(m){} - bool operator()(const OBJ &obj) throw() - { - return m_value == (obj.*m_member); - } -}; - -template - member_match_functor member_match(const T &s,T OBJ::* m) - { return member_match_functor(s,m); } - -template -class member2_match_functor -{ -private: - T1 m_value1; - T1 (OBJ::*m_member1); - T2 m_value2; - T2 (OBJ::*m_member2); -public: - member2_match_functor(const T1 &s1,T1 OBJ::*m1,const T2 &s2,T2 OBJ::*m2):m_value1(s1),m_member1(m1),m_value2(s2),m_member2(m2){} - bool operator()(const OBJ &obj) throw() - { return ((m_value1 == (obj.*m_member1)) && (m_value2 == (obj.*m_member2))); } -}; - -template - member2_match_functor member2_match(const T1 &s1,T1 OBJ::* m1,const T2 &s2,T2 OBJ::* m2) - { return member2_match_functor(s1,m1,s2,m2); } - -//*********************************************************** -//* accumulate with a delimiter -//* -//*********************************************************** -template inline _Ty accumulate_with_delimiter(_InIt _First, _InIt _Last, _Ty _Val, _Tdel _del) -{ // return sum of _Val and all in [_First, _Last) - if (_First != _Last) - { - _Val = _Val + *_First; - ++_First; - } - - for (; _First != _Last; ++_First) - { - _Val = _Val + _del + *_First; - } - return (_Val); -} - -// with binop. Not sure if this one makes much sense -template inline _Ty accumulate_with_delimiter(_InIt _First, _InIt _Last, _Ty _Val, _Tdel _del,_Fn2 _Func) -{ // return sum of _Val and all in [_First, _Last), using _Func - if (_First != _Last) - { - _Val = _Func(_Val, *_First); - ++_First; - } - - for (; _First != _Last; ++_First) - { - _Val = _Val + _del; - _Val = _Func(_Val, *_First); - } - return (_Val); -} - -//********************************************************** -//* streamOutFunctor -//* -//* functor class which will output an element to a stream -//* with a prefix and suffix string. Useful for outputing -//* elements of a container -//********************************************************* -template class streamOutFunctor -{ - std::ostream &m_o; - const std::string m_prefix; - const std::string m_suffix; -public: - inline streamOutFunctor(std::ostream &o) : m_o(o){} - inline streamOutFunctor(std::ostream &o,const std::string &prefix,const std::string &suffix) - : m_o(o),m_prefix(prefix),m_suffix(suffix){} - inline void operator()(const T &t) { m_o << m_prefix << t << m_suffix; } -}; - -//// for use on maps. Sort of the opposite of lower_bound. Returns the largest element -//// less than the key -template typename Map::const_iterator -greatest_less(Map const& m, typename Map::key_type const& k) { - typename Map::const_iterator it = m.lower_bound(k); - if(it != m.begin()) { - return --it; - } - return m.end(); -} - -template typename Map::iterator -greatest_less(Map & m, typename Map::key_type const& k) { - typename Map::iterator it = m.lower_bound(k); - if(it != m.begin()) { - return --it; - } - return m.end(); -} - -template typename Map::const_iterator -greatest_less_or_equal(Map const& m, typename Map::key_type const& k) { - typename Map::const_iterator it = m.lower_bound(k); - if ((it != m.end()) && ((*it).first == k)) - return it; - if(it != m.begin()) { - return --it; - } - return m.end(); -} - -template typename Map::iterator -greatest_less_or_equal(Map & m, typename Map::key_type const& k) { - typename Map::iterator it = m.lower_bound(k); - if ((it != m.end()) && ((*it).first == k)) - return it; - if(it != m.begin()) { - return --it; - } - return m.end(); -} - -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/stl/stringUtils.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/stl/stringUtils.h deleted file mode 100644 index 647fc242..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/stl/stringUtils.h +++ /dev/null @@ -1,383 +0,0 @@ -#pragma once -#ifndef _stringUtils_H_ -#define _stringUtils_H_ - -#include -#include -#include -#include -#include -#include - -namespace stringUtil -{ - #ifdef _WIN32 - inline std::string eol() throw() { return "\r\n"; } - #elif MACINTOSH - inline std::string eol() throw() { return "\r"; } - #else - inline std::string eol() throw() { return "\n"; } - #endif - - ////////////////////////////////////////////////////////////////// - //////////////////// String Conversion /////////////////////////// - ////////////////////////////////////////////////////////////////// - - // the 'safe' functions are to avoid bad_cast exceptions when the - // passed in type does not have a facet, or the facet indicates that - // the value is out of range. Since I may be running this against Unicode - // strings, I need to deal with this. Most likely there's a way to set the - // proper locale and facet so the error doesn't occur, but this is beyond - // me right now - NMR - template - bool safe_is_alpha(T v) - { - if (((unsigned int)v) > 0x7f) return false; - return std::isalpha((char)v,std::locale()); - } - - template - bool safe_is_digit(T v) - { - if (((unsigned int)v) > 0x7f) return false; - return std::isdigit((char)v,std::locale()); - } - - template - bool safe_is_space(T v) - { - if (((unsigned int)v) > 0x7f) return false; - return std::isspace((char)v,std::locale()); - } - - template - T safe_to_lower(T v) - { - if (((unsigned int)v) > 0x7f) return v; - return std::tolower((char)v,std::locale()); - } - - template - T safe_to_upper(T v) - { - if (((unsigned int)v) > 0x7f) return v; - return std::toupper((char)v,std::locale()); - } - - template - S toLower(const S &s) throw() - { - S result; - for (typename S::const_iterator i = s.begin(); i != s.end(); ++i) - { - result += (stringUtil::safe_is_alpha(*i) ? stringUtil::safe_to_lower(*i) : *i); - } - - return result; - } - - template - S toUpper(const S &s) throw() - { - S result; - for (typename S::const_iterator i = s.begin(); i != s.end(); ++i) - { - result += (stringUtil::safe_is_alpha(*i) ? stringUtil::safe_to_upper(*i) : *i); - } - - return result; - } - - template - inline bool compareStringsWithoutCase(const S &s1,const S &s2) throw() - { - S s1c(toLower(s1)); - S s2c(toLower(s2)); - return (s1c == s2c); - } - - inline std::string dosToUnix(const std::string &s) throw() - { - std::string result; - bool r(false); - for (std::string::const_iterator i = s.begin(); i != s.end(); ++i) - { - if ((*i) == '\n') - { - if (r) - { - result += '\n'; - } - else - { - result.push_back(*i); - } - r = false; - } - else if ((*i) == '\r') - { - if (r) - result.push_back('\r'); - r = true; - } - else - { - if (r) - result.push_back('\r'); - r = false; - result.push_back(*i); - } - } - return result; - } - - inline std::string unixToDos(const std::string &s) throw() - { - std::string result; - for (std::string::const_iterator i = s.begin(); i != s.end(); ++i) - { - if ((*i) == '\n') - result += "\r\n"; - else - result.push_back(*i); - } - return result; - } - - //*************************************************************** - //* tos, tows - //* - //* These templates and overloaded functions allow you to convert - //* any streamable value to a string or wide-string. It can be a - //* great convenience to be able to do - //* - //* string("test five ") + tos(5); - //* - //* instead of - //* - //* ostringstream o; - //* o << "test five " << 5; - //* o.str() - //* - //* tows is just like tos, but for wide strings. You can also use these - //* to convert standard strings to wide strings and vice-versa - //* - //* for example: - //* - //* wstring ws = tows(string("hello")); - //* string s = tos(wstring(L"goodbye")); - //* - //************************************************************************ - - template - S tobs(T v) // to basic string - { - std::basic_ostringstream o; - o << v; - return o.str(); - } - - template - S tobs(const S v) { return v; } - template - S tobs(const typename S::value_type *v) { return S(v); } - - template - std::string tos(t v) - { - std::ostringstream o; - o << v; - return o.str(); - } - - inline std::string tos(const std::string &v) { return v; } - inline std::string tos(const char *v) { return std::string(v); } - - template - std::string tohex(t v) - { - std::ostringstream o; - o << std::hex << v; - return o.str(); - } - - #ifdef _WIN32 - template - std::wstring tows(t v) - { - std::wostringstream o; - o << v; - return o.str(); - } - - inline std::string tos(const wchar_t *value) - { - if (!value) return ""; - - size_t len = ::wcslen(value); - - char *s = new char[len + 1]; - ::wcstombs(s,value,len); - s[len] = '\0'; - std::string result(s); - delete [] s; - - return result; - } - - inline std::string tos(const std::wstring &s) - { - return tos(s.c_str()); - } - - inline std::wstring tows(const char *value) - { - if (!value) return L""; - - size_t len = ::strlen(value); - - wchar_t *s = new wchar_t[len + 1]; - ::mbstowcs(s,value,len); - s[len] = 0; - std::wstring result(s); - delete [] s; - - return result; - } - - inline std::wstring tows(const std::string &value) - { - return tows(value.c_str()); - } - #endif - - //////////////////////////////////////////////////////////////////// - ////////////////////// String stripping //////////////////////////// - //////////////////////////////////////////////////////////////////// - - //****************************************************************** - //* A collection of templates and functions to allow stripping of - //* leading and trailing items from a string - //* - //* --- stripItem - //* - //* Strip leading and trailing items from a container - //* template parameters are the container type, and a function which returns - //* true if we have the value to strip - //* - //* - //* ---- stripChar - //* strips characters off a string by either a function (which returns - //* true if the character is found), or by an actual character mathc. - //* There are also forms for wide strings - //* - //* ---- stripWhitespace - //* removes leading and trailing spaces from a string using isspace() - //************************************************************************* - template - S stripItem(const S &s,F func,bool stripLeading = true, bool stripTrailing = true) - { - typename S::const_iterator leftit = s.begin(); - typename S::const_reverse_iterator rightit = s.rbegin(); - - if (s.length() < 1 ) - return s; - - if (stripLeading) - { - while (leftit != s.end() && func(*leftit)) - { - ++leftit; - } - } - if (leftit == s.end()) return S(); - - if (stripTrailing) - { - while (rightit != s.rend() && func(*rightit)) - { - ++rightit; - } - } - if (rightit == s.rend()) return S(); - - typename S::const_iterator endpnt = (++rightit).base(); - - if (leftit > endpnt) - return S(); - - return s.substr( (leftit - s.begin()) ,(endpnt-leftit) +1); - } - - template - S stripChar(const S &s,FUNC f,bool stripLeading = true,bool stripTrailing = true) - { return stripItem(s,f,stripLeading,stripTrailing); } - - template - inline S stripChar(const S &s,typename S::value_type c,bool stripLeading = true,bool stripTrailing = true) - { return stripItem(s,bind1st(std::equal_to(),c),stripLeading,stripTrailing); } - - template - bool myspace(S c) { return safe_is_space(c); } - template - inline S stripWhitespace(const S &s) { return stripChar(s,stringUtil::myspace); } - - template - bool myalphadigit(S c) { return !(safe_is_alpha(c) || safe_is_digit(c)); } - template - inline S stripAlphaDigit(const S &s) { return stripChar(s,stringUtil::myalphadigit); } - - //***************************************************************** - //* tokenizer - //* - //* break up a string into substrings based on a delimiter item. - //****************************************************************** - template - std::vector tokenizer_if(const S &ins,F isdelimiter) throw() - { - std::vector result; - S accum; - - for (typename S::const_iterator i = ins.begin(); i != ins.end(); ++i) - { - if (!isdelimiter(*i)) - { - accum.push_back(*i);// was += - } - else - { - if (!accum.empty()) - { - result.push_back(accum); - accum = S(); - } - } - } - - if (!accum.empty()) - { - result.push_back(accum); - } - return result; - } - - template - inline std::vector tokenizer(const S &ins,typename S::value_type delim) throw() - { return tokenizer_if(ins,bind1st(std::equal_to(),delim)); } - - inline std::string escapeBackslashes(const std::string &s) throw() - { - std::string result; - for (std::string::const_iterator i = s.begin(); i != s.end(); ++i) - { - result += (*i); - if ((*i) == '\\') - result += (*i); - } - return result; - } - - ////////////////////////////////////////////////////////////////////////// -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/threading/MT_stl.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/threading/MT_stl.h deleted file mode 100644 index 7b4de1bf..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/threading/MT_stl.h +++ /dev/null @@ -1,110 +0,0 @@ -#pragma once -#ifndef MT_stl_H_ -#define MT_stl_H_ - -#include -#include "thread.h" - -/***** STL like containers that have Multithread features *******/ - -template -class MT_queue -{ - std::queue m_container; - mutable AOL_namespace::mutex m_mutex; - conditionVariable m_conditionVariable; - -public: - typedef T value_type; - typedef T message_t; - typedef typename std::queue::size_type size_type; - - MT_queue(){} - - size_type size() const - { - stackLock sl(m_mutex); - return m_container.size(); - } - - bool empty() const - { - stackLock sl(m_mutex); - return m_container.empty(); - } - - // note, it is important that this is T and not T&. If it was - // T& and we did something like this - // - // T &f = mtq.front(); - // - // Then f would be able to manipulate a queue entry outside the - // protection of the lock. We avoid this by returning T (a copy) - // instead. - T front() const - { - stackLock sl(m_mutex); - return m_container.front(); - } - - void has_front(T &t,bool &has) const - { - stackLock sl(m_mutex); - has = false; - if (!m_container.empty()) - { - has = true; - t = m_container.front(); - } - } - - void push(const T &t) // push_back - { - stackLock sl(m_mutex); - m_container.push(t); - m_conditionVariable.signal(); - } - - void pop() // pop_front - { - stackLock sl(m_mutex); - if (!m_container.empty()) - { - m_container.pop(); - } - } - - std::queue getAll() - { - stackLock sl(m_mutex); - - std::queue result = m_container; - m_container.clear(); - return result; - } - - void clear() - { - stackLock sl(m_mutex); - m_container.clear(); - } - - // blocking retrieval. Will block until something is in the - // queue to get - T get() - { - stackLock sl(m_mutex); - - while (m_container.empty()) - { - m_conditionVariable.wait(m_mutex); - } - - T t = m_container.front(); - m_container.pop(); - - return t; - } -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/threading/messageThread.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/threading/messageThread.h deleted file mode 100644 index 8b47bf09..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/threading/messageThread.h +++ /dev/null @@ -1,184 +0,0 @@ -#ifndef messageThread_H_ -#define messageThread_H_ - -#include "thread.h" -#include "MT_stl.h" -#include -#ifdef _WIN32 -#include -#else -#include -#endif - -#ifndef _WIN32 -#define _ASSERTE assert -#endif - -///////////////////////////////////////////////////////////////// -//* templates that allow you to build a message driven thread -//* -//* -//* define a class that is your handler. It must have a type -//* message_t which is the message type, and a method -//* bool operator()(const message_t &m) which is the message handler. -//* this method should return false when all processing is done and -//* the thread should shutdown -//* -/* example - -class mh -{ - string m_string; - -public: - struct message - { - int m_v; - message(int v):m_v(v){} - }; - typedef message message_t; - -protected: - - bool operator()(const message_t &mm) - { - if (!mm.m_v) return false; // if value is zero, then we are done - ::MessageBox(0,tos(mm.m_v).c_str(),m_string.c_str(),MB_OK); - return true; - } - - mh(const string &s):m_string(s){} -}; - -main() -{ -messageThread m("this is a test"); -m.start(); -m.postMessage(m::message(1)); -m.postMessage(m::message(2)); -m.postMessage(m::message(3)); -m.postMessage(m::message(4)); -m.postMessage(m::message(0)); -m.join(); -} - -*/ - -template -class messageHandler: public Handler -{ -private: - Queue m_queue; - -protected: - unsigned operator()() throw() - { - unsigned result = (unsigned)-1; - try - { - while (true) - { - typename Queue::value_type m = m_queue.get(); - if (!Handler::operator()(m)) - break; - } - result = 0; - } - catch(...){} - - return result; - } -public: - inline void postMessage(const typename Queue::message_t &m) - { - m_queue.push(m); - } - - inline typename Queue::size_type pendingMessages() const throw() { return m_queue.size(); } - inline void clearMessageQueue() throw() { m_queue.clear(); } - - messageHandler(){} - template messageHandler(const P1 &p1):Handler(p1){} - template messageHandler(const P1 &p1,const P2 &p2):Handler(p1,p2){} - template messageHandler(const P1 &p1,const P2 &p2,const P3 &p3):Handler(p1,p2,p3){} - template messageHandler(const P1 &p1,const P2 &p2,const P3 &p3,const P4 &p4):Handler(p1,p2,p3,p4){} - template messageHandler(const P1 &p1,const P2 &p2,const P3 &p3,const P4 &p4,const P5 &p5):Handler(p1,p2,p3,p4,p5){} - template messageHandler(const P1 &p1,const P2 &p2,const P3 &p3,const P4 &p4,const P5 &p5,const P6 &p6):Handler(p1,p2,p3,p4,p5,p6){} - template messageHandler(const P1 &p1,const P2 &p2,const P3 &p3,const P4 &p4,const P5 &p5,const P6 &p6,const P7 &p7):Handler(p1,p2,p3,p4,p5,p6,p7){} - template messageHandler(P1 &p1):Handler(p1){} -}; - -template -class messageThread: public Tthread > > -{ -public: - messageThread(){} - template messageThread(const P1 &p1):Tthread > >(p1){} - template messageThread(const P1 &p1,const P2 &p2):Tthread > >(p1,p2){} - template messageThread(const P1 &p1,const P2 &p2,const P3 &p3):Tthread > >(p1,p2,p3){} - template messageThread(const P1 &p1,const P2 &p2,const P3 &p3,const P4 &p4):Tthread > >(p1,p2,p3,p4){} - template messageThread(const P1 &p1,const P2 &p2,const P3 &p3,const P4 &p4,const P5 &p5):Tthread > >(p1,p2,p3,p4,p5){} - template messageThread(const P1 &p1,const P2 &p2,const P3 &p3,const P4 &p4,const P5 &p5,const P6 &p6):Tthread > >(p1,p2,p3,p4,p5,p6){} - template messageThread(const P1 &p1,const P2 &p2,const P3 &p3,const P4 &p4,const P5 &p5,const P6 &p6,const P7 &p7):Tthread > >(p1,p2,p3,p4,p5,p6,p7){} - template messageThread(P1 &p1):Tthread > >(p1){} -}; - -//////////////// Finite state machine -template -class fsm: public Handler { - -public: - typedef RETVAL (Handler::*state)(const typename Handler::message_t &m);// throw(); // should not throw an exception - - // this is broken in VC 7, so trans must be made public - //friend class Handler; -public: - RETVAL operator()(const typename Handler::message_t &m) throw() { _ASSERTE(m_State);return (this->*m_State)(m); } - - void trans(state target) throw() - { - if (target == m_State) return; - _ASSERTE(m_State); -#ifndef NDEBUG - state tmp = m_State; -#endif - (this->*m_State)(Handler::message_t::exitStateMessage()); -#ifndef NDEBUG - // sanity check - don't change states in exit_sig - _ASSERTE(tmp == m_State); -#endif - m_State = target; - (this->*m_State)(Handler::message_t::enterStateMessage()); - _ASSERTE(m_State == target); // don't change states in enter_sig - } -public: - - fsm():m_State(&fsm::initialState){} - template fsm(const P1 &p1): - Handler(p1),m_State(&fsm::initialState){} - template fsm(P1 &p1): - Handler(p1),m_State(&fsm::initialState){} - - template fsm(const P1 &p1,const P2 &p2): - Handler(p1,p2),m_State(&fsm::initialState){} - template fsm(const P1 &p1,P2 &p2): - Handler(p1,p2),m_State(&fsm::initialState){} - template fsm(P1 &p1,P2 &p2): - Handler(p1,p2),m_State(&fsm::initialState){} - - template fsm(const P1 &p1,const P2 &p2,const P3 &p3): - Handler(p1,p2,p3),m_State(&fsm::initialState){} - template fsm(const P1 &p1,const P2 &p2,const P3 &p3,const P4 &p4): - Handler(p1,p2,p3,p4),m_State(&fsm::initialState){} - template fsm(const P1 &p1,const P2 &p2,const P3 &p3,const P4 &p4,const P5 &p5): - Handler(p1,p2,p3,p4,p5),m_State(&fsm::initialState){} - template fsm(const P1 &p1,const P2 &p2,const P3 &p3,const P4 &p4,const P5 &p5,const P6 &p6): - Handler(p1,p2,p3,p4,p5,p6),m_State(&fsm::initialState){} - template fsm(const P1 &p1,const P2 &p2,const P3 &p3,const P4 &p4,const P5 &p5,const P6 &p6,const P7 &p7): - Handler(p1,p2,p3,p4,p5,p6,p7),m_State(&fsm::initialState){} - -private: - state m_State; -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/threading/thread.cpp b/Src/Plugins/DSP/sc_serv3/nmrCommon/threading/thread.cpp deleted file mode 100644 index 3100453a..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/threading/thread.cpp +++ /dev/null @@ -1,375 +0,0 @@ -#include "threading/thread.h" -#ifndef _WIN32 -#include -#include "global.h" -#else -#include -#endif - -using namespace std; - -// thread safe sleep function -// which is clamped to 10 ms. -void safe_sleep(int sec, int usec) -{ -#ifdef _WIN32 - int ms = (usec / 1000); - ms += (sec * 1000); - if (ms < 10) ms = 10; - ::Sleep(ms); -#else - struct timeval mytime; - if (!sec && (usec < 10000)) usec = 10000; - mytime.tv_sec = sec; - mytime.tv_usec = usec; - select(0, NULL, NULL, NULL, &mytime); -#endif -} - -#ifndef _WIN32 -#include -#include -#endif - -using namespace AOL_namespace; - -rwLock::rwLock() -{ -#ifdef PTHREAD_RWLOCK_PREFER_WRITER_NP - pthread_rwlockattr_t attr; - ::pthread_rwlockattr_init (&attr); - ::pthread_rwlockattr_setkind_np (&attr, PTHREAD_RWLOCK_PREFER_WRITER_NP); - int r = ::pthread_rwlock_init (&m_lock, &attr); - ::pthread_rwlockattr_destroy (&attr); -#else - int r = ::pthread_rwlock_init (&m_lock, NULL); -#endif - if (r) - throw runtime_error("Could not create rwlock"); -} - -rwLock::~rwLock() -{ - ::pthread_rwlock_destroy (&m_lock); -} - -void rwLock::lock() -{ - ::pthread_rwlock_wrlock (&m_lock); -} - -void rwLock::rdLock() -{ - ::pthread_rwlock_rdlock (&m_lock); -} - -bool rwLock::tryRdLock() -{ - int n = ::pthread_rwlock_tryrdlock (&m_lock); - if (n == 0) - return true; - if (n != EBUSY) - throw runtime_error("Error with trying rwlock, " + n); - return false; -} - -void rwLock::unlock() -{ - ::pthread_rwlock_unlock (&m_lock); -} - - -mutex::mutex() throw(runtime_error) -{ - if (::pthread_mutex_init(&m_mutex, NULL)) - { - throw runtime_error("Could not create mutex"); - } -} - -mutex::~mutex() throw() -{ - ::pthread_mutex_destroy(&m_mutex); -#ifdef _WIN32 - m_mutex = NULL; -#endif -} - -void mutex::lock() throw(runtime_error) -{ - if (::pthread_mutex_lock(&m_mutex)) - { - throw runtime_error("Could not lock mutex"); - } -} - -bool mutex::timedLock(int milliseconds) throw(runtime_error) -{ - if (milliseconds == INFINITE) - { - lock(); - return true; - } - - if (milliseconds == 0) - { - int err = ::pthread_mutex_trylock(&m_mutex); - if (err == EBUSY) - { - return false; - } - if (err) - { - throw runtime_error("Could not trylock mutex"); - } - return true; - } - - int tenth_second_sleep_intervals = (milliseconds / 100); - for (int x = 0; x < tenth_second_sleep_intervals; ++x) - { - int err = ::pthread_mutex_trylock(&m_mutex); - if (!err) - { - return true; - } - safe_sleep(0, 100000); - if (err == EBUSY) - { - continue; - } - throw runtime_error("Could not trylock mutex"); - } - return false; -} - -void mutex::unlock() throw(runtime_error) -{ - if (::pthread_mutex_unlock(&m_mutex)) - { - throw runtime_error("Could not unlock mutex"); - } -} - -conditionVariable::conditionVariable() throw(runtime_error) -{ - if (::pthread_cond_init(&m_conditionVariable,NULL)) - { - throw runtime_error("Could not create conditionVariable"); - } -} - -conditionVariable::~conditionVariable() throw() -{ - ::pthread_cond_destroy(&m_conditionVariable); -} - -void conditionVariable::wait(mutex &m) throw(runtime_error) -{ - if (::pthread_cond_wait(&m_conditionVariable,&m.m_mutex)) - { - throw runtime_error("Could not wait on condition variable"); - } -} - -bool conditionVariable::timedWait(AOL_namespace::mutex &m,int milliseconds) throw(runtime_error) -{ - struct timespec ts; - ts.tv_sec = ::time(NULL) + (milliseconds / 1000); - ts.tv_nsec = (milliseconds - ((milliseconds / 1000) * 1000)) * 1000000; - int err = ::pthread_cond_timedwait(&m_conditionVariable,&m.m_mutex,&ts); - if (!err) - { - return true; - } - if (err == ETIMEDOUT) - { - return false; - } - throw runtime_error("timedWait error"); -} - -void conditionVariable::signal() throw(runtime_error) -{ - if (::pthread_cond_signal(&m_conditionVariable)) - { - throw runtime_error("Could not signal condition variable"); - } -} - -void conditionVariable::broadcast() throw(runtime_error) -{ - if (::pthread_cond_broadcast(&m_conditionVariable)) - { - throw runtime_error("Could not broadcast on condition variable"); - } -} - -#ifdef _WIN32 -event::event(BOOL bManualReset) throw(runtime_error) : m_event(NULL) -{ - m_event = ::CreateEvent(NULL,bManualReset,FALSE,NULL); - if (!m_event) - { - throw runtime_error("Could not create event object"); - } -} - -event::~event() throw() -{ - forgetHandleNULL(m_event); -} - -void event::wait() throw(std::runtime_error) -{ - if (::WaitForSingleObject(m_event,INFINITE) != WAIT_OBJECT_0) - { - throw runtime_error("event::wait() - wait error"); - } -} - -void event::setEvent() throw(std::runtime_error) -{ - if (!::SetEvent(m_event)) - { - throw runtime_error("event::setEvent() - set error"); - } -} - -void event::resetEvent() throw(std::runtime_error) -{ - if (!::ResetEvent(m_event)) - { - throw runtime_error("event::resetEvent() - reset error"); - } -} -#else -event::event(bool manualReset) throw(runtime_error) - : m_manualReset(manualReset), m_signaled(false) -{ -} - -void event::wait() throw(runtime_error) -{ - stackLock sl(m_mutex); - while (!m_signaled) - { - m_conditionVariable.wait(m_mutex); - } - if (!m_manualReset) - { - m_signaled = false; - } -} - -bool event::timedWait(int milliseconds) throw(runtime_error) -{ - if (milliseconds == INFINITE) - { - wait(); - return true; - } - - if (milliseconds == 0) - { - stackLock sl(m_mutex); - bool result = m_signaled; - if (m_signaled && !m_manualReset) - { - m_signaled = false; - } - return result; - } - - stackLock sl(m_mutex); - while(!m_signaled) - { - if (!m_conditionVariable.timedWait(m_mutex,milliseconds)) - { - return false; - } - } - - if (!m_manualReset) - { - m_signaled = false; - } - return true; -} - -void event::setEvent() throw(runtime_error) -{ - stackLock sl(m_mutex); - m_signaled = true; - m_conditionVariable.broadcast(); -} - -void event::resetEvent() throw(runtime_error) -{ - stackLock sl(m_mutex); - m_signaled = false; -} - -int WaitForSingleObject(Win32SyncObject &o, int milli_timeout) throw() -{ - int result = WAIT_ABANDONED; - - try - { - result = (o.syncObjectTimedWait(milli_timeout) ? WAIT_OBJECT_0 : WAIT_TIMEOUT); - } - catch(...) {} - - return result; -} - -int WaitForMultipleObjects(int count, Win32SyncObjectPtr *objs, bool waitall, int milliseconds) throw() -{ - __uint64 start = time_now_ms(); - - try - { - std::vector signaled(count,false); - int sig_count = 0/*, ms = (milliseconds % 1000)*/, - quantum = 100;/*(ms > 100 ? (ms / 10) : 100);*/ - - // as milliseconds is only set as '1000' in main.cpp - // then we don't need to do the checking and can just - // hard-code the quantum value to give 100ms interval - - for (int x = 0; (x <= milliseconds) || (milliseconds == INFINITE); x += quantum) - { - for (int oo = 0; oo < count; ++oo) - { - if (!signaled[oo]) - { - if (objs[oo]->syncObjectTimedWait(0)) - { - signaled[oo] = true; - ++sig_count; - if (!waitall) - { - return WAIT_OBJECT_0 + oo; - } - if (sig_count == count) - { - return WAIT_OBJECT_0; - } - } - } - } //for - - safe_sleep(0, quantum * 1000); - - __uint64 now = time_now_ms(); - if ((int)(now - start) >= milliseconds) - { - break; - } - } // for - return WAIT_TIMEOUT; - } //try - catch(...) {} - return WAIT_ABANDONED; -} -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/threading/thread.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/threading/thread.h deleted file mode 100644 index 05fd8033..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/threading/thread.h +++ /dev/null @@ -1,575 +0,0 @@ -#pragma once -#ifndef _THREAD_H_ -#define _THREAD_H_ - -#ifdef _WIN32 -#include -#include -#include -#else -#include -#include -#include -#include -#include -#include -#endif -#include -#include "macros.h" - -/////////////////////////////////////////////////////////////////////////////// -/// Various thread classes for applications that need to do threading and -/// aren't going to be including various Microsoft class libraries -////////////////////////////////////////////////////////////////////////////// - - -//******************************************************************** -//* Tthread and thread -//* -//* allows you to run code on a thread via a template. Create a class -//* which has a method const unsigned operator()() and use it to instantiate -//* the template. If you want to use a bare function, encapsulate it in the -//* class pointer_to_thread_function. The Vthread class uses the traditional -//* virtual function approach -/* - Example: - - class foo - { - const unsigned operator()() - { - for (int x = 0; x < 4: ++x) - { - cout << x << endl; - } - return 1; - } - }; - - unsigned bar() - { - for (int x = 0; x < 4; ++x) - cout << x << endl; - return 1; - } - - class narf: public Vthread - { - const unsigned operator()() - { - for (int x = 0; x < 4; ++x) - { - cout << x << endl; - } - return 1; - } - }; - - main() - { - Tthread f; - Tthread b(bar); - narf n; - n.start(); - f.start(); - b.start(); - ::WaitForSingleObject(f,INFINITE); // or f.join(); - ::WaitForSingleObject(b,INFINITE); // or b.join(); - ::WaitForSingleObject(n,INFINITE); // or n.join(); - } - -*/ - -//********************************************************************** - -#ifdef _WIN32 -#ifndef ASSERT -#define ASSERT(x) { if (!(x)) ::MessageBoxW(0,L"Assert failure",L"ASSERT",MB_OK); } -#endif -#else -#ifndef ASSERT -#define ASSERT(x) assert(x) -#endif -#endif - -#ifdef _WIN32 -#define THREAD_FUNC unsigned __stdcall -#else -#define THREAD_FUNC void* -#endif - -#ifdef _WIN32 -class thread_CORE -{ -#pragma warning(push) -#pragma warning(disable: 4127) -#pragma warning(disable: 4100) - nocopy(thread_CORE) -#pragma warning(pop) - -protected: - HANDLE m_threadHandle; - -public: - static int standard_signal_block() throw(){return 0;} // unix only - - thread_CORE() : m_threadHandle(0) {} - - ~thread_CORE() throw() - { - if (m_threadHandle) - { - ::WaitForSingleObject(m_threadHandle, INFINITE); - ::CloseHandle(m_threadHandle); - } - m_threadHandle = 0; - } - - inline void join() - { - if (m_threadHandle) - { - ::WaitForSingleObject(m_threadHandle, INFINITE); - } - } - inline operator HANDLE() const throw() { return m_threadHandle; } - static unsigned long getCurrentThreadID() { return (unsigned long)GetCurrentThreadId(); } -}; - -template -class Tthread: public thread_CORE, public Handler -{ - static inline unsigned __stdcall _start_func(void *arg) - { return reinterpret_cast *>(arg)->operator()(); } - -public: - Tthread(){} - template Tthread( P1 &p1):Handler(p1){} - template Tthread( P1 &p1, P2 &p2):Handler(p1,p2){} - template Tthread( P1 &p1, P2 &p2, P3 &p3):Handler(p1,p2,p3){} - template Tthread( P1 &p1, P2 &p2, P3 &p3, P4 &p4):Handler(p1,p2,p3,p4){} - template Tthread( P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5):Handler(p1,p2,p3,p4,p5){} - template Tthread( P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5,P6 &p6):Handler(p1,p2,p3,p4,p5,p6){} - template Tthread( P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5, P6 &p6,P7 &p7):Handler(p1,p2,p3,p4,p5,p6,p7){} - template Tthread( P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5, P6 &p6, P7 &p7,P8 &p8):Handler(p1,p2,p3,p4,p5,p6,p7,p8){} - template Tthread( P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5, P6 &p6, P7 &p7, P8 &p8, P9 &p9):Handler(p1,p2,p3,p4,p5,p6,p7,p8,p9){} - template Tthread(P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5, P6 &p6, P7 &p7, P8 &p8, P9 &p9, P10 &p10):Handler(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10){} - template Tthread(P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5, P6 &p6, P7 &p7, P8 &p8, P9 &p9, P10 &p10,P11 &p11):Handler(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11){} - template Tthread(P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5, P6 &p6, P7 &p7, P8 &p8, P9 &p9, P10 &p10,P11 &p11,P12 &p12):Handler(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12){} - - void start(int __unused = 1) throw(std::runtime_error) - { - unsigned m_threadIdentifier = 0; - m_threadHandle = (HANDLE)::_beginthreadex(NULL, 0, _start_func, this, 0, &m_threadIdentifier); - if (!m_threadHandle) - { - throw std::runtime_error("Could not start thread"); - } - } -}; - -class SimpleThread -{ -protected: - HANDLE m_threadHandle; - -public: - SimpleThread(unsigned (__stdcall *_start_func) (void *arg) = 0, void *user = 0) : m_threadHandle(0) - { - if (_start_func) - { - start(_start_func, user); - } - } - - ~SimpleThread() throw() - { - if (m_threadHandle) - { - ::CloseHandle(m_threadHandle); - } - m_threadHandle = 0; - } - - void start(unsigned (__stdcall *_start_func) (void *arg), void *user) throw(std::runtime_error) - { - unsigned m_threadIdentifier = 0; - m_threadHandle = (HANDLE)::_beginthreadex(NULL, 0, _start_func, user, 0, &m_threadIdentifier); - if (!m_threadHandle) - { - throw std::runtime_error("Could not start thread"); - } - } -}; - -#else - -class thread_CORE -{ - nocopy(thread_CORE) - -protected: - pthread_t m_threadHandle; - -public: - static int standard_signal_block() throw() - { - sigset_t catchset; - sigemptyset(&catchset); - sigaddset(&catchset,SIGPIPE); - sigaddset(&catchset,SIGTERM); - sigaddset(&catchset,SIGHUP); - sigaddset(&catchset,SIGINT); - sigaddset(&catchset,SIGQUIT); - sigaddset(&catchset,SIGTSTP); // ^Z allow this - sigaddset(&catchset,SIGCHLD); - sigaddset(&catchset,SIGWINCH); - sigaddset(&catchset,SIGUSR1); - sigaddset(&catchset,SIGUSR2); - return pthread_sigmask(SIG_BLOCK,&catchset,NULL); - } - - thread_CORE() : m_threadHandle(0) {} - - ~thread_CORE() throw() - { - if (m_threadHandle) - { - ::pthread_join(m_threadHandle, NULL); - } - m_threadHandle = 0; - } - - inline void join() - { - if (m_threadHandle) - { - ::pthread_join(m_threadHandle,NULL); - m_threadHandle = 0; - } - } - inline operator pthread_t() const throw() { return m_threadHandle; } - static unsigned long getCurrentThreadID() { return (unsigned long)::pthread_self(); } -}; - -template -class Tthread: public thread_CORE, public Handler -{ - static inline void* _start_func(void *arg) - { - standard_signal_block(); - long x = (long)(reinterpret_cast *>(arg))->operator()(); - return (void*)x; - } - -public: - Tthread(){} - template Tthread( P1 &p1):Handler(p1){} - template Tthread( P1 &p1, P2 &p2):Handler(p1,p2){} - template Tthread( P1 &p1, P2 &p2, P3 &p3):Handler(p1,p2,p3){} - template Tthread( P1 &p1, P2 &p2, P3 &p3, P4 &p4):Handler(p1,p2,p3,p4){} - template Tthread( P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5):Handler(p1,p2,p3,p4,p5){} - template Tthread( P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5,P6 &p6):Handler(p1,p2,p3,p4,p5,p6){} - template Tthread( P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5, P6 &p6,P7 &p7):Handler(p1,p2,p3,p4,p5,p6,p7){} - template Tthread( P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5, P6 &p6, P7 &p7,P8 &p8):Handler(p1,p2,p3,p4,p5,p6,p7,p8){} - template Tthread( P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5, P6 &p6, P7 &p7, P8 &p8, P9 &p9):Handler(p1,p2,p3,p4,p5,p6,p7,p8,p9){} - template Tthread(P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5, P6 &p6, P7 &p7, P8 &p8, P9 &p9, P10 &p10):Handler(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10){} - template Tthread(P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5, P6 &p6, P7 &p7, P8 &p8, P9 &p9, P10 &p10,P11 &p11):Handler(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11){} - template Tthread(P1 &p1, P2 &p2, P3 &p3, P4 &p4, P5 &p5, P6 &p6, P7 &p7, P8 &p8, P9 &p9, P10 &p10,P11 &p11,P12 &p12):Handler(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12){} - - void start(int joined = 1) throw(std::runtime_error) - { - if (joined && m_threadHandle) - { - throw std::runtime_error("Thread already exists"); - } - int ret = pthread_create(&m_threadHandle, NULL, _start_func, this); - if (ret) - { - throw std::runtime_error("Could not start thread" + std::string(ret == EAGAIN ? " [Increase the open files (ulimit -n) limit]" : "")); - } - } -}; - - -class SimpleThread -{ -public: - SimpleThread(void *(*_start_func) (void *arg) = 0, void *user = 0) - { - if (_start_func) - { - start(_start_func, user); - } - } - - void start(void *(*_start_func) (void *arg), void *user) throw(std::runtime_error) - { - pthread_t m_threadHandle = 0; - pthread_attr_t attr; - int ret = pthread_attr_init(&attr); - if (ret) - { - throw std::runtime_error("Could not start thread - pthread_attr_init failure"); - } - - ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - if (ret) - { - pthread_attr_destroy(&attr); - throw std::runtime_error("Could not start thread - pthread_attr_setdetachstate failure"); - } - - ret = pthread_create(&m_threadHandle,&attr,_start_func,user); - if (ret) - { - pthread_attr_destroy(&attr); - throw std::runtime_error("Could not start thread" + std::string(ret == EAGAIN ? " [Increase the open files (ulimit -n) limit]" : "")); - } - - pthread_attr_destroy(&attr); - } -}; -#endif - -class pointer_to_thread_function -{ -public: - typedef unsigned (*func_t)(); - - inline pointer_to_thread_function(func_t f):m_function(f){} -private: - func_t m_function; -protected: - inline const unsigned operator()() { return (*m_function)(); } -}; - -class vthread_stub -{ - protected: - virtual const unsigned operator()() = 0; - virtual ~vthread_stub(){} -}; - -typedef Tthread Vthread; - -#ifdef _WIN32 -class event -{ -#pragma warning(push) -#pragma warning(disable: 4127) -#pragma warning(disable: 4100) - nocopy(event) -#pragma warning(pop) - -private: - HANDLE m_event; - -public: - event(BOOL bManualReset) throw(std::runtime_error); - ~event() throw(); - - inline operator HANDLE() const throw() { return m_event; } - void wait() throw(std::runtime_error); - void setEvent() throw(std::runtime_error); - void resetEvent() throw(std::runtime_error); -}; - -#else - -class Win32SyncObject -{ -public: - virtual void syncObjectWait() throw(std::runtime_error) = 0; - virtual bool syncObjectTimedWait(int milliseconds) throw(std::runtime_error) = 0; - virtual ~Win32SyncObject(){} -}; -typedef Win32SyncObject* Win32SyncObjectPtr; - -/// these provide basic resource mgmt for typical uses -#endif - -class conditionVariable; - -namespace AOL_namespace { -#pragma pack(push, 1) -// conflicts with headers in solaris -#ifndef _WIN32 -class mutex : public Win32SyncObject -#else -class mutex -#endif -{ - nocopy(mutex) - -private: - pthread_mutex_t m_mutex; - -public: - mutex() throw(std::runtime_error); - ~mutex() throw(); - void lock() throw(std::runtime_error); - bool timedLock(int milliseconds) throw(std::runtime_error); - void unlock() throw(std::runtime_error); - void syncObjectWait() throw(std::runtime_error) { lock(); } - bool syncObjectTimedWait(int milliseconds) throw(std::runtime_error) { return timedLock(milliseconds); } -#ifndef _WIN32 - inline operator Win32SyncObject*() throw() { return this; } -#endif - friend class ::conditionVariable; -}; -#pragma pack(pop) - -class rwLock -{ - pthread_rwlock_t m_lock; - -public: - rwLock(); - ~rwLock(); - bool tryRdLock(); - void lock(); - void rdLock(); - void unlock(); -}; - -} - -class conditionVariable -{ - nocopy(conditionVariable) - -private: - pthread_cond_t m_conditionVariable; - -public: - conditionVariable() throw(std::runtime_error); - ~conditionVariable() throw(); - void wait(AOL_namespace::mutex &m) throw(std::runtime_error); - bool timedWait(AOL_namespace::mutex &m,int milliseconds) throw(std::runtime_error); - void signal() throw(std::runtime_error); - void broadcast() throw(std::runtime_error); -}; - -#ifndef _WIN32 -class event : public Win32SyncObject -{ - nocopy(event) - -private: - conditionVariable m_conditionVariable; - AOL_namespace::mutex m_mutex; - bool m_manualReset; - bool m_signaled; - -public: - event(bool bManualReset) throw(std::runtime_error); - void wait() throw(std::runtime_error); - bool timedWait(int milliseconds) throw(std::runtime_error); - void setEvent() throw(std::runtime_error); - void resetEvent() throw(std::runtime_error); - void syncObjectWait() throw(std::runtime_error) { wait(); } - bool syncObjectTimedWait(int milliseconds) throw(std::runtime_error) { return timedWait(milliseconds); } - inline operator Win32SyncObject*() throw() { return this; } - -}; -#endif - -/* class stackLock - - Stack based mutex locker/unlocker for unwrapped Win32 mutexes. - Equivalent to CAutoLock for CCritSec objects. -*/ - -class stackLock -{ - AOL_namespace::mutex &m_m; -public: - stackLock(AOL_namespace::mutex &m) : m_m(m) - { - m_m.lock(); - } - ~stackLock() - { - m_m.unlock(); - } -}; - -class stackRWLock -{ - AOL_namespace::rwLock &m_rw; - bool m_locked; - -public: - stackRWLock(AOL_namespace::rwLock &l, bool reader = true, bool lockNow = true) : m_rw(l), m_locked(lockNow) - { - if (lockNow == false) - return; - if (reader) - m_rw.rdLock(); - else - m_rw.lock(); - } - ~stackRWLock() - { - if (m_locked) - m_rw.unlock(); - } - bool tryRdLock() - { - if (m_locked == false) - { - if (m_rw.tryRdLock()) - { - m_locked = true; - return true; - } - } - return false; - } - void lock() { if (m_locked == false) { m_rw.lock(); m_locked = true; } } - void rdLock() { if (m_locked == false) { m_rw.rdLock(); m_locked = true; } } - void unlock() { if (m_locked) { m_rw.unlock(); m_locked = false; } } - -}; - -#ifndef _WIN32 - -#define WAIT_ABANDONED (-1) -#define WAIT_TIMEOUT (0) -#define WAIT_OBJECT_0 (1) -#define INFINITE (-1) - -int WaitForSingleObject(Win32SyncObject &o,int milli_timeout) throw(); -inline int WaitForSingleObject(Win32SyncObject *o,int milli_timeout) throw() { return WaitForSingleObject(*o,milli_timeout); } -int WaitForMultipleObjects(int count,Win32SyncObjectPtr *objs,bool waitall,int milliseconds) throw(); -inline void CloseHandle(Win32SyncObject *o) { delete o; } -typedef Win32SyncObject *HANDLE; - -#endif - -inline bool _SetEvent(event &e) { bool result=false; try {e.setEvent(); result=true; }catch(...){} return result; } -inline bool _SetEvent(event *e) { return _SetEvent(*e); } -inline bool _ResetEvent(event &e) { bool result=false; try {e.resetEvent();result=true;}catch(...){} return result; } -inline bool _ResetEvent(event *e) { return _ResetEvent(*e); } - -namespace AOL_namespace -{ - template class synchronizedPrimitive - { - private: - mutable AOL_namespace::mutex m_lock; - T m_t; - - public: - synchronizedPrimitive(){} - synchronizedPrimitive(const T &t):m_t(t){} - T get() const throw() { stackLock sl(m_lock); return m_t; } - void set(const T &t) throw() { stackLock sl(m_lock); m_t = t; } - }; -} - -// thread safe sleep function -void safe_sleep(int sec, int usec = 0); - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/unicode/uniFile.cpp b/Src/Plugins/DSP/sc_serv3/nmrCommon/unicode/uniFile.cpp deleted file mode 100644 index 102ee4b3..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/unicode/uniFile.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#ifdef _WIN32 -#include -#include -#else -#include -#endif -#include -#include -#include -#include "uniFile.h" -#include "stl/stringUtils.h" - -using namespace std; -using namespace stringUtil; - -FILE* uniFile::fopen(const uniFile::filenameType &f,const char *mode) throw() -{ -#ifdef _WIN32 - uniString::utf32 u32(f); - std::wstring u16; - u32.toUtf16(u16); - return _wfopen(u16.c_str(),tows(mode).c_str()); -#else - return ::fopen((const char *)f.c_str(),mode); -#endif -} - -void uniFile::unlink(const uniFile::filenameType &f) throw() -{ -#ifdef _WIN32 - uniString::utf32 u32(f); - std::wstring u16; - u32.toUtf16(u16); - ::DeleteFileW(u16.c_str()); -#else - ::unlink((const char *)f.c_str()); -#endif -} - -bool uniFile::fileExists(const uniFile::filenameType &f) throw() -{ -#ifdef _WIN32 - uniString::utf32 u32(f); - std::wstring u16; - u32.toUtf16(u16); - struct _stat64i32 st = {0}; - int result = _wstat(u16.c_str(),&st); - if (st.st_mode & _S_IFDIR) return 0; - return (result == 0); -#else - struct stat st; - int result = stat((const char *)f.c_str(),&st); - if (S_ISDIR(st.st_mode)) return 0; - return (result == 0); -#endif -} - -size_t uniFile::fileSize(const uniFile::filenameType &f) throw() -{ -#ifdef _WIN32 - uniString::utf32 u32(f); - std::wstring u16; - u32.toUtf16(u16); - struct _stat64i32 st; - if (_wstat(u16.c_str(),&st) == -1) return 0; - return st.st_size; -#else - struct stat st; - if (stat((const char *)f.c_str(),&st) == -1) return 0; - return st.st_size; -#endif -} - -time_t uniFile::fileTime(const uniFile::filenameType &f) throw() -{ -#ifdef _WIN32 - uniString::utf32 u32(f); - std::wstring u16; - u32.toUtf16(u16); - struct _stat64i32 st; - if (_wstat(u16.c_str(),&st) == -1) return 0; - return st.st_mtime; -#else - struct stat st; - if (stat((const char *)f.c_str(),&st) == -1) return 0; - return st.st_mtime; -#endif -} diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/unicode/uniFile.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/unicode/uniFile.h deleted file mode 100644 index b90d59c2..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/unicode/uniFile.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#ifndef uniFile_H_ -#define uniFile_H_ - -#include "uniString.h" -#include - -// functions that help bridge the difference between -// unicode file handling on various platforms - -namespace uniFile -{ - // posix uses utf8 for unicode filenames. Msft uses utf16. To avoid lots - // of platform conditional code, we will standardize on utf8 and convert - // as necessary on Msft platforms. This should be okay since file opens are - // not a high speed inner loop type of operation - typedef uniString::utf8 filenameType; - - //typedef enum { OPENFILE_READ = 1,OPENFILE_WRITE = 2,OPENFILE_BINARY=4 } OpenFile_t; - //FILE* fopen(const filenameType &f,int open_file_type) throw(); - - FILE* fopen(const filenameType &f, const char *mode) throw(); - void unlink(const filenameType &f) throw(); - bool fileExists(const filenameType &f) throw(); - size_t fileSize(const filenameType &f) throw(); - time_t fileTime(const filenameType &f) throw(); -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/unicode/uniString.cpp b/Src/Plugins/DSP/sc_serv3/nmrCommon/unicode/uniString.cpp deleted file mode 100644 index 317a1015..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/unicode/uniString.cpp +++ /dev/null @@ -1,786 +0,0 @@ -#include "uniString.h" -#include -#include -#include - -using namespace std; -using namespace uniString; - -/*****************************************************************/ -//////////////// various helping funcs ///////////////////////// - -// helper function that throws exceptions -static void throwBadUTF8Code(utf8::value_type v, int position) throw(badUnicodeData) -{ - ostringstream o; - o << "Bad UTF-8 code (" << hex << (int)v << ") at position " << position; - throw uniString::badUnicodeData(o.str()); -} - -static void throwBadUTF16Code(utf16::value_type v, int position) throw(badUnicodeData) -{ - ostringstream o; - o << "Bad UTF-16 code (" << hex << (int)v << ") at position " << position; - throw uniString::badUnicodeData(o.str()); -} - -bool utf8::isValid(bool allowIncompleteEndingSequence) const throw() -{ - int position = 0; - for (utf8::const_iterator i = begin(); i != end(); ++i, ++position) - { - utf8::value_type v8 = (*i); - if (v8 & 0x80) - { - // count number of follow up bytes - utf8::value_type follow_up_mask = 0xc0; - utf8::value_type leading_value_mask = 0x3f; - int follow_up_bytes = 0; - - while ((v8 & follow_up_mask) == follow_up_mask) - { - if (follow_up_mask == 0xff) - { - return false; - } - - ++follow_up_bytes; - follow_up_mask = (follow_up_mask >> 1) | 0x80; - leading_value_mask = leading_value_mask >> 1; - } - - // we should always have follow up bytes since 0x80 is illegal - if (!follow_up_bytes) - { - return false; - } - - utf32::value_type v = v8 & leading_value_mask; - while(follow_up_bytes--) - { - ++i; - ++position; - if (i == end()) - { - if (allowIncompleteEndingSequence) - { - break; - } - else - { - return false; - } - } - v8 = *i; - if ((v8 & 0xc0) != 0x80) // follow ups must begin with 10xxxxxx - { - return false; - } - v = (v << 6) | (v8 & 0x3f); - } - } - } - return true; -} - -// convert utf8 to utf32 -/* - u32 - utf32 string to set - ibegin,iend - template iterators for the beginning and end of the UTF-8 bitstream - allowIncompleteEndingSequence - if true then we just ignore missing values at the very end - of the bitstream. Otherwise we throw an exception. -*/ - -template -static void Utf8ToUtf32(utf32 &u32, ITER ibegin, ITER iend, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - // use temp so an exception leaves this string in tact - utf32 newValue; - int position = 0; - - for (ITER i = ibegin; i != iend; ++i,++position) - { - utf8::value_type v8 = (*i); - if (!(v8 & 0x80)) - { - newValue.push_back(v8); - } - else - { - // count number of follow up bytes - utf8::value_type follow_up_mask = 0xc0; - utf8::value_type leading_value_mask = 0x3f; - int follow_up_bytes = 0; - - while ((v8 & follow_up_mask) == follow_up_mask) - { - if (follow_up_mask == 0xff) - { - throwBadUTF8Code(v8, position); - } - ++follow_up_bytes; - follow_up_mask = (follow_up_mask >> 1) | 0x80; - leading_value_mask = leading_value_mask >> 1; - } - - // we should always have follow up bytes since 0x80 is illegal - if (!follow_up_bytes) - { - throwBadUTF8Code(v8, position); - } - - utf32::value_type v = v8 & leading_value_mask; - while (follow_up_bytes--) - { - ++i; - ++position; - if (i == iend) - { - if (allowIncompleteEndingSequence) - { - break; - } - else - { - throw badUnicodeData("Bad UTF-8 data. Ending sequence is incomplete"); - } - } - v8 = *i; - if ((v8 & 0xc0) != 0x80) // follow ups must begin with 10xxxxxx - { - throwBadUTF8Code(v8, position); - } - v = (v << 6) | (v8 & 0x3f); - } - if (v != Utf16BOM) - { - newValue.push_back(v); - } - } - } - - u32.clear(); - u32 = newValue; -} - -///////////////////// byte swap stuff for UTF-16 ////////////////////////////////////////////////////// -// endian swap of 16 bit value -static inline utf16::value_type byteSwap(utf16::value_type nValue) throw() -{ - return (((nValue>> 8)) | (nValue << 8)); -} - -#if __BYTE_ORDER == __LITTLE_ENDIAN -// push a value into a UTF-16 encoding string based on the endian of the value and what -// the machine natively stores. On entry "v" is in the native format of the machine since -// it was just converted from the 32 bit code point. -template -static void Utf16EndianPush(T &u16, utf16::value_type v, bool littleEndian) throw() -{ - if (littleEndian) - { - u16.push_back(v); - } - else - { - u16.push_back(byteSwap(v)); - } -} - -// convert a UTF-16 value to machine native value -static inline utf16::value_type unswap(utf16::value_type v, bool littleEndianData) throw() -{ - return (littleEndianData ? v : byteSwap(v)); -} -#else -template -static void Utf16EndianPush(T &u16, utf16::value_type v, bool littleEndian) throw() -{ - if (!littleEndian) - { - u16.push_back(v); - } - else - { - u16.push_back(byteSwap(v)); - } -} - -static inline utf16::value_type unswap(utf16::value_type v,bool littleEndianData) throw() -{ - return (!littleEndianData ? v : byteSwap(v)); -} -#endif -/////////////////////////////////// - -// assign UTF-32 from UTF-16 encoding -/* - u32 - utf32 string to set - ibegin,iend - iterators for UTF-16 encoding source - assumeLittleEndian - assume the UTF-16 encoding is little endian unless a BOM is detected - allowIncompleteEndingSequence - if true ignore final code point if UTF-16 sequence is incomplete, otherwise - throw an exception -*/ - -template -static void Utf16ToUtf32(utf32 &u32, ITER ibegin, ITER iend, bool assumeLittleEndian, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - bool littleEndianData = assumeLittleEndian; - - utf32 newValue; - - int position = 0; - - for (ITER i = ibegin; i != iend; ++i,++position) - { - utf16::value_type w1 = (utf16::value_type)(*i); // yes, use utf16 value even for wstring since we know it's good - if (w1 == 0xfeff) - { - littleEndianData = leSystem; - continue; - } - else if (w1 == 0xfffe) - { - littleEndianData = !leSystem; - continue; - } - - w1 = unswap(w1,littleEndianData); - if (w1 < 0xd800 || w1 > 0xdfff) - { - newValue.push_back(w1); - } - else if (w1 > 0xdbff) - { - throwBadUTF16Code(w1,position); - } - else - { - ++i; - ++position; - if (i == iend) - { - if (allowIncompleteEndingSequence) - { - break; - } - else - { - throw badUnicodeData("Bad UTF-16 data. Ending sequence is incomplete"); - } - } - utf16::value_type w2 = (*i); - w2 = unswap(w2, littleEndianData); - if (w2 < 0xdc00 || w2 > 0xdfff) - { - throwBadUTF16Code(w2, position); - } - utf32::value_type v1 = w1 & 0x03ff; - utf32::value_type v2 = w2 & 0x03ff; - newValue.push_back((v1 << 10) | v2); - } - } - - u32.clear(); - u32 = newValue; -} - -template -static void Utf32CodeToUtf8(utf32::value_type v, U8 &u8) throw() -{ - if (v < 0x00000080) - { - // only allow \t, \r, \n if in 0-31 ranage - // otherwise expat in the DNAS will refuse - if (v <= 31) - { - if (v == 9 || v == 10 || v == 13) - { - u8.push_back((utf8::value_type)v); - } - } - else - { - u8.push_back((utf8::value_type)v); - } - } - else - { - utf32::value_type maxTopValue = 0x0000003f; - utf8::value_type topValueBitPattern = 0x80; - vector buf; - - // filter out the extended control characters just incase - if (v >= 0x80 && v <= 0x9F) - { - u8.push_back((utf8::value_type)0x3F); - return; - } - // and also filter this so we don't insert BOMs - else if (v == 0xFFFE || v == 0xFFFF) - { - return; - } - - while (v > maxTopValue) - { - buf.push_back(0x00000080 | (v & 0x0000003f)); - v = v >> 6; - maxTopValue = maxTopValue >> 1; - topValueBitPattern = ((topValueBitPattern >> 1) | 0x80); - } - - buf.push_back(topValueBitPattern | v); - u8.insert(u8.end(), buf.rbegin(), buf.rend()); - } -} - -template -static void Utf32ToUtf8(const utf32 &u32, U8 &u8, bool leadingBOM) throw() -{ - u8.clear(); - if (leadingBOM) - { - // we rarely want a BOM in utf-8. But I've run into template bugs where - // the utf8 constructor is accidentally getting called with true for the BOM - // this compile time flag checks for that - Utf32CodeToUtf8(Utf16BOM,u8); - } - for (utf32::const_iterator i = u32.begin(); i != u32.end(); ++i) - { - Utf32CodeToUtf8(*i, u8); - } -} - -// create UTF-16 from unicode (according to rfc2781) -template -static void Utf32ToUtf16(const utf32 &u32, U16 &u16, bool leadingBOM, bool littleEndian) throw() -{ - u16.clear(); - if (leadingBOM) - { - Utf16EndianPush(u16, Utf16BOM, littleEndian); - } - for (utf32::const_iterator i = u32.begin(); i != u32.end(); ++i) - { - utf32::value_type v = *i; - if (v < 0x00010000) - { - Utf16EndianPush(u16, v, littleEndian); - } - else - { - utf32::value_type vp = v - 0x00010000; - utf16::value_type w1 = 0xd800; - utf16::value_type w2 = 0xdc00; - w1 = w1 | ((vp & 0x000ffc00) >> 10); - w2 = w2 | (vp & 0x000003ff); - Utf16EndianPush(u16,w1,littleEndian); - Utf16EndianPush(u16,w2,littleEndian); - } - } -} - -utf32::utf32(const __int8 *s, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf8ToUtf32(*this, s, s + strlen((const char *)s), allowIncompleteEndingSequence); -} - -utf32::utf32(const __int8 *s, size_t len, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf8ToUtf32(*this, s, s + len, allowIncompleteEndingSequence); -} - -utf32::utf32(const std::string &s, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf8ToUtf32(*this, s.begin(), s.end(), allowIncompleteEndingSequence); -} - -utf32::utf32(const utf8 &u8, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf8ToUtf32(*this, u8.begin(), u8.end(), allowIncompleteEndingSequence); -} - -utf32::utf32(const utf8::value_type *u8, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf8ToUtf32(*this, u8, u8 + strlen((const char *)u8), allowIncompleteEndingSequence); -} - -utf32::utf32(const utf8::value_type *u8,size_t len, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf8ToUtf32(*this, u8, u8 + len, allowIncompleteEndingSequence); -} - -utf32::utf32(const utf16 &u16,bool assumeLittleEndian, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf16ToUtf32(*this, u16.begin(), u16.end(), assumeLittleEndian, allowIncompleteEndingSequence); -} - -utf32::utf32(const utf16::value_type *u16, bool assumeLittleEndian, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - utf16::size_type len = 0; - const utf16::value_type *tmp = u16; - if (tmp && *tmp) - { - while(*(tmp++)) - { - ++len; - } - } - Utf16ToUtf32(*this, u16, u16 + len, assumeLittleEndian, allowIncompleteEndingSequence); -} - -utf32::utf32(const utf16::value_type *u16, size_t len, bool assumeLittleEndian ,bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf16ToUtf32(*this, u16, u16 + len, assumeLittleEndian, allowIncompleteEndingSequence); -} - -#ifdef _WIN32 -utf32::utf32(const std::wstring &w, bool assumeLittleEndian, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf16ToUtf32(*this, w.begin(), w.end(), assumeLittleEndian, allowIncompleteEndingSequence); -} - -utf32::utf32(const wchar_t *u16, bool assumeLittleEndian, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - size_t len = 0; - const wchar_t *tmp = u16; - if (tmp && *tmp) - { - while(*(tmp++)) - { - ++len; - } - } - Utf16ToUtf32(*this,u16,u16+len,assumeLittleEndian,allowIncompleteEndingSequence); -} - -utf32::utf32(const wchar_t *u16, size_t len, bool assumeLittleEndian, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf16ToUtf32(*this, u16, u16 + len, assumeLittleEndian, allowIncompleteEndingSequence); -} -#endif - -void utf32::assign(const __int8 *s, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf8ToUtf32(*this, s, s + strlen((const char *)s), allowIncompleteEndingSequence); -} - -void utf32::assign(const __int8 *s, size_t len, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf8ToUtf32(*this, s, s + len, allowIncompleteEndingSequence); -} - -void utf32::assign(const std::string &s, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf8ToUtf32(*this, s.begin(), s.end(), allowIncompleteEndingSequence); -} - -void utf32::assign(const utf8 &u8, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf8ToUtf32(*this, u8.begin(), u8.end(), allowIncompleteEndingSequence); -} - -void utf32::assign(const utf8::value_type *u8, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf8ToUtf32(*this, u8, u8 + strlen((const char *)u8), allowIncompleteEndingSequence); -} - -void utf32::assignAsHighBitANSI(const utf8::value_type *u8) throw() -{ - if (u8) - { - while (*u8) - { - push_back(*u8); - ++u8; - } - } -} - -void utf32::assign(const utf8::value_type *u8, size_t len, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf8ToUtf32(*this, u8, u8 + len, allowIncompleteEndingSequence); -} - -void utf32::assign(const utf16 &u16, bool assumeLittleEndian, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf16ToUtf32(*this, u16.begin(), u16.end(), assumeLittleEndian, allowIncompleteEndingSequence); -} - -void utf32::assign(const utf16::value_type *u16, bool assumeLittleEndian, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - utf16::size_type len = 0; - const utf16::value_type *tmp = u16; - if (tmp && *tmp) - { - while(*(tmp++)) - { - ++len; - } - } - Utf16ToUtf32(*this, u16, u16 + len, assumeLittleEndian, allowIncompleteEndingSequence); -} - -void utf32::assign(const utf16::value_type *u16, size_t len, bool assumeLittleEndian, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf16ToUtf32(*this, u16, u16 + len, assumeLittleEndian, allowIncompleteEndingSequence); -} - -#ifdef _WIN32 -void utf32::assign(const std::wstring &w, bool assumeLittleEndian, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf16ToUtf32(*this, w.begin(), w.end(), assumeLittleEndian, allowIncompleteEndingSequence); -} - -void utf32::assign(const wchar_t *u16, bool assumeLittleEndian, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - size_t len = 0; - const wchar_t *tmp = u16; - if (tmp && *tmp) - { - while(*(tmp++)) - { - ++len; - } - } - Utf16ToUtf32(*this, u16, u16 + len, assumeLittleEndian, allowIncompleteEndingSequence); -} - -void utf32::assign(const wchar_t *u16, size_t len, bool assumeLittleEndian, bool allowIncompleteEndingSequence) throw(badUnicodeData) -{ - Utf16ToUtf32(*this, u16, u16 + len, assumeLittleEndian, allowIncompleteEndingSequence); -} -#endif - -void utf32::assignFromLatinExtended(const std::string &s) throw() -{ - clear(); - for (string::const_iterator i = s.begin(); i != s.end(); ++i) - { - push_back((utf32::value_type)(*i)); - } -} - -void utf32::assignFromLatinExtended(const __uint8 *s) throw() -{ - clear(); - if (s) - { - while (*s) - { - push_back(*(s++)); - } - } -} - -void utf32::assignFromLatinExtended(const __uint8 *s, size_t len) throw() -{ - clear(); - if (s && len > 0) - { - while (len--) - { - push_back(*(s++)); - } - } -} - -utf8 utf32::toUtf8(bool leadingBOM) const throw() -{ - utf8 u8; - Utf32ToUtf8(*this, u8, leadingBOM); - return u8; -} - -void utf32::toUtf8(utf8 &u8, bool leadingBOM) const throw() -{ - Utf32ToUtf8(*this, u8, leadingBOM); -} - -void utf32::toUtf8(std::string &s, bool leadingBOM) const throw() -{ - Utf32ToUtf8(*this, s, leadingBOM); -} - -utf16 utf32::toUtf16(bool leadingBOM, bool littleEndian) const throw() -{ - utf16 u16; - Utf32ToUtf16(*this, u16, leadingBOM, littleEndian); - return u16; -} - -void utf32::toUtf16(utf16 &u16, bool leadingBOM, bool littleEndian) const throw() -{ - Utf32ToUtf16(*this, u16, leadingBOM, littleEndian); -} - -#ifdef _WIN32 -void utf32::toUtf16(std::wstring &w, bool leadingBOM, bool littleEndian) const throw() -{ - Utf32ToUtf16(*this, w, leadingBOM, littleEndian); -} -#endif - -namespace uniString -{ - template - class xmlEscapes: public map - { - public: - xmlEscapes() - { - static const typename T::value_type lessthan[] = - {(typename T::value_type)'&',(typename T::value_type)'l',(typename T::value_type)'t',(typename T::value_type)';',(typename T::value_type)0}; - static const typename T::value_type greaterthan[] = - {(typename T::value_type)'&',(typename T::value_type)'g',(typename T::value_type)'t',(typename T::value_type)';',(typename T::value_type)0}; - static const typename T::value_type ampersand[] = - {(typename T::value_type)'&',(typename T::value_type)'a',(typename T::value_type)'m',(typename T::value_type)'p',(typename T::value_type)';',(typename T::value_type)0}; - static const typename T::value_type apostrophe[] = - {(typename T::value_type)'&',(typename T::value_type)'a',(typename T::value_type)'p',(typename T::value_type)'o',(typename T::value_type)'s',(typename T::value_type)';',(typename T::value_type)0}; - static const typename T::value_type quote[] = - {(typename T::value_type)'&',(typename T::value_type)'q',(typename T::value_type)'u',(typename T::value_type)'o',(typename T::value_type)'t',(typename T::value_type)';',(typename T::value_type)0}; - - (*this)['<'] = T(lessthan); - (*this)['>'] = T(greaterthan); - (*this)['&'] = T(ampersand); - (*this)['\''] = T(apostrophe); - (*this)['"'] = T(quote); - } - }; -} - -static const uniString::xmlEscapes gUtf32XmlEscapes; -static const uniString::xmlEscapes gUtf16XmlEscapes; -static const uniString::xmlEscapes gUtf8XmlEscapes; - -template -static T xml_escape(const T &t, const uniString::xmlEscapes &m) throw() -{ - T result; - - for (typename T::const_iterator i = t.begin(); i != t.end(); ++i) - { - typename uniString::xmlEscapes::const_iterator e = m.find(*i); - if (e != m.end()) - { - result.insert(result.end(),(*e).second.begin(),(*e).second.end()); - } - else - { - result.push_back(*i); - } - } - return result; -} - -utf32 utf32::escapeXML() const throw() -{ - return xml_escape(*this, gUtf32XmlEscapes); -} - -utf16 utf16::escapeXML() const throw() -{ - return xml_escape(*this, gUtf16XmlEscapes); -} - -utf8 utf8::escapeXML() const throw() -{ - return xml_escape(*this, gUtf8XmlEscapes); -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -void utf8::assign(const utf32 &u32, bool leadingBOM) throw() -{ - u32.toUtf8(*this, leadingBOM); -} - -void utf16::assign(const utf32 &u32, bool leadingBOM, bool littleEndian) throw() -{ - u32.toUtf16(*this, leadingBOM, littleEndian); -} - -//////////////////////////////////////////////////////////////////////////////////////////// -string utf8::toANSI(bool allowHighBitCodePoints) const throw() -{ - string result; - bool utf32MethodWorked = false; - - try - { - // convert to utf32 so we can easily remove code points - const utf32 u32(*this); - if (allowHighBitCodePoints) - { - for (utf32::const_iterator i = u32.begin(); i != u32.end(); ++i) - { - result.push_back((char)*i); - } - } - else - { - for (utf32::const_iterator i = u32.begin(); i != u32.end(); ++i) - { - if ((*i) <= 0x7f) - { - result.push_back((char)*i); - } - else - { - result.push_back((char)'?'); - } - } - } - utf32MethodWorked = true; - } - catch(...) - { - } - - // if the string actually has high bit ANSI values (for instance, from a badly - // formed playlist), we should still do something sensible. - if (!utf32MethodWorked) - { - result.clear(); - if (allowHighBitCodePoints) - { - for (utf8::const_iterator i = begin(); i != end(); ++i) - { - result.push_back((char)*i); - } - } - else - { - for (utf8::const_iterator i = begin(); i != end(); ++i) - { - if ((*i) <= 0x7f) - { - result.push_back((char)*i); - } - else - { - result.push_back((char)'?'); - } - } - } - } - return result; -} - -#ifdef _WIN32 -wstring utf8::toWString() const throw(badUnicodeData) -{ - utf32 u32(*this); - wstring result; - u32.toUtf16(result); - return result; -} -#endif - -int utf8::toInt() const throw() -{ - return ::atoi((*this).hideAsString().c_str()); -} diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/unicode/uniString.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/unicode/uniString.h deleted file mode 100644 index 51bbbd49..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/unicode/uniString.h +++ /dev/null @@ -1,354 +0,0 @@ -#pragma once -#ifndef uniString_H_ -#define uniString_H_ - -#include "intTypes.h" -#include -#include -#include - -namespace uniString -{ - // exception for bad utf8/utf16 conversions - class badUnicodeData: public std::runtime_error - { - public: - explicit badUnicodeData(const std::string &msg) : std::runtime_error(msg){} - }; - - #if __BYTE_ORDER == __LITTLE_ENDIAN - static const bool leSystem = true; - #else - static const bool leSystem = false; - #endif - - class utf8; - class utf16; - class utf32; - - template - size_t strlen(const S *s) throw() - { - if (!s) return 0; - size_t len(0); - while (*(s++)) - { - ++len; - } - return len; - } - - // string length calculator with a limit (in case the string is badly formed) - template - size_t strlen(const S *s, size_t maxamt) throw() - { - if (!s) return 0; - size_t len(0); - while (maxamt && (*s)) - { - ++s; - ++len; - --maxamt; - } - return len; - } - - template - bool is_a_number(T t) - { - return (((int)t) >= ((int)'0') && ((int)t) <= ((int)'9')); - } - - template - bool is_a_number(I ibegin,I iend) - { - for (I i = ibegin; i != iend; ++i) - { - if (!is_a_number(*i)) - { - return false; - } - } - return true; - } - - class utf16: public std::basic_string<__uint16> - { - public: - typedef std::basic_string<__uint16> base_t; - - utf16(){} - utf16(const utf16 &u16) : base_t(u16){} - explicit utf16(const utf16::value_type *u16) : base_t(u16){} - explicit utf16(const utf16::value_type *u16, utf16::size_type len) : base_t(u16, len){} - #ifdef _WIN32 - explicit utf16(const std::wstring &w) : base_t(w.begin(), w.end()){} - #endif - explicit utf16(utf16::size_type Cnt,utf16::value_type Val) : base_t(Cnt, Val){} - explicit utf16(const base_t &u16) : base_t(u16){} - - void assign(const utf32 &u32,bool leadingBOM = true, bool littleEndian = leSystem) throw(); - utf16 escapeXML() const throw(); - }; - - class utf8: public std::basic_string<__uint8> - { - public: - typedef std::basic_string<__uint8> base_t; - utf8(){} - - utf8(const utf8 &u8) : base_t(u8) {} - - utf8(const utf8::value_type *u8) : base_t(u8) {} - - explicit utf8(const utf8::value_type *u8, utf8::size_type len) : base_t(u8, len) {} - - utf8(const char *u8) : base_t((const utf8::value_type *)u8) {} - - explicit utf8(const char *u8,utf8::size_type len) : base_t((const utf8::value_type *)u8, len) {} - - utf8(const std::string &s) : base_t(s.begin(), s.end()) {} - - explicit utf8(utf8::size_type Cnt, utf8::value_type Val) : base_t(Cnt, Val) {} - - utf8(const base_t &u8) : base_t(u8) {} - - template - explicit utf8(T ibegin, T iend) : base_t(ibegin, iend) {} - - explicit utf8(const utf32 &u32, bool leadingBOM = false) - { - assign(u32, leadingBOM); - } - - void assign(const utf32 &u32, bool leadingBOM = false) throw(); - bool isValid(bool allowIncompleteEndingSequence = false) const throw(); - utf8 escapeXML() const throw(); - int toInt() const throw(); - - // sometimes we need to stuff this in a string. For example if we want to throw - // a runtime_error exception with the utf8 data. - std::string hideAsString() const throw() - { - std::string s(begin(), end()); - return s; - } - - // remove code points above 0x7f - std::string toANSI(bool allowHighBitCodePoints = false) const throw(); - // convenience function for windows - #ifdef _WIN32 - // converts to utf16 - std::wstring toWString() const throw(badUnicodeData); - #endif - - utf8 operator+(const utf8 &u8) const throw() - { - utf8 result(*this); - result.insert(result.end(), u8.begin(), u8.end()); - return result; - } - - utf8 operator+(const char *s) const throw() - { - utf8 result(*this); - result.insert(result.end(), s, s + strlen(s)); - return result; - } - - utf8 operator+(const std::string &s) const throw() - { - utf8 result(*this); - result.insert(result.end(), s.begin(), s.end()); - return result; - } - - template - utf8 operator+(T v) const throw() - { - utf8 result(*this); - result += v; - return result; - } - - template - utf8& operator+=(T v) throw() - { - base_t::operator+=(v); - return *this; - } - - utf8& operator+=(const std::string &s) throw() - { - utf8 result = (*this) + s; - *this = result; - return *this; - } - - utf8& operator+=(const char *s) throw() - { - utf8 result = (*this) + s; - *this = result; - return *this; - } - - template - bool equals(ITER ibegin, ITER iend) const throw() - { - const_iterator i1 = begin(); - ITER i2 = ibegin; - while ((i1 != end()) && (i2 != iend)) - { - if (((utf8::value_type)*i1) != ((utf8::value_type)*i2)) - { - return false; - } - ++i1; - ++i2; - } - return ((i1 == end()) && (i2 == iend)); - } - - bool operator==(const char *s) const throw() - { - return equals(s, s + strlen(s)); - } - - bool operator==(const std::string &s) const throw() - { - return equals(s.begin(), s.end()); - } - }; - - inline utf8 operator+(const char *s, const utf8 &u8) throw() - { - utf8 r(s); - r.insert(r.end(), u8.begin(), u8.end()); - return r; - } - - inline utf8 operator+(const std::string &s, const utf8 &u8) throw() - { - utf8 r(s); - r.insert(r.end(), u8.begin(), u8.end()); - return r; - } - - class utf32: public std::basic_string<__uint32> - { - public: - typedef std::basic_string<__uint32> base_t; - - utf32(){} - utf32(const utf32 &us): base_t(us){} - utf32(const utf32::value_type *u32) : base_t(u32){} - explicit utf32(const utf32::value_type *u32, utf32::size_type len) : base_t(u32, len){} - explicit utf32(utf32::size_type Cnt, utf32::value_type Val) : base_t(Cnt, Val){} - utf32(const base_t &s) : base_t(s){} - explicit utf32(utf32::const_iterator b, utf32::const_iterator e) : base_t(b, e){} - explicit utf32(utf32::const_reverse_iterator b, utf32::const_reverse_iterator e) : base_t(b, e){} - - explicit utf32(const __int8 *s, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - explicit utf32(const __int8 *s, size_t len, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - explicit utf32(const std::string &s, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - explicit utf32(const utf8 &u8, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - explicit utf32(const utf8::value_type *u8, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - explicit utf32(const utf8::value_type *u8, size_t len, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - void assignAsHighBitANSI(const utf8::value_type *u8) throw(); - void assign(const __int8 *s, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - void assign(const __int8 *s, size_t len, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - void assign(const std::string &s, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - void assign(const utf8 &u8, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - void assign(const utf8::value_type *u8, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - void assign(const utf8::value_type *u8, size_t len, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - - // use this one if the source is LATIN-1 and it may contain high bit characters - void assignFromLatinExtended(const std::string &s) throw(); - void assignFromLatinExtended(const __uint8 *s) throw(); // null terminated - void assignFromLatinExtended(const __uint8 *s, size_t len) throw(); // no termination - ////////////////// - - explicit utf32(const utf16 &u16, bool assumeLittleEndian = leSystem, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - explicit utf32(const utf16::value_type *u16, bool assumeLittleEndian = leSystem, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - explicit utf32(const utf16::value_type *u16, size_t len, bool assumeLittleEndian = leSystem, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - #ifdef _WIN32 - explicit utf32(const std::wstring &w, bool assumeLittleEndian = leSystem, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - explicit utf32(const wchar_t *u16, bool assumeLittleEndian = leSystem, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - explicit utf32(const wchar_t *u16, size_t len, bool assumeLittleEndian = leSystem, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - #endif - void assign(const utf16 &u16, bool assumeLittleEndian = leSystem, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - void assign(const utf16::value_type *u16, bool assumeLittleEndian = leSystem, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - void assign(const utf16::value_type *u16, size_t len, bool assumeLittleEndian = leSystem, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - #ifdef _WIN32 - void assign(const std::wstring &w, bool assumeLittleEndian = leSystem, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - void assign(const wchar_t *u16, bool assumeLittleEndian = leSystem, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - void assign(const wchar_t *u16, size_t len, bool assumeLittleEndian = leSystem, bool allowIncompleteEndingSequence = false) throw(badUnicodeData); - #endif - utf8 toUtf8(bool leadingBOM = false) const throw(); - void toUtf8(utf8 &u8, bool leadingBOM = false) const throw(); - void toUtf8(std::string &s, bool leadingBOM = false) const throw(); - utf16 toUtf16(bool leadingBOM = false, bool littleEndian = leSystem) const throw(); - void toUtf16(utf16 &u16, bool leadingBOM = false, bool littleEndian = leSystem) const throw(); - #ifdef _WIN32 - void toUtf16(std::wstring &w, bool leadingBOM = false, bool littleEndian = leSystem) const throw(); - #endif - - utf32 escapeXML() const throw(); - - utf32& operator+=(const utf32 &u32) - { - insert(end(), u32.begin(), u32.end()); - return *this; - } - - utf32 operator+(const utf32 &u32) - { - utf32 result(*this); - result += u32; - return result; - } - }; - - static const utf16::value_type Utf16BOM = 0xfeff; -} - -inline uniString::utf8 asciiToUtf8(std::string s) -{ - uniString::utf8 result; - const size_t siz = s.size(); - for (size_t i = 0; i < siz; i++) - { - int c = s[i]; - - // nothing specicial to do if 0-127 - if (c < 128 && c >= 0) - { - if (c >= 0 && c <= 31) - { - if (c == 9 || c == 10 || c == 13) - { - result.push_back((__uint8)c); - } - } - else - { - result.push_back((__uint8)c); - } - } - // otherwise we need to attempt to convert - else - { - // bump back to +ve - if (c < 128) - { - c += 256; - } - result.push_back((__uint8)(c >> 6) | 0xC0); - result.push_back((__uint8)(c & 0x3F) | 0x80); - } - } - - return result; -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/win32/rezFuncs.cpp b/Src/Plugins/DSP/sc_serv3/nmrCommon/win32/rezFuncs.cpp deleted file mode 100644 index a667b3f5..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/win32/rezFuncs.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include -#include "rezFuncs.h" -#include "stl/stringUtils.h" - -using namespace std; -using namespace stringUtil; -using namespace uniString; - -void getVersionInfo(utf8 &version) throw() -{ - version = ""; - - TCHAR filename[_MAX_PATH + 1] = {0}; - DWORD junk = 0; - char *versionData = 0; - - // version information from the application resources - ::GetModuleFileName(0,filename,_MAX_PATH); - DWORD versionInfoSize = ::GetFileVersionInfoSize(filename,&junk); - versionData = new char[versionInfoSize]; - if (::GetFileVersionInfoW(filename,0,versionInfoSize,versionData)) - { - void *valPtr = 0; - UINT valSize = 0; - if (::VerQueryValue(versionData,_T("\\"), &valPtr, &valSize)) - { - const VS_FIXEDFILEINFO *ffi = reinterpret_cast(valPtr); - version = - tos(((ffi->dwProductVersionMS & 0xffff0000) >> 16)) + "." + - tos(((ffi->dwProductVersionMS & 0x0000ffff))) + "." + - tos(((ffi->dwProductVersionLS & 0xffff0000) >> 16)) + "." + - tos(((ffi->dwProductVersionLS & 0x0000ffff))); - } - } - delete [] versionData; -} diff --git a/Src/Plugins/DSP/sc_serv3/nmrCommon/win32/rezFuncs.h b/Src/Plugins/DSP/sc_serv3/nmrCommon/win32/rezFuncs.h deleted file mode 100644 index 3db0d496..00000000 --- a/Src/Plugins/DSP/sc_serv3/nmrCommon/win32/rezFuncs.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once -#ifndef rezFuncs_H_ -#define rezFuncs_H_ - -#include "unicode/uniString.h" - -void getVersionInfo(uniString::utf8 &version) throw(); - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_FlashPolicyServer.cpp b/Src/Plugins/DSP/sc_serv3/protocol_FlashPolicyServer.cpp deleted file mode 100644 index 82a49bca..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_FlashPolicyServer.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include -#include "protocol_FlashPolicyServer.h" -#include "webNet/urlUtils.h" -#include "services/stdServiceImpl.h" -#include "global.h" -#include "bandwidth.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -protocol_FlashPolicyServer::protocol_FlashPolicyServer(const socketOps::tSOCKET s, - const uniString::utf8 &clientLogString) throw(std::exception) - : runnable(s), m_outBufferSize(0), m_clientLogString(clientLogString), - m_outBuffer(0), m_state(&protocol_FlashPolicyServer::state_Send) -{ - // flash x-domain file - m_outMsg = gOptions.getCrossDomainFile(false); - if (m_outMsg.empty()) m_outMsg = MSG_HTTP404; - m_outBuffer = m_outMsg.c_str(); - bandWidth::updateAmount(bandWidth::FLASH_POLICY, (m_outBufferSize = (int)m_outMsg.size())); -} - -protocol_FlashPolicyServer::~protocol_FlashPolicyServer() throw() -{ - socketOps::forgetTCPSocket(m_socket); -} - -void protocol_FlashPolicyServer::timeSlice() throw(std::exception) -{ - (this->*m_state)(); -} - -// send buffer text -void protocol_FlashPolicyServer::state_Send() throw(std::exception) -{ - if (sendDataBuffer(DEFAULT_CLIENT_STREAM_ID, m_outBuffer, m_outBufferSize, m_clientLogString)) - { - m_result.done(); - } -} diff --git a/Src/Plugins/DSP/sc_serv3/protocol_FlashPolicyServer.h b/Src/Plugins/DSP/sc_serv3/protocol_FlashPolicyServer.h deleted file mode 100644 index 2972a08d..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_FlashPolicyServer.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once -#ifndef protocol_FlashPolicyServer_H_ -#define protocol_FlashPolicyServer_H_ - -#include "threadedRunner.h" -#include - -// this class takes any necessary actions indicated by an HTTP -// call with the url (typically on :843) -class protocol_FlashPolicyServer: public runnable -{ -private: - int m_outBufferSize; - const uniString::utf8& m_clientLogString; - const uniString::utf8::value_type *m_outBuffer; // for outgoing text lines - uniString::utf8 m_outMsg; - - typedef void (protocol_FlashPolicyServer::*state_t)(); - - state_t m_state; - - void state_Send() throw(std::exception); - -protected: - virtual void timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "protocol_FlashPolicyServer"; } - -public: - protocol_FlashPolicyServer(const socketOps::tSOCKET s, const uniString::utf8 &clientLogString) throw(std::exception); - virtual ~protocol_FlashPolicyServer() throw(); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_HTTPClient.cpp b/Src/Plugins/DSP/sc_serv3/protocol_HTTPClient.cpp deleted file mode 100644 index 1406cbcc..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_HTTPClient.cpp +++ /dev/null @@ -1,305 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include -#include "protocol_HTTPClient.h" -#include "ripList.h" -#include "stats.h" -#include "streamData.h" -#include "w3cLog.h" -#include "global.h" -#include "bandwidth.h" -#include "MP3Header.h" -#include "ADTSHeader.h" -#include "file/fileUtils.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define DEBUG_LOG(...) do { if (gOptions.HTTPClientDebug()) DLOG(__VA_ARGS__); } while (0) -#define AD_DEBUG_LOG(...) do { if (gOptions.adMetricsDebug()) DLOG(__VA_ARGS__); } while (0) - -protocol_HTTPClient::protocol_HTTPClient (protocol_HTTPStyle &hs, const streamData::streamID_t streamID, - const uniString::utf8 &hostName, const utf8 &addr, const uniString::utf8 &XFF) throw(std::exception) - : protocol_shoutcastClient (hs, streamID, hostName, addr, XFF, streamData::HTTP) -{ - setCallback (&protocol_shoutcastClient::state_AttachToStream); -} - - -protocol_HTTPClient::~protocol_HTTPClient() throw() -{ - cleanup("HTTP", gOptions.HTTPClientDebug(), false, true); -} - -////////////////////////////////////////////////////////////////////////////// - -void protocol_HTTPClient::timeSlice() throw(exception) -{ - int ret = doTimeSlice(); - if (ret == 1) - { - m_state = &protocol_HTTPClient::state_Stream; - return; - } - else if (ret == 2) - { - return; - } - - (this->*m_state)(); -} - - -void protocol_HTTPClient::setCallback (protocol_shoutcastClient::state_t callback, protocol_shoutcastClient::state_t next) -{ - m_state = callback ? callback : m_nextState; - m_nextState = callback ? next : NULL; -} - - -void protocol_HTTPClient::state_Close() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - m_result.done(); -} - -void protocol_HTTPClient::state_SendText() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(m_clientLogString + __FUNCTION__); -#endif - - if (sendText()) - { - m_metaIntervalCounter = 0; - m_state = m_nextState; - } -} - -// find the appropriate stream and try to attach to it -void protocol_HTTPClient::state_AttachToStream() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - int read_bitrate = 0, dataType = 0; - m_streamData = streamData::accessStream(m_streamID); - if (!m_streamData) - { - if (processReject("HTTP", bandWidth::CLIENT_HTTP_SENT, MSG_ICY_HTTP401, - MSG_ICY_HTTP401_LEN, &read_bitrate, &dataType)) - { - goto fall_through; - } - - m_state = &protocol_shoutcastClient::state_SendText; - m_nextState = &protocol_shoutcastClient::state_Close; - } - else - { -fall_through: - const utf8 movedUrl = gOptions.stream_movedUrl(m_streamID); - if (movedUrl.empty()) - { - const int add = processAdd("HTTP", bandWidth::CLIENT_HTTP_SENT, - MSG_ICY_HTTP401, MSG_ICY_HTTP401_LEN, movedUrl, - (m_streamData ? m_streamData->streamBackupServer() : "")); - if (add != 1) - { - m_state = &protocol_shoutcastClient::state_SendText; - m_nextState = &protocol_shoutcastClient::state_Close; - } - else - { - const bool isPodcast = (!m_streamData && (gOptions.getBackupLoop(m_streamID) == 1)); - m_OKResponse = MSG_ICY_HTTP200; - if (!isPodcast) - { - utf8 title = (m_streamData ? m_streamData->streamName() : gOptions.stream_backupTitle(m_streamID)); - if (!m_streamData) - { - if (!gOptions.read_stream_backupTitle(m_streamID)) - { - title = gOptions.backupTitle(); - } - - if (title.empty()) - { - title = gOptions.stream_backupFile(m_streamID); - if (!gOptions.read_stream_backupFile(m_streamID)) - { - title = gOptions.backupFile(); - } - - if (!title.empty()) - { - title = fileUtil::stripSuffix(fileUtil::stripPath(title)); - } - } - } - - m_OKResponse += "icy-name:" + title + "\r\n" - "icy-genre:"; - if (m_streamData) - { - for (int i = 0; i < 5; i++) - { - if (!m_streamData->m_streamInfo.m_streamGenre[i].empty()) - { - m_OKResponse += (i ? ", " : "") + m_streamData->m_streamInfo.m_streamGenre[i]; - } - } - } - else - { - m_OKResponse += "Misc"; - } - - m_OKResponse += "\r\n" - "icy-br:" + tos((m_streamData ? m_streamData->streamBitrate() : read_bitrate)) + "\r\n" + - "icy-sr:" + tos((m_streamData ? m_streamData->streamSampleRate() : 0)) + "\r\n" + - (m_streamData ? (m_streamData->streamIsVBR() ? "icy-vbr:1\r\n" : "") : ""); - } - - if (m_streamData) - { - m_OKResponse += "icy-url:" + m_streamData->streamURL() + "\r\n"; - - if (isUserAgentRelay(toLower(m_userAgent)) && (!m_streamData->allowPublicRelay())) - { - m_OKResponse += "icy-pub:0\r\n"; - } - else - { - m_OKResponse += "icy-pub:" + tos(m_streamData->streamPublic()) + "\r\n"; - } - - m_OKResponse += "content-type:" + m_streamData->streamContentType() + "\r\n"; - } - else - { - utf8 path = getStreamPath(m_streamID); - if (!path.empty() && path.find(utf8("/")) == 0) - { - path = path.substr(1); - } - - m_OKResponse += "Content-Type:" + utf8(dataType == AACP_DATA ? "audio/aacp" : "audio/mpeg") + "\r\n"; - - if (!isPodcast) - { - utf8 pub = toLower(gOptions.stream_publicServer(m_streamID)); - if (pub.empty()) - { - pub = toLower(gOptions.publicServer()); - } - if (pub == "always") - { - m_OKResponse += "icy-pub:1\r\n"; - } - else if (pub == "never") - { - m_OKResponse += "icy-pub:0\r\n"; - } - } - else - { - m_OKResponse += "Content-Disposition:attachment;filename=\"" + path + "\"\r\n" - "Content-Length:" + tos(m_backupFile.size()) + "\r\n"; - } - } - - if (gOptions.clacks()) - { - m_OKResponse += "X-Clacks-Overhead:GNU Terry Pratchett\r\n"; - } -//#define USE_CHUNKED -#ifdef USE_CHUNKED - m_OKResponse += "Transfer-Encoding:chunked\r\n\r\n"; -#else - m_OKResponse += "\r\n"; -#endif - DEBUG_LOG(m_clientLogString + "Sending [" + eol() + stripWhitespace(m_OKResponse) + eol() + "]"); - m_outBuffer = m_OKResponse.c_str(); - bandWidth::updateAmount(bandWidth::CLIENT_HTTP_SENT, (m_outBufferSize = (int)m_OKResponse.size())); - m_state = &protocol_shoutcastClient::state_SendText; - if (!m_headRequest) - { - m_nextState = &protocol_shoutcastClient::state_InitiateStream; - } - else - { - m_removeClientFromStats = false; - m_ignoreDisconnect = true; - m_nextState = &protocol_shoutcastClient::state_Close; - } - m_result.schedule(); - m_result.timeoutSID(m_streamID); - m_result.run(); - - // when the client is added, we get back the unique id of the connection - // but we now check for being > 0 as we need to filter out some of the - // YP connections from being counted as valid clients for stats, etc - reportNewListener("HTTP"); - } - } - else - { - // if we get to here then we attempt to redirect the clients to the moved url - // which is useful if the stream has moved hosting or it has been deprecated. - streamMovedOrRejected("HTTP", bandWidth::CLIENT_HTTP_SENT, movedUrl, 2); - m_state = &protocol_shoutcastClient::state_SendText; - m_nextState = &protocol_shoutcastClient::state_Close; - } - } -} - -void protocol_HTTPClient::state_SendIntro() throw(exception) -{ - state_SendIntroFile(); - if (m_introFile.empty()) - { - acquireIntroFile(); - if (m_introFile.empty()) - { - m_state = &protocol_shoutcastClient::state_Stream; - } - else - { - m_state = &protocol_shoutcastClient::state_SendIntroFile; - } - } -} - -void protocol_HTTPClient::state_InitiateStream() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - resetReadPtr(); - - if (!m_streamData || m_introFile.empty()) - { - // send intro file if we have it - acquireIntroFile(); - m_state = (m_introFile.empty() ? &protocol_shoutcastClient::state_Stream : &protocol_shoutcastClient::state_SendIntroFile); - } - else - { - m_state = &protocol_shoutcastClient::state_SendIntro; - } - - setW3CState(); - - m_result.run(); -} - - -void protocol_HTTPClient::return_403(void) -{ - protocol_shoutcastClient::return_403(); - m_state = &protocol_shoutcastClient::state_SendText; - m_nextState = &protocol_shoutcastClient::state_Close; -} diff --git a/Src/Plugins/DSP/sc_serv3/protocol_HTTPClient.h b/Src/Plugins/DSP/sc_serv3/protocol_HTTPClient.h deleted file mode 100644 index 3a20c999..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_HTTPClient.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once -#ifndef protocol_HTTPClient_H_ -#define protocol_HTTPClient_H_ - -#include "protocol_shoutcastClient.h" -#include - -class streamData; - -class protocol_HTTPClient: public protocol_shoutcastClient -{ -private: - - typedef void (protocol_HTTPClient::*state_t)(); - state_t m_state; - state_t m_nextState; - - void state_AttachToStream() throw(std::exception); - void state_Close() throw(std::exception); - void state_SendText() throw(std::exception); - void state_InitiateStream() throw(std::exception); - void state_SendIntro() throw(std::exception); - - virtual void timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "protocol_HTTPClient"; } - -public: - protocol_HTTPClient (protocol_HTTPStyle &hs, const streamData::streamID_t streamID, const uniString::utf8 &hostName, - const uniString::utf8 &addr, const uniString::utf8 &XFF) throw(std::exception); - - virtual ~protocol_HTTPClient() throw(); - - virtual void setCallback (protocol_shoutcastClient::state_t callback = NULL, protocol_shoutcastClient::state_t next = NULL); - - void return_403(void); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_HTTPSource.cpp b/Src/Plugins/DSP/sc_serv3/protocol_HTTPSource.cpp deleted file mode 100644 index cc0479fe..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_HTTPSource.cpp +++ /dev/null @@ -1,462 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include "protocol_HTTPSource.h" -#include "protocol_backup.h" -#include "streamData.h" -#include "global.h" -#include "base64.h" -#include "bandwidth.h" -#include "MP3Header.h" -#include "ADTSHeader.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define LOGNAME "SRC" -#define DEBUG_LOG(...) do { if (gOptions.HTTPSourceDebug()) DLOG(__VA_ARGS__); } while (0) - -protocol_HTTPSource::protocol_HTTPSource (microConnection &mc, const string &firstLine) throw(exception) : - runnable (mc), m_srcPort(mc.m_srcPort), m_srcAddr(mc.m_srcAddress) -{ - m_srcStreamID = DEFAULT_SOURCE_STREAM; - m_remainder = new __uint8[BUF_SIZE * 4]; - m_remainderSize = 0; - m_denied = false; - m_outBuffer = NULL; - m_outBufferSize = 0; - m_streamData = NULL; - m_state = &protocol_HTTPSource::state_GetLine; - m_nextState = &protocol_HTTPSource::state_AnalyzeHeaders; - - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - // to be able to do certain things later on - // we need to determine the stream from the - // mountpoint which is in the PUT request - string request, url, protocolAndVersion; - getHTTPRequestDetails(firstLine, request, url, protocolAndVersion); - - bool htmlPage = false; - m_srcStreamID = (int)streamData::getStreamIdFromPath(url, htmlPage); - if ((m_srcStreamID > 0) && (m_srcStreamID <= INT_MAX)) - { - // update the log message for the read stream number - m_srcLogString = srcAddrLogString (m_srcAddr, m_srcPort, m_srcStreamID); - - // if we have a moved stream then now we have the stream id - // then we need to check and block the source as applicable - utf8 movedUrl = gOptions.stream_movedUrl(m_srcStreamID); - - if (!movedUrl.empty()) - { - m_denied = true; - ELOG(m_srcLogString + "HTTP source rejected. Stream is configured as having moved."); - - m_outBuffer = MSG_STREAMMOVED; - bandWidth::updateAmount(bandWidth::SOURCE_V1_SENT, (m_outBufferSize = MSG_STREAMMOVED_LEN)); - m_state = &protocol_HTTPSource::state_SendBuffer; - m_nextState = &protocol_HTTPSource::state_CloseConnection; - return; - } - } - else - { - m_denied = true; - ELOG(m_srcLogString + "Bad Stream ID (" + tos(m_srcStreamID) + "). Stream ID cannot be below 1 or above 2147483647."); - - m_outBuffer = MSG_BADSTREAMID; - bandWidth::updateAmount(bandWidth::SOURCE_V1_SENT, (m_outBufferSize = MSG_BADSTREAMID_LEN)); - m_state = &protocol_HTTPSource::state_SendBuffer; - m_nextState = &protocol_HTTPSource::state_CloseConnection; - } -} - -protocol_HTTPSource::~protocol_HTTPSource() throw() -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - if (m_streamData) - { - streamData::streamSourceLost(m_srcLogString, m_streamData, m_srcStreamID); - m_streamData = 0; - } - - socketOps::forgetTCPSocket(m_socket); - forgetArray(m_remainder); - - if (!m_denied) - { - ILOG(m_srcLogString + "HTTP source disconnected."); - } -} - -void protocol_HTTPSource::state_AnalyzeHeaders() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - int maxHeaderLineCount = gOptions.maxHeaderLineCount(); - if ((int)m_headers.size() >= maxHeaderLineCount) - { - m_denied = true; - throwEx(m_srcLogString + "Max header lines exceeded"); - } - - m_lineBuffer = stripWhitespace(m_lineBuffer); - if (m_lineBuffer.empty()) - { - // adjust headers for titleFormat and urlFormat - utf8 titleFormat = gOptions.titleFormat(); - utf8 urlFormat = gOptions.urlFormat(); - if (!titleFormat.empty()) - { - utf8::size_type pos = titleFormat.find(utf8("%s")); - m_headers["ice-name"] = (pos == utf8::npos ? titleFormat : titleFormat.replace(pos,2,m_headers["ice-name"])); - } - - if (!urlFormat.empty()) - { - utf8::size_type pos = urlFormat.find(utf8("%s")); - m_headers["ice-url"] = (pos == utf8::npos ? urlFormat : urlFormat.replace(pos,2,m_headers["ice-url"])); - } - - // dump headers to log - if (gOptions.HTTPSourceDebug()) - { - for (map::const_iterator i = m_headers.begin(); i != m_headers.end(); ++i) - { - DEBUG_LOG(m_srcLogString + "Source client header [" + (*i).first + ":" + (*i).second + "]"); - } - } - - config::streamConfig stream; - const bool found = gOptions.getStreamConfig(stream, m_srcStreamID); - - if (!found && gOptions.requireStreamConfigs()) - { - m_denied = true; - throwEx(m_srcLogString + "HTTP source rejected. Stream " + - tos(m_srcStreamID) + " must be defined in config file"); - } - - // check that these bitrates are allowed (looking at both max and average values) - int streamMaxBitrate = 0, streamMinBitrate = 0; - const int bitrate = getStreamBitrate(m_headers) * 1000, - ret = gOptions.isBitrateDisallowed(m_srcStreamID, bitrate, streamMinBitrate, streamMaxBitrate); - if (ret) - { - m_denied = true; - utf8 mode = ((streamMaxBitrate == streamMinBitrate) ? "of" : (ret == 2 ? "up to" : "from")); - throwEx(m_srcLogString + "HTTP source rejected. Only bitrates " + mode + " " + - tos((ret == 1 ? streamMinBitrate : streamMaxBitrate) / 1000) + - " kbps are allowed - detected " + tos(bitrate / 1000) + " kbps."); - } - - m_streamData = streamData::createStream(streamData::streamSetup(m_srcLogString, m_srcAddr, - (found ? stream.m_authHash : ""), m_srcUserID, "", - stream.m_backupUrl.url(), streamData::HTTP, - m_srcStreamID, m_srcPort, stream.m_maxStreamUser, - stream.m_maxStreamBitrate, stream.m_minStreamBitrate, - stream.m_allowPublicRelay, false, getStreamSamplerate(m_headers), - mapGet(m_headers, "icy-vbr", (bool)false), m_headers)); - if (!m_streamData) - { - m_denied = true; - ELOG(m_srcLogString + "HTTP source rejected. A source is already connected."); - m_outBuffer = MSG_STREAMINUSE; - bandWidth::updateAmount(bandWidth::SOURCE_V1_SENT, (m_outBufferSize = MSG_STREAMINUSE_LEN)); - m_state = &protocol_HTTPSource::state_SendBuffer; - m_nextState = &protocol_HTTPSource::state_CloseConnection; - m_result.run(); - return; - } - - utf8 sourceIdent = mapGet(m_headers, "user-agent", utf8()); - m_streamData->updateSourceIdent(sourceIdent); - - m_outBuffer = MSG_HTTP_VALIDPASSWORD; - bandWidth::updateAmount(bandWidth::SOURCE_V1_SENT, (m_outBufferSize = MSG_HTTP_VALIDPASSWORD_LEN)); - m_state = &protocol_HTTPSource::state_SendBuffer; - m_nextState = &protocol_HTTPSource::state_GetStreamData; - m_result.run(); - } - else - { - // find the colon that divides header lines into key/value fields - utf8::size_type pos = m_lineBuffer.find(utf8(":")); - utf8 key = toLower(stripWhitespace(m_lineBuffer.substr(0, pos))); - if (pos == utf8::npos) - { - if (!key.empty() && ((key == "ice-name") || (key == "ice-url"))) - { - // allow through ice-name and ice-url if there is - // a titleformat and urlformat to use respectively - } - else - { - m_denied = true; - throwEx(m_srcLogString + "HTTP source connection rejected. " - "Bad header string [" + m_lineBuffer + "]"); - } - } - - utf8 value = stripWhitespace(m_lineBuffer.substr(pos+1)); - if (key.empty() || value.empty()) - { - if (!key.empty() && value.empty()) - { - if (key == "ice-genre") - { - value = "Misc"; - } - else if (((key == "ice-name") && !gOptions.titleFormat().empty()) || - ((key == "ice-url") && !gOptions.urlFormat().empty())) - { - // allow through ice-name and ice-url if there is - // a titleformat and urlformat to use respectively - } - else if (key == "ice-url") - { - value = "http://www.shoutcast.com"; - } - } - else - { - m_denied = true; - throwEx(m_srcLogString + "HTTP source connection rejected. " - "Bad header string [" + m_lineBuffer + "]"); - } - } - - if (!key.empty()) - { - if (key == "authorization") - { - if (!value.empty()) - { - utf8 password; - vector vauth = tokenizer(value, (utf8::value_type)' '); - // format " Basic xxxxxxxxx" - vector<__uint8> va = base64::decode((vauth.size() < 2 ? "" : vauth[1]).hideAsString().c_str()); - password.insert(password.end(), va.begin(), va.end()); - - utf8::size_type ppos = password.find((utf8)":"); - if (ppos != utf8::npos) - { - // we're looking to see if this is an updated 1.x source - // which is able to indicate the stream # for the stream - // so that we're able to support multiple 1.x sources so - // we need to parse the password and extract the parts - utf8 m_srcPassword = password; - extractPassword(m_srcPassword, m_srcUserID, m_srcStreamID); - - // as we are a v1 source then we must adhere to the master password - // instead of using a specific per stream password as in v2 streams - // though we also accept connections as sid=1 so check for that too - utf8 srcPassword = gOptions.stream_password(m_srcStreamID); - if (srcPassword.empty()) - { - srcPassword = gOptions.password(); - } - - if (m_srcPassword.empty() || (m_srcPassword != srcPassword)) - { - m_denied = true; - ELOG(m_srcLogString + "HTTP source connection denied" + (m_srcUserID.empty() ? "" : " for user (" + m_srcUserID + ")") + - ". " + (m_srcPassword.empty() ? "Empty password not allowed." : "Bad password: " + m_srcPassword)); - m_outBuffer = MSG_INVALIDPASSWORD; - bandWidth::updateAmount(bandWidth::SOURCE_V1_SENT, (m_outBufferSize = MSG_INVALIDPASSWORD_LEN)); - m_state = &protocol_HTTPSource::state_SendBuffer; - m_nextState = &protocol_HTTPSource::state_CloseConnection; - } - else - { - // if we've got a source already connected and it's not a backup - // then it's better that we just abort processing now than later - bool isSourceActive = false; - streamData *sd = streamData::accessStream(m_srcStreamID, isSourceActive); - if (sd && (isSourceActive == true) && (sd->isBackupStream(m_srcStreamID) == false)) - { - m_denied = true; - ELOG(m_srcLogString + "HTTP source rejected. A source is already connected."); - m_outBuffer = MSG_STREAMINUSE; - bandWidth::updateAmount(bandWidth::SOURCE_V1_SENT, (m_outBufferSize = MSG_STREAMINUSE_LEN)); - m_state = &protocol_HTTPSource::state_SendBuffer; - m_nextState = &protocol_HTTPSource::state_CloseConnection; - return; - } - else - { - ILOG(m_srcLogString + "HTTP source connection starting."); - } - - if (sd) - { - sd->releaseStream(); - } - } - } - else - { - // TODO need to send a valid rejection response for this - m_denied = true; - throwEx(m_srcLogString + "HTTP source connection rejected. " - "Bad header string [" + m_lineBuffer + "]"); - } - - } - else - { - m_denied = true; - throwEx(m_srcLogString + "HTTP source connection rejected. " - "Bad header string [" + m_lineBuffer + "]"); - } - } - } - m_headers[key] = value; - m_nextState = &protocol_HTTPSource::state_AnalyzeHeaders; - m_state = &protocol_HTTPSource::state_GetLine; - m_result.read(); - m_lineBuffer.clear(); - } -} - -void protocol_HTTPSource::timeSlice() throw(std::exception) -{ - try - { - if (m_streamData && m_streamData->isDead()) - { - m_result.done(); - return; - } - (this->*m_state)(); - } - catch(const exception &) - { - throw; - } -} - -void protocol_HTTPSource::state_SendBuffer() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - if (sendDataBuffer(m_srcStreamID, m_outBuffer, m_outBufferSize, m_srcLogString)) - { - m_state = m_nextState; - } -} - -void protocol_HTTPSource::state_GetLine() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - if (getHTTPStyleHeaderLine(m_srcStreamID, m_lineBuffer, m_srcLogString)) - { - m_state = m_nextState; - } -} - -void protocol_HTTPSource::state_GetStreamData() throw(exception) -{ - time_t cur_time; - - try - { - const int autoDumpTime = detectAutoDumpTimeout (cur_time, m_srcStreamID, (m_srcLogString + "Timeout waiting for stream data")); - - int bitrate = m_streamData->streamBitrate(); - const int type = m_streamData->streamUvoxDataType(); - while (true) - { - char buf[BUF_SIZE * 4] = {0}; - int amt = (BUF_SIZE - 1); - - // if we had anything left over then now we - // need to copy it back into the buffer and - // adjust the max data amount to be read in - if ((m_remainderSize > 0) && ((amt + m_remainderSize) <= (BUF_SIZE * 4))) - { - memcpy(buf, m_remainder, m_remainderSize); - } - else - { - m_remainderSize = 0; - } - - // adjust the position in the buffer based on the prior - // state of the remaining data as part of frame syncing - int rval = 0; - if ((rval = recv (&buf[m_remainderSize], (BUF_SIZE - 1), 0x0)) < 1) - { - if (rval < 0) - { - rval = socketOps::errCode(); - if (rval == SOCKETOPS_WOULDBLOCK) - { - m_result.schedule (80); - m_result.read(); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - return; - } - WLOG (m_srcLogString + "Socket error while waiting for data. " + socketErrString(rval), LOGNAME, m_srcStreamID); - } - else - DLOG (m_srcLogString + "Remote socket closed while waiting for data.", LOGNAME, m_srcStreamID); - throwEx (""); - } - - // update these details before we mess with anything - bandWidth::updateAmount(bandWidth::SOURCE_V1_RECV, rval); - - // if we're here then we account for what we already had in the total - // so that we then don't skip the new data read with the original data - rval += m_remainderSize; - m_remainderSize = 0; - amt = rval; - - if (m_streamData->syncToStream(m_remainderSize, m_remainder, amt, bitrate, - type, buf, m_srcLogString)) - { - m_denied = true; - throwEx(m_srcLogString + "HTTP source disconnected. " - "Unable to sync to the stream. Please check the " - "source is valid and in a supported format."); - } - - m_lastActivityTime = ::time(NULL); - } - } - catch (exception &e) - { - // if there was a failure, now see if we have a backup and attempt to run - // before we remove the current handling of the dropped source connection - vector backupInfo = gOptions.getBackupUrl(m_srcStreamID); - if (!backupInfo.empty() && !m_denied) - { - m_denied = true; - if (m_streamData) - { - m_streamData->clearCachedMetadata(); - streamData::streamSourceLost(m_srcLogString, m_streamData, m_srcStreamID); - m_streamData = 0; - } -#ifdef INCLUDE_BACKUP_STREAMS - ILOG (m_srcLogString + "HTTP source disconnected - trying source backup."); - threadedRunner::scheduleRunnable (new protocol_backup(backupInfo[0], getStreamBitrate(m_headers), - fixMimeType(m_headers["content-type"]))); -#endif - } - throw; - } -} - -void protocol_HTTPSource::state_CloseConnection() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - m_result.done(); -} diff --git a/Src/Plugins/DSP/sc_serv3/protocol_HTTPSource.h b/Src/Plugins/DSP/sc_serv3/protocol_HTTPSource.h deleted file mode 100644 index 82fe7256..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_HTTPSource.h +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once -#ifndef protocol_HTTPSource_H_ -#define protocol_HTTPSource_H_ - -#include "threadedRunner.h" -#include - -class streamData; - -/* - Runnable object that handles the shoutcast source (broadcaster) - protocol -*/ - -class protocol_HTTPSource : public runnable -{ -private: - const u_short m_srcPort; - short unsigned int m_remainderSize; - bool m_denied; // used to prevent source disconnected messages e.g. for failed passwords - // is a padding hole around here... - __uint8 * m_remainder; - const uniString::utf8 m_srcAddr; - uniString::utf8 m_srcLogString; - uniString::utf8 m_srcUserID; - int m_srcStreamID; - int m_outBufferSize; - const uniString::utf8::value_type *m_outBuffer; // for outgoing text lines - uniString::utf8 m_lineBuffer; // received ICY header line - httpHeaderMap_t m_headers; // the received source headers - streamData *m_streamData; // associated stream object - - typedef void (protocol_HTTPSource::*state_t)(); - - state_t m_state; - state_t m_nextState; - - void state_ConfirmPassword() throw(std::exception); - void state_SendBuffer() throw(std::exception); - void state_GetLine() throw(std::exception); - void state_AnalyzeHeaders() throw(std::exception); - void state_CloseConnection() throw(std::exception); - void state_GetStreamData() throw(std::exception); - -protected: - virtual void timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "protocol_HTTPSource"; } - -public: - protocol_HTTPSource (microConnection &mc, const string &firstLine) throw(std::exception); - - virtual ~protocol_HTTPSource() throw(); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_HTTPStyle.cpp b/Src/Plugins/DSP/sc_serv3/protocol_HTTPStyle.cpp deleted file mode 100644 index 23d7219f..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_HTTPStyle.cpp +++ /dev/null @@ -1,4808 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include -#include "protocol_HTTPStyle.h" -#include "protocol_shoutcast1Client.h" -#include "protocol_shoutcast2Client.h" -#include "protocol_HTTPClient.h" -#include "protocol_flvClient.h" -#include "protocol_m4aClient.h" -#include "protocol_admincgi.h" -#include "base64.h" -#include "banList.h" -#include "ripList.h" -#include "adminList.h" -#include "webNet/urlUtils.h" -#include "file/fileUtils.h" -#include "aolxml/aolxml.h" -#include "services/stdServiceImpl.h" -#include "global.h" -#include "bandwidth.h" -#include "updater.h" -#include "metadata.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define HEAD_REQUEST (m_httpRequestInfo.m_request == HTTP_HEAD) - -size_t gFF_fix = 0; - -CacheMap_t m_xmlStatsCache, m_xmlStatisticsCache, m_jsonStatsCache, - m_jsonStatisticsCache, m_7Cache, m_PLSCache, m_M3UCache, - m_ASXCache, m_QTLCache, m_XSPFCache, m_xmlTracksCache, - m_xmlMetadataCache, m_jsonMetadataCache, m_jsonTracksCache, - m_xmlPlayedCache, m_jsonPlayedCache, m_htmlPlayedCache, - m_streamArtCache, m_playingArtCache, m_crossdomainCache; - -AOL_namespace::mutex m_xmlStatsLock, m_xmlStatisticsLock, m_jsonStatsLock, - m_jsonStatisticsLock, m_7Lock, m_PLSLock, m_M3ULock, - m_ASXLock, m_QTLLock, m_XSPFLock, m_xmlTracksLock, - m_xmlMetadataLock, m_jsonMetadataLock, m_jsonTracksLock, - m_xmlPlayedLock, m_jsonPlayedLock, m_htmlPlayedLock, - m_streamArtLock, m_playingArtLock, m_crossdomainLock; - -#ifdef _WIN32 -typedef unsigned long in_addr_t; -#endif - -const utf8 getStreamHeader(const streamData::streamID_t sid, const utf8& headerTitle) -{ - return "" - "" - "Shoutcast Server" - "" - "" - "" - "
Shoutcast " + - headerTitle + "
" - "" - "Shoutcast Server v" + addWBR(gOptions.getVersionBuildStrings() + "/" SERV_OSNAME) + - "
" - "
 | 
"; -} - -const utf8 getStreamMiddlePlayingHeader(const streamData::streamID_t sid) -{ - return "" - "
 | 
"; -} - -const utf8 getStreamMiddleListenHeader(const streamData::streamID_t sid) -{ - return "" - "
 | 
"; -} - -const utf8 getStreamEndHeader(const streamData::streamID_t sid) -{ - return "
 | 
" - "
 | 
" - "
"; -} - -const bool getHideState(const streamData::streamID_t sid) -{ - const utf8 &hideStats = gOptions.getStreamHideStats(sid); - if (!hideStats.empty()) - { - return ((hideStats == "stats" || hideStats == "all")) && !(hideStats == "none"); - } - return false; -} - -#define DEBUG_LOG(...) do { if (gOptions.httpStyleDebug()) DLOG(__VA_ARGS__); } while (0) -#define LOGNAME "[HTTPSTYLE] " - -#define COMPRESS(header, body) if (m_compressed && compressData(body)) header += "Content-Encoding:gzip\r\n" - -const utf8 getNewVersionMessage(const utf8& ending) -{ - utf8 body = ""; - // display update message where applicable - updater::verInfo ver; - if (updater::getNewVersion(ver)) - { - body += "
" - "
New DNAS Version Available: " + ver.ver + "
" - "Please login or see here to find out more about the new DNAS version." - + (!ver.slimmsg.empty() ? "

" + ver.slimmsg : "") + "
" + ending; - } - return body; -} - -const utf8 getStreamPath(const size_t sid, const bool for_public) -{ - utf8 streamPath; - config::streamConfig stream; - if (gOptions.getStreamConfig(stream, sid)) - { - // if not empty then set to the value otherwise leave as /stream/ - if (!stream.m_urlPath.empty()) - { - // but ensure that a / is on the front if not manually specified - if (stream.m_urlPath[0] == '/') - { - streamPath = stream.m_urlPath; - } - else - { - streamPath = "/" + stream.m_urlPath; - } - - // this makes sure that if someone sets / or /stream/x/ then - // if we're asked for a 'public' url that we append the ';'. - if (for_public && (streamPath.rfind((utf8)"/") == streamPath.size() - 1)) - { - streamPath += ";"; - } - } - } - - if (streamPath.empty()) - { - if (!sid || (sid == DEFAULT_CLIENT_STREAM_ID)) - { - streamPath = (!for_public ? "/" : "/;"); - } - else - { - streamPath = "/stream/" + tos(sid) + (!for_public ? "/" : "/;"); - } - } - - return streamPath; -} - -protocol_HTTPStyle::protocol_HTTPStyle (microConnection &mc, const string &firstLine) throw(exception) : - runnable (mc), m_clientPort(mc.m_srcPort), m_clientHostName(mc.m_srcHostName), m_clientAddr(mc.m_srcAddress), m_clientLogString(dstAddrLogString(mc.m_srcHostName,mc.m_srcPort)) -{ - m_protocols = mc.m_protocols; - m_outBufferSize = 0; - m_outBuffer = NULL; - m_postRequest = 0; - m_compressed = 0; - m_postRequestLength = 0; - m_state = &protocol_HTTPStyle::state_GetLine; - m_nextState = &protocol_HTTPStyle::state_AnalyzeHTTPHeaders; - - // Parse the first line of the HTTP transaction into it's components - // (GET/POST etc, url, query etc.) and now is done first so we can - // abort the request asap if getting bad data instead of waiting to - // process the headers and then look at the actual HTTP request... - string request, url, protocolAndVersion; - const int state = getHTTPRequestDetails(firstLine, request, url, protocolAndVersion); - if (!request.empty()) - { - if (request == "GET") - { - m_httpRequestInfo.m_request = HTTP_GET; - } - else if (request == "POST") - { - m_httpRequestInfo.m_request = HTTP_POST; - m_postRequest = 1; - } - else if (request == "HEAD") - { - m_httpRequestInfo.m_request = HTTP_HEAD; - } - else - { - ELOG(m_clientLogString + "Badly formed HTTP request [" + firstLine + "]"); - sendMessageAndClose(MSG_HTTP405); - return; - } - } - else - { - ELOG(m_clientLogString + "Badly formed HTTP request [" + firstLine + "]"); - sendMessageAndClose(MSG_HTTP405); - return; - } - - if ((m_httpRequestInfo.m_request == HTTP_UNKNOWN) || - (state != 3) || url.empty() || protocolAndVersion.empty() || - (protocolAndVersion.find("/") == string::npos)) - { - ELOG(m_clientLogString + "Badly formed HTTP request [" + firstLine + "]"); - sendMessageAndClose(MSG_HTTP400); - return; - } - - // check for query data and finish up url - string::size_type pos = url.find("?"); - m_httpRequestInfo.m_url = urlUtils::unescapeString(url.substr(0, pos)); - - // provide a stripped version to speed up some of the checks - const utf8::size_type upos = m_httpRequestInfo.m_url.find(utf8("/")); - m_url = (((upos == 0) && m_httpRequestInfo.m_url.size() > 1) ? - m_httpRequestInfo.m_url.substr(upos + 1) : m_httpRequestInfo.m_url); - - // this is so we can do Icecast title updates which use - // a different path but will do a ?mode=updinfo request - if (m_url == "admin/metadata") - { - m_url = "admin.cgi"; - } - - string queryData = ""; - if (pos != string::npos) - { - queryData = url.substr(pos+1); - const vector queryTokens = tokenizer(queryData,'&'); - utf8 lastToken; - for (vector::const_iterator i = queryTokens.begin(); i != queryTokens.end(); ++i) - { - // this is for a specific case when we get xml titles - // and we need it to preserve the data instead of it - // tokenising and leaving broken xml for & cases - if (!lastToken.empty() && ((*i).find("amp;") == 0)) - { - m_httpRequestInfo.m_QueryParameters[lastToken] = m_httpRequestInfo.m_QueryParameters[lastToken] + - "&" + urlUtils::unescapeString((*i)); - // we don't want to process like normal so skip - continue; - } - pos = (*i).find("="); - if (pos == string::npos) - { - m_httpRequestInfo.m_QueryParameters[(lastToken = urlUtils::unescapeString(*i))] = ""; - } - else - { - m_httpRequestInfo.m_QueryParameters[(lastToken = urlUtils::unescapeString((*i).substr(0, pos)))] = - urlUtils::unescapeString((*i).substr(pos + 1)); - } - } - } - - if (gOptions.httpStyleDebug()) - { - DLOG(m_clientLogString + "HTTP Request [" + (m_httpRequestInfo.m_request == HTTP_GET ? "GET" : - (m_httpRequestInfo.m_request == HTTP_POST ? "POST" : - (HEAD_REQUEST ? "HEAD" : "UNKNOWN"))) + "]"); - DLOG(m_clientLogString + "HTTP Url [" + m_url + "]"); - if (!queryData.empty()) DLOG(m_clientLogString + "HTTP Query [" + queryData + "]"); - pos = protocolAndVersion.find("/"); - DLOG(m_clientLogString + "HTTP Protocol [" + protocolAndVersion.substr(0, pos) + "]"); - DLOG(m_clientLogString + "HTTP Version [" + protocolAndVersion.substr(pos + 1) + "]"); - } -} - -protocol_HTTPStyle::~protocol_HTTPStyle() throw() -{ - socketOps::forgetTCPSocket(m_socket); -} - -void protocol_HTTPStyle::timeSlice() throw(std::exception) -{ - (this->*m_state)(); -} - -void protocol_HTTPStyle::getPNGImage(const uniString::utf8 &png) throw() -{ - const utf8 &modified = mapGet(m_httpRequestInfo.m_HTTPHeaders, utf8("if-modified-since"),utf8("0")); - const time_t curTime = ::time(NULL), - readTime = readRFCDate(modified), - diffTime = (curTime - readTime); - - // check if we need to provide a copy or if we can just do a '304 Not Modified' response - if (!readTime || (diffTime > g_upTime) || (diffTime > 31536000)) - { - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:image/png\r\n" - "Access-Control-Allow-Origin:*\r\n" - "Cache-Control:private,max-age=31536000\r\n" - "Expires:" + getRFCDate(curTime + 31536000) + "\r\n" - "Last-Modified:" + getRFCDate(g_upTime) + "\r\n" - "Content-Length:" + tos(png.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? png : "")); - } - else - { - sendMessageAndClose("HTTP/1.0 304 Not Modified\r\n\r\n"); - } -} - -const utf8 protocol_HTTPStyle::getClientIP(const bool streamPublic, const utf8 &publicIP) throw() -{ - // test for potentially invalid IPs or ones that will cause the playlist link generation to fail - // attempting to use the server path provided by the YP if in public mode, otherwise uses 'host' - DEBUG_LOG(m_clientLogString + "streamPublic: " + tos(streamPublic) + " " + - "publicIP: " + publicIP + " " + "hostIP: " + m_hostIP + " " + - "clientAddr: " + g_IPAddressForClients); - return (!streamPublic || publicIP.empty() ? - ((g_IPAddressForClients.find(utf8("0.")) == 0 || - // allow localhost / loopback connections through for admin access - ((!g_IPAddressForClients.empty() && g_IPAddressForClients.find(utf8("127.")) == 0)) || - g_IPAddressForClients.empty()) && !m_hostIP.empty() ? - m_hostIP : (!m_hostIP.empty() ? m_hostIP : g_IPAddressForClients)) : publicIP); -} - -const bool isCDNMaster(const streamData::streamID_t sid) -{ - if (!gOptions.cdn().empty()) - { - // check if opt-in or opt-out - bool isCDN = (gOptions.cdn() == "always" || gOptions.cdn() == "master"); - // then if manually specifed, we override - if (gOptions.read_cdn_master(sid)) - { - const int master = gOptions.cdn_master(sid); - if (master != -1) - { - isCDN = (!!master); - } - } - return isCDN; - } - return false; -} - -const bool isCDNSlave(const streamData::streamID_t sid) -{ - if (!gOptions.cdn().empty()) - { - // check if opt-in or opt-out - // for 'master' we run opt-in - bool isCDN = (gOptions.cdn() == "always"); - // then if manually specifed, we override - if (gOptions.read_cdn_slave(sid)) - { - const int slave = gOptions.cdn_slave(sid); - if (slave != -1) - { - isCDN = (!!slave); - } - } - return isCDN; - } - return false; -} - -const bool protocol_HTTPStyle::isAdminAccessAllowed(const uniString::utf8 &hostIP, const uniString::utf8 &hostName) throw() -{ - int inAdminIp = g_adminList.find(hostIP), - inAdminName = inAdminIp; - - DEBUG_LOG(m_clientLogString + "Pre-check admin access - hostIP: " + - hostIP + ", hostName: " + hostName + ", " + "inAdminIp: " + - tos(inAdminIp) + ", inAdminName: " + tos(inAdminName)); - - // 1 if found, 0 if not, -1 if empty (assume allowed) - if (inAdminIp == -1) - { - // abort and just pass through if there's no list - return true; - } - - // in a lot of cases it will work out that - // hostIP and hostName are set as the same - // so only try if there is a difference... - if (!hostName.empty() && (hostIP != hostName)) - { - inAdminName = g_adminList.find(hostName); - } - - DEBUG_LOG(m_clientLogString + "Checking admin access - hostIP: " + - hostIP + ", hostName: " + hostName + ", " + "inAdminIp: " + - tos(inAdminIp) + ", inAdminName: " + tos(inAdminName)); - - // if either check matches then we will allow the - // request as the host might map to an allowed IP - // etc. is only if both don't match then we block - return (inAdminIp || inAdminName); -} - -const bool protocol_HTTPStyle::isAccessAllowed(const streamData::streamID_t sid, const utf8 &hostAddr = "", - const bool showOutput = false) throw() -{ - if (isUserAgentOfficial(m_userAgentLowered)) - { - return true; - } - - const utf8& addr = (hostAddr.empty() ? m_clientAddr : hostAddr); - const bool inBan = g_banList.find(addr,((gOptions.read_stream_banFile(sid) && !gOptions.stream_banFile(sid).empty()) ? sid : 0)); - const bool inRip = g_ripList.find(addr,((gOptions.read_stream_ripFile(sid) && !gOptions.stream_ripFile(sid).empty()) ? sid : 0)); - const bool isCDN = isCDNMaster(sid); - bool ripOnly = (isCDN ? true : gOptions.stream_ripOnly(sid)); - - if (!gOptions.read_stream_ripOnly(sid)) - { - ripOnly = (isCDN ? true : gOptions.ripOnly()); - } - - if (gOptions.httpStyleDebug()) - { - string host = m_clientAddr.hideAsString(); - if (gOptions.nameLookups()) - { - host = m_clientAddr.hideAsString(); - string addr = host; - u_short port = 0; - socketOps::getpeername(this->m_socket, addr, port); - - if (socketOps::addressToHostName(addr, port, host)) - { - host = addr; - } - - DEBUG_LOG(m_clientLogString + "Checking access rights - addr: " + addr + ", " + - "host: " + host + ", " + "inBan: " + tos(inBan) + ", " + "inRip: " + - tos(inRip) + ", " + "isCDN: " + tos(isCDN) + ", " + "ripOnly: " + tos(ripOnly)); - } - else - { - DEBUG_LOG(m_clientLogString + "Checking access rights - addr: " + addr + ", " + - "inBan: " + tos(inBan) + ", " + "inRip: " + tos(inRip) + ", " + - "isCDN: " + tos(isCDN) + ", " + "ripOnly: " + tos(ripOnly)); - } - } - - // check here if we're ok to try to provide the stream to the client or not - bool allowed = true; - if ((ripOnly || inBan) && (!inRip)) - { - allowed = false; - if (ripOnly) - { - // allow localhost / loopback connections through for admin access - if (!m_clientAddr.empty() && m_clientAddr.find(utf8("127.")) == 0) - { - allowed = true; - } - else - { - if (showOutput) - { - if (gOptions.nameLookups()) - { - string hostName = m_clientAddr.hideAsString(); - string addr = hostName; - u_short port = 0; - socketOps::getpeername(this->m_socket, addr, port); - - if (socketOps::addressToHostName(addr, port, hostName)) - { - hostName = addr; - } - - if (hostName != addr) - { - WLOG("[" + hostName + " (" + m_clientAddr + ") sid=" + tos(sid) + "] Host not in reserved list - disconnecting."); - } - else - { - WLOG("[" + m_clientAddr + " sid=" + tos(sid) + "] IP not in reserved list - disconnecting."); - } - } - else - { - WLOG("[" + m_clientAddr + " sid=" + tos(sid) + "] IP not in reserved list - disconnecting."); - } - - m_result.schedule(1000); - } - } - } - else - { - // allow loopback address through for admin access - if (!m_clientAddr.empty() && m_clientAddr.find(utf8("127.")) == 0) - { - allowed = true; - } - else - { - utf8::size_type pos; - if (!m_referer.empty() && (pos = m_referer.rfind(utf8("/admin.cgi"))) != utf8::npos) - { - allowed = true; - } - - if (showOutput && !(m_url == "index.css")) - { - allowed = false; - if (gOptions.nameLookups()) - { - string hostName = m_clientAddr.hideAsString(); - string addr = hostName; - u_short port = 0; - socketOps::getpeername(this->m_socket, addr, port); - - if (socketOps::addressToHostName(addr, port, hostName)) - { - hostName = addr; - } - - if (hostName != addr) - { - ILOG("[" + hostName + " (" + m_clientAddr + ") sid=" + tos(sid) + "] Host in banned list - disconnecting."); - } - else - { - ILOG("[" + m_clientAddr + " sid=" + tos(sid) + "] IP in banned list - disconnecting."); - } - } - else - { - ILOG("[" + m_clientAddr + " sid=" + tos(sid) + "] IP in banned list - disconnecting."); - } - - m_result.schedule(1000); - } - } - } - } - return allowed; -} - -const bool protocol_HTTPStyle::isViewingAllowed(const streamData::streamID_t sid, const utf8 &password, - const bool no_stream, bool &adminOverride, - const bool hide, bool &passworded) throw() -{ - adminOverride = false; - // when the hidestats option is enabled, still need to allow it on the admin page - if (m_referer.rfind(utf8("/admin.cgi")) != utf8::npos) - { - adminOverride = true; - } - - // do a password check if we've got a hidden page or if a password param is present - bool proceed = false; - - if ((hide == true) || (passworded == true)) - { - passworded = false; - if (!password.empty()) - { - utf8 streamPassword; - if (!no_stream) - { - streamPassword = gOptions.stream_password(sid); - if (!gOptions.read_stream_password(sid) && streamPassword.empty()) - { - streamPassword = gOptions.password(); - } - } - - utf8 streamAdminPassword = gOptions.stream_adminPassword(sid); - if (!gOptions.read_stream_adminPassword(sid) && streamAdminPassword.empty()) - { - streamAdminPassword = gOptions.adminPassword(); - } - - passworded = ((!streamPassword.empty() && (password == streamPassword)) || - (!streamAdminPassword.empty() && (password == streamAdminPassword))); - - if (hide) - { - proceed = passworded; - } - } - } - - return proceed; -} - -const bool protocol_HTTPStyle::findBaseStream(bool& no_sid, streamData::streamID_t& sid) -{ - // if no sid is specified, attempt to match to the only stream (v1 like behaviour) - // before just attempting to provide the results for the default stream id (sid=1) - if (no_sid) - { - bool htmlPage = false; - streamData::streamID_t found_sid = streamData::getStreamIdFromPath(m_httpRequestInfo.m_url, htmlPage); - if (found_sid > 0) - { - sid = found_sid; - no_sid = false; - } - - streamData::streamID_t lastSID = 0; - if (!found_sid && streamData::totalActiveStreams(lastSID) == (streamData::streamID_t)DEFAULT_CLIENT_STREAM_ID) - { - sid = lastSID; - return true; - } - } - return false; -} - -const bool protocol_HTTPStyle::getCachedResponse(cacheItem *item, AOL_namespace::mutex &lock, const int limit) -{ - utf8 response; - if (GetFromCache(item, lock, m_lastActivityTime, !!m_compressed, HEAD_REQUEST, response, limit)) - { - sendMessageAndClose(response); - return true; - } - return false; -} - -void protocol_HTTPStyle::sendCachedResponse(cacheItem *item, CacheMap_t &cache, AOL_namespace::mutex &lock, - uniString::utf8 &header, uniString::utf8 &body, - const streamData::streamID_t sid, - const bool jsonp, const bool noCompress) -{ - if (sid && !noCompress) - { - COMPRESS(header, body); - } - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - - const utf8 &response = (header + body); - if (!jsonp) - { - // if a callback is specified then is best to not cache - AddorUpdateCache(item, m_lastActivityTime, !!m_compressed, - header, response, cache, lock, sid); - } - sendMessageAndClose((!HEAD_REQUEST ? response : header)); -} - -// look at the HTTP intro line and headers and decide what to do next -void protocol_HTTPStyle::state_DetermineAction() throw(exception) -{ - utf8 relayHostIP, relayHostName, XFF; - - // figure out what to do next based on HTTP intro line and headers - // dump http headers to log - for (map::const_iterator i = m_httpRequestInfo.m_HTTPHeaders.begin(); i != m_httpRequestInfo.m_HTTPHeaders.end(); ++i) - { - DEBUG_LOG(m_clientLogString + "HTTP Header [" + (*i).first + ":" + (*i).second + "]"); - // grab the ip used for accessing to determine - // the ip to return in the listen action when - // destip has not been specified or is invalid - if ((*i).first == "host") - { - m_hostIP = (*i).second; - if (!m_hostIP.empty()) - { - // strip off the port from the ip though - // could just use it but want to ensure - // the correct port is used for it all - utf8::size_type pos = utf8::npos; - if ((pos = m_hostIP.find(utf8(":"))) != utf8::npos) - { - m_hostIP.resize(pos); - } - } - } - - // used specificially with the fire buuilds to be able to work around - // issues with the VIPs and what is checked against the reserved list - // -this gets the IP and also will resolve the hostname as applicable - else if ((*i).first == "icy-host") - { - relayHostIP = (*i).second; - if (gOptions.nameLookups()) - { - u_short port = 0; - string addr, hostName; - socketOps::getpeername(m_socket, addr, port); - hostName = relayHostIP.hideAsString(); - if (socketOps::addressToHostName(addr, port, hostName)) - { - hostName = relayHostIP.hideAsString(); - } - relayHostName = hostName; - } - } - - else if ((*i).first == "x-forwarded-for") - { - //utf8 blah = "129.78.138.66";//", 129.78.64.103"; - // this can be in the format of client - // or client, proxy1, proxy2, etc. and - // it can be open to spoofing so we'll - // see what complaints that will arise - if (!(*i).second.empty()) - { - utf8::size_type pos = utf8::npos; - if ((pos = (*i).second.find(utf8(","))) != utf8::npos) - { - utf8 tempAddr = (*i).second.substr(0, pos); - if (!tempAddr.empty()) - { - tempAddr = stripWhitespace(tempAddr); - in_addr_t ip = inet_addr((const char *)tempAddr.c_str()); - if (ip != INADDR_NONE) - { - XFF = tempAddr; - } - } - } - else - { - utf8 tempAddr = stripWhitespace((*i).second); - if (!tempAddr.empty()) - { - in_addr_t ip = inet_addr((const char *)tempAddr.c_str()); - if (ip != INADDR_NONE) - { - XFF = tempAddr; - } - } - } - } - } - - else if ((*i).first == "referer") - { - m_referer = (*i).second; - } - - else if ((*i).first == "accept-encoding") - { - utf8 encoding = (*i).second; - if (!encoding.empty()) - { - vector encodingTokens = tokenizer(stripWhitespace(encoding), ','); - for (vector::const_iterator i = encodingTokens.begin(); i != encodingTokens.end(); ++i) - { - utf8 value = stripWhitespace(*i); - if (value == "gzip") - { - m_httpRequestInfo.m_AcceptEncoding |= ACCEPT_GZIP; - m_compressed = 1; - } - else if (value == "deflate") - { - m_httpRequestInfo.m_AcceptEncoding |= ACCEPT_DEFLATE; - } - } - } - } - } - - // attempt to work out the streamid to use, keeping a track of things, etc - // - // for b195+ we recognise the sid from the password if - // its not provided as a specific parameter on the url - streamData::streamID_t sid = mapGet(m_httpRequestInfo.m_QueryParameters, "sid", -1), realSID = sid; - // with means in b72+ to do this based on the streampath instead of by sid - utf8 sp = mapGet(m_httpRequestInfo.m_QueryParameters, "sp", (utf8)""); - bool hasMount = false; - if (sp.empty()) - { - // this allows us to support icecast based title updates and on - // reflection would have been the better naming to use vs 'sp'. - sp = mapGet(m_httpRequestInfo.m_QueryParameters, "mount", (utf8)""); - hasMount = !sp.empty(); - } - if (!sp.empty()) - { - bool htmlPage = false; - // make sure there is a / on the front so that we're - // going to be able to search for a match correctly. - if (sp.find(utf8("/")) != 0) - { - sp = "/" + sp; - } - streamData::streamID_t found_sid = streamData::getStreamIdFromPath(sp, htmlPage); - if (found_sid > 0) - { - realSID = sid = found_sid; - } - } - - bool no_sid = ((int)sid <= 0); - // check that we've got a valid sid, otherwise force assume it's sid=1 i.e. helps for just /listen.pls - sid = ((sid >= DEFAULT_CLIENT_STREAM_ID) && !(no_sid && ((int)sid <= -1)) ? sid : DEFAULT_CLIENT_STREAM_ID); - - // this will better handle user agents which could have high bit code points - // so we attempt to convert the string to a hopefully valid utf8 encoded string - string agent = string(mapGet(m_httpRequestInfo.m_HTTPHeaders, "user-agent", (utf8)"").toANSI()); - m_userAgentLowered = toLower((m_userAgent = asciiToUtf8(agent))); - - if (isUserAgentRelay(m_userAgentLowered)) - { - bool allowRelay = gOptions.stream_allowRelay(sid); - if (!gOptions.read_stream_allowRelay(sid)) - { - allowRelay = gOptions.allowRelay(); - } - - if (!allowRelay && !(m_url == "admin.cgi")) - { - ILOG(m_clientLogString + "Relay not allowed: `" + m_userAgent + "'."); - sendMessageAndClose(MSG_HTTP403); - return; - } - } - - if ((m_userAgentLowered.find(utf8("rip")) != utf8::npos) || - (m_userAgentLowered.find(utf8("copy")) != utf8::npos)) - { - if (!(m_url == "admin.cgi")) - { - ILOG(m_clientLogString + "Stream savers not allowed."); - sendMessageAndClose(MSG_HTTP403); - return; - } - } - - utf8::size_type ipos = m_url.find(utf8("images/")); - if ((ipos == 0) || (m_url == "favicon.ico")) - { - utf8 url = (ipos == 0 ? m_url.substr(7) : m_url); - if (url == "favicon.ico") - { - const utf8 &modified = mapGet(m_httpRequestInfo.m_HTTPHeaders, utf8("if-modified-since"), utf8("0")); - const time_t curTime = ::time(NULL), - readTime = readRFCDate(modified), - diffTime = (curTime - readTime); - - // check if we need to provide a copy or if we can just do a '304 Not Modified' response - if (!readTime || (diffTime > gOptions.m_favIconTime) || (diffTime > 31536000)) - { - - const int g_favIconSize = 1150; - const uniString::utf8::value_type g_favIcon[] = { - "\x00\x00\x01\x00\x01\x00\x10\x10\x00\x00\x01\x00\x20\x00\x68\x04" - "\x00\x00\x16\x00\x00\x00\x28\x00\x00\x00\x10\x00\x00\x00\x20\x00" - "\x00\x00\x01\x00\x20\x00\x00\x00\x00\x00\x40\x04\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x14\x9a\xfd\x2f\x13\x95\xfe\x54\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x18\x98\xfd\x3d\x16\x98\xfd\xff\x15\x97" - "\xfd\xab\x11\x95\xfd\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x4c\xba\xfc\x02\x31\xa5\xfc\xa2\x1a\x9a" - "\xfd\xff\x16\x99\xfd\xea\x13\x95\xfd\x5a\x07\x7a\xfe\x01\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\xb4\xfb\x05\x46\xb2" - "\xfc\xb2\x28\xa0\xfb\xff\x16\x98\xfd\xff\x15\x98\xfd\xb0\x11\x93" - "\xfd\x1b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x46\xb5" - "\xfd\x09\x4b\xb7\xfd\xbf\x3a\xaa\xfb\xff\x1a\x98\xfc\xff\x16\x98" - "\xfd\xed\x14\x98\xfe\x60\x08\x81\xfe\x01\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13\x98" - "\xfd\x21\x1e\x9e\xfd\x82\x41\xb1\xfd\xfa\x49\xb4\xfc\xff\x28\x9e" - "\xfa\xff\x16\x97\xfd\xff\x15\x98\xfd\xb6\x10\x95\xfd\x1d\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x15\x98" - "\xfd\x48\x16\x98\xfd\xff\x19\x99\xfd\xff\x42\xb0\xfc\xff\x4d\xb7" - "\xfc\xff\x3a\xa9\xfa\xff\x1a\x97\xfb\xff\x14\x98\xf9\x8f\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x26\x99" - "\xf9\x17\x3a\xa8\xfa\xaf\x3d\xaa\xfa\xfe\x40\xad\xfb\xff\x3d\xac" - "\xfb\xff\x4d\xb7\xfc\xff\x49\xb4\xfc\xf6\x24\x97\xf5\x6c\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x4a\xb5\xfd\x48\x4c\xb7\xfc\xd7\x1f\x97" - "\xf9\xff\x36\xa7\xfa\xff\x19\x9a\xfd\xc8\x0e\x92\xfe\x0c\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x2d\xac\xfd\x07\x1e\x98" - "\xfa\xd6\x4c\xb6\xfc\xf1\x27\x9d\xfa\xff\x15\x97\xfd\xbe\x10\x9a" - "\xfd\x0a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12\x90" - "\xfa\x8d\x4a\xb5\xfc\x1b\x4a\xb6\xfc\xa4\x29\xa0\xfb\xfd\x15\x97" - "\xfd\xb6\x10\x94\xfd\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11\x8e" - "\xf9\x6c\x00\x00\x00\x00\x00\x00\x00\x00\x49\xb6\xfc\x3d\x27\xa1" - "\xfc\xce\x15\x97\xfd\x25\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x2d\x2d\x2d\x02\x2e\x2e\x2e\x08\x0f\x8c" - "\xfa\x4a\x2a\x2a\x2a\x09\x00\x00\x00\x00\x00\x00\x00\x00\x45\xb4" - "\xf8\x04\x13\x92\xf7\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x36\x36\x36\x29\x2f\x2f\x2f\x2d\x0e\x7f" - "\xe7\x2e\x31\x31\x31\x38\x33\x33\x33\x21\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x35\x35\x35\x33\x31\x31\x31\x50\x23\x55" - "\x85\x38\x32\x32\x32\x4d\x33\x33\x33\x21\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x2b\x2b\x2b\x02\x34\x34\x34\x4d\x35\x35" - "\x35\x60\x32\x32\x32\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xcf\xff" - "\x00\x00\xc3\xff\x00\x00\xc0\xff\x00\x00\xe0\x7f\x00\x00\xf0\x1f" - "\x00\x00\xf0\x0f\x00\x00\xf0\x0f\x00\x00\xf0\x0f\x00\x00\xfc\x0f" - "\x00\x00\xfe\x07\x00\x00\xff\x03\x00\x00\xff\x63\x00\x00\xfc\x33" - "\x00\x00\xfc\x1f\x00\x00\xfc\x1f\x00\x00\xfc\x3f\x00\x00" - }; - - const int g_favIconSizeGZ = 498; - const uniString::utf8::value_type g_favIconGZ[] = { - "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03\x63\x60\x60\x04\x42\x01" - "\x01\x06\x20\xa9\xc0\x90\xc1\xc2\xc0\x20\xc6\xc0\xc0\xa0\x01\xc4" - "\x40\x21\xa0\x08\x44\x1c\x04\x1c\x58\x18\x70\x02\x91\x59\x7f\xf5" - "\x85\xa7\xfe\x0b\xc1\xad\x02\x3f\x90\x98\xf1\xd7\x56\x6c\xc6\xdf" - "\xff\xa2\xd3\xff\xae\x16\x9c\xfa\x57\x9c\x54\xfd\x3e\xbb\xfe\x30" - "\x19\x2e\xfd\xb3\x48\x6a\xd6\xdf\xff\x62\x33\xff\xbe\x12\x9e\xfa" - "\x37\x8a\xbd\xea\x1f\x23\x29\x66\xb8\x6c\xf9\xcd\xea\xb6\xe9\xcf" - "\x26\x8d\x05\xbf\xff\x83\xdd\x32\xe3\xef\x06\xc1\xc9\x7f\xa5\x49" - "\x31\xc3\x6d\xeb\x5f\x4e\xef\xed\x7f\xf7\x5b\xad\xfa\xfd\x5f\x6a" - "\xc6\x1f\x90\x39\x6f\x45\x66\xfc\x4b\xe0\x68\x24\xce\x2d\xc2\x33" - "\xfe\x2a\xca\xcd\xfb\xdb\xe4\xb8\xf1\xef\x2f\xcf\x2d\x7f\xfe\x6b" - "\xcc\xfb\xf5\x5f\x6c\x3a\xd8\x2d\xdb\x04\xa6\xfe\x95\x25\xa4\x1f" - "\xa8\xce\x03\xe4\x76\xc9\x99\x7f\xff\x3b\x6d\xf8\xf3\xdf\x77\xfb" - "\x9f\xff\x56\x2b\x7f\xfd\x97\x9a\xfe\xfb\xbf\xc8\x8c\x9f\xfd\x84" - "\xf4\xab\xcd\xfc\x29\x6e\xb5\xe2\xd7\x7a\xdb\x55\xbf\xfe\x39\xac" - "\xfd\xfd\xdf\x76\xcd\x6f\xb0\x19\x40\xb7\x7c\x53\x99\xfe\x35\x87" - "\x18\x3f\x80\x80\xd7\xd6\xbf\x1e\x3e\xdb\xff\x5c\x97\x9f\xfe\xf3" - "\xbf\xd9\xf2\x5f\xff\x25\x67\xfd\x3d\xc1\x37\xe9\x1f\x0f\xb1\xfa" - "\x41\x40\x77\xcd\x5f\x76\xb9\x19\xbf\xae\xf9\x6c\xfb\xf3\x51\x7d" - "\xee\x2f\x50\xda\xd8\x27\x30\xeb\x2f\x17\x29\x66\x08\x4d\xf8\xd5" - "\xeb\xb5\xf5\x8f\xb4\xd7\xb6\x3f\x4b\x34\x17\xfc\xfe\x0b\x34\x63" - "\x9b\xc0\x94\xbf\x6c\xc4\xea\x17\xec\xfb\x09\xf7\xb3\xe7\xb6\x3f" - "\xb6\xea\x0b\xff\x9c\x03\x9a\xa1\x4a\xd0\xed\xba\xba\x4c\x7a\x7a" - "\x7a\x1c\xfc\x3d\xbf\xbc\xb4\xb4\xb4\x38\x61\xe2\xae\x5b\x7e\xb0" - "\x08\x4f\xfa\x4e\xd0\x7e\x33\x33\x33\x4d\x7d\x7d\x7d\x5d\xbe\xfa" - "\xe7\x7a\x86\x86\x86\x16\xc6\xc6\xc6\x8a\xc4\xba\x19\x04\x4c\x4d" - "\x4d\x8d\x81\xfa\x02\x94\x43\x5b\x2d\x8c\x8c\x8c\x7c\x49\xd5\xaf" - "\xad\xad\xcd\x64\x62\x62\xe2\x0b\x34\x27\x01\xa8\xdf\x01\x97\xba" - "\xf3\xff\x19\x18\x0e\x03\xf1\x01\x20\x7e\x50\xcf\xc0\xf0\x41\x1e" - "\x88\xf9\x11\xf8\x0f\x10\xff\x63\x67\x60\xf8\xcf\x0c\xc4\xc9\x40" - "\xbe\x31\x10\xcb\x43\xb1\x3d\x03\x03\x00\x34\x69\x3c\x26\x7e\x04" - "\x00\x00" - }; - - const time_t modTime = (!gOptions.m_favIconTime ? (gOptions.m_favIconTime = curTime) : gOptions.m_favIconTime); - utf8 header = "HTTP/1.0 200 OK\r\n" - "Access-Control-Allow-Origin:*\r\n" - "Content-Type:" + gOptions.faviconFileMimeType() + "\r\n" - "Content-Length:" + tos((m_compressed ? g_favIconSizeGZ : g_favIconSize)) + "\r\n" - + (m_compressed ? "Content-Encoding:gzip\r\n" : "") + - "Cache-Control:private,max-age=31536000\r\n" - "Expires:" + getRFCDate(::time(NULL) + 31536000) + "\r\n" - "Last-Modified:" + getRFCDate(0) + "\r\n\r\n", - body = (m_compressed ? utf8(g_favIconGZ,g_favIconSizeGZ) : utf8(g_favIcon,g_favIconSize)); - - if(gOptions.faviconFile() == "") - { - } - else - { - if (gOptions.m_faviconBody.empty()) - { - body = loadLocalFile(fileUtil::getFullFilePath(gOptions.faviconFile())); - if (!body.empty()) - { - gOptions.m_faviconBodyGZ = gOptions.m_faviconBody = body; - - gOptions.m_faviconHeader = "HTTP/1.0 200 OK\r\n" - "Content-Type:" + gOptions.faviconFileMimeType() + "\r\n" - "Content-Length:" + tos(body.size()) + "\r\n" - "Cache-Control:private,max-age=31536000\r\n" - "Expires:" + getRFCDate(curTime + 31536000) + "\r\n" - "Last-Modified:" + getRFCDate(modTime) + "\r\n\r\n"; - - if (compressData(gOptions.m_faviconBodyGZ)) - { - gOptions.m_faviconHeaderGZ = "HTTP/1.0 200 OK\r\n" - "Content-Type:" + gOptions.faviconFileMimeType() + "\r\n" - "Content-Length:" + tos(gOptions.m_faviconBodyGZ.size()) + "\r\n" - "Cache-Control:private,max-age=31536000\r\n" - "Content-Encoding:gzip\r\n" - "Expires:" + getRFCDate(curTime + 31536000) + "\r\n" - "Last-Modified:" + getRFCDate(modTime) + "\r\n\r\n"; - } - else - { - gOptions.m_faviconHeaderGZ.clear(); - } - } - else - { - body = MSG_HTTP404; - } - } - - if (!gOptions.m_faviconBody.empty()) - { - // make sure there is a gzipped version available to send if signalled as supported - if (m_compressed && !gOptions.m_faviconBodyGZ.empty()) - { - body = gOptions.m_faviconBodyGZ; - header = gOptions.m_faviconHeaderGZ; - } - else - { - body = gOptions.m_faviconBody; - header = gOptions.m_faviconHeader; - } - } - } - - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); - } - else - { - sendMessageAndClose("HTTP/1.0 304 Not Modified\r\n\r\n"); - } - return; - } - else if (url == "listen.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x16\x00\x00\x00\x0D\x08\x04\x00\x00\x00\x07\xAC\x56" - "\xE8\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC3\x00\x00\x0E" - "\xC3\x01\xC7\x6F\xA8\x64\x00\x00\x01\x2A\x49\x44\x41\x54\x28\xCF" - "\x63\xF8\xC7\x88\x05\xBA\x82\x21\xF3\x3F\xAD\x5F\x13\x9E\x4F\x7D" - "\x33\xF9\x9F\xF2\x3F\x1E\x90\x38\x03\x16\xA5\xE9\xFF\xFE\xEF\xFA" - "\xFF\xEF\xFF\x3F\x96\x4F\x3A\xC7\xF6\xA4\xBD\xBB\x76\xF7\xE3\xAD" - "\x7F\x1A\x20\xE5\x98\x8A\x3B\xFF\xFD\x9F\xF1\x9F\x01\xA4\xD8\xF0" - "\xBD\xF1\xB9\x5D\x1E\x9F\x95\x7E\x5E\xBC\xF7\x76\xDD\x3F\x41\x54" - "\xC5\xAB\xC1\xF0\x7F\x19\x50\x29\x48\xF1\xB7\xA5\xBB\xB6\x3E\xDF" - "\xF2\xEA\x76\xE4\xCF\xA0\x5F\x6F\x3F\xFE\xD3\xFE\xC7\x8F\xAC\xF8" - "\x7F\x08\x18\x32\x40\x15\x9F\x5F\xEF\xF5\xD4\xF3\xE9\x8B\x3D\xD7" - "\x3F\xF1\xFF\xBB\xF8\xE9\x6E\x1E\x9A\x62\x06\x24\xF8\xF7\xFF\xCB" - "\x15\x4F\xF6\x58\xBC\x9A\x7D\xEE\xF5\x47\xD7\xDF\x53\xBF\x3D\x6A" - "\xC0\xAB\xB8\x5E\xED\xED\xD1\xDC\x87\xA5\xF7\x5F\xEE\xF3\x79\x56" - "\x74\x8B\x80\xE2\x57\x5D\x4F\x8E\x1B\x7E\x58\x78\xE5\xF5\x17\xE7" - "\x3F\x33\x7E\x60\x28\x46\x75\xF3\x8B\xEE\xCC\x47\xC1\xCF\x5F\x1D" - "\x3B\xF3\x95\xE7\xDF\xA5\xAF\x77\x73\x51\x15\xA3\x85\xC6\x9F\xD6" - "\xB3\x2B\x5E\xEE\x7E\x71\xD1\xED\x4F\xEE\xAF\xF7\x5F\xD0\x43\x03" - "\x3D\x9C\x15\x7F\x68\x9F\x3B\x68\xF7\x51\xEB\xEB\x8D\xCB\xAF\xA7" - "\xFC\xE3\xC7\x1F\x83\xCC\x9F\x74\x4E\x1C\xCE\x7C\x71\xE3\xF2\xA7" - "\xF3\xFF\x14\xB0\xC7\x20\x6A\xDA\xE8\x7A\xD6\xFF\xAA\x0F\xA8\x94" - "\x0B\x24\x0E\x00\x69\xB1\x67\x35\x8E\x65\x16\x39\x00\x00\x00\x00" - "\x49\x45\x4E\x44\xAE\x42\x60\x82", 376); - getPNGImage(png); - } - else if (url == "history.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x0D\x00\x00\x00\x0F\x08\x04\x00\x00\x00\x95\x2A\x8D" - "\xFC\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0B\x12\x00\x00\x0B" - "\x12\x01\xD2\xDD\x7E\xFC\x00\x00\x00\xA5\x49\x44\x41\x54\x18\xD3" - "\x6D\x90\xA1\x12\xC3\x20\x0C\x86\x79\x84\x49\xEC\xE4\x64\x65\xED" - "\x24\x72\x72\x76\xB2\xB2\x72\xB6\xB2\xB2\x12\x5B\x89\x9C\x9C\xED" - "\x23\x20\x79\x95\x7F\x3F\xA1\x39\x22\xC6\x77\x90\xE3\xBE\x4B\x02" - "\x71\x01\x16\x8F\x19\x4E\x57\xE0\xA5\x73\xC3\xD8\x65\xC0\x62\x18" - "\x28\xEE\x2A\x03\x36\xC3\x20\x78\x55\xBB\x21\x09\x93\xAA\x0F\x59" - "\xF1\x34\x31\xA8\x3A\x58\xE8\xC5\x5D\x63\x64\xCE\x17\x0F\x55\x91" - "\x05\x22\xB2\xC4\x84\x0B\xCF\xB5\xF7\x9A\xB8\xB3\xC4\xC4\x27\x78" - "\x16\x2D\x10\x95\x4D\xDE\x8E\xAB\x30\x57\x59\x7B\xB5\x6E\x35\x26" - "\x7E\xBA\x71\xE0\x7C\x61\xA7\xFD\xEC\xDD\xB2\x2C\x1B\x07\x35\xB2" - "\x7C\xE9\x93\xD4\x75\x70\x4C\xCB\x3F\xE1\x5C\x61\x0F\x15\x3F\x46" - "\x11\xE5\xA0\x02\x5A\xBC\xC7\x00\x00\x00\x00\x49\x45\x4E\x44\xAE" - "\x42\x60\x82", 243); - getPNGImage(png); - } - else if (url == "lock.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x08\x00\x00\x00\x0B\x08\x04\x00\x00\x00\xE8\x92\x04" - "\xAE\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC3\x00\x00\x0E" - "\xC3\x01\xC7\x6F\xA8\x64\x00\x00\x00\x81\x49\x44\x41\x54\x08\xD7" - "\x8D\xC8\x3D\x0E\x82\x40\x10\x86\xE1\xA1\xB1\xF2\xAF\x30\xA1\xE0" - "\x4A\xD6\x34\x9E\x80\xD6\x0A\xAD\x37\x14\x34\x44\xAF\xA0\xD7\xD2" - "\x1B\xD0\xC1\xEE\xB7\xCC\x30\xC3\x96\xD8\x99\xA7\x79\xF3\x92\x66" - "\x52\xA2\xF7\x09\x7A\x29\x35\xA3\xB9\x80\x7F\xC7\x5C\x73\x7D\x01" - "\xC3\x5C\x10\x57\xDF\x70\xB0\x2B\xDF\xA6\xA3\x7E\x46\xAE\x88\xDD" - "\x73\x3A\x0B\x3C\x86\x0B\x3F\xC0\x8E\x10\x6B\xB9\x0B\x80\xD0\x4A" - "\x2D\x88\xD4\xD9\xD6\x76\x76\x4A\xF6\xA9\x3A\x23\x67\x9B\x15\xF7" - "\xCF\x68\x7E\x46\x63\x14\x6C\x5C\x09\xB6\x00\x7C\x27\x7A\xE3\x33" - "\xC6\x13\x8C\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 207); - getPNGImage(png); - } - else if (url == "streamart.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x0D\x00\x00\x00\x0E\x08\x04\x00\x00\x00\x5E\x76\x5E" - "\x59\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x00\x77\x49\x44\x41\x54\x18\xD3" - "\x75\x90\x3B\x01\xC0\x20\x0C\x44\x4F\x02\x16\x90\x50\x0B\xC8\xA8" - "\x85\x4A\xE8\xDA\x11\x09\x58\x40\x42\x57\x64\xC4\xCA\xEB\x40\x7F" - "\x14\x9A\x6C\x79\xB9\x24\x17\xA9\x0B\x23\x30\xA3\x51\x04\x84\x7E" - "\x20\x62\xC1\xFE\x50\x46\x92\xE1\x99\x48\x18\x85\x42\x22\x52\x55" - "\x92\x0A\x1A\xA7\x64\x43\xE0\xB9\x67\x7F\x33\x57\xE4\x3A\xB0\xF1" - "\xF2\xE1\x09\x37\x88\xCF\xD9\x19\x91\xB8\xB6\x2E\x34\x8F\x71\xD7" - "\x6C\xAD\xEC\xAD\xD5\x48\x38\x0B\x5B\xAB\xAA\xB0\x76\x97\xD7\x83" - "\x0E\xF0\x9F\x7B\xB8\x7B\x95\x61\x07\x00\x00\x00\x00\x49\x45\x4E" - "\x44\xAE\x42\x60\x82", 197); - getPNGImage(png); - } - else if (url == "playingart.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x0D\x00\x00\x00\x0E\x08\x04\x00\x00\x00\x5E\x76\x5E" - "\x59\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x00\x77\x49\x44\x41\x54\x18\xD3" - "\x75\x90\x41\x15\x80\x20\x10\x44\x27\x02\x15\x88\x60\x05\x62\x58" - "\x81\x08\x5E\x3D\x12\x81\x0A\x46\xF0\x4A\x0C\xAA\x7C\x0F\x08\x28" - "\xE2\xCE\x69\xF7\xBF\x79\xB3\xBB\x92\x56\x1C\x19\x7D\x6B\x45\x08" - "\x37\x43\x19\x8F\xD0\x0C\x49\xC7\x3F\x2A\xAE\x40\x24\x91\xC8\x44" - "\x16\xEC\x9D\xCE\x4C\x09\x49\x76\x8A\x32\x3D\x6B\x54\xA9\xFD\x03" - "\x4C\x5F\x2B\xB4\xA1\xC3\x8E\x77\xFA\x96\x10\x11\xC7\x13\x9D\x6C" - "\xD4\x3B\xCD\xFB\x71\x9E\xFD\x6E\x1D\x81\xE1\x61\x89\xE2\xAE\xE0" - "\x02\xE8\xCB\x7B\xB8\xAB\x17\xF7\x85\x00\x00\x00\x00\x49\x45\x4E" - "\x44\xAE\x42\x60\x82", 197); - getPNGImage(png); - } - else if (url == "noadavail.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC1\x00\x00\x0E" - "\xC1\x01\xB8\x91\x6B\xED\x00\x00\x02\x66\x49\x44\x41\x54\x38\xCB" - "\x63\xF8\xFF\xFF\x3F\x03\x0A\x66\x60\xD0\x00\xE2\x66\x20\xDE\x0C" - "\xC4\xAF\x81\xF8\x31\x10\xAF\x07\xE2\x1A\xB0\x1C\x9A\x7A\x74\xCD" - "\x39\x40\xFC\x19\x2C\x8C\x1D\x7F\x07\xE2\x02\xEC\x06\x30\x30\x6C" - "\x87\x29\xFC\xCA\xC0\xB0\x6E\x29\xBF\x40\xC7\x82\xBE\xCA\x9B\xAB" - "\xA6\x57\x3F\x9C\x2F\x21\x32\xF9\x33\x03\xC3\x62\x24\x83\x40\x6A" - "\x59\x10\x06\x40\x6C\x06\x73\xFF\x30\x30\xBC\x2D\xF3\x70\x4A\xCF" - "\x2E\x4E\x9B\xB3\xFE\xF0\x82\x77\xDB\x4E\xCE\xFB\x94\x53\x9B\xBC" - "\x36\x30\xDA\x2B\xF6\x14\x1F\x4F\x18\x50\xCD\x73\xA8\xDA\x12\x88" - "\x01\x10\x3F\x83\x9D\xFD\x9B\x81\xE1\x3A\x88\x7E\xA8\xAD\xF2\x7A" - "\xDA\xB2\xCE\x5B\xBB\xCF\x2C\xF9\x7A\xF0\xCA\xC2\x5F\x53\xD6\x36" - "\xBF\xEA\x98\x5B\x71\x38\x3C\xCD\x2F\xEE\x36\x2B\x8B\x0F\x92\x77" - "\x34\x18\xA0\x01\x06\x12\x58\x3E\x5B\x5E\xDE\xE9\x17\x2B\xCB\x4F" - "\x10\x7F\x8F\x87\xE5\xD1\x45\xBB\xFA\x1F\x2E\x39\xD8\xF8\x21\xAD" - "\x21\xEE\x40\xF5\xB4\xEC\x4B\xA1\x39\xBE\x13\x54\x0D\x55\x95\x80" - "\xF2\xD3\xA1\x7A\x6A\x18\xA0\xA1\x0D\x72\x7A\xA0\x95\xAD\x95\xC6" - "\x4E\x37\xAB\x43\x20\xFE\x5F\x46\xC6\x7F\x3B\x0B\xFD\xDE\x77\x6C" - "\x8C\x7F\xA1\xED\xA8\x5F\xE6\x91\xE4\x98\x68\xE1\x67\x16\x2C\xAB" - "\x25\x2F\x06\x94\x87\xB9\x62\x3D\x03\x34\xAA\x40\x1C\x19\x19\x45" - "\x79\x7E\xC7\x70\xFB\xA4\x43\xD6\xCA\x30\xB1\xFF\xFB\xE2\x8C\xFE" - "\xC4\x77\x07\x5F\x30\x0D\xB3\x6C\x10\x51\x92\x52\xE7\xE4\xE3\x66" - "\x06\x8A\x8B\x40\xE5\x1F\xA3\x18\xA0\xA0\xA5\xCC\x24\xAD\x26\xC7" - "\x2B\xAC\x2C\x6B\xB3\x5C\x51\xFC\x10\xCC\x90\x93\x1E\x1A\xBF\xAB" - "\x16\x47\xBF\x0A\x28\x72\xE9\x53\x31\x51\x96\x43\x37\x00\xEE\x05" - "\x03\x3B\x23\x59\xBF\x0C\xDF\xE4\x90\xC2\xC0\x34\x2D\x4B\x6D\xD3" - "\xCD\xE9\xEE\x0F\xFF\x30\x31\x82\x0D\xB9\xAC\x2F\xF5\x25\xAD\x37" - "\xF0\x90\x55\x98\xA9\x19\x30\xB0\x3D\x91\xBD\x00\x0B\xC4\xD9\x56" - "\x1E\x56\x86\x89\x0D\xD1\x1B\x73\xA7\x26\x5D\x0B\x2F\x0F\x68\x6D" - "\x5C\x59\x76\x77\x6E\xB1\xC3\xC7\x9F\xCC\x4C\xBF\x41\x6A\xEE\x49" - "\xF1\xBF\x8C\xB7\x56\xB5\x00\xB2\xFB\x91\x03\x51\x03\x1A\x25\xFF" - "\xCF\x71\x73\x06\x7B\xA5\xBA\x96\x24\x74\x84\x9C\x4C\xEB\x8B\xB9" - "\xD1\xB0\xB6\xE8\x6B\xD9\xCA\xA4\x9F\x0D\xF9\x2E\xCF\x3F\x71\xB1" - "\xFD\x02\xA9\xF9\xC5\xC0\x70\x15\x48\xFF\x46\x44\x23\x24\x21\x15" - "\x40\x4D\x7C\xBE\x97\x8F\x2B\xDA\x22\xD0\x34\xCE\x3D\xCD\x79\x7E" - "\xE6\xEC\xF8\x77\x59\x73\xE2\x3E\x7A\xE6\xBA\xAE\x2D\xB4\x51\x2B" - "\x04\x3A\xFD\x09\x50\xCD\x3F\xD4\x84\x84\x25\x29\x7F\x02\x7A\x67" - "\x36\x1F\x77\x5B\x52\x89\xFB\xF5\xF4\x4A\xEF\xFB\x93\xC5\x04\xBA" - "\x3F\x30\x32\xCC\x80\xDA\x0C\x52\xB3\x1B\x35\x29\x43\x0C\x60\x01" - "\x9B\x0A\xF5\x0E\x9E\xCC\x54\x02\xD3\x8C\x99\x1B\xC9\xC8\xCE\x00" - "\x29\x75\xE7\x5B\x81\xE0\xCE\xEC\x00\x00\x00\x00\x49\x45\x4E\x44" - "\xAE\x42\x60\x82", 692); - getPNGImage(png); - } - else if (url == "adavail.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC2\x00\x00\x0E" - "\xC2\x01\x15\x28\x4A\x80\x00\x00\x02\xF6\x49\x44\x41\x54\x38\xCB" - "\x63\x60\xC0\x00\x8C\x2C\xEC\x6C\x1C\xEA\x2A\xCA\x1A\x39\x33\x57" - "\x4D\x7C\xBA\x74\xEB\xE4\x37\xBA\xC6\xBA\x8D\x6C\xEC\x1C\x5A\x20" - "\x49\x06\xFC\x80\x91\x95\x95\x85\x4D\x41\x48\x40\xD4\xC7\xDC\xDC" - "\xBA\x77\xF5\xE1\x45\xDF\xB7\x9D\x5C\xF8\xC3\x3D\xD4\x7D\xA3\xA0" - "\xA0\x70\x10\x0B\x2B\x9B\x12\x50\x11\x13\x56\xAD\x4C\x8C\x4C\x3C" - "\xFC\xBC\x42\xF6\xF6\x0E\x8E\x5D\xB5\x2D\x15\xE7\x96\xEF\x98\xFD" - "\xF1\xFC\xBD\x8D\xFF\x2E\x3E\x5C\xFB\x6F\xD9\xFE\x49\x3F\xCA\xDB" - "\xF2\xAE\x5A\x39\x59\x4D\xE4\xE4\xE6\xD6\x01\x2A\x67\xC5\xB0\x9A" - "\x9D\x95\x43\xC5\xC1\xD1\xA9\x65\xDD\xEE\x45\x1F\x4E\xDE\xDA\xF8" - "\x77\xEA\xEA\xB6\xF7\xFB\x2E\x2C\xFB\x7B\xF2\xF6\xAA\x7F\xF3\x77" - "\xF5\xFD\x3A\x7A\x6B\xF9\xBF\xC5\xBB\x26\x7C\xD6\x37\xD7\x2F\x62" - "\x62\x62\x92\x44\xF3\x0E\x23\xB3\x88\x90\xB8\x5B\x65\x6D\xD9\xE1" - "\x2B\x8F\x77\xFD\xEF\x9D\x53\xF3\x40\xCD\x56\xA7\x7E\xE3\xF1\x85" - "\x5F\x76\x5E\x9A\xF6\xCB\x21\xC1\xFD\x58\xCB\x82\x92\xB7\xEB\xCE" - "\xF6\xFC\x0F\x4E\xF5\xD9\x06\x74\x85\x39\x9A\x57\x18\x99\xA5\xA5" - "\xE4\xC3\xBA\x27\xB7\xDC\xB8\xF8\x68\xFB\xFF\xEC\xAA\x94\xF3\x9C" - "\x7C\xDC\x6A\x93\xB7\xD6\xBC\x99\xBA\x27\xF9\xBB\x94\x86\x42\xA3" - "\xBA\xBD\x7A\x7D\x68\xB9\xCF\x6D\xC7\x24\x97\x73\xFC\xA2\xC2\xBE" - "\x40\x4D\xCC\x28\x41\xC0\xCF\x27\x68\x97\x92\x9B\xB4\x7B\xFD\xB9" - "\x89\xFF\xDB\xD7\xA7\x7E\x4D\xEF\xCD\xBE\x30\x75\x4F\xFD\xAF\xEE" - "\x9D\xB1\xBF\x14\xCC\xB5\x26\xB2\xB0\xB3\xF2\x73\x0B\xF1\x6A\x81" - "\x30\x33\x0B\x8B\x00\x66\xF8\x33\x32\x71\x8B\xCA\x4A\xC7\x07\x56" - "\xFA\xDE\x6D\xD9\x96\xF4\x7F\xE6\xA1\xFC\xFF\x13\xF7\xE6\xFD\xEF" - "\xD8\x99\xF2\xAF\x74\x69\xC2\x77\xBF\x1A\xBF\xDB\x52\x3A\x2A\x4D" - "\xCC\x2C\xAC\x32\x78\x23\x12\xA8\x40\x41\x44\x5D\xB1\xC1\x26\xD5" - "\xF9\x7C\xE3\xC6\x8C\x3F\xAD\xDB\x52\xFF\x35\x6D\x49\xFD\xD3\xBF" - "\x2F\xFD\x5F\xDD\xC6\x94\xFF\xC6\x5E\xC6\xF3\x59\xD9\xD8\xD5\x31" - "\xD2\x04\x1B\x3B\xBB\x98\xA0\x94\x88\x81\xB0\x8C\x98\x11\x3B\x17" - "\x87\x30\x2B\x1B\xA7\x5E\xE7\x86\xEA\x8F\x4D\x1B\x93\x7E\x9B\xC5" - "\x3A\x9E\x8A\x68\x0F\xBC\xD5\xB1\x2B\xFD\x5F\xCE\xE2\xB8\xBF\x92" - "\xCA\xD2\x09\x28\x61\xC0\xC8\xC8\xC8\xAA\xA4\xAE\x96\x97\x33\x29" - "\xFF\x7D\xC9\x9C\xA2\x2F\xDA\x96\xBA\xB9\x40\x41\xB6\xA6\xD5\xA5" - "\x6F\xEA\xD6\x26\x7E\x17\x93\x97\x2E\xD4\xB4\x56\x49\x6C\xD8\x9C" - "\xFA\xB7\x70\x65\xD2\x7F\x69\x55\x4C\x03\x58\x94\x54\x94\x53\xAB" - "\xE6\x15\xBC\x9E\xB0\xBF\xFC\x3F\x30\xB4\x0F\x2B\xEA\x69\x64\x76" - "\x6C\xA8\xFF\x5C\xB5\x36\xF1\xA7\xA6\x9B\xF1\x4A\xCF\x3C\xE7\x0D" - "\x0D\x9B\xD3\xFF\xC5\x74\x86\xBE\x14\x96\x12\x0B\x41\x8F\x05\x46" - "\x4E\x4E\x2E\x6D\x33\x6F\xCB\x59\x79\x0B\x93\x7E\x54\x6D\x48\xF9" - "\x5F\x3C\x35\xEB\x45\xE7\xD6\x9A\xBF\x15\x6B\x92\xFF\xA5\x4C\x8B" - "\xFD\x52\xB1\x2E\xED\x7F\xEE\x82\xC4\x5F\xDA\x2E\x7A\x3D\xAC\x6C" - "\x6C\x8A\x18\x61\x00\x8C\x05\x5E\x1E\x3E\x7E\x47\x2D\x1B\x9D\xBE" - "\x80\x52\xEF\x9B\x79\xF3\x53\x7E\xD4\x6D\xCC\xFE\x57\xBB\x01\xE8" - "\x6F\xA0\xC6\x60\x60\xEC\x68\xD9\xEA\xF4\x73\x70\x71\x81\x32\x15" - "\x1B\xCE\xCC\xC4\xC2\xCA\xAA\x0C\x34\xC8\x43\xD1\x40\xB5\x2F\x61" - "\x7A\xF4\xF7\xB4\x99\x71\xDF\x0D\xBD\xCD\xD6\xF3\xF2\xF3\x7B\x03" - "\xE5\x14\x88\xC8\x91\xC0\x9C\xC2\xC6\xAE\x29\x26\x2F\x99\x15\xDA" - "\x1A\xF4\x34\xB6\x27\xFC\xB5\xBC\x8E\x72\x2D\x34\xEA\x30\x00\x00" - "\xBB\x07\x15\x4B\xC6\x05\x9A\xAA\x00\x00\x00\x00\x49\x45\x4E\x44" - "\xAE\x42\x60\x82", 836); - getPNGImage(png); - } - else if (url == "adplayed.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC1\x00\x00\x0E" - "\xC1\x01\xB8\x91\x6B\xED\x00\x00\x02\x50\x49\x44\x41\x54\x38\xCB" - "\x63\x60\xA0\x22\x60\x04\x02\x39\x31\x71\x89\xB2\xA9\x4B\x3A\x5E" - "\x29\xA8\x2A\xF4\x02\xF9\xF2\x20\x71\x62\x34\xB3\x00\x81\x86\x9A" - "\x86\x6A\x59\x62\x56\xCC\xC1\x3D\xE7\x96\xFE\xCA\xAD\x4B\xBA\xA6" - "\xA6\xA5\x5C\xCD\xCC\xCC\x4C\xD8\x10\x46\x06\x46\x31\x6D\x1D\xAD" - "\xD6\x65\x9B\xA7\xBD\xE9\x5F\xDC\xF8\xFE\xF0\xD5\x15\x7F\xE7\xED" - "\xE8\xF9\xB9\x60\x73\xD7\x3B\x79\x65\xD9\x76\x31\x31\xF1\x3A\xBC" - "\xAE\x62\x61\x61\x35\xCA\x2F\xC9\x3C\x3B\x67\x55\xE7\x6B\x31\x05" - "\xF1\xD2\x95\x87\xFA\xBF\x19\xB8\x19\xEF\xCB\x6B\x8D\x7B\xED\x13" - "\xEE\x7E\x0F\xE8\xAA\xD3\x78\x5D\x05\x34\xC0\x38\xA7\x34\xE5\x42" - "\xEF\xB2\xF2\xB7\x7A\x76\xFA\xF5\xDD\x9B\xB2\xBE\x0A\xCB\x89\x4E" - "\x37\xB1\x36\xDE\xB4\x7C\xDB\x8C\xAF\x40\x57\x7D\x84\xB9\x6A\xE1" - "\x96\xEE\x77\x4A\xEA\xF2\xE5\x40\x6D\xFC\xC8\x8E\xE0\x95\x56\x96" - "\xAE\x2D\x9C\x1D\xF5\xA9\x67\x4B\xF6\xF7\x9E\x9D\x19\x7F\x83\x4B" - "\xDD\xDE\x94\xD5\x17\xBC\x99\xB3\xB2\xF3\x9D\xA8\xBC\x78\x19\xC8" - "\x55\x86\xEE\xA6\x7B\xEB\x66\x66\x3F\x77\x8F\x70\x38\xC4\xC4\xC4" - "\xA4\x81\x6C\x00\x13\xD0\x6F\xDC\xAC\x5C\x9C\xFE\x3A\x1E\xFA\xDB" - "\x1B\x37\xA4\xFE\x4E\x68\xF1\xFB\xD6\x3C\xA5\xEC\xDF\xC4\x35\x55" - "\xBF\xF4\xEC\xF5\x27\x80\x5C\x25\xA2\x20\xDE\x2B\x2A\x2F\x1C\x2F" - "\xA3\x2D\x5B\x0B\x34\x40\x01\xAE\x9B\x95\x8D\x4D\xD7\xC4\xDD\xB4" - "\x5F\x56\x4D\x36\x91\x95\x9D\x55\xA9\x66\x59\xFA\x67\x59\x3D\xC5" - "\x65\xCE\xB1\x36\x0F\xCB\x16\xC7\xFF\xEF\xDD\x92\xF5\x13\xE4\xAA" - "\xE4\x9E\xA0\xE7\xAA\x36\xEA\x73\x98\x98\x99\x35\x51\xC2\x80\x93" - "\x8B\xD3\xBD\x70\x6A\xC6\xDB\xA8\x2A\xBF\x4B\x02\xA2\x42\x71\xD5" - "\xCB\xB3\xBF\xCA\xE8\x29\x2C\xF1\xCA\xB6\x3B\xE9\x96\xE1\xF4\x59" - "\xD7\xCB\xF0\x04\xC8\x55\xC5\x0B\x63\xBE\x34\x6E\x48\xFA\x65\x1E" - "\x60\xB8\x93\x91\x89\x49\x11\x39\x05\x49\xA9\x18\xAB\x4C\xCF\x9C" - "\x11\xF9\x31\xAB\x3B\xF1\x75\xFD\xFA\xDC\xBF\xA1\x75\x7E\xDF\x13" - "\x3B\x63\x7F\xEA\x3B\xEB\x6F\x07\xBA\xCA\x08\xE4\x2A\x39\x43\xA5" - "\x85\x01\x45\x8E\x47\x0A\x96\xC7\xFF\x65\xE3\x64\x77\x42\x89\x49" - "\x66\x16\x66\x2D\x29\x35\xC9\x2A\x87\x58\x9B\xA3\x79\x0B\x13\x7E" - "\xD9\x84\x59\x3E\x2C\x9E\x9E\xF9\x2D\xB2\xCA\xEF\x3A\xD0\x55\xF1" - "\x10\x57\x29\x2E\xF6\x2D\x70\x3C\x1E\xDB\x19\xFC\x8E\x95\x8D\xD5" - "\x1A\x5B\x52\x96\xE5\x15\xE6\x2B\x09\x6E\xF0\x7B\x25\x2C\x23\x3A" - "\x15\xE8\xAA\x45\xC8\xAE\x4A\x9A\x14\xF9\x35\x7D\x46\xD4\x27\x39" - "\x5D\xD9\x2E\xA0\x7A\x61\x82\xC9\x1B\xDD\x55\xEE\xD9\xCE\xD7\xA4" - "\xD5\xA5\xAA\x99\x98\x99\xE4\x40\x31\x47\x6C\x06\x83\xBB\x0A\x98" - "\x1E\x3A\x81\x7C\x19\x6A\xE6\x60\x06\x00\x9A\x6E\xEF\x92\x09\x7E" - "\x22\xAD\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 670); - getPNGImage(png); - } - else if (url == "v1.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x01\x81\x49\x44\x41\x54\x38\xCB" - "\xA5\x93\x41\x4B\x02\x51\x14\x85\xFD\x29\xFD\x8A\x16\x2D\x5A\xB4" - "\x68\xD1\x22\x08\x5A\xB4\x94\xA0\x7F\x20\xB4\x6C\x11\x11\xC1\x14" - "\x42\x84\x60\x44\x66\xB5\x08\x22\x08\xC1\xC1\xC4\xAC\x4D\x61\x46" - "\x12\x8E\x9A\x49\x9A\x59\x56\x9A\xCE\x28\x64\x24\xC4\x69\xCE\x90" - "\xC3\x3C\x67\x5C\x75\xE1\x83\xC7\xB9\xE7\x1E\xDE\x7B\xF3\xC6\xE5" - "\xEA\x2B\x49\x92\xDC\x3A\x71\x1D\xF4\x41\xCD\xED\x1A\x54\x7A\x73" - "\x48\x27\xE5\xF7\xFB\xA1\x28\x0A\x5A\xAD\x16\x7A\xC5\x35\x35\xF6" - "\xE8\xA1\xD7\x69\x58\x95\x65\xD9\x18\x78\x6C\x76\x11\xBC\x56\xB1" - "\x18\x7D\x37\xE0\x9A\x1A\x8B\x1E\x7A\x85\x10\xA6\xF6\x86\x03\xC9" - "\x26\x66\x76\xCB\x8E\xB0\x67\x09\x49\x99\x67\xE6\xD6\x58\xDB\x89" - "\x06\xA6\x03\x25\x93\x83\x94\x8A\xD3\xFB\xB6\xA0\xD1\xC3\xFA\x3B" - "\x8E\x9B\x01\x71\x9E\xAF\xD8\xF8\xC6\xD4\xD6\x83\x49\x48\xD1\xD0" - "\xE9\xFE\x20\xA6\x07\x58\x75\x42\x2F\x67\x38\xCB\x00\xE3\x92\x36" - "\x2F\xEA\x98\xF4\x17\x4C\x66\xF7\x8B\x08\x67\x34\x44\xEF\x34\x41" - "\x27\xF4\x72\x86\xB3\x46\x00\x6B\xFE\xB8\x82\x09\x5F\x5E\x60\x2F" - "\xF9\x81\x93\x9C\x66\xD3\xE9\x65\x09\x01\x9E\xA3\x32\xC6\xD7\x73" - "\x02\xC1\x44\x1D\x91\xAC\x6A\xD3\xE9\x15\x02\xB8\x9D\x8D\xF3\x57" - "\x8C\x79\x33\x02\x81\xCB\x1A\x64\xA5\x69\xD3\xE9\xB5\x1E\xC1\xB8" - "\xC4\x42\xED\x0B\xA3\xAB\x69\x13\xCF\x61\x09\x57\xA5\x36\xB2\xD5" - "\x4F\x2C\x84\xCA\x42\x8F\x5E\xEB\x25\x9A\x9F\xD1\x1B\x7B\xC1\xC8" - "\xCA\xAD\xC1\xB2\xFC\x04\x39\xDD\x44\x38\xDD\x80\xEF\xAC\x6A\xEA" - "\xF4\x08\x9F\xB1\xFF\x21\xAD\x45\x9F\x31\xBC\x74\xE3\x08\x7B\xB6" - "\x87\xE4\xF4\x94\xF3\x6F\x1D\x48\x91\x0A\xE6\x76\xF2\x06\x5C\x53" - "\x1B\xF8\x94\xFF\xFD\x33\xFD\xE7\x77\xFE\x05\xEF\x5F\x9A\xB1\x51" - "\x9D\x7F\x55\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 463); - getPNGImage(png); - } - else if (url == "v2.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x01\xA6\x49\x44\x41\x54\x38\xCB" - "\xA5\x93\xBD\x2F\x83\x51\x14\xC6\xFB\xA7\xF8\x2B\x0C\x06\x83\xC1" - "\x60\x90\x48\x0C\x6C\x5D\x98\x8C\x84\x58\x31\x54\x5E\xD5\x44\x9A" - "\x26\x15\x14\x11\xB1\xF8\x88\x44\x95\x52\x22\x48\x51\x8D\xB4\x48" - "\x35\xF4\x4B\x5B\x6D\xD3\x56\x69\x4A\x0D\x7D\xBC\xCF\x8D\xDE\xF4" - "\xAD\x9A\x9C\xE4\x97\xF7\xDE\x73\x9E\x73\x72\xCF\x7D\xCF\xD5\xE9" - "\xEA\x4C\x51\x14\xBD\x8A\x4B\x05\x75\xD0\xA7\xD7\xFD\x65\x6A\xB0" - "\x49\xC5\x6B\xB5\x5A\xE1\xF7\xFB\x51\x28\x14\x50\x35\xAE\xE9\x63" - "\x8C\x1A\x6A\x1B\x25\xE7\xED\x76\xBB\x48\x08\xE7\xBE\xB0\x74\x95" - "\xC7\xD8\x7E\x4A\xC0\x35\x7D\x34\x6A\xA8\xD5\x14\x61\xD5\x6A\xB2" - "\xED\x32\x87\x9E\xE5\x48\x43\x18\xAB\x29\xE2\x95\x3D\xF3\x68\xB4" - "\x05\x77\x16\xDD\xB6\x90\xE0\xF0\xE1\x4D\xF8\x2A\x95\x0A\x7C\x89" - "\x92\xF4\x53\x43\xFB\x69\x47\xCF\x02\x2E\xF6\xF7\x94\x2D\xA3\x6B" - "\xEE\x51\x70\x1E\x2A\xC2\x7C\x92\x86\x7E\x25\x2C\x18\x77\x24\x11" - "\xCC\x7C\xCA\x38\xB5\xCC\x61\x2E\x0B\x88\x4B\x9A\x3D\xCB\xA0\xD3" - "\x1A\x14\xF4\xAF\x86\xD0\x6B\x7B\x94\xFB\xD1\xED\x18\x92\x85\xB2" - "\xDC\x53\xCB\x1C\xE6\x8A\x02\xB4\xE1\xAD\x18\x3A\x2C\x01\x0D\x8A" - "\x33\x01\x4F\xB4\x88\xDD\xBB\x57\x0C\x6D\x44\xA5\x9F\x5A\x9A\xA6" - "\xC0\xE0\x7A\x04\xED\x33\xF7\x92\xE9\x83\x04\x96\xDC\x19\x18\xF6" - "\xE2\x18\xD9\xD4\xC6\xA8\xD5\x14\xE0\x71\xCC\xC7\x49\xB4\x99\x6E" - "\x05\x46\x67\x1C\xF3\xA7\x29\x0C\xAC\x3D\x49\x5F\x2D\xD4\xD6\xB6" - "\x20\x2E\x31\x98\xFE\x40\xEB\x94\x4F\xE0\x89\xBC\xC3\x79\x9F\x87" - "\xF9\x28\xA9\x92\x10\x4C\x3A\x9E\x65\x9C\xDA\xDA\x4B\x94\xBF\xD1" - "\x74\x10\x47\x8B\xE1\x06\x16\x35\x61\xC7\x97\x85\xDD\x97\x13\x5F" - "\xB2\x7A\x91\x16\x31\x6A\x34\xBF\xB1\x7E\x90\x8C\xFB\xCF\x68\x9E" - "\xB8\x6E\x08\x63\xBF\x06\xA9\xD1\x28\x07\x5E\x4A\x50\x1C\x31\xF4" - "\x2D\x06\x04\x5C\xD3\xF7\xE7\x28\xFF\xFB\x31\xFD\xE7\x39\x7F\x03" - "\x7B\x97\xA2\x69\xD2\xB0\x90\x85\x00\x00\x00\x00\x49\x45\x4E\x44" - "\xAE\x42\x60\x82", 500); - getPNGImage(png); - } - else if (url == "relay.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x01\xAB\x49\x44\x41\x54\x38\xCB" - "\xA5\x93\xCB\x4B\x02\x51\x14\xC6\xFD\x53\xFA\x2B\x5A\xB4\x68\xD1" - "\xA2\x45\x8B\x20\x68\x51\x3B\x5B\x04\xAD\x5A\x15\x41\xDB\x1E\x14" - "\x58\x08\x11\x81\x15\xBD\x89\x36\x45\x44\x98\x45\x58\x10\x45\x0F" - "\x33\x6B\x7A\x88\x54\xEA\x68\x9A\xA2\x26\x9A\x59\x0B\xBF\xE6\x3B" - "\xE4\xA0\x36\xAE\x3C\xF0\x63\xCE\xE3\x3B\x87\x7B\xEF\xDC\x6B\x32" - "\x55\x98\xC5\x62\x31\x6B\x38\x35\x50\x01\x73\x66\x53\x35\xD3\x8A" - "\x75\x1A\x6E\x9B\xCD\x06\x45\x51\x90\x4E\xA7\x51\x34\xFA\xCC\xB1" - "\x46\x0D\xB5\x46\xCD\x29\xBB\xDD\x2E\x0D\xFE\xE4\x0F\x96\xAF\x52" - "\x18\x3A\x78\x17\xE8\x33\x47\xA3\x86\xDA\xB2\x21\x9C\x5A\x6C\x5E" - "\xBC\x4C\xA2\x63\x25\x60\x08\x6B\x25\x43\xDC\xFA\x9E\xB9\x34\xDA" - "\xC2\x79\x02\xED\x8B\xAF\x50\x22\x39\x14\x0A\x05\xC9\xF1\x7B\xF7" - "\x96\x93\x3C\xA1\x86\xF6\xB7\x1D\x33\x07\x38\xB9\xBF\x97\xC4\x37" - "\xDA\xE6\x9F\x05\x36\xCC\x9D\xC5\x61\x5E\xF3\x0B\xC3\x8E\x08\x7C" - "\xF1\xBC\x5E\xA7\x96\x3D\xEC\xE5\x00\x39\xA4\xD9\xD3\x38\x5A\x6D" - "\x3E\xE1\x36\xFC\x09\xAB\x33\xAA\xC7\x83\x3B\x2A\x22\xE9\x6F\x3D" - "\xA6\x96\x3D\xEC\x95\x01\xB4\x81\x6D\x15\x2D\x33\x5E\xC1\x13\xFA" - "\x84\x3F\x91\x87\x2B\x98\x15\xF6\x1E\x3E\xD0\xBF\x15\xD4\xEB\xD4" - "\xD2\xCA\x06\xF4\x6D\x06\xD0\x3C\xF5\x28\xDC\xA8\x59\xEC\x2A\x29" - "\x8C\xEF\x87\xE5\xCB\xB8\x58\x23\xD4\x96\x0D\xE0\x72\xA6\x8F\x23" - "\x68\xB2\xDE\x0B\xD7\xC1\x0C\xC6\x1C\x21\xF1\xBB\x96\xB5\x25\x9F" - "\x44\x85\x62\x9D\xDA\xD2\x2D\xC8\x21\xFA\x62\x5F\x68\x9C\xB8\x13" - "\x5C\x81\x0C\x46\xED\xAA\x1E\xF7\x6E\x3C\x23\x9C\xCA\xEB\x31\xB5" - "\xA5\x87\xA8\xFF\x46\xEB\x61\x18\x0D\xE3\x1E\xCC\x1C\xBD\xA1\x67" - "\xD5\x27\x3E\xE9\x9C\x7D\xC2\xFA\x45\x4C\x7C\x6A\xCA\x7E\x63\xE5" - "\x45\x9A\x3C\x08\xA1\x7E\xE4\xDA\x10\xD6\xFE\x5D\x24\xA3\xAB\xEC" - "\x8D\xE6\x60\x71\xA8\xE8\x5E\xF2\x0A\xF4\x99\xAB\x7A\x95\x6B\x7E" - "\x4C\xB5\x3C\xE7\x5F\xCE\xEF\xA6\xA0\xA0\x37\x1F\x5A\x00\x00\x00" - "\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 505); - getPNGImage(png); - } - else if (url == "wa.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x02\x0D\x49\x44\x41\x54\x38\xCB" - "\x8D\x93\x4F\x68\x92\x71\x18\xC7\x35\xA3\xFF\x86\x5B\x5B\x32\x61" - "\x0D\xC2\xEE\xC5\x08\x22\x0F\x8D\xB5\x0E\x12\x81\x04\xEE\xE0\x41" - "\x21\xA2\xD8\x24\x2A\x56\xB1\x82\xC4\x0A\x06\xC5\xD0\x75\xD8\xA2" - "\x4D\x66\x10\x48\xB0\xB6\x5D\x94\x1D\xB2\x74\x68\x2D\xDD\x41\x93" - "\x2E\xC1\xCA\x2D\x8D\x6D\x81\x98\x22\x25\x82\x7C\xF2\x7D\xB7\x44" - "\x97\x6E\xFB\xC0\x73\x7A\xDF\xCF\xF3\xFE\x9E\xEF\xEF\x79\x25\x92" - "\xCD\x61\xBD\x2A\x51\x94\xCA\x2E\xD9\x06\x2C\x7C\x5D\x20\x10\x0C" - "\x54\x36\xD1\xE9\xF5\xFA\xB4\xF1\x62\x27\x5B\xCA\x8B\x4B\x8B\x08" - "\x24\x93\x49\xDC\x6E\x37\x6A\xB5\x3A\xEE\x9D\x70\x92\x9B\x3C\x8F" - "\xF5\xB2\x62\xD3\x06\x24\x12\x09\xFE\xD1\x77\xAB\x0F\xAB\xD5\xCA" - "\xCF\x99\x07\xA4\x1F\xB7\x10\x19\x6B\x46\xD9\x28\x9B\xDE\x52\xF6" - "\x78\x3C\x18\x8D\x46\xE2\x9F\x67\x29\x4C\x74\xB1\x7A\x4D\x46\xCA" - "\x21\xE7\xA8\x72\x47\x7A\x3D\x87\xFA\xB2\xD9\x6C\xC6\xE9\x74\xC2" - "\x97\x61\x0A\xE3\x2D\xAC\xF6\x4A\x49\x0D\xEE\xE4\xF8\x11\x29\x2E" - "\x97\xAB\x56\xB0\x6B\x33\x0B\xB3\x5A\x2C\x16\xD2\x3F\x62\x10\xBC" - "\x00\x6F\x4E\xF2\xC7\x75\x82\xE2\x5B\x3D\xF1\x29\x3D\x5E\x9B\x96" - "\xAB\xDD\x67\x09\x85\x43\x55\x4D\xC4\xB4\x05\x6E\x9B\xB4\x64\x46" - "\x3A\xC9\x3C\x3C\x44\xC6\x56\x12\x7F\x2D\x81\xBF\x1D\x66\x0E\x93" - "\x1B\xDA\x4F\x7E\x40\xCA\x3D\xD3\x69\xF1\x5D\x9F\xCF\x57\x6E\x22" - "\x5E\x95\xC0\xDD\x9E\x8E\xD2\x13\x15\x84\xBA\xE0\xF7\x77\x98\x3F" - "\x47\xE1\x75\x33\xB9\xC1\x3D\x14\x47\x77\xC1\xF8\x6E\x9E\x3D\xB9" - "\xB3\xD6\xC0\xEF\xAB\x3E\xC5\xDC\xC7\x39\x9E\xDA\x1E\x71\xE3\xD2" - "\x29\xC8\x97\xB2\xF8\xA4\x25\x37\xDA\x40\x7E\x64\x1F\xBC\x92\xE3" - "\xBB\xBF\x17\xDB\x40\xBF\x28\x87\xE7\xC3\xB5\x73\x30\x18\x0C\xA5" - "\xF9\xDF\x93\x77\xB7\x93\x1D\x92\x53\x9C\x6A\x24\xEE\x50\x70\xBD" - "\xFB\x18\xC1\x60\x50\x94\xA3\xD1\x68\x4D\x59\xA1\xD1\x68\x22\xA9" - "\x6F\x01\xB2\x63\x6D\xE4\x5D\x4D\xF0\x4E\x85\xBD\xF7\x20\x2F\x5F" - "\x3C\x2F\xEF\x44\x2C\x16\xAB\x29\x4B\x04\x79\xE5\xC3\x34\x59\x47" - "\x1B\xC5\xD9\x56\x7C\xC3\x4A\x7A\x4C\x67\xF0\xFB\xFD\x65\xB9\xDE" - "\x97\x45\xFA\x75\x6A\xF2\x93\x4A\xD2\xDE\x56\xAE\xE8\x0E\x08\x8B" - "\x42\x28\x14\x62\x79\x65\x59\x94\x37\x5E\xDB\x7F\x08\xBB\x6D\xBF" - "\xD9\x80\xAA\x49\xE6\xAC\xD8\x32\xF1\xAA\x36\xA6\x5D\x8F\x48\xA9" - "\x3A\xB6\xF9\x3B\x57\xF1\x17\x81\x38\xA3\x74\x72\x00\xB9\xAF\x00" - "\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 603); - getPNGImage(png); - } - else if (url == "curl.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x00\x4E\x49\x44\x41\x54\x38\xCB" - "\x63\x60\xA0\x0F\x68\xF8\x7F\xE0\xC0\x81\xFF\x98\x6C\xDA\x18\xD0" - "\xF0\x1F\x53\x11\xD1\x06\x40\x24\x61\x98\x2C\x03\x28\xF2\x02\x44" - "\x02\xBB\x17\x90\x31\xDE\x30\xC0\xE6\x05\x64\x31\x4C\xEF\x51\x3B" - "\xBE\x09\xC7\x02\x59\xF1\x4D\x4F\x03\x06\xAF\x17\x88\x4A\x07\xC8" - "\x71\x8C\x8D\x8D\x2D\x1D\x00\x00\x6B\x22\xE2\xA4\xD5\xBE\x1F\x4C" - "\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 156); - getPNGImage(png); - } - else if (url == "radionomy.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x00\xAB\x49\x44\x41\x54\x38\xCB" - "\x63\x60\x00\x02\xB1\xAE\x33\xAC\x40\x5C\x0A\xC4\x37\x81\xF8\x1F" - "\x10\xFF\xC7\x81\xFF\x41\xD5\x80\xD4\xB2\x32\x20\x69\xDE\x81\x47" - "\x13\x2E\xBC\x03\x6C\x08\xD4\x34\x90\xC0\x3B\x20\x0E\x03\x62\x2E" - "\x06\x1C\x00\x24\x07\x55\xF3\x0E\xAA\xA7\x94\x01\xEA\x24\x10\x27" - "\x8C\x81\x48\x00\x35\x04\xA4\xE7\x26\x03\x92\x9F\xF1\xD9\xCC\x8A" - "\xC5\x25\xE0\x30\x61\x80\xF9\x09\x8B\xA6\xC9\x40\x7C\x0B\x88\x7B" - "\x81\xF8\x2F\x10\x37\xA0\xC9\x43\xF4\xE1\x31\x60\x03\x54\xEE\x2E" - "\x10\xD7\x03\xB1\x13\xB9\x06\xD8\xE3\xF0\x16\xD1\x06\x88\x50\x6A" - "\x80\x00\xCD\x0D\xC0\x1A\x8D\x40\x7E\x22\x10\x4F\x05\x62\x36\x1C" - "\x09\x0A\x1E\x8D\x14\x27\x24\x8A\x93\x32\xB9\x99\x69\x27\x7A\x8E" - "\x24\x2B\x3B\x03\x00\xC3\xBC\x4D\xD5\xF9\xC1\xBC\x7C\x00\x00\x00" - "\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 249); - getPNGImage(png); - } - else if (url == "chrome.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x02\xE8\x49\x44\x41\x54\x78\x01\x65\x93\xDD\x6B\xD6" - "\x65\x18\xC7\x3F\xD7\xFD\xB2\xFD\x9E\x47\x63\xB3\x74\x4D\xDB\xF2" - "\x99\x21\xC5\x93\x16\x19\x61\x27\xD1\x36\xF1\xA0\x37\x09\x02\xE7" - "\xEA\xC4\x88\x75\x24\x74\xE2\x69\x41\x45\x7F\xC1\x3C\x1B\x42\x45" - "\x50\x9E\x14\x41\x74\x12\x54\xD0\x91\x06\xE9\x81\x33\x59\xE5\x66" - "\x9B\x3A\x6D\xDB\xE3\xDA\xCB\xF3\x7B\xBB\xEF\xAB\x1F\x13\x65\xD5" - "\x07\x3E\x47\xF7\x75\x7F\xBF\x07\xF7\x7D\x09\xFF\xE1\xAF\x63\x2F" - "\x8A\x49\x3A\xFB\x4D\xAD\xE3\x29\x31\x66\xB7\x46\x25\xA6\xD9\xD5" - "\xB8\x96\x9E\x0F\xED\x6C\x16\x50\x36\xE1\xE6\x5F\x19\xE6\x2E\xB1" - "\x9D\xF7\xC6\xB5\x6C\x0C\x18\x01\x06\xC4\x99\x44\x43\x24\xA6\x79" - "\x1A\xB3\x62\xBA\x3A\x3F\x13\xD7\xF3\x09\x60\xFE\x5E\x40\xB9\xB8" - "\x0A\x80\xA6\x45\x53\x6A\xFE\x14\x30\xA8\x31\x4A\x35\x8C\x18\x41" - "\xA3\xA2\x45\xA8\x57\x01\x8F\x57\x41\xEF\x57\x0E\x69\xBB\x38\x01" - "\x5C\x02\x70\xA1\xB5\xC6\xD9\x47\x7D\xEF\xD3\xBF\x15\xE3\x3E\xC6" - "\xA1\x6A\x98\xE8\xEF\x5C\x46\x75\x43\x2D\xA9\x0C\x68\x16\x24\xE6" - "\xE5\x90\xE6\x61\x3C\xA6\xF2\x06\x30\xEF\xCA\x56\xE4\xAB\xD1\x1D" - "\x63\xEE\xB3\x5B\xC3\x07\x26\x33\xA4\xA3\x04\x03\x72\xFF\x36\x42" - "\x7F\x3F\x78\xB0\xE9\x34\xE4\xB7\x37\xC2\xAC\x46\xC4\xE8\xB0\xEB" - "\x29\xC7\x80\x0F\xDD\x3B\xA7\x1B\x0F\x47\x2F\x47\x7F\x38\xD4\x45" - "\xDF\xD4\x75\xB6\xB7\x03\x3C\xF9\x04\x53\xAF\xBD\xC9\xCC\x03\x0D" - "\x30\xC2\x9E\xCE\x3F\xD8\xEF\xC6\xD9\xC2\x39\xAC\x57\xAC\x8B\x18" - "\xA3\x47\xC5\xF1\x89\xBC\xF4\xCD\x0B\x47\xC4\xF2\xB9\x51\xAD\x1F" - "\xFA\xF4\x1A\x43\x17\x1D\x7F\x9E\xFC\x88\xAF\x69\x40\x54\x00\x04" - "\x61\xA4\x39\xC5\xF3\xF7\x9D\x80\xB0\x00\x22\x68\x94\x75\x8D\x76" - "\xD4\x10\xB4\x81\x92\x44\x67\xF8\x79\xB8\x9B\xB9\x67\xF6\x72\xD6" - "\xEE\x62\xEE\xD6\x0A\x8B\x7F\xB7\x59\xAA\x9C\x5D\x58\xE1\xA7\xB9" - "\x06\xA5\x6F\x02\x01\x94\x4A\x49\x62\x30\x0D\x17\x03\x18\x5B\x19" - "\x95\x56\x5F\x8D\x8B\x87\x7B\x58\x49\x0B\x16\x56\x53\x12\x6F\x01" - "\x48\x8B\xC0\xF2\x9A\xB2\x19\x8D\x86\x50\x5A\x9C\x16\x3A\xA3\x86" - "\x54\xAD\xD4\xC5\x18\x26\x77\x2E\xB1\x2F\x2C\x53\x4E\x15\xDC\x5C" - "\x2D\x01\xA8\x77\x78\x0E\xEE\xBC\x8E\x2F\x2F\xA3\x58\x54\x85\x50" - "\xBA\x34\xE4\x7E\xC6\xC5\x54\x2F\x00\x57\xC4\xCA\x3E\xE3\x85\xC5" - "\x6C\x89\x1B\x5B\xBF\xE5\xC8\xC1\xE7\xB8\xF4\xBB\x05\x60\xFF\xC0" - "\x2A\xCF\xEE\x38\x0D\xE5\x4D\xC0\x12\x4B\x47\x91\xFA\x2B\x45\xE6" - "\x2F\xC8\xE2\x77\x7D\x1C\xBB\xD6\x7C\xD7\xD6\xE5\x03\x5B\x37\x88" - "\x03\x50\xB6\x75\x74\xD3\xE3\x76\x91\xA5\xB0\x27\xFC\xC2\xDB\xBD" - "\xE7\x48\x0C\x54\xCD\x64\x6B\x09\x59\xBB\xF3\xBD\x8D\x67\x8C\x51" - "\x28\xDB\x71\x22\x06\x19\x24\x32\x6C\x6B\x82\x78\xA1\x95\xDD\x66" - "\x21\x6D\x51\xCF\x32\xDE\xEA\xF9\x95\x44\x84\xAA\x91\x6C\x3D\x21" - "\x5D\xED\xFC\xBE\xC8\xDD\x04\x80\xCC\x7E\xF9\x08\x00\xAF\xCF\x35" - "\x9A\xD6\xCB\x29\x57\x33\x83\xAE\x26\x62\xBC\x10\x81\x97\x6B\xF3" - "\x1C\xEF\x9A\x23\x14\x96\x74\xBD\x43\xF3\xB6\xFF\xB1\xCC\xED\xBD" - "\xAF\x2C\xD3\x5F\xEC\xE5\x2E\xA3\xB3\x7D\xBD\xD6\xC9\x58\x15\x34" - "\x22\x4E\x06\x1E\xF2\x45\x72\xB2\xFB\x06\x0F\x4A\x91\xE6\x85\x9D" - "\x0E\x85\x39\x53\x96\xE6\x5F\xCB\x24\x97\x3F\x7E\x8C\xCD\xBC\x3A" - "\xB9\x5D\xB6\x74\xB9\x3E\xB5\x72\xE0\x70\x7D\x7D\xF7\xF1\xAD\xCB" - "\xC4\x28\x57\x43\x90\xF3\x2B\x2D\xF7\xBF\x75\xFE\x07\xC1\xB8\x73" - "\x8C\xE9\x85\xD9\x6A\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60" - "\x82", 801); - getPNGImage(png); - } - else if (url == "firefox.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x03\x3C\x49\x44\x41\x54\x38\x11\x05\xC1\x4B\x68\x5C" - "\x55\x00\x80\xE1\xFF\xDC\x73\xE7\x95\x8C\x79\x4D\x26\x0E\x69\x4C" - "\x82\x8D\x49\x93\x2A\x41\x25\x89\x31\xE8\x46\x45\x22\x6E\x04\x11" - "\x45\x51\xD0\x8D\x2B\x17\x82\x10\x50\xF7\x2E\x45\x5D\xB8\x11\x5C" - "\xB6\x14\x2A\x5A\xAA\x3B\x43\x85\x28\xA8\x2D\x5A\x34\xE6\xD1\x4C" - "\x26\xCE\x8C\x93\xC7\xDC\xCC\xEB\xCE\xDC\xD7\x39\xF7\xF8\x7D\x02" - "\x00\x00\x00\xE0\xAB\xBD\x50\x96\x4E\xBD\x59\x3F\x8A\x57\x0D\x3C" - "\x08\x18\x01\x07\x29\xDB\xFA\x25\x9B\xCF\xDE\xDB\xB8\x24\x35\x00" - "\x00\x80\x00\xA8\x7F\x36\x67\xE5\xA2\x5D\xF1\xFE\xFC\xF1\x78\xAB" - "\xE3\xBF\xD7\x16\xF6\xCB\x76\x52\x5E\xC8\x24\xAC\x84\x40\x10\x46" - "\x2A\x4A\xC4\xAA\xBC\x38\x96\xB8\x92\x33\x9D\x2F\xE7\x9E\x9A\xAD" - "\x2C\x83\x01\x90\x00\xEF\x2E\x0C\x3E\xBA\x15\xAE\xBF\xBE\xE9\xCE" - "\x6E\x9C\x38\xCD\xD7\x72\xF6\xF6\x50\x26\xD1\x92\x75\x9D\xC7\xD3" - "\x31\x75\x3F\x94\xAD\x86\x3B\x9C\xE9\x36\xD6\x96\x46\x1B\xCF\x27" - "\x9E\xCC\xBB\x1F\x17\xB6\xFE\xFE\xF4\x36\xB1\x04\x78\x65\x7C\xEC" - "\x4D\xD1\xF3\x3F\x99\x32\x3B\x53\x2B\xD9\x9F\xC5\xCA\xC8\x6F\xDC" - "\x74\x57\x29\x47\x03\xB4\x83\x80\x66\xC7\x23\xAA\xB7\xB1\x3A\x81" - "\x58\x9B\x93\x63\x13\xF9\xF0\x99\xB0\x20\xF7\x3E\xBF\xB2\xBB\x6D" - "\x1B\x73\x59\xFC\xF9\x86\x9E\x1E\xC9\x34\xC4\x14\x0D\x92\x96\xA1" - "\x56\x1B\xE4\x89\xC6\x2D\xF6\xFA\x2B\xDC\xB5\x2F\x23\x23\x8D\xE8" - "\xFA\x94\xDB\x5D\xF6\xCA\x43\xAC\x3C\x9D\x1C\x08\xC7\xE5\xDB\xE6" - "\x9C\x1F\xE4\x5B\xCD\xDC\xBC\x34\xE6\x43\x23\xC4\x08\xB6\x05\x29" - "\x8B\x84\x0E\x99\x0C\xE0\x54\x8D\x51\x6E\x0F\x60\x39\x2D\x8C\x73" - "\x4E\xE8\x76\xE9\x35\x2B\x3C\xB7\x74\x4E\x7F\xA6\x9A\x08\xEB\x07" - "\x37\xEC\xC8\x63\x45\x79\x4C\x8A\x84\xC1\x28\xD0\xAE\x40\x0F\xDB" - "\x5C\xF5\xE6\xB9\xD5\x9A\xC0\x68\x07\xD5\x73\x51\x6E\x93\x38\xF4" - "\x99\x5A\x2C\xA0\xA3\x16\xBD\x60\xBA\xB0\x73\xFD\xE2\xBA\xED\xB9" - "\x0C\x11\x62\x27\x00\xE5\x41\xE3\x3F\xF8\x46\x2F\xF0\x63\xD4\x4F" - "\x37\x3E\x86\x58\x83\xD7\x80\xA0\x83\xF6\xBA\x3C\x94\x77\x18\xEE" - "\x3F\xA1\x78\x98\x4D\xEF\xB7\x06\xA7\xEC\xC0\x23\x24\x12\xB1\x25" - "\x8C\x15\x6B\x43\x9F\x84\x4B\x69\x87\xED\xB3\x32\xD9\xAC\x66\x3A" - "\xDF\xE5\x76\xA9\x9F\xC3\x33\x8F\xA4\xE9\x72\x9F\xEF\xA0\x3A\x4D" - "\x32\x7E\xA4\x17\x26\xED\xA2\x1D\xF8\xFC\x6A\x42\xEA\x16\x14\xD2" - "\x7D\x60\xA7\x0C\x6B\xE9\x0A\x0F\x4F\x9E\x12\xE9\x98\x83\x76\x92" - "\xFD\x68\x02\xD5\x4B\xF1\xC8\xCC\x39\x8F\x3F\x70\x42\xF7\xD8\xC7" - "\x2A\xC9\x5A\xAE\x19\xFF\x64\x1B\x6D\xFE\xF1\x3C\x71\xC7\xC4\xE2" - "\x05\x69\x19\x92\x02\x02\x0D\xBF\x57\x24\x9B\xD5\x01\xEE\x76\xB3" - "\x04\x96\x26\x97\x6A\xB0\x3E\xDF\x24\xD5\xD1\x9C\x15\xD3\x54\xFF" - "\x92\x55\x59\x8B\x4B\xF2\xEB\x03\x27\x7A\xF5\xFE\x9C\x1F\x45\xBC" - "\x88\x10\x49\x29\x20\x29\x21\x3F\x18\x93\xEE\x83\xA1\x74\xC8\x6A" - "\xC1\xE5\x9D\xC7\xDA\x2C\x8F\x87\x84\x65\xC1\xBF\xBB\x36\xC5\x43" - "\x79\xFD\xA5\xDC\xD1\x77\x12\xE0\xD9\xDC\x60\x31\x0E\xC4\x68\xAC" - "\xC4\x92\x41\x08\x61\x04\x69\x11\x73\x31\x1B\xB2\x9C\xF7\x59\x1C" - "\x0D\xC8\xA5\x34\xAA\x09\x5E\xDD\xC4\x61\xCB\x7C\x9F\x15\xEA\xA3" - "\x99\x1B\xB5\xA6\x04\xF8\xF6\xB4\x61\x9C\x40\xED\x0F\x18\x7B\x2C" - "\xA9\xAC\x59\xB4\xB0\xB5\x16\x28\x25\x88\x43\x81\xF2\xC1\xEB\x08" - "\x4A\x27\xC2\xEC\x54\xC3\x9B\xD7\x8A\xCE\x07\x1B\x7F\x54\x8A\x00" - "\x12\x00\xA0\x14\x04\xC1\x1D\xB7\xBB\xAD\x22\x4E\x2D\x65\xA5\x82" - "\x00\xDB\xF7\x31\xAD\x9E\xF1\x1C\x37\x3E\xAF\x36\xF5\xFE\xD6\x71" - "\x70\xED\xEA\x51\xFD\x8B\x4D\xA7\x75\x0F\x50\x00\x02\x00\x00\x00" - "\xB0\x81\xEC\x98\x4C\x14\x66\xD2\xE9\x89\x0B\xA9\x64\x2E\x30\x71" - "\x5C\x57\xCA\xA9\x06\x61\xED\x28\x0C\x6A\x80\x0B\x28\x00\x80\xFF" - "\x01\xD5\xC5\xB8\x35\x61\xCD\xB2\x5B\x00\x00\x00\x00\x49\x45\x4E" - "\x44\xAE\x42\x60\x82", 885); - getPNGImage(png); - } - else if (url == "safari.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x03\x2E\x49\x44\x41\x54\x38\x11\x75\xC1\x4B\x4C\x1C" - "\x75\x00\x07\xE0\xDF\xBC\x67\xFE\xF3\xDA\x61\xE9\xB6\xC0\x2E\x2C" - "\x94\xA6\x65\x23\xC5\x08\x41\xD3\x18\xAD\x35\x31\x69\x6F\x26\x90" - "\xE8\x49\xAE\xE8\xD5\x0B\x37\xCA\xCD\x8B\x37\x3D\x35\x69\xDA\x98" - "\x18\x83\x89\x26\x35\x8A\x89\x31\x5A\x63\x02\xB5\x07\xB7\x40\x28" - "\xB0\xB0\x0F\xB6\xFB\x90\xD9\x07\x3B\xCC\xEC\xEE\xCC\xEC\x8E\x7B" - "\xE0\x40\x7C\x7C\x1F\x85\xFF\xB0\xB4\xB4\x34\x23\x8A\xE2\x94\xEF" - "\xFB\x1B\x2B\x2B\x2B\xDB\x14\x45\x05\xF8\x1F\x14\xFE\x21\xB5\xBF" - "\xAF\x1E\xE5\xF3\x1F\x48\x92\xF4\x11\x91\xA4\x12\x21\xA4\x1C\x00" - "\x39\xDB\xB6\x1F\xA7\x52\xA9\xC7\x73\x73\x73\x0D\x9C\x43\xE1\x9C" - "\x64\x32\x39\x2B\x8A\xC2\x72\x26\x9D\xBE\x99\x3D\xCA\x4B\xB6\xD3" - "\x42\x10\x00\x22\xCF\x42\x53\xE5\x56\x37\x08\x7E\x3D\x3C\x38\x5C" - "\x5E\xBE\x7B\x77\x1D\x67\x18\x9C\x59\x5D\x5D\x7D\x93\xE7\xB9\x07" - "\x4F\x9E\x3C\x7D\x75\xEF\xA8\xCE\xB1\x72\x1C\x46\x78\x1C\x10\x86" - "\xD0\xEC\x88\x28\x16\x4B\x6C\xCD\x7C\x31\x6E\x1E\x1F\xDF\x1A\xBF" - "\x7C\x79\x73\x6B\x6B\x2B\x83\x1E\x06\x3D\x0B\x0B\x0B\xD1\xD1\x78" - "\xFC\x5E\x2E\xFF\x62\xB2\xD0\x54\x40\x5F\xB8\x0E\x85\x84\xA1\x13" - "\x02\xC7\xE7\x01\x36\x04\x86\xD1\xE0\x75\x02\x04\xFE\x89\x61\x59" - "\x8D\x97\x66\xA6\xA7\xD7\xFE\x4C\x26\x4F\x68\xF4\xF0\x3C\xFF\x5E" - "\xB9\x5C\x9A\x35\x3D\x05\x26\x1F\xC3\x5F\xCD\x0E\x52\x0D\x07\x0D" - "\x06\xC8\x35\x5B\x28\x17\x0E\xD0\xDA\xFB\x1D\x05\xAF\x0F\x6A\x6C" - "\x0A\x7D\x46\x68\x5A\x51\xD5\xF7\xD1\x43\x87\xFB\xFA\xB4\x4E\xC7" - "\xBF\x43\xB1\x02\x32\x6D\x03\x45\x1B\xA8\x77\x00\x4F\xE0\xE0\x0B" - "\x02\x94\xC6\x21\xA2\x7F\xDC\xC7\x73\x57\x41\xC5\x67\xD1\xA0\xC2" - "\x18\x88\xC5\x21\xCB\xE4\xCE\xE2\xE2\xA2\x4E\x0F\x0F\x0F\x5F\x92" - "\x09\x19\x65\x24\x03\x99\x3A\x8D\x74\xC9\x41\xBA\xEE\xC3\xF2\x19" - "\xFC\xF4\xF3\x53\x24\x7E\xFB\x0C\xFC\xF8\xCB\x88\xCC\xDC\x80\x04" - "\xC0\x69\x71\x30\x22\x31\x70\x1C\x17\x0F\x82\x60\x90\x95\x15\x85" - "\x84\x42\x21\xA1\x4B\xB3\xE0\xDA\x5D\x0C\xD0\x2C\x22\x9A\x88\xC4" - "\x25\x82\xB1\xA1\x18\xB6\xC9\x3C\x6A\x57\xDF\xC0\x81\x45\x23\xE5" - "\x11\x04\x39\x07\xD7\x07\x55\xB8\xED\xB6\x90\xCF\xE7\x09\xED\x79" - "\x9E\xA5\x6A\x9A\xAD\x4B\x0C\xF4\xB0\x06\x4F\x31\xB0\x55\xED\x80" - "\xF7\x4E\x91\x6D\x74\x51\x9F\x78\x1B\x0D\x51\x87\x2B\x89\x90\x06" - "\xFB\x61\x0C\x18\x30\x14\x0E\xA6\x69\xDA\x99\x74\xDA\xA2\x37\x36" - "\x36\x4A\x15\xB3\xB2\x23\x50\x1E\x86\x46\x14\x1C\xC9\x32\xC6\x06" - "\x78\x24\xCD\x36\x56\x8B\x1A\x44\xA2\x62\xBF\xE2\x83\x95\x45\x30" - "\x82\x80\x5B\x93\xFD\xF0\x4F\x2B\x48\x67\xB2\xCF\x77\xF7\xF6\x0A" - "\x0C\x00\x4F\xD5\x34\x89\x61\xE8\xDB\xB7\x6F\x4C\x31\x27\xBC\x82" - "\x1A\x58\x64\x69\x03\x3E\x2B\xC1\x2A\x05\x70\xC1\x81\x0E\xF1\x18" - "\x95\x80\xF9\x58\x13\xDF\x7E\xF5\x85\xF7\xEC\xD9\xE6\xA7\xA6\x69" - "\xAE\x33\xE8\xA9\x55\xAB\xB9\x53\xDB\x9E\x10\xE0\x5F\x9B\x7B\x7D" - "\x12\x6D\xA2\xC3\x62\x05\x04\x1C\x07\xC2\xF2\x08\xE9\x2C\x66\x2E" - "\x06\x98\xBF\xE8\xE0\x87\x2F\xEF\x63\x6D\xED\xC7\xEF\x8B\xC5\xE2" - "\x27\xAE\xEB\x3A\x0C\x7A\x9A\x3D\xED\x56\x6B\x33\x93\xCD\x5E\x3B" - "\x35\x0B\xF1\x77\xAE\xF4\x53\x37\x87\x55\xBC\x72\x81\xC1\xEC\x60" - "\x17\x6F\x45\x1C\x44\xCC\x1D\x7C\xFD\xF0\x5E\xF0\xE8\xD1\x77\xBF" - "\x94\xCB\xE5\x8F\x2D\xCB\xCA\xA0\x87\xC2\x39\xB2\x2C\xC7\x75\x5D" - "\xFF\x30\x16\x8D\xBE\x9B\x48\x4C\x44\x47\x46\x46\x04\x8E\xE7\x71" - "\x6C\x9A\xEE\xCE\xEE\x6E\x3E\xB5\x9F\xFA\xA6\x54\x28\x7C\x6E\xDB" - "\x76\x1A\x67\x28\xFC\x9B\x20\x49\x52\x42\xD3\xF5\xD7\x54\x4D\x1B" - "\xE3\x38\x0E\xAE\xEB\xA6\x6B\xD5\xEA\x7A\xB5\x52\xD9\x06\xD0\xC6" - "\x39\x7F\x03\x12\xDF\x5D\xB7\xD4\xC5\x56\x33\x00\x00\x00\x00\x49" - "\x45\x4E\x44\xAE\x42\x60\x82", 871); - getPNGImage(png); - } - else if (url == "ie.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x03\x50\x49\x44\x41\x54\x38\x11\x8D\xC1\x7B\x68\x1B" - "\x75\x00\x07\xF0\xEF\xEF\xEE\x72\x49\x2E\x97\x47\xD3\x24\xC6\x3E" - "\xB2\xDA\x9A\x59\xD9\xDC\x2B\x48\xB7\x76\xCC\xC1\xA8\x3A\x10\xB6" - "\x15\x57\x14\xDC\x40\x10\x59\xE9\x98\xFF\xC9\x90\xE1\x98\x22\x88" - "\x22\x28\x43\x68\x51\x51\xD8\x10\xCA\x5A\x51\xD9\xF0\xB1\x39\xD8" - "\xAB\xDB\x1C\x76\x63\xF6\x61\xB3\xD4\x35\x49\x93\xA6\x79\xF4\xD2" - "\xBC\x93\xBB\xDF\xFD\x0C\xAC\xC2\x10\x84\x7D\x3E\x04\x8F\x88\x95" - "\x86\xAD\x48\xFE\xEE\x67\xCA\xC2\x1A\x54\x8A\x45\xA6\xD3\x5B\x7C" - "\xCF\x75\x85\xE0\x7F\xF4\x9D\xBE\xDD\xD0\xD8\xE2\xEE\x5C\x67\x59" - "\x6C\x3E\xE8\x3E\xEB\xB3\x96\xA6\x7A\xD5\x42\xCA\x66\xD2\xB2\x77" - "\x41\xB9\x02\xA8\xBE\xC8\x74\x3A\x2C\xE0\x3F\xF6\x7F\x75\x4D\x7A" - "\x3A\xD0\xDE\xDF\xE0\x34\xBF\xE9\x37\x46\xD6\x6F\x2C\xFE\x2C\xD1" - "\x6C\x90\xBF\x24\xEC\xC4\x38\xDF\x35\x3D\x95\x90\x7E\x1D\x19\xE5" - "\x7F\x64\xAF\xF7\xED\x04\x83\x8F\xC7\x43\xFA\xBF\xBE\x2E\x6F\xEE" - "\x79\xEA\x7D\x5F\xB3\xF9\x44\xB7\x69\xA2\x2D\xB0\xFC\x85\x71\xA5" - "\x54\xE1\xC6\x9B\x8E\x60\xDE\xFB\x12\x54\xC9\xEB\xD6\x78\xE9\x45" - "\xA7\x97\x16\x7B\xE9\xD8\x5D\x59\xAC\x96\x38\x3C\xA4\x73\x4B\xC7" - "\xA1\x26\x97\xE1\xF0\x36\xF6\x9B\xD1\x1F\x3D\x89\xD9\x94\x18\x39" - "\x6B\x1A\xF8\x36\xA8\xAE\x3D\x4D\xAB\x6A\xD8\x21\x73\xF0\x7A\x4C" - "\x76\xD7\x63\xD6\x13\x47\x73\xEF\x6D\x03\x66\x63\x1C\x56\xF5\x8F" - "\x05\xFD\x4E\x1B\x06\xBA\x70\xD1\xD0\x1A\xFB\x06\x93\x19\xF7\xC4" - "\x68\xBA\xB7\xEF\xAD\x0F\xD6\xBD\x76\xAC\x49\x3A\xF0\xF7\x64\x6C" - "\x7F\xAD\x54\x9D\xB6\x5A\x78\x38\x1D\xA2\x23\x6A\xDE\xF8\x6A\xF3" - "\x4F\x17\x64\x0E\xAB\x7C\x0D\xDA\x8E\xAD\x86\x9B\x4F\xB4\x2D\x9D" - "\xC2\x9F\xEC\x59\xFD\x07\xD3\xE0\x97\x27\xCF\x3D\x3E\xB5\xB7\xFB" - "\xAA\xBC\x67\xF8\x8A\x75\xEC\xB3\x0B\x93\xD9\x64\xEE\x8C\x81\x07" - "\x64\x89\x87\x68\x16\xB7\x58\x9B\xDC\x9B\x09\xEA\x82\xF3\xE7\xF9" - "\x12\x4D\x0F\xB5\x6B\xBF\xBC\x71\xBF\xE4\xC1\xCD\x27\xDF\xD1\x0B" - "\x35\xE3\x2C\x61\x2C\x07\x80\xE0\x01\x46\x38\xE2\x12\x2D\xC6\x8E" - "\x44\x46\xC3\xED\x99\x3C\x0D\xCD\x24\x0F\x0B\xA8\x6B\xF7\xC4\x37" - "\xA8\xE9\x5B\xDB\x23\x4B\x2A\x2E\xFB\x06\xC0\x89\x76\x70\xB4\x6A" - "\x63\x8C\x88\x00\x08\xFE\x45\xA0\x97\x0B\xD5\x60\xA5\xA8\x42\xAB" - "\xD4\x74\x5D\xD3\xCA\x02\xD5\xCE\x9B\xB8\xC2\xD5\x5D\xB9\xE4\x5C" - "\xCB\x77\xB5\x43\x28\x72\xAD\xF0\xA8\x1A\x8D\xCE\xA5\x8E\x45\xEE" - "\x25\xCF\x99\x24\x51\xC0\x03\xAC\x94\x2F\xF3\x4C\x87\x50\xAE\xE8" - "\x48\x66\x35\xA8\x4A\x25\x23\x40\xCF\x78\xA0\x4C\x06\xE2\x69\xEE" - "\xAF\x2B\x5A\xA0\xAD\xB3\xA4\xBA\x74\x9B\x68\x70\x79\x6D\xCF\x87" - "\xEE\x44\xC6\xCE\xBC\x12\xC8\xA3\xEE\xE0\xE8\x84\x63\xD3\xD6\x8E" - "\xA3\x94\x13\x36\xCC\xC7\x6B\x58\x09\x65\x43\x6A\x22\x74\x5C\x40" - "\x79\xCE\xC9\x94\xC5\xE6\x16\x5A\xF8\x38\xB5\x82\x1D\x2E\x45\x1D" - "\x6C\xB0\xF1\x70\x38\x2C\x2F\xF7\xEC\x7E\xC6\xBC\x69\x7A\xE9\x7B" - "\x10\x08\xB2\x43\xDA\x27\xCA\xE6\x17\x32\x79\x5D\x28\x43\x67\x35" - "\x9D\x1C\x8F\x7E\xB2\x5B\x11\x48\x2E\x2C\xA1\x5C\x86\x5D\x54\xEE" - "\xC4\x62\xA5\x1B\x2E\x07\xB7\x5E\x96\xF8\xE7\x78\x4E\x34\xC8\x76" - "\xCB\x5E\xC9\x2E\xED\x41\x1D\x65\x84\xAC\x14\x28\xE2\xC9\x0A\xCB" - "\x2C\xE5\x47\xB2\xD1\xC4\xE7\xA8\xE3\xA0\x23\x0D\x5D\x50\x19\x2C" - "\xBE\xF8\xDB\x6B\x23\x8D\x89\x1B\x83\xD9\xE8\xC2\x48\x78\xA1\xA8" - "\xC4\x53\x35\x64\x72\x94\xA4\x73\x94\xC4\x92\x55\x16\x5E\x28\xC6" - "\x16\x23\xCA\x87\xA9\xFB\xF1\x23\xA1\x77\xB7\x2F\xA3\x8E\x50\x76" - "\x8A\x27\xE3\x43\xFB\x50\xC9\x77\x03\xEA\x1F\x84\x54\xEF\x5D\x4C" - "\xFA\xC3\x1F\xB1\x4F\xD7\xD8\x1B\x2D\x5D\x26\x93\xA1\x95\x81\xD1" - "\x72\x51\x9D\x5B\x4E\xE5\xAE\xCD\x8E\xCF\x04\x63\x43\xFD\x14\xAB" - "\x08\xEA\xF4\xE0\x01\x82\xF8\x94\x15\xB4\xC2\x03\x2C\xCF\xED\x9A" - "\xD1\xF0\x88\xFE\x01\xAA\x49\x94\xA9\xE6\x22\x1B\x06\x00\x00\x00" - "\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 905); - getPNGImage(png); - } - else if (url == "vlc.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x02\x20\x49\x44\x41\x54\x38\xCB" - "\x9D\x93\x4F\x48\x53\x71\x00\xC7\x3F\xBF\xF7\xDE\xDE\xDE\xB6\xE7" - "\xDE\x66\x30\x65\xFE\xEB\xCF\x92\x4A\x4A\xEC\x3F\x2E\x0B\xA2\xEC" - "\x10\x8C\x52\x30\xA3\x4B\x97\xEA\x10\x81\x78\x52\x28\x08\x3A\xD5" - "\xA9\x82\xB2\x82\x4E\x46\xC7\x0C\x22\x21\xE8\xCF\x41\xA8\x40\xC2" - "\x29\xE4\x44\x49\x62\xA6\x92\x6B\xBA\x5A\xC6\xB6\xB7\xED\x75\xC9" - "\x2E\x6B\xB6\xFA\x5E\xBF\x5F\xBE\x7C\xBE\x87\x2F\xAC\xA2\xF0\x39" - "\xED\x62\xF8\x8C\x72\x99\xFF\xD1\x83\x0E\x6F\xF5\x7C\x17\x56\xAC" - "\x1B\xAB\xFF\x58\xD9\xBA\x62\x39\xA9\x98\x91\xAF\x0D\x1E\x92\xAA" - "\xB6\x62\xF9\x1B\xB0\xD6\xEF\x6F\x2D\x96\x53\x8A\x19\xD6\x9E\xB3" - "\xA1\x58\x53\x23\x19\x33\x4B\x7A\x64\x2C\x04\x4F\xEF\x96\x4C\x70" - "\xF5\x46\x9F\xEE\xF6\x94\x1F\xB0\x84\x82\x90\x6C\xB8\x74\x77\xF0" - "\xDA\xCD\x3E\x4F\xC9\x04\x6B\xC2\xF7\x9A\xAB\x8C\xD6\x72\xBB\xDA" - "\x84\x2A\x43\xF5\xEC\xB0\x91\x1C\x7E\xD1\x02\x3C\x29\xA9\xC0\x58" - "\x8C\x84\xFC\xC3\x23\xB8\xC3\xA0\x1A\x60\xC4\x60\x76\xC1\x1E\xFA" - "\x53\x41\xC1\x84\xDB\x27\xEB\x65\xB7\x95\x3A\x22\x2B\x60\x01\x79" - "\x40\x75\x42\x59\x3E\x7D\xF8\xCE\xA9\x4D\xB6\xBF\x16\x24\x76\x75" - "\x35\xE4\xB6\xB7\x05\xB2\xC6\x5A\x72\x36\x9D\xAC\xAC\x93\x31\x6A" - "\x31\x1B\x8F\xD6\x2D\xED\xBC\xB0\x6D\xD5\x09\x1F\xEE\xB7\x7B\x07" - "\x13\x5F\xDA\x53\xCD\xDD\x7C\x2A\x77\xA2\xE6\x52\x08\x49\x90\x34" - "\x05\xC9\xCF\x09\xE4\xC8\x9B\xB6\x81\xF3\x5B\xA6\x8F\xDF\x1A\x5F" - "\x2A\x20\x88\x3E\x3C\xBD\x4F\x7B\x3D\x10\x35\x16\xA7\x2F\xD9\x1C" - "\x2E\x72\x42\x25\x6D\xF7\x92\x51\xBD\xE4\x25\x0D\x45\x73\xA0\x2E" - "\x7C\xEC\xF5\x4D\x8C\x47\x9F\xF7\xEC\x3D\x58\x40\xA0\xC5\x47\x3B" - "\x62\xCB\x79\xDD\x33\xFA\x08\x9F\x4F\x42\xDA\x10\xC4\x72\xFA\x90" - "\x64\x81\x2B\x39\x4F\xCD\xC4\x10\xE2\xFD\x63\xF1\x23\x8B\xEE\xCB" - "\xC4\x3A\x81\x97\x00\x02\x60\xEE\xD5\x15\xD9\xF5\xEE\xFA\x44\x7C" - "\x2A\x1E\x98\x99\x81\x4A\x0F\x38\x35\x50\x14\x81\xCD\x29\x90\x45" - "\x9E\x6F\x71\x98\x9C\x83\xAA\x6A\xA8\xDC\x6C\x44\xCD\x96\xDE\x40" - "\x45\x73\x8F\xA9\x00\x38\x48\x34\xDA\x95\x78\xC0\x5F\x0F\x5E\x0F" - "\xA4\x92\x20\xB2\x20\x59\x16\x92\x69\x21\x34\x28\xAB\x84\xDD\x35" - "\xE0\xA8\x00\xA1\x7D\xAD\x35\xB5\xE5\x1D\xC0\x5B\x05\x40\xCF\x0C" - "\x75\x2A\x1B\xFD\x00\xD8\xEB\x80\xEF\x2B\x87\xF8\xC5\xB8\x32\xD4" - "\x05\xE8\x80\x0C\x4A\x6A\xF0\xC4\xEF\x82\x67\xFD\x63\x93\xDE\x6C" - "\xEA\x9F\xDE\x9A\x76\x2F\x46\x00\x7E\x02\x6B\x20\xAD\x2C\x4A\xE3" - "\xCD\x0E\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 622); - getPNGImage(png); - } - else if (url == "fb2k.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x04\x00\x00\x00\xB5\xFA\x37" - "\xEA\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x01\x4C\x49\x44\x41\x54\x28\xCF" - "\x6D\x91\x3D\x28\xC4\x71\x1C\xC6\x9F\xDF\xEF\xDC\xFD\x4F\xE9\xF2" - "\x9A\xAB\x43\x28\x49\xC9\x62\xF0\x32\xB8\x52\x5E\xCA\x6D\xC2\x60" - "\x10\x16\x59\x44\xD8\x2E\x65\xB1\x5B\xA4\x2C\x22\xDB\x95\x41\x57" - "\x36\x2F\x25\x79\x49\x62\x21\x13\x65\x40\x4E\x49\x9D\xB7\xFB\x18" - "\x9C\xEB\x0E\x9F\xF1\xFB\xF4\x3C\xDF\x7A\x1E\x29\x89\xF1\xE7\x76" - "\xC9\x25\x49\x72\xF9\xDA\x6D\xA9\x32\x31\x39\x9D\x8B\x87\x77\xEE" - "\x26\x79\xE5\x64\xD5\xEF\xDC\x76\xAF\x18\x5F\xBA\xEE\xF1\x04\x6F" - "\x5E\x60\x66\xDF\xD6\xD9\xDA\xC9\x6D\xB8\x8B\x7B\x3B\xE4\xA4\xEC" - "\xA6\x28\xB4\x0A\x00\xC7\xB1\xA3\xC7\x04\x00\x7D\x11\xE3\x97\x49" - "\xFA\x5D\x0D\x27\x31\x7E\x71\xF9\x9C\xD5\x92\xCC\x30\x79\x15\x61" - "\xFE\xA1\x66\xCE\x14\x7C\x3F\x08\xF4\xAD\x87\x68\xE6\x3C\x25\x5D" - "\x10\xA4\x95\xE1\x4D\x5B\x26\x23\x19\x5B\x36\xB6\xDD\x86\xC8\xE7" - "\x0A\x80\x6B\x8A\x11\xCD\x84\x0F\x6C\xA5\xAC\x64\x8C\xBF\x27\xB2" - "\x86\x10\x21\x00\x7A\x11\x62\x89\xC1\xA8\x09\xC8\x48\x32\x39\x45" - "\x23\x1F\x89\x11\x84\x8B\x77\x12\x64\x23\x06\xF8\x24\x30\xF1\xD3" - "\x85\x35\x25\x53\x5B\xB0\x47\x14\x80\x4D\x76\x81\xD9\x7D\x5B\x9E" - "\x6C\x56\x92\xDB\xDD\x78\x70\x0F\xB0\xC0\x3C\x00\x67\x31\xA7\x45" - "\x9E\xF4\x2E\x9D\xC2\xFE\x87\xF8\x06\x8B\x2C\x13\xE1\xE9\xAD\x78" - "\x48\xDE\x5F\x6B\xC8\xA9\x1C\x3B\x79\x07\x38\xFD\xA8\x9E\xFE\x2B" - "\x4B\x92\xBB\x7C\xF4\x21\x1E\x7B\xAD\x1A\xCF\x0C\x4F\xC7\xFA\x3A" - "\x72\x43\xB2\xE9\xA7\x2F\x4C\x12\xCB\xB6\x7D\xA8\x6B\x13\x00\x00" - "\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 410); - getPNGImage(png); - } - else if (url == "wmp.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x02\x55\x49\x44\x41\x54\x38\xCB" - "\xD5\x93\x4B\x48\x94\x51\x14\xC7\xFF\xF7\x7E\xF7\x7B\xCC\xCB\xC7" - "\x8C\xAF\xD1\x31\xED\x81\xD1\xA6\x20\x22\x06\xAD\x45\x12\x6D\x82" - "\xA2\x08\x24\x42\xDA\xB5\x6F\x51\x50\xFB\x68\x23\x84\xBB\x96\x41" - "\x9B\xB6\x25\x84\xDA\x26\x8A\x94\x28\xA5\xA8\xA6\x30\x35\x23\xD4" - "\xC6\x79\xE9\x38\xE3\x7C\x8F\x7B\xEF\x69\x61\x46\xE3\xBA\x4D\x67" - "\x73\x76\x3F\x7E\xE7\x7F\xCE\x01\xFE\xFB\x62\x00\x70\xFD\xF1\x7C" - "\x6F\x22\xE6\x1C\x06\x10\xE3\x0C\x61\x00\xA6\x25\xB8\x30\x18\xB3" - "\x0C\x0E\xD3\x36\x85\xE0\x06\x17\x9B\x1B\x1B\x99\x8A\x62\x8B\xC2" - "\x09\x7D\xB8\x7D\xA2\xC3\x05\x00\x01\x00\xC9\x78\xE4\xF2\xD1\x7D" - "\xED\xA9\xB2\x1B\x9C\xB1\x75\xCD\x4A\xAC\xBF\x8F\xDB\xBA\xC6\xCA" - "\xD1\x3E\x7F\x2B\xDA\xED\x81\x73\xF2\x03\x65\x69\xA5\x0A\x51\x2D" - "\xB3\x39\x1F\x77\x00\x4C\xFC\x01\x70\x06\x80\x48\x8B\xD5\x99\xC6" - "\xFE\xC5\x91\x44\x48\x6F\x71\x88\x30\x60\x37\x44\x7E\xB4\x9C\xF6" - "\xBE\xF5\x5C\x2C\x49\xCD\x51\xF1\x14\x79\x41\x40\x9F\x4A\xA4\x77" - "\x46\x10\x00\x50\xA8\x2A\x35\x97\x2D\xAD\x5F\x98\xB9\x11\x0F\x1F" - "\x1F\xE6\x3C\xD4\x04\xF9\x72\x14\xE4\xCE\x21\x55\xCC\xDA\x55\xB3" - "\x3D\x5A\xE9\x18\xA8\x19\x8C\x18\xDF\x95\x01\x07\x00\x5F\x6A\x74" - "\x2F\x4F\x1C\x6B\x74\x0B\x06\x8B\x26\x21\x8E\x0C\xC1\xBA\xF2\x08" - "\xBC\x2B\x0D\xBD\xB6\x84\xD4\xE7\x87\x61\x59\xAD\x30\x02\x49\xCE" - "\xB6\x73\xAB\x03\x30\x06\x24\xCA\xF3\x9D\x14\x10\xA0\xB7\xED\x78" - "\xF3\x1E\x58\x43\xF7\x61\x0E\xDE\x84\xB3\xFA\x91\xBB\x9B\x65\x26" - "\x95\x96\xBE\xD2\xFE\xDF\x00\xF1\xBB\x13\x31\x2B\xD8\x06\x80\x76" - "\xB6\x03\xE9\x41\xE5\x97\xA1\x03\xA0\x2A\x49\x06\x80\xD2\x80\x4C" - "\x36\xDA\xBC\xCE\x80\x08\xC8\xB7\xA7\x17\xC8\x27\x90\xD2\x20\x22" - "\xC8\xAF\xD3\xD8\x1A\xBD\x84\xE0\xF9\x03\x94\x22\x07\x24\x8F\x34" - "\xF8\x96\x30\xE0\x08\x03\x51\xDB\x60\x75\x06\x04\x60\x35\xD9\x3F" - "\x9B\x6D\x4D\x9F\x4B\xCE\x3E\x75\xD4\x97\x69\x04\x6F\xC7\x00\x29" - "\x01\x26\xF0\xEE\xD0\xD5\x22\x0F\x37\x48\xF2\xD6\xA1\x88\x21\xBB" - "\xE1\xE9\x7A\x03\x30\xE6\x93\x21\x27\x07\x46\x16\x7F\x52\x53\x21" - "\x78\x3D\x06\x72\x03\xF8\x91\x94\x9E\x1A\xBC\x9B\x5B\xD9\x7B\x2A" - "\xE7\x4A\x42\xC5\x0D\x58\xAE\xB4\x69\x8C\xDF\xBB\xE5\x00\x08\x01" - "\x60\x02\x00\xB2\x0B\x99\x29\x77\x65\x2E\xCD\x80\xA9\xEF\x2D\xC3" - "\xA9\xCE\xF3\xD7\xE2\xB6\x72\xA9\x64\x36\x0B\x32\x9D\x30\xAB\x78" - "\x96\x94\x81\x59\xCC\x17\xEC\x62\x6E\x2D\x56\x5A\xCA\x30\x00\x26" - "\x80\x1A\xDB\x7D\xDB\xA9\x64\x17\x3F\x78\xF2\x6C\xBC\xB5\xB7\xAF" - "\x27\x96\x68\x6B\x73\xA2\x0D\x2D\xCC\x74\x3A\x88\xF1\xFD\x6F\x9E" - "\x3D\x79\x91\x79\x35\x3E\x59\x5E\x9E\xCF\xFF\xB3\x67\xFA\x05\xB0" - "\xB4\x12\x06\x04\xED\x6B\x1E\x00\x00\x00\x00\x49\x45\x4E\x44\xAE" - "\x42\x60\x82", 675); - getPNGImage(png); - } - else if (url == "icecast.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x02\xC7\x49\x44\x41\x54\x38\xCB" - "\x95\x92\x6B\x48\x93\x61\x14\xC7\x5F\x4B\x53\xBA\x78\x63\x66\x89" - "\x48\x89\x15\x95\xB7\xC4\xB4\x54\x4C\xA4\xCC\x10\xDC\xE5\xD5\xCD" - "\xCD\x4B\xD2\x74\x73\x7B\xA7\x73\xCB\xCB\x34\x35\xDC\xE6\x6D\xF3" - "\x92\xBE\x86\x69\x5E\xD2\xA6\xA9\x65\x98\x64\xA0\x29\xD2\x97\x0C" - "\xF1\x43\xA0\xF5\x41\x41\xBA\x48\x44\xA9\x88\xFA\xC5\x20\xFE\xBD" - "\x5A\x94\x5D\x2C\xFB\xC1\x03\x0F\x87\x73\xFE\xE7\xFF\x3C\xE7\x10" - "\xC4\x37\xEC\xEC\x1D\x59\xD6\x36\xF6\xE6\xC4\x06\x12\x94\xBD\xB6" - "\x11\x31\xA5\x07\x36\xC6\x76\xED\xB6\x71\x26\x36\xC3\xD6\xCE\xC1" - "\x92\xC5\x72\xDA\xB9\x76\x17\x52\x77\xEC\xE5\xC5\xD3\x63\x6C\x71" - "\xCB\x4B\x6F\x7F\xAE\x0B\x6B\xAF\xD3\x0E\xE6\x58\x12\xFF\xC2\x9E" - "\xB5\xDF\x2B\x30\x4C\xE1\x46\x95\xCE\x4C\xA8\x6A\x57\x20\x50\x0D" - "\x22\x22\x8E\x9E\x3E\xE4\xEA\x11\x4F\x6C\x05\x21\xD5\xE9\x1C\x97" - "\xD6\xF3\x5C\xAE\x7F\x01\x35\xBD\x82\xE8\xD4\x5E\x84\x73\x34\x88" - "\x4C\x6C\x78\xE5\x1B\x28\xF4\xF8\x6B\xF1\xC5\x8C\x01\x57\x85\xE1" - "\xCD\x8C\x9A\xE9\x9C\xAC\x19\x42\x6E\xC5\x38\xA2\x04\x99\x88\x52" - "\xF4\x22\x2A\xB5\x0F\x91\x97\x9A\xDF\x05\x9F\x4F\xF5\xF9\x63\xB1" - "\x88\xEA\x3C\x4C\x95\xBD\x7E\xAB\xAA\x59\x84\xC6\x30\x8A\xB2\x0A" - "\x13\x8A\x75\x85\x28\xD1\xEA\xD0\x7D\x6F\x18\x42\x49\x0D\x48\x46" - "\x84\x9D\xD4\xFA\xE1\x64\x50\xAC\xDF\x2F\x9D\x07\xBD\x52\x8D\xB3" - "\xEF\xD5\xF4\x32\xA4\x97\xDB\x61\x2C\xD2\xE2\x6E\x67\x07\x5A\xAF" - "\x57\x43\x2D\x15\xA3\xDD\x74\x1B\x55\xE5\xD5\x50\x66\xD1\x8C\x9B" - "\x07\x8C\x48\xDB\x62\xD0\x39\x2A\x74\xBD\x38\x4E\xD5\xEF\xAB\x30" - "\xCE\x7E\x5C\xB3\x4D\x15\x8E\x21\x2F\x27\x07\x49\x7C\x36\x2A\x4B" - "\xAA\xD0\xD6\xDC\x08\x89\x58\x8A\xDA\xEA\x6B\x68\x6F\xAA\x47\x7E" - "\x86\x06\x22\x49\x2D\x48\x45\x1F\xB8\x92\x8E\xE5\x80\xB3\xB2\x30" - "\x82\x2F\xEF\xEE\x11\x65\x3E\x81\x48\x3D\x00\x95\xBA\x10\xC3\x43" - "\x8F\x31\x36\xFA\x14\x94\xF2\x0A\x0C\xBA\x22\x94\xE8\xB5\x28\xC8" - "\xD1\xA0\xAD\xE5\x16\x5A\x1B\x6E\x40\x9F\x97\x8B\x70\x6E\x2E\x42" - "\x48\x03\x4E\x5F\xC8\x7A\x46\xB0\x13\x6A\xF7\x90\x29\x5D\x43\x9A" - "\x02\x1A\x0B\xF3\xF3\x98\x9B\x9B\x83\x20\x5A\x80\xF8\x58\x11\x74" - "\x45\x34\x04\x31\x72\xA4\x48\xE5\x50\x29\xD3\xC1\xE1\x70\xB0\xBC" - "\xBC\x82\xD2\xB2\x4A\x78\x9C\x8A\x1F\x77\x3B\x7A\xC6\x71\xFD\x19" - "\x64\x22\x6D\x55\x90\x9D\xBD\x60\xA2\x8D\x28\xD7\x5E\x45\x86\x2A" - "\x1D\x89\x62\x35\x63\xD3\x04\x9F\x10\x39\xBC\x03\xE2\x50\xA4\x2B" - "\x85\x97\xA7\xDF\xA7\x7A\x83\xEE\x73\x53\x4D\x15\xB8\x5C\x7E\xE8" - "\xF7\x4F\x64\xB6\xCF\x6A\x64\x64\x64\x61\x75\x75\x15\x75\x75\x75" - "\x98\x9C\x9C\x84\x48\xAC\x07\x4F\xD6\xFD\x55\x20\x58\x8E\xE3\x3E" - "\x1C\x3C\xEC\x7F\x34\x31\x35\x35\x35\xB4\xB4\xB4\x04\x83\xB1\x3C" - "\xED\xB7\x51\x5A\x5B\xDB\x99\x85\xF3\xF2\x6F\xF2\xA5\x8D\x88\xA2" - "\xEE\xFF\x24\xE0\x1D\x2C\xC3\x31\xF7\xD0\x1E\x07\x6B\x5B\x4B\x26" - "\xCF\x62\xD3\x65\xE2\x0A\xF5\xE6\xA4\xA4\xAD\x9E\x64\xC6\xF5\x43" - "\x40\x06\x4F\xFF\x18\xD3\x3E\x67\x77\x0B\x62\xAB\x90\xC9\xAD\x95" - "\xBC\x94\xAE\x75\x81\x23\x3E\x3C\xDA\xCD\xE5\xE0\x76\xE2\x7F\x60" - "\x9C\x98\x45\xF0\x8B\xCB\x4E\xF8\x91\x2D\x4C\xE7\x6D\x9B\xE5\x7D" - "\x01\xA7\x4F\x5F\xE6\xC8\x50\xBB\x4A\x00\x00\x00\x00\x49\x45\x4E" - "\x44\xAE\x42\x60\x82", 789); - getPNGImage(png); - } - else if (url == "html5.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x01\x9F\x49\x44\x41\x54\x38\xCB" - "\x9D\x93\xCF\x4B\x02\x41\x14\xC7\xF7\x8F\xF0\xE8\x39\xED\x26\x1D" - "\x82\x08\xAA\x83\xD0\x29\x22\x82\x2C\x28\xD1\x48\xA8\x4B\x25\x88" - "\xD4\x29\x41\x88\xF5\x10\x74\x10\xBA\xF4\xC3\x2E\x21\x44\x10\x1D" - "\xCB\x4E\x92\xE0\xC9\xE8\x90\x1E\x3A\xA5\xEE\xB8\xAE\xAB\x64\x98" - "\x85\xD9\x6B\xE7\x35\xBB\x8C\xAB\x16\xF4\xE0\x0B\xBB\xCC\x77\x3F" - "\x33\xF3\x7D\x6F\x85\xC2\xD4\x80\x45\x13\xFC\x53\x16\x81\xD6\x6F" - "\xA6\xDA\xB2\xBD\x4B\xEA\x92\x1D\xD7\x04\xBD\xB4\x97\x3C\x7E\xE0" - "\x1A\x82\xA2\x77\x8C\xD3\x38\xBC\x6E\x39\x3B\x54\x5F\x1F\x06\xD5" - "\x8D\x80\x3C\x0F\xC8\x50\x00\x89\xEE\x80\xA2\x28\x86\x54\x55\x05" - "\x73\x35\xE3\xBB\x50\x59\x44\x40\x86\x07\x24\x28\x40\x12\x37\xF1" - "\xC3\xF2\x53\x0E\xE4\xE4\x35\x28\x77\x37\xD0\xCA\xA5\x3B\xD4\xD8" - "\xF7\x81\xB2\x60\xA3\x80\x04\x0F\x88\x21\x20\xE0\x42\x40\xE9\xF2" - "\xD4\xC8\xE0\xC5\x37\xD8\xA5\xF2\x3C\x02\x62\x3C\x40\xA4\xE6\xE2" - "\xEA\xE4\xCF\x09\xB2\x0F\x40\x0E\x45\x28\x1D\x45\xE0\xFD\x2A\xDA" - "\x21\x9A\x81\x3C\x87\x00\x91\x07\x04\x70\x47\xF7\xE8\x9F\x19\xD4" - "\xFD\x23\x40\x66\x11\x10\xE0\x01\x1E\xFD\xC8\x34\x07\x5D\x24\xE2" - "\x87\xB7\x93\x6D\xD4\x57\xB3\x81\x00\x7A\x05\x69\x06\xBD\x1E\x1E" - "\xE0\xD4\x01\x72\xEA\x16\xAF\x60\xCE\x80\x56\xBB\x4A\xF0\xB9\x38" - "\x8D\x6B\x4E\x1E\xE0\x30\x00\xF7\x69\x3C\xBE\xB4\x17\xC4\x2B\xD5" - "\x83\x13\xD0\x3C\x0B\x23\xE0\xF3\x39\x8B\x00\xE6\x75\xF0\x00\xAB" - "\x01\xA0\xED\xEB\x93\x41\xEB\x31\x85\x93\xC8\xBC\x56\x81\x2F\x63" - "\x7C\xB5\x69\x94\xC2\x6B\x50\xBA\x38\x86\x8A\x36\x0F\x6D\xA5\x00" - "\x1F\xC9\x73\x68\x1C\x6C\x60\x07\xAA\x5E\xD3\x18\x73\x00\xD2\xEB" - "\x5F\xE0\xFB\x4F\x77\x67\x33\x40\x7A\x01\x42\x9A\xB2\x66\x00\x9D" - "\x7B\xD9\x65\xD3\x93\x07\xE6\x09\x09\xFD\x8A\xE5\xB1\xA2\x29\xAE" - "\xA9\xC6\x14\x67\xAD\xB6\x9A\xFD\xDF\x6D\xBF\x3E\xC4\xFD\x38\xE7" - "\x3F\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 493); - getPNGImage(png); - } - else if (url == "flash.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x01\x15\x49\x44\x41\x54\x38\xCB" - "\x95\x93\x41\x8A\xC2\x30\x14\x40\x7F\x3D\xC1\x78\x84\x7A\x04\x0F" - "\x20\x88\x5A\xAB\xAD\x8A\xB8\x1A\x10\xC6\xEE\xDD\x09\x6E\x5C\xBA" - "\x70\xA3\xCC\xC2\xBD\x17\xF0\x04\x2E\xBD\xC0\xE0\x09\xE6\x06\x95" - "\x42\xA1\x50\x28\xFD\x93\x84\x64\xF8\x69\xD3\xA2\x81\xB7\x69\xF3" - "\xDE\x4F\x03\x05\xDF\xB2\x70\xC2\x98\x02\xE0\x8C\x30\x95\xF0\x77" - "\x7C\x8F\xC7\x18\x37\x1A\x82\x91\xC4\x65\x40\x6D\xC0\xAA\x0E\xB8" - "\xA6\x80\x06\x91\x45\xC0\x30\x5D\x0B\x28\x94\x48\xE5\xFD\x7C\x8E" - "\xBF\x8F\x07\xF2\x65\x0C\xD4\xF1\x1D\x04\x48\x17\x95\x87\x3C\xC0" - "\x8F\xE6\x15\x24\x4F\x12\xB4\x5A\x98\xE7\x39\xC6\xCF\x27\x9E\x56" - "\xAB\x92\x2C\x02\xEA\x62\x3C\x82\x7A\x76\xBB\x5C\x30\xCB\x32\xDC" - "\x76\xBB\x46\xD9\xE1\x81\x11\x11\x28\x5F\xB6\x8D\x69\x9A\x6A\x50" - "\x59\x0B\x98\xB8\x1E\x8F\x98\x24\x89\x06\x15\x15\xE0\x92\xA3\x71" - "\x16\xCD\x26\x9E\xD7\x6B\x8C\xE3\x58\xB0\xE9\x74\x4A\x53\x15\x03" - "\x53\x20\x8A\xA2\x7F\x0E\xCB\x65\xA5\xA8\x80\x61\xE1\xBB\xC2\x30" - "\xC4\x9F\xFB\x1D\x77\xBE\x5F\x12\x8B\xB2\x08\x38\x86\x8B\x71\x5E" - "\x10\xFB\x12\x70\xDE\x90\x74\xD9\x12\xC0\xA0\x66\x63\xD5\x54\x2E" - "\xF6\x24\x20\x97\xCD\xF8\x7C\x03\xF6\xBF\x41\x9B\xF1\xF1\x07\x5A" - "\x4C\x80\x8C\x91\x5C\x9B\x60\x00\x00\x00\x00\x49\x45\x4E\x44\xAE" - "\x42\x60\x82", 355); - getPNGImage(png); - } - else if (url == "rtb.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x00\xA9\x49\x44\x41\x54\x38\xCB" - "\xAD\x53\xC1\x0D\xC4\x20\x0C\xCB\x28\x1D\x25\x4B\xF4\xDF\x51\xB2" - "\xD9\x8D\x76\x95\x53\x19\xB8\xD6\x04\xA9\x3A\x24\x4B\xB4\xC2\xC6" - "\x4E\x82\x99\x5A\x11\x91\x70\xFF\x26\xF8\xBD\x5C\x11\x9E\x04\x33" - "\x8D\x4B\xCC\x35\x79\xDF\x3F\xB6\x6D\xFD\x20\xF7\x77\xE0\x3F\xCE" - "\x3E\x6E\x1E\x09\xD8\x47\xD4\x22\x3F\x4E\x94\x6D\xE6\xAF\xE2\xB4" - "\x82\x29\xDB\xC7\x51\x0B\x00\xC9\xBD\xF2\x74\xDB\x20\x81\x8C\x7D" - "\x15\x03\x48\xEE\x78\x0B\x0E\xF7\xD6\xAD\x45\x92\x3B\xB3\x49\x47" - "\x04\x85\x47\xB1\xE4\x32\xC2\x4A\x84\x35\x19\x1D\x25\x97\x45\xAC" - "\xAA\x0D\xF2\x3D\x66\x2B\xE2\xAC\x8D\xAB\x76\xB6\x36\xAA\x41\x52" - "\x31\x9E\x83\xE6\xF3\x51\x56\x22\x74\x21\x47\xF9\x2F\x8F\xE9\xE5" - "\x73\x3E\x01\x35\x60\x01\xA4\x93\x4C\xC0\x7E\x00\x00\x00\x00\x49" - "\x45\x4E\x44\xAE\x42\x60\x82", 247); - getPNGImage(png); - } - else if (url == "ps.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x04\x00\x00\x00\xB5\xFA\x37" - "\xEA\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x00\xE2\x49\x44\x41\x54\x28\xCF" - "\xA5\xCE\xBF\x2B\x04\x70\x00\xC6\xE1\xEF\x24\xC2\x9D\x23\x52\x26" - "\xD9\x0D\x97\xED\x22\x31\x28\x93\x01\x65\xB0\xF8\x03\xAE\x8C\xCA" - "\x20\x75\x83\x48\xE1\xE4\x72\x49\x91\xB2\xB2\x18\x64\x40\x16\x19" - "\xAE\x48\x91\xF2\xF3\xBA\x52\x2C\x06\x0A\x3D\x46\x91\x53\xF2\xCE" - "\x4F\x6F\x9F\x10\xFE\xB2\x9C\x82\x5F\x41\x9F\x61\xEB\xEE\x8B\xA3" - "\x84\x98\x3A\x8D\x92\xC5\x9E\xDA\x55\x19\xB3\xA5\x5C\xB3\x27\x3F" - "\x82\x88\x05\xE7\x6A\x55\xD8\x2D\x06\xD2\x4E\xD5\xAA\xB1\xE8\xC7" - "\x86\x88\x79\xC7\x62\xCA\xEC\x7D\x07\x2F\x2E\x25\x44\xA4\x3D\x18" - "\x90\xF2\xFE\x09\xDE\xDC\x59\x12\xD7\xA3\x5B\xA5\x19\x37\x46\x4D" - "\xCB\x98\x95\xF3\x2A\xE4\xF5\x6A\xD0\x22\xEB\x44\x87\xA8\x94\x21" - "\x5D\x56\x1D\x19\x54\x22\x29\x6C\x8B\x6A\xB2\x2C\x6B\x44\xA7\x88" - "\x09\x05\x67\x56\xB4\xAA\xD7\xEF\x42\x08\xE1\xDA\x81\x39\xE3\x76" - "\xB4\x29\x95\x32\xA9\x5A\x5C\x46\xDE\xAD\xC7\xAF\xA9\x57\xA6\xAC" - "\xD9\x70\xE8\x59\x08\x21\xEC\xDB\x14\xFE\xBD\x0F\x28\x4D\xB1\x81" - "\xCE\x50\xD3\x95\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 304); - getPNGImage(png); - } - else if (url == "mplayer.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\x9C\x00\x00\x0E" - "\xC4\x01\x75\xF6\x84\x81\x00\x00\x01\xBE\x49\x44\x41\x54\x38\xCB" - "\xB5\x93\x4D\x6B\x13\x41\x18\xC7\x97\x7C\x0A\x6F\x82\x37\xBF\x80" - "\x57\x3F\x81\x47\xD3\x83\xD4\x80\xF5\xE2\xCB\x21\xA8\xE8\x36\xC4" - "\x22\xE9\xC1\x1C\x12\x85\xE2\x41\x44\x6D\x11\xC1\x43\x63\x5A\xA5" - "\x9A\x88\x11\x8B\x07\xA1\x07\x6F\xBE\x20\xD9\x45\x21\x31\x11\xEB" - "\xEE\xEC\xEC\xEE\x64\x13\x4C\xF7\xE7\xCE\x56\xEA\x45\xD1\x06\xFD" - "\xC3\x33\xC3\xC0\xCC\xFF\x79\x66\xE6\xF7\x18\xC6\xFF\xD4\xCB\x0D" - "\x9F\xA5\xBB\x82\xB9\x79\x87\xE9\xE3\x9B\x1C\x38\xF8\x99\x3D\xFB" - "\xFA\xEC\xDD\xDF\xE3\x71\xD3\x67\x67\xA3\xA5\x14\x4A\x0D\x79\xFD" - "\x36\x62\xE5\x61\x40\x75\xC1\xE7\xDC\xAC\xC7\x19\x53\xFE\x36\xA6" - "\x8E\x6E\x6E\x1B\x5C\xF0\x24\xEF\xC7\x5B\xEC\x56\xC3\xD1\x38\x49" - "\x3A\xC0\x38\x24\x3C\x86\x4C\x26\x31\x48\x0C\x66\x3C\x9F\x49\xF5" - "\x2A\x0C\x31\x2E\x25\x57\xD0\x3A\x3B\xEB\x73\xF5\x5A\xC8\x8D\xDB" - "\x8A\xC3\xD3\x82\xC5\x3B\x16\xF5\x7A\x9D\x76\xBB\x4D\xA7\xD3\xA1" - "\xD7\xEB\x21\xA5\xA4\xDB\xED\x62\x59\x16\x51\x14\xB1\x1A\x2A\x8C" - "\x5B\x72\xBB\x82\x13\x79\xC9\x91\x63\x82\x99\x93\x5E\x3A\x2F\x2E" - "\x3D\x21\x9F\xCF\xA7\x51\xA9\x54\x28\x14\x0A\x14\x8B\x45\x6A\xB5" - "\x1A\xA6\x69\xE2\x38\x0E\x57\x82\xF0\x1F\x18\xAC\x27\x83\x56\xA8" - "\x62\x46\xA3\x18\xE1\xC5\xA8\x41\xCC\x20\x79\x20\xD7\x75\xE9\xF7" - "\xFB\xB4\x5A\x2D\x1A\x8D\x46\xBA\x56\xC9\x97\xEB\xF2\xB5\x4E\x27" - "\xC9\x0D\xFB\x87\xC1\xDF\xE8\xAB\xB3\xC5\xEA\x5A\xC4\x9B\x77\xDF" - "\xD2\xF5\x94\x9F\x54\xA0\x33\xC5\x71\xFC\xC7\xC3\x1F\x3E\x8E\xB9" - "\x38\xEF\x72\xBF\xBE\xC1\xF2\x4A\xC4\xBD\xE5\x88\x53\x09\x02\x29" - "\x4C\xD5\x05\xC1\x83\xB5\x90\x47\xCD\x20\x8D\xE6\xD3\x80\x67\xCF" - "\xE5\x4E\xAC\xBF\x90\x98\x73\x2E\xAE\x08\xC9\x64\x32\xE4\x72\x39" - "\xCE\x97\xBE\xFC\x44\x59\x73\xAD\xF9\xD6\x9C\x6B\xDE\x35\xF7\x9A" - "\x7F\xDD\x07\xBA\x1F\xBA\x9F\x02\xAE\xDF\x74\xB0\x6C\x9F\x6C\x36" - "\x8B\x6D\xDB\x94\x2E\x0B\x76\xDD\x5C\xA5\xB2\xA0\x5C\xF5\x29\x95" - "\x3D\x26\xEA\xCE\x5F\x19\x7C\x07\xD7\xA8\xAB\xC5\x53\x48\xD2\x2A" - "\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 524); - getPNGImage(png); - } - else if (url == "apple.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x04\x00\x00\x00\xB5\xFA\x37" - "\xEA\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x00\xAD\x49\x44\x41\x54\x28\xCF" - "\x63\x60\xC0\x02\x1E\xFD\x67\xC0\x0D\x2E\xFD\x8F\xFA\x5F\x86\x4F" - "\x41\xD4\xFF\xA0\xFF\xAB\xFE\xE3\xD1\xEF\x85\x5D\xFA\xD5\xFF\x26" - "\xA0\xCE\xB0\xFF\x9B\xFE\x9F\x03\x2A\x48\xFB\x9F\xF5\x7F\x1F\xAA" - "\xB2\xAC\xFF\x6E\x40\xBB\x93\xC0\x30\x0B\x0A\x91\xA4\xCF\x81\xA5" - "\xB3\xFE\x17\x01\x61\x1E\x18\x16\xFD\xBF\x86\xAC\x60\x11\xD0\xE6" - "\x24\xA8\x14\x04\x4E\x42\xB5\x60\xDA\x7F\x3F\xB0\xBD\x08\xD8\x86" - "\xAA\xE0\x10\x50\x41\x12\x8A\x82\xB4\xFF\xA7\xFE\xA3\x84\x9C\xDB" - "\xFF\x38\xA0\x20\x32\x8C\xFB\xBF\x0B\x59\x49\x1B\x50\x20\x09\x0D" - "\xDE\x42\x56\x70\x0D\x18\x0A\x51\x40\x45\x08\xB8\x0C\x3D\xB8\xB6" - "\x01\x15\x44\xFD\xAF\x02\x06\x18\xC8\xF8\xAA\xFF\x58\xE3\xF0\xDC" - "\x7F\x58\xB8\x30\x10\x0F\x00\x5E\x29\xAA\xB1\xD7\x27\xEE\x1B\x00" - "\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 251); - getPNGImage(png); - } - else if (url == "synology.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x04\x00\x00\x00\xB5\xFA\x37" - "\xEA\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x00\xAA\x49\x44\x41\x54\x28\xCF" - "\xB5\xD0\xCD\x4A\x02\x01\x18\x85\xE1\xEF\xFE\xAF\xC0\xBD\x84\x18" - "\x18\x22\xA1\x09\x35\x43\x19\x3A\x88\x3F\x19\x14\x49\x24\x41\xC5" - "\x40\xA6\x1B\x41\x21\x62\x9E\x16\x6D\x6A\xD1\xB4\xC9\xB3\x7E\x36" - "\xE7\x8D\xF8\x7B\x4A\xF7\x2F\xA0\x90\xDB\x94\x81\xB1\xB6\xBA\x87" - "\xDF\x41\x6A\xE7\xC9\xC8\x1C\x2B\xD7\x16\x66\xEE\x14\xE6\xFA\x76" - "\x22\xE2\x4A\xCD\xB9\xB5\x23\x5B\x03\xC7\x1A\x6E\x34\x25\x4E\x4C" - "\xF4\x45\xC4\xBB\xA5\x44\x22\x33\x96\xBA\x75\x86\x54\xC5\x0B\x86" - "\x22\xE2\xC2\xDA\x54\xD7\xAB\xAA\xCC\xB3\x0E\x4E\x1D\xC8\x2C\xF5" - "\x44\xC4\xBD\xA6\x8E\x37\x1C\x5A\x58\x19\x62\xE4\xD1\xA5\x96\xFC" - "\xAB\x43\x01\x26\x1A\xB6\x3F\x1E\x14\xDF\x43\x7D\x98\xCA\xF7\x95" - "\xBA\x1C\x7C\x02\xE6\xEF\xB0\xFE\x1C\xF5\x08\xB2\x00\x00\x00\x00" - "\x49\x45\x4E\x44\xAE\x42\x60\x82", 248); - getPNGImage(png); - } - else if (url == "roku.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x04\x00\x00\x00\xB5\xFA\x37" - "\xEA\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x00\x64\x49\x44\x41\x54\x28\xCF" - "\x63\x60\xA0\x0A\x68\xF8\xCF\x80\x04\x03\xFE\x2F\xF8\x8F\x43\x81" - "\x03\x5C\x51\xC3\x7F\xEC\x26\x00\x81\x16\x98\xA5\x80\x5B\xC1\x01" - "\x28\x1B\xC5\x1A\x64\x05\x0B\xA0\xEC\x03\xD8\x14\x2C\x00\xDA\xAD" - "\x00\x75\x28\x1E\x5F\x60\xB8\x00\x53\x41\x16\x4E\x05\x50\x3F\x30" - "\xE0\x56\xC0\xC0\x00\x71\x83\x01\x6E\x6F\x02\x01\x98\x1D\x8A\xEA" - "\x0B\x07\x30\x84\xF0\xB2\xA0\x3C\x8C\x00\x27\x13\x00\x00\x9C\xD5" - "\x79\xC4\xEC\xC2\x17\x58\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42" - "\x60\x82", 178); - getPNGImage(png); - } - else if (url == "itunes.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0B\x13\x00\x00\x0B" - "\x13\x01\x00\x9A\x9C\x18\x00\x00\x03\x87\x49\x44\x41\x54\x38\xCB" - "\x4D\x93\x4B\x68\x5C\x65\x1C\x47\x7F\xFF\xEF\x3E\xE6\x95\x9B\x99" - "\x49\x9A\xF4\x26\xCD\x98\x4C\x93\x4E\x1E\x6D\x93\x4A\x5D\xB4\x2A" - "\x49\xB5\x69\xD0\x2A\x05\x17\x62\x0B\x85\x16\x34\x98\xB8\x51\x17" - "\x52\x15\x25\x62\xC1\x4D\x21\xB5\xB8\xA9\xD9\xA8\xC1\x85\x94\x08" - "\x52\x04\x51\x3A\xA5\xA6\x25\x09\x18\x43\x8A\xAF\xD8\x94\x32\x49" - "\x9A\x99\x49\xEA\xCC\x9D\xB9\xF3\xBE\x8F\xEF\x73\x13\xC1\xB3\x3F" - "\x67\x77\x08\x00\x88\x88\x84\x10\x00\x20\xA2\xD1\x68\x74\xE4\xC4" - "\xC8\xB9\xC7\x3A\x3A\x87\xEA\x83\xE1\x56\x22\x62\x05\x33\x97\x5C" - "\x4B\xDC\x9F\x8D\xC7\xE3\xD3\xAB\xAB\xAB\xAB\x00\xC0\x18\x63\x9C" - "\x73\x4E\x3B\xB2\x00\x80\xF1\xB1\xB1\x77\x9F\x38\x72\xEC\x22\xF3" - "\x86\x64\xBF\x16\x86\xEA\xF5\x03\x20\xD4\x6A\x35\x54\x8A\x26\x78" - "\x25\xCB\x7F\x5B\x9A\xFD\xE4\xD3\x2B\x57\x3E\xFC\x2F\x42\x00\x08" - "\x80\x98\x98\x98\x98\x6A\x8E\xEC\x1F\xAD\xB1\x3A\xEC\x6E\xEB\xB0" - "\x55\x2D\x4C\xDE\x80\x46\x8A\x22\x13\x83\x10\x76\xB5\xCC\x93\x89" - "\x84\x62\xE7\xD3\x28\x6C\xFD\x39\x73\xE1\xC2\x3B\x2F\x03\x80\x04" - "\x00\xA3\xA3\xAF\xBD\xD5\xD2\x31\xF0\x7E\xD2\x84\xAD\xE9\xED\x54" - "\x91\x7C\x32\x17\x9C\x6D\xAF\xAF\xB0\x07\x77\xE7\xE9\xAF\x5F\x7E" - "\x66\xBF\xCF\xC7\xA5\x6A\x29\x2B\x78\xB0\xC3\x12\xAE\xE8\x1F\xE8" - "\x8D\xA8\xF3\x0B\x0B\x37\x65\x5D\xD7\xF5\xFD\x03\x47\x3E\x9E\xFB" - "\x23\x0D\x7D\xDF\x01\x29\x61\x82\x85\x79\x09\x73\x5F\x7F\x86\xBC" - "\x61\xC0\xB5\x1D\x08\xCE\xE1\x58\x55\xEC\xEE\xEC\xA5\xFE\xD8\x33" - "\xEA\xF2\xE2\x12\x9E\xEC\x3D\xF4\x5E\x77\x77\xF7\xB4\x74\xE6\xCC" - "\xE9\xF1\xED\x52\xDD\x8B\xC9\xB2\xC7\xA9\x78\x1B\xA5\x6A\x40\x07" - "\xC1\xC5\xFD\xF8\x35\x54\xCD\x02\x98\x2C\xC1\x13\x0C\x41\x0D\x68" - "\x20\xC5\x0F\xA7\xE5\x71\x4A\xA6\x32\x76\x29\x97\x97\x0E\x76\xEE" - "\x2A\xC9\xAD\x7B\xA2\xCF\xFE\xB4\x5C\x40\x35\x14\x21\xB3\xE6\x85" - "\x4F\x04\xC1\x6D\x07\x6A\x43\x03\xDA\x4E\x9E\x85\xDA\xBA\x0F\x4E" - "\xA8\x1D\x52\x31\x8B\xD4\x37\x97\xB0\x59\x91\x91\xE5\x75\xCC\x58" - "\x4B\xE2\xD4\xE1\xC8\x90\x6C\xB9\x6A\xDB\xCA\x46\x0E\x1E\x45\x25" - "\xC5\x0E\xC0\x2F\x87\x21\x39\x29\x68\x91\xBD\xA8\x3B\x79\x0A\x8F" - "\x92\x40\xCE\x06\x84\x53\x86\x6D\x39\x28\x59\x2A\x52\x25\x99\x0A" - "\x1B\x65\x94\x0E\xD6\xB5\xCA\xB6\x23\x60\x94\x3D\x40\x49\x05\xAB" - "\x79\xE0\xE5\x1E\xF8\x5D\x0E\x3B\x6B\xC0\x63\x00\x39\x47\x40\x09" - "\x10\x90\xC9\x21\x9D\x33\x61\x14\x81\x94\xE1\x02\x26\xC1\xB2\x38" - "\x98\x6B\x15\x37\x43\xC1\x26\x00\x3E\xC1\xFC\x0D\xD0\x75\xA0\xB1" - "\x1E\x10\x12\x83\xAD\x01\x3E\x96\x47\x76\xF2\x4D\xDC\xFB\xE0\x2C" - "\xDC\x5A\x0D\x92\xE2\x03\x1C\x8F\xF0\x06\x1A\x41\xBC\x9A\x62\xDB" - "\xA9\xBF\x6F\xC7\xF6\x34\x00\x65\x45\xC4\xFC\x15\xB4\x5F\xFF\x08" - "\xC5\x2F\x2E\xC2\x1B\xD0\x00\x0D\x70\x96\x6E\xC0\xF8\xF1\x5B\x48" - "\x66\x06\xF5\x5A\x3D\xB8\xA5\x02\x59\x9B\x77\xB6\xEC\x42\x3E\xF3" - "\x60\x4E\xCA\x65\xD3\x1B\xCF\x0F\x8F\xBC\x3E\xBF\xA1\x7B\xFA\xA5" - "\x59\x2E\x96\x67\x88\x9B\x65\x04\x7B\x0E\xE0\xD1\xDE\x21\xD8\x52" - "\x13\x9A\xBD\x04\x2D\x12\x43\xBE\x6F\x14\x9B\xEB\x24\xEC\x95\x75" - "\xE9\xF4\xB0\x8A\x5B\x3F\x5C\x7D\x43\x32\x0B\x95\x5C\xA4\xC9\x15" - "\x7D\x87\x86\x8F\xFF\x9A\xD5\xDC\xCE\xA8\x82\x40\x57\x0F\xFD\x73" - "\xF4\x3C\x36\x4A\x41\x64\x9D\x00\xCC\xAE\x41\xA4\x9B\x8E\xE3\x61" - "\xCA\x27\xCA\x0B\xF7\xEC\xE7\x8E\x06\x24\x35\x77\xED\x72\xFC\xE6" - "\xEC\x57\x84\x1D\xC6\xC7\xC6\xBE\x34\xDA\xDF\x3E\xF7\x7D\x36\x04" - "\xD1\x15\x76\x2C\x3F\x23\xE1\x0A\x12\x42\xC0\xCD\x39\x02\x89\x82" - "\xC0\x6A\x5A\x7E\x21\x56\x45\x8C\xCD\x5C\xBF\x3C\x79\xE9\x25\x00" - "\x5C\x22\x22\x06\x40\x2C\x2E\x2E\x7E\xD7\x17\x5C\xA3\x63\xB1\xB6" - "\xA7\x4A\x5B\xB2\x62\xAE\x57\x59\x6D\xDB\x22\xB1\x55\x25\x2D\x53" - "\x64\x07\xA5\x3C\x7B\xA5\x67\xDD\xA5\xB5\xAB\x93\x9F\x4F\x4D\xBD" - "\x0A\x40\x10\x11\xA3\x9D\x9D\x99\x10\x82\x03\x40\x44\x0F\xF6\x0D" - "\x0E\x9E\x38\xDF\x10\x39\xFC\xB4\xF0\x36\xB7\x00\x8C\xA8\xB6\xBD" - "\x65\x6C\x2E\xDD\xB9\x73\xFB\xC6\x74\xE2\x61\xE6\xEE\xFF\x9D\x7F" - "\x01\x0D\x6F\xA1\x6E\xFB\xAE\xB6\x18\x00\x00\x00\x00\x49\x45\x4E" - "\x44\xAE\x42\x60\x82", 981); - getPNGImage(png); - } - else if (url == "warn.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\x00\x00\x00\x1F\xF3\xFF" - "\x61\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x01\x88\x49\x44\x41\x54\x38\xCB" - "\x9D\x93\xCD\x4A\x02\x51\x18\x86\xA7\x24\xA2\x02\x47\xAC\x4C\x8C" - "\x68\x51\x37\x90\xAB\xDA\x55\x77\x90\x17\x50\x0B\x6F\xC1\xBA\x81" - "\x7E\xD6\x25\xD4\xA2\x85\x9B\xA0\x56\x6D\x2A\xC2\x28\xA2\xA0\xB0" - "\x06\x8C\x74\x61\x90\x41\x18\x92\x3F\xD8\x8F\x24\xF8\x33\xE3\xBC" - "\x7D\xE7\x8C\x33\x5A\x69\x69\x07\x1E\xCE\x7B\xDE\x73\xBE\xF7\xFB" - "\x66\x31\x82\xD0\x60\x25\xFD\xD6\xF1\xA2\x34\x08\x06\xD3\x42\xAB" - "\x8B\x15\x96\xDE\x56\x88\x65\x1E\xD2\x52\x31\xEB\x98\xBF\x72\x00" - "\xD8\xE6\xE4\x03\x8E\xD6\xA6\xC8\x5D\xD8\x79\x77\x3D\x80\x4D\xC1" - "\xBC\xA6\xBB\xBF\x9F\xD9\x00\xC5\xC7\x0A\x38\x2A\xE9\xEC\xB9\xAD" - "\xB9\x29\x32\x27\x7D\x28\xA6\x17\xA0\x16\xBC\xD5\x80\xC2\x1A\x79" - "\xF3\xC8\x9C\xF4\xE3\xCF\xEE\x49\x7F\x2F\xD4\x8F\x45\x62\xA9\x1A" - "\x40\x9A\x79\x74\xFF\xFB\x14\xF1\x3D\x0B\x0A\xB1\x39\x94\x5F\x3C" - "\x50\x09\x23\x80\x74\xF9\xD5\x83\x62\x6C\x16\xF1\x7D\x0B\x1A\x76" - "\x7F\xDC\x35\xA3\x9C\x70\x6B\x24\xDD\x46\x80\x7E\x66\xB0\x37\x75" - "\xA7\x88\xEE\xF4\x20\x17\x9A\x80\xF2\xE4\x82\x12\x9B\x21\x5C\xD5" - "\x00\xD2\xDC\x27\xB2\xB7\x93\xB8\xA7\xB7\x3F\xBA\x47\xB6\xBA\x20" - "\x47\xA7\xA0\x30\x1E\x18\xD3\x46\x80\xA2\xFB\x51\xCD\x67\x6F\xBF" - "\x4C\x11\xF2\x75\x22\x7D\x3A\x04\x39\x32\x56\x83\x13\xF2\x9D\xF3" - "\x9B\xA7\xF9\x89\xE3\x61\x84\xA9\xC6\xE8\x7E\xB3\xD9\x81\x52\x68" - "\x84\x18\x85\x4C\xBB\x1C\x26\x48\xEB\x13\x70\x4F\xF7\xC3\x9A\x0E" - "\x52\x0D\x9F\x42\x5A\x37\x21\x75\x64\x45\x29\x38\x40\xD8\xF9\x2E" - "\x57\x76\x23\x80\xCE\x72\xCD\x3D\x23\x71\x28\x42\xDA\x30\x41\x08" - "\x78\xDB\x91\xF2\x9B\x51\x92\xC4\x0A\x96\x1A\x5D\x87\x6B\x91\x7E" - "\x2E\x11\xCF\x07\xDD\x08\x78\xDB\xC0\x3F\xE1\x72\x55\xC0\x7F\x60" - "\xB5\x9F\x32\xEB\xC2\x92\x1E\xFA\xFF\x9A\x00\x00\x00\x00\x49\x45" - "\x4E\x44\xAE\x42\x60\x82", 470); - getPNGImage(png); - } - else if (url == "xff.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x10\x00\x00\x00\x10\x08\x04\x00\x00\x00\xB5\xFA\x37" - "\xEA\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0E\xC4\x00\x00\x0E" - "\xC4\x01\x95\x2B\x0E\x1B\x00\x00\x00\xCC\x49\x44\x41\x54\x28\xCF" - "\x63\x60\x08\x67\x68\x64\x68\x40\x83\xAD\x40\x28\xCC\x00\x05\xB5" - "\xDF\xFF\xA3\x83\xE3\xFF\x4D\xFE\x6B\xFD\xCF\xEA\xC1\xA9\xE0\xF0" - "\xFF\xD8\xFF\xEF\xFF\x5B\xFD\x77\x9E\x84\x43\xC1\xC1\xFF\x12\x40" - "\x69\xAB\xFF\x5C\xFF\x19\x8A\xB0\x2A\x40\x00\xA0\x5B\x88\x52\xD0" - "\xFC\x7F\xED\xFF\x9B\xFF\xE3\xFF\xBF\xFE\x1F\x0C\x86\x57\xFF\xA7" - "\x81\xE9\xED\x30\x05\x67\xFE\x8B\x01\x6D\xEC\xFB\xFF\xF6\x3F\xF7" - "\xFF\x3B\x40\xF8\xFD\xBF\xCC\xFF\x03\x40\xFA\x03\xC2\x8A\x98\xFF" - "\x72\xFF\xFF\x00\x15\xB0\xFE\x8F\xFE\x9F\x0A\xE4\xCB\xFC\xF7\x07" - "\xB2\xDE\xC0\x14\x3C\x07\x9A\x20\x05\x34\x10\x64\xC2\x95\xFF\xD7" - "\xC1\x0A\x76\x02\x59\xBF\x60\x0A\xC2\xFE\x97\xFF\xDF\xF1\x5F\xF1" - "\xFF\xA3\xFF\xBC\x50\xC7\xC9\xFC\xBF\x8F\xEC\xC8\x03\xFF\xBF\x81" - "\xC3\xEF\x19\x30\x88\x20\xE0\xD8\xFF\xEF\x24\x79\x93\x42\x05\x9E" - "\xE0\xC8\xC5\x05\xE3\x00\x1F\xF1\x7A\x19\x4B\x38\x03\x56\x00\x00" - "\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 282); - getPNGImage(png); - } - else - { - sendMessageAndClose(MSG_HTTP404); - } - return; - } - else if (m_url == "index.css") - { - const utf8 &modified = mapGet(m_httpRequestInfo.m_HTTPHeaders, utf8("if-modified-since"), utf8("0")); - const time_t curTime = ::time(NULL), - readTime = readRFCDate(modified), - diffTime = (curTime - readTime); - - // check if we need to provide a copy or if we can just do a '304 Not Modified' response - if (!readTime || (diffTime > gOptions.m_styleCustomHeaderTime) || (diffTime > 31536000)) - { - const time_t modTime = (!gOptions.m_styleCustomHeaderTime ? (gOptions.m_styleCustomHeaderTime = curTime) : gOptions.m_styleCustomHeaderTime); - utf8 body, - header = "HTTP/1.0 200 OK\r\n" - "Content-Type:text/css\r\n" - "Vary:Accept-Encoding\r\n" - "Cache-Control:private,max-age=31536000\r\n" - + utf8(m_compressed ? "Content-Encoding:gzip\r\n" : "") + - "Expires:" + getRFCDate(curTime + 31536000) + "\r\n" - "Last-Modified:" + getRFCDate(modTime) + "\r\n", - // v2 DNAS style - g_styleV2Str = "a:visited,a:link{color:#2762AE;text-decoration:none;}" - "a:hover{text-decoration:underline;}" - ".logo,.titlespan,.tsp,.inp,.tll,b.w,.infh{color:#DEAC2F;}" - ".logo{font-weight:bold;font-size:2.25em;letter-spacing:-0.0625em;padding-left:0.1em;}" - "textarea,input,select,body,pre,table,b.i{color:#636363;font-family:arial,helvetica;font-size:small;}" - "textarea,input,select{background-color:#F0F0F0;border:1px solid #CCCCCC;}" - ".ls,.ls td,.en,.en td,.ent,fieldset,.infb{border-collapse:collapse;border:1px solid #CCCCCC;}" - ".ls a{display: block;}" - ".tsp{background:#4C4C4C;}" - ".inp{background:#636363;}" - ".tll,.infh,.thr{background:#F0F0F0;}" - "div.thr{padding:0.4em;display:inline-block;}" - ".tnl{color:#636363;font-weight:bold;text-decoration:none;}" - ".submit{color:white;background:#2350A5;border:1px solid #CCCCCC;}" - "span.default{overflow:auto;border:1px solid #CCCCCC;color:#636363;display:block;}" - ".titlespan{padding:3px 0 2px 0;display:block;}" - "input:disabled,font.t{color:#CCCCCC;}" - "hr{border:0;background-color:#CCCCCC;height:1px;margin:0 -15px;}" - "b.e{color:red;}" - "b.d{color:green;}" - "b.u{color:blue;}" - ".infh{position:relative;top:-15px;margin:0 -15px;padding:2px 0px;border-bottom:1px solid #CCCCCC;}" - ".infb{display:inline;float:left;margin:0px 15px;padding:15px 15px 10px;}", - // v1 DNAS style - g_styleV1Str = "a:visited,a:link,b.u{color:blue;text-decoration:none;}" - "a:hover{text-decoration:underline;}" - ".logo{color:red;font-weight:bold;font-size:2.25em;letter-spacing:-0.0625em;padding-left:0.1em;}" - "textarea,input,select,body,pre,b.i{color:#eeeeee;background:black;font-family:arial,helvetica;font-size:small;}" - ".ls,.en,.ent,fieldset,.infb{border-collapse:collapse;}" - "textarea,input,select,.ent,.ls td,.en td,.infb,span.default{border:1px solid #CCCCCC;}" - ".inp,.infh{background:#000080;}" - ".ls a{display: block;}" - ".tll{background:black;}" - ".tsp{background:#000025;}" - "div.thr{padding:0.4em;display:inline-block;}" - ".thr{background:#DDDDDD;}" - ".tnl{color:black;font-weight:bold;text-decoration:none;}" - "span.default{overflow:auto;color:white;display:block;}" - ".titlespan{color:white;padding:3px 0 2px 0;display:block;}" - "input:disabled,font.t{color:#CCCCCC;}" - "hr{border:0;background-color:#CCCCCC;height:1px;margin:0 -15px;}" - "b.e{color:red;}" - "b.d{color:green;}" - "b.w{color:yellow;}" - ".infh{position:relative;top:-15px;margin:0 -15px;padding:2px 0px;border-bottom:1px solid #CCCCCC;}" - ".infb{display:inline;float:left;margin:0px 15px 10px 0px;padding:15px 15px 10px;}"; - - if (gOptions.m_styleCustomStr.empty()) - { - bool compress = !!m_compressed; - const bool v2 = (gOptions.adminCSSFile() == "v2"); - if (!v2 && !(gOptions.adminCSSFile() == "v1")) - { - body = gOptions.getIndexCSS(compress); - } - - // fallback to v2 DNAS style - if (body.empty()) - { - // force things to the default style if not found so we're not re-trying all the time - gOptions.m_styleCustomStrGZ = gOptions.m_styleCustomStr = body = (v2 ? g_styleV2Str : g_styleV1Str); - compress = true; - } - - gOptions.m_styleCustomHeader = "HTTP/1.0 200 OK\r\n" - "Content-Type:text/css\r\n" - "Vary:Accept-Encoding\r\n" - "Cache-Control:private,max-age=31536000\r\n" - "Expires:" + getRFCDate(curTime + 31536000) + "\r\n" - "Last-Modified:" + getRFCDate(modTime) + "\r\n"; - - if (compress && !gOptions.m_styleCustomStrGZ.empty() && compressData(gOptions.m_styleCustomStrGZ)) - { - gOptions.m_styleCustomHeaderGZ = gOptions.m_styleCustomHeader + "Content-Encoding:gzip\r\n"; - } - else - { - gOptions.m_styleCustomStrGZ.clear(); - } - } - - if (!gOptions.m_styleCustomStr.empty()) - { - // make sure there is a gzipped version available to send if signalled as supported - if (m_compressed && !gOptions.m_styleCustomStrGZ.empty()) - { - body = gOptions.m_styleCustomStrGZ; - header = gOptions.m_styleCustomHeaderGZ; - } - else - { - body = gOptions.m_styleCustomStr; - header = gOptions.m_styleCustomHeader; - } - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - } - - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); - } - else - { - sendMessageAndClose("HTTP/1.0 304 Not Modified\r\n\r\n"); - } - return; - } - - // now we do most of the processing depending on the mode the http instance has been started as - const utf8 &type = toLower(stripWhitespace(mapGet(m_httpRequestInfo.m_QueryParameters, "type", (utf8)""))); - const int webSetupAllowed = (m_protocols & P_WEB_SETUP); - const utf8 host = (relayHostName.empty() ? m_clientHostName : relayHostName), - addr = (relayHostIP.empty() ? m_clientAddr : relayHostIP); - - if (m_protocols & P_WEB) - { - bool auth_check = false; - // make sure we unescape this so we cope with some weird clients - utf8 password = urlUtils::unescapeString(mapGet(m_httpRequestInfo.m_QueryParameters, "pass", (utf8)"").hideAsString()); - if (password.empty()) - { - // as we need the password for some of the public pages - // we'll convert any 'authorization' headers into their - // 'pass' parameter equivalent and then do all checking - // based on the password which will be cleaner overall. - const utf8 &auth = mapGet(m_httpRequestInfo.m_HTTPHeaders, "authorization", (utf8)""); - const vector &vauth = tokenizer(auth, (utf8::value_type)' '); - // format " Basic xxxxxxxxx" - const vector<__uint8> va = base64::decode((vauth.size() < 2 ? "" : vauth[1]).hideAsString().c_str()); - password.insert(password.end(), va.begin(), va.end()); - auth_check = true; - } - else - { - // we also support base64 encoded passwords - // so we need to check for them and decode - // before passing on to be fully checked. - if (password.find(utf8("YWRtaW46")) == 0) - { - vector<__uint8> va = base64::decode(password.hideAsString().c_str()); - password.clear(); - password.insert(password.end(), va.begin(), va.end()); - auth_check = true; - } - } - - // look at the password and check for the multi-1.x style support, - // extracting as needed which is likely if using the same password - // parameters for the title update handling that should be sent - utf8 dj_name; // throw-away - int alt_sid = -1; - if (extractPassword(password, dj_name, alt_sid)) - { - if (alt_sid != -1) - { - realSID = sid = alt_sid; - } - - // if this is from a converted 'authorization' header then we - // need to ensure that the user is what we allow i.e. 'admin' - // changed b611 as Icecast sources send different values so - // for those cases we'll have to allow it through so it works - if (auth_check && !hasMount && !(dj_name == "admin")) - { - password.clear(); - } - } - - if (m_url == "admin.cgi") - { - // added in 2.4.8+ the ability to restrict access to the admin - // sections based on the IP / host reported by the connection. - // this is a user request as a means to help restrict access - // to these pages and (slightly) improve security (https would - // be better but for the time being, it's this and passwords). - if (isAdminAccessAllowed(addr, host) == false) - { - // try to redirect to something (if configured) - // before failing and provide a 403 response... - const utf8 redirectUrl = gOptions.getStreamRedirectURL((no_sid ? 0 : sid), false, false, !!m_compressed, true); - sendMessageAndClose((!redirectUrl.empty() ? redirectUrl : MSG_HTTP403)); - return; - } - - // we need a password for all of the admin.cgi methods - // so no point in creating it if we know it's missing - // and return WWW-Authenticate quicker than if we did - // the checks inside of protocol_admincgi like before. - if (!password.empty()) - { - const socketOps::tSOCKET s = m_socket; - m_socket = socketOps::cINVALID_SOCKET; - - const bool zero_sid = (((int)realSID == -1) ? true : (realSID == 0)); - threadedRunner::scheduleRunnable(new protocol_admincgi(s, sid, no_sid, zero_sid, m_clientLogString, - password, m_referer, m_hostIP, m_userAgent, - m_httpRequestInfo)); - m_result.done(); - } - else - { - sendMessageAndClose(MSG_AUTHFAILURE401 + utf8(!HEAD_REQUEST ? - "UnauthorizedShoutcast " - "Administrator" : "")); - } - return; - } - else if (m_url == "index.html") - { - // if no sid is specified, attempt to match to the only stream (v1 like behaviour) - // before just attempting to provide the results for the default stream id (sid=1) - if (no_sid) - { - streamData::streamID_t lastSID = 0; - if (streamData::totalActiveStreams(lastSID) != (streamData::streamID_t)DEFAULT_CLIENT_STREAM_ID) - { - path_root_summary(XFF); - } - else - { - if (realSID == 0) - { - path_root_summary(XFF, true); - } - else - { - sendMessageAndClose(redirect("index.html?sid=" + tos(lastSID), !!m_compressed)); - } - } - } - else - { - path_root(sid, XFF); - } - return; - } - else if ((m_url == "7.html") || (m_url == "7")) - { - findBaseStream(no_sid, sid); - - bool adminOverride = false, hide = getHideState((no_sid ? 0 : sid)), passworded = false, - proceed = isViewingAllowed(sid, password, false, adminOverride, hide, passworded); - - if ((hide == true) && (adminOverride == false) && (proceed == false)) - { - path_redirect_url(sid, no_sid, true); - } - else - { - if (isAccessAllowed(sid, XFF) == true) - { - cacheItem *item = m_7Cache[sid]; - if (getCachedResponse(item, m_7Lock)) - { - return; - } - - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(sid, info, extra); - - stats::statsData_t data; - stats::getStats(sid, data); - - const int maxUsers = ((info.m_streamMaxUser > 0) && (info.m_streamMaxUser < gOptions.maxUser()) ? info.m_streamMaxUser : gOptions.maxUser()); - // 7.html format is CURRENTLISTENERS STREAMSTATUS PEAKLISTENERS MAXLISTENERS UNIQUELISTENERS BITRATE SONGTITLE - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:text/html;charset=utf-8\r\n" - "Cache-Control:no-cache\r\nConnection:close\r\n", - body = "" + tos(data.connectedListeners) + "," + - (extra.isConnected ? "1" : "0") + "," + tos(data.peakListeners) + - "," + (maxUsers > 0 ? tos(maxUsers) : "UNLIMITED") + "," + - tos(data.uniqueListeners) + "," + tos(info.m_streamBitrate) + - "," + aolxml::escapeXML(info.m_currentSong) + getfooterStr(); - - sendCachedResponse(item, m_7Cache, m_7Lock, header, body, sid); - } - else - { - sendMessageAndClose(MSG_HTTP403); - } - } - return; - } - else if (m_url == "stats") - { - findBaseStream(no_sid, sid); - - bool adminOverride = false, hide = getHideState((no_sid ? 0 : sid)), passworded = true, - proceed = isViewingAllowed(sid, password, false, adminOverride, hide, passworded); - - if ((hide == true) && (adminOverride == false) && (proceed == false)) - { - path_redirect_url(sid, no_sid, true); - } - else - { - if (isAccessAllowed(sid, XFF) == true) - { - const bool json = mapGet(m_httpRequestInfo.m_QueryParameters, "json", (bool)false); - if (json) - { - const utf8 &callback = mapGet(m_httpRequestInfo.m_QueryParameters, "callback", (utf8)""); - path_stats_json(sid, passworded, callback); - } - else - { - path_stats_xml(sid, passworded); - } - } - else - { - sendMessageAndClose(MSG_HTTP403); - } - } - return; - } - else if (m_url == "statistics") - { - bool adminOverride = false, hide = getHideState((no_sid ? 0 : sid)), passworded = true, - proceed = isViewingAllowed(sid, password, true, adminOverride, hide, passworded); - - if ((hide == true) && (adminOverride == false) && (proceed == false)) - { - path_redirect_url(sid, no_sid, true); - } - else - { - if (isAccessAllowed(sid, XFF) == true) - { - const bool json = mapGet(m_httpRequestInfo.m_QueryParameters, "json", (bool)false); - if (json) - { - const utf8 &callback = mapGet(m_httpRequestInfo.m_QueryParameters, "callback", (utf8)""); - path_statistics_json(sid, passworded, callback); - } - else - { - path_statistics_xml(sid, passworded); - } - } - else - { - sendMessageAndClose(MSG_HTTP403); - } - } - return; - } - else if (m_url == "robots.txt") - { - utf8 header = "HTTP/1.0 200 OK\r\n" - "Content-Type:text/plain\r\n" - "Connection:close\r\nContent-Length:24\r\n\r\n", - body = "User-agent:*\r\nDisallow:/"; - - if (gOptions.robotstxtFile() == "") - { - } - else - { - if (gOptions.m_robotsTxtBody.empty()) - { - body = loadLocalFile(fileUtil::getFullFilePath(gOptions.robotstxtFile())); - if (!body.empty()) - { - gOptions.m_robotsTxtBodyGZ = gOptions.m_robotsTxtBody = body; - gOptions.m_robotsTxtHeader = "HTTP/1.0 200 OK\r\n" - "Content-Type:text/plain\r\n" - "Connection:close\r\n" - "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - - if (compressData(gOptions.m_robotsTxtBodyGZ)) - { - gOptions.m_robotsTxtHeaderGZ = "HTTP/1.0 200 OK\r\n" - "Content-Type:text/plain\r\n" - "Connection:close\r\n" - "Content-Length:" + tos(gOptions.m_robotsTxtBodyGZ.size()) + "\r\n" - "Content-Encoding:gzip\r\n\r\n"; - } - else - { - gOptions.m_robotsTxtBodyGZ.clear(); - } - } - else - { - body = MSG_HTTP404; - } - } - - if (!gOptions.m_robotsTxtBody.empty()) - { - // make sure there is a gzipped version available to send if signalled as supported - if (m_compressed && !gOptions.m_robotsTxtBodyGZ.empty()) - { - body = gOptions.m_robotsTxtBodyGZ; - header = gOptions.m_robotsTxtHeaderGZ; - } - else - { - body = gOptions.m_robotsTxtBody; - header = gOptions.m_robotsTxtHeader; - } - } - } - - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); - return; - } - else if (m_url == "crossdomain.xml") - { - path_crossdomain(); - return; - } - else if ((m_url == "played.html") || (m_url == "played")) - { - // if no sid is specified, attempt to match to the only stream (v1 like behaviour) - // before just attempting to provide the results for the default stream id (sid=1) - if (no_sid && findBaseStream(no_sid, sid)) - { - sendMessageAndClose(redirect((!gOptions.getSongHistorySize(sid) ? "index.html?sid=" : "played.html?sid=") + tos(sid), !!m_compressed)); - return; - } - else - { - if (!no_sid && !gOptions.getSongHistorySize(sid)) - { - sendMessageAndClose(redirect("index.html?sid=" + tos(sid), !!m_compressed)); - return; - } - } - - const bool json = (type == "json"), xml = (type == "xml"); - const utf8 &hideStats = gOptions.getStreamHideStats((no_sid ? 0 : sid)); - bool hide = (hideStats == "all") && !(hideStats == "none"), adminOverride = false, passworded = false, - proceed = isViewingAllowed(sid, password, false, adminOverride, hide, passworded); - - // only do a password check if we've got a hidden page - if ((hide == true) && !password.empty()) - { - if (proceed && !(json || xml)) - { - proceed = false; - } - } - - // if xml or json is requested then we see if we - // should provide it publically or use redirect - if (no_sid || ((hide == true) && (proceed == false))) - { - path_redirect_url(sid, no_sid, false); - } - else - { - if (!json && !xml) - { - path_played_html(sid, XFF); - } - else - { - if (json) - { - const utf8 &callback = mapGet(m_httpRequestInfo.m_QueryParameters, "callback", (utf8)""); - path_played_json(sid, callback, proceed, XFF); - } - else - { - path_played_xml(sid, proceed, XFF); - } - } - } - return; - } - else if ((m_url == "home.html") || (m_url == "home")) - { - if (no_sid) - { - path_root_summary(XFF); - } - else - { - path_home(sid); - } - return; - } - else if ((m_url == "currentsong") || (m_url == "nextsong")) - { - const utf8 &hideStats = gOptions.getStreamHideStats((no_sid ? 0 : sid)); - bool adminOverride = false, hide = (hideStats == "all") && !(hideStats == "none"), - passworded = false, proceed = isViewingAllowed(sid, password, false, adminOverride, hide, passworded); - - if ((hide == true) && (adminOverride == false) && (proceed == false)) - { - path_redirect_url(sid, no_sid, true); - } - else - { - path_track(sid, (m_url == "nextsong")); - } - return; - } - else if (m_url == "nextsongs") - { - const utf8 &hideStats = gOptions.getStreamHideStats((no_sid ? 0 : sid)); - bool adminOverride = false, hide = (hideStats == "all") && !(hideStats == "none"), - passworded = false, proceed = isViewingAllowed(sid, password, false, adminOverride, hide, passworded); - - if ((hide == true) && (adminOverride == false) && (proceed == false)) - { - path_redirect_url(sid, no_sid, true); - } - else - { - const bool json = mapGet(m_httpRequestInfo.m_QueryParameters, "json", (bool)false); - if (json) - { - const utf8 &callback = mapGet(m_httpRequestInfo.m_QueryParameters, "callback", (utf8)""); - path_tracks_json(sid, callback); - } - else - { - path_tracks_xml(sid); - } - } - return; - } - else if (m_url == "currentmetadata") - { - const utf8 &hideStats = gOptions.getStreamHideStats((no_sid ? 0 : sid)); - bool adminOverride = false, hide = (hideStats == "all") && !(hideStats == "none"), - passworded = false, proceed = isViewingAllowed(sid, password, false, adminOverride, hide, passworded); - - if (no_sid || ((hide == true) && (adminOverride == false) && (proceed == false))) - { - path_redirect_url(sid, no_sid, true); - } - else - { - const bool json = mapGet(m_httpRequestInfo.m_QueryParameters, "json", (bool)false); - if (json) - { - const utf8 &callback = mapGet(m_httpRequestInfo.m_QueryParameters, "callback", (utf8)""); - path_current_metadata_json(sid, callback); - } - else - { - path_current_metadata_xml(sid); - } - } - return; - } - else if ((m_url == "streamart") || (m_url == "playingart")) - { - const utf8 &hideStats = gOptions.getStreamHideStats((no_sid ? 0 : sid)); - bool adminOverride = false, hide = (hideStats == "all") && !(hideStats == "none"), - passworded = false, proceed = isViewingAllowed(sid, password, false, adminOverride, hide, passworded); - - if (no_sid || ((hide == true) && (adminOverride == false) && (proceed == false))) - { - path_redirect_url(sid, no_sid, true); - } - else - { - path_art(sid, (m_url == "playingart")); - } - return; - } - else if ((m_url == "listen.pls") || (m_url == "listen")) - { - if (isAccessAllowed(sid, XFF) == true) - { - cacheItem *item = m_PLSCache[sid]; - if (getCachedResponse(item, m_PLSLock, 5)) - { - return; - } - - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(sid, info, extra); - - int index = 1; - utf8 backupServer = ""; - if (!info.m_backupServer.empty()) - { - ++index; - backupServer = "File"+tos(index)+"=" + info.m_backupServer + - (!info.m_streamName.empty() ? "\nTitle"+tos(index)+"=" + info.m_streamName : "") + - "\nLength"+tos(index)+"=-1\n"; - - if (!info.m_backupServersList.empty()) - { - for (vector::const_iterator b = info.m_backupServersList.begin(); b != info.m_backupServersList.end(); ++b) - { - ++index; - backupServer += "File"+tos(index)+"=" + (*b) + - (!info.m_streamName.empty() ? "\nTitle"+tos(index)+"=" + info.m_streamName : "") + - "\nLength"+tos(index)+"=-1\n"; - } - } - } - - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:audio/x-scpls\r\nConnection:close\r\n", - body = "[playlist]\nNumberOfEntries=" + tos(index) + - "\nFile1=http://" + getClientIP(info.m_streamPublic, info.m_publicIP) + ":" + - tos(g_portForClients) + getStreamPath(sid, true) + - ((streamData::getStreamContentType(sid) == "video/nsv") ? ";stream.nsv\n" : "\n") + - (!info.m_streamName.empty() ? "Title1=" + info.m_streamName + "\n" : "") + "Length1=-1\n" + - backupServer + "Version=2"; - - sendCachedResponse(item, m_PLSCache, m_PLSLock, header, body, sid); - } - else - { - sendMessageAndClose(MSG_HTTP403); - } - return; - } - else if (m_url == "listen.m3u") - { - if (isAccessAllowed(sid, XFF) == true) - { - cacheItem *item = m_M3UCache[sid]; - if (getCachedResponse(item, m_M3ULock, 5)) - { - return; - } - - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(sid, info, extra); - - utf8 backupServer = ""; - if (!info.m_backupServer.empty()) - { - backupServer = "\n#EXTINF:-1," + info.m_streamName + "\n" + info.m_backupServer; - if (!info.m_backupServersList.empty()) - { - for (vector::const_iterator b = info.m_backupServersList.begin(); b != info.m_backupServersList.end(); ++b) - { - backupServer += "\n#EXTINF:-1," + info.m_streamName + "\n" + (*b); - } - } - } - - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:audio/x-mpegurl\r\nConnection:close\r\n", - body = "#EXTM3U\n" - "#EXTINF:-1," + info.m_streamName + "\n" - "http://" + getClientIP(info.m_streamPublic, info.m_publicIP) + - ":" + tos(g_portForClients) + getStreamPath(sid, true) + - (streamData::getStreamContentType(sid) == "video/nsv" ? ";stream.nsv" : "") + - backupServer; - - sendCachedResponse(item, m_M3UCache, m_M3ULock, header, body, sid); - } - else - { - sendMessageAndClose(MSG_HTTP403); - } - return; - } - else if (m_url == "listen.asx") - { - if (isAccessAllowed(sid, XFF) == true) - { - cacheItem *item = m_ASXCache[sid]; - if (getCachedResponse(item, m_ASXLock, 5)) - { - return; - } - - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(sid, info, extra); - - utf8 backupServer = ""; - if (!info.m_backupServer.empty()) - { - backupServer = "\n\n" + - (!info.m_streamName.empty() ? "" + aolxml::escapeXML(info.m_streamName) + "\n" : "") + - "\n"; - if (!info.m_backupServersList.empty()) - { - for (vector::const_iterator b = info.m_backupServersList.begin(); b != info.m_backupServersList.end(); ++b) - { - backupServer += "\n\n" + - (!info.m_streamName.empty() ? "" + aolxml::escapeXML(info.m_streamName) + "\n" : "") + - "\n"; - } - } - backupServer += "\n"; - } - - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:video/x-ms-asf\r\nConnection:close\r\n", - body = "\n" + - (!info.m_streamName.empty() ? "" + aolxml::escapeXML(info.m_streamName) + "\n" : "") + - "\n" + - (!info.m_streamName.empty() ? "" + aolxml::escapeXML(info.m_streamName) + "\n" : "") + - "\n" + backupServer + ""; - - sendCachedResponse(item, m_ASXCache, m_ASXLock, header, body, sid); - } - else - { - sendMessageAndClose(MSG_HTTP403); - } - return; - } - else if (m_url == "listen.qtl") - { - if (isAccessAllowed(sid, XFF) == true) - { - cacheItem *item = m_QTLCache[sid]; - if (getCachedResponse(item, m_QTLLock, 5)) - { - return; - } - - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(sid, info, extra); - - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:application/x-quicktimeplayer\r\nConnection:close\r\n", - body = "" - "" - ""; - - sendCachedResponse(item, m_QTLCache, m_QTLLock, header, body, sid); - } - else - { - sendMessageAndClose(MSG_HTTP403); - } - return; - } - else if (m_url == "listen.xspf") - { - if (isAccessAllowed(sid, XFF) == true) - { - cacheItem *item = m_XSPFCache[sid]; - if (getCachedResponse(item, m_XSPFLock, 5)) - { - return; - } - - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(sid, info, extra); - - utf8 backupServer = ""; - if (!info.m_backupServer.empty()) - { - backupServer = "\n" + info.m_backupServer + "\n" + - (!info.m_streamName.empty() ? "" + aolxml::escapeXML(info.m_streamName) + "\n" : "") + - ""; - if (!info.m_backupServersList.empty()) - { - for (vector::const_iterator b = info.m_backupServersList.begin(); b != info.m_backupServersList.end(); ++b) - { - backupServer += "\n" + (*b) + "\n" + - (!info.m_streamName.empty() ? "" + aolxml::escapeXML(info.m_streamName) + "\n" : "") + - ""; - } - } - backupServer += "\n"; - } - - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:application/xspf+xml\r\nConnection:close\r\n", - body = "\n" - "" + - (!info.m_streamName.empty() ? "" + aolxml::escapeXML(info.m_streamName) + "" : "") + - "" + aolxml::escapeXML(info.m_streamURL) + "" - "" - "http://" + getClientIP(info.m_streamPublic, info.m_publicIP) + - ":" + tos(g_portForClients) + getStreamPath(sid, true) + - (streamData::getStreamContentType(sid) == "video/nsv" ? ";stream.nsv" : "") + - "" + - (!info.m_streamName.empty() ? "" + aolxml::escapeXML(info.m_streamName) + "" : "") + - "" + backupServer + ""; - - sendCachedResponse(item, m_XSPFCache, m_XSPFLock, header, body, sid); - } - else - { - sendMessageAndClose(MSG_HTTP403); - } - return; - } - else if (m_url == "shoutcast.swf") - { - path_shoutcastswf(); - return; - } -#ifdef CONFIG_BUILDER - else if ((m_url == "builder") || (m_url == "setup")) -#else - else if (m_url == "setup") -#endif - { - sendMessageAndClose(redirect("index.html", !!m_compressed)); - return; - } - } - else if (webSetupAllowed) - { - if ((m_url == "runserver") && (m_httpRequestInfo.m_request == HTTP_POST)) - { - sendMessageAndClose("HTTP/1.0 200 OK\r\nContent-Length:0\r\n\r\n"); - setkill(2); - return; - } - else if ((m_url == "exit") && (m_httpRequestInfo.m_request == HTTP_POST)) - { - sendMessageAndClose("HTTP/1.0 200 OK\r\nContent-Length:0\r\n\r\n"); - setkill(1); - return; - } - else if ((m_url == "config") && (m_httpRequestInfo.m_request == HTTP_POST)) - { - utf8 conf_file = gStartupDirectory + "sc_serv.conf"; - ILOG("[SETUP] Saving settings to `" + conf_file + "'"); - - config setupOptions; - setupOptions.load(conf_file, false); - - const vector queryTokens = tokenizer(m_httpRequestInfo.m_PostLine.toANSI(true),'&'); - for (vector::const_iterator i = queryTokens.begin(); i != queryTokens.end(); ++i) - { - const utf8 entry = urlUtils::unescapeString(*i); - const string::size_type pos = entry.find(utf8("=")); - if (pos == string::npos) - { - setupOptions.setOption(entry, (utf8)""); - } - else - { - const utf8 name = entry.substr(0, pos); - const utf8 value = entry.substr(pos + 1); - setupOptions.setOption(name, value); - } - } - - if (setupOptions.rewriteConfigurationFile(true, false, true)) - { - ILOG("[SETUP] Saved settings to `" + conf_file + "'"); - } - else - { - ILOG("[SETUP] Unable to save settings to `" + conf_file + "'. Please resolve the error(s) above."); - } - - sendMessageAndClose("HTTP/1.0 200 OK\r\nContent-Length:0\r\n\r\n"); - return; - } - else if (m_url == "configs") - { - const utf8 &query = stripWhitespace(mapGet(m_httpRequestInfo.m_QueryParameters, "query", (utf8)"")); - utf8 fn = "sc_serv.conf"; - utf8 body = ""; - - const vector queryTokens = tokenizer(query.toANSI(true),'&'); - for (vector::const_iterator i = queryTokens.begin(); i != queryTokens.end(); ++i) - { - const utf8 entry = urlUtils::unescapeString(*i); - const string::size_type pos = entry.find(utf8("=")); - if (pos != string::npos) - { - const utf8 name = entry.substr(0,pos); - const utf8 value = entry.substr(pos+1); - if (name == "fn") - { - fn = value; - } - else if (name == "body") - { - body = value; - } - } - } - - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:text/plain\r\n" - "Content-Disposition:attachment;filename=\""+fn+"\"\r\n"; - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); - return; - } -#ifdef CONFIG_BUILDER - else if (m_url == "collapse.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x0D\x00\x00\x00\x0D\x08\x06\x00\x00\x00\x72\xEB\xE4" - "\x7C\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0B\x13\x00\x00\x0B" - "\x13\x01\x00\x9A\x9C\x18\x00\x00\x00\xA3\x49\x44\x41\x54\x28\xCF" - "\xA5\x92\x3D\x0A\xC4\x20\x10\x46\x73\xA1\xDC\x2A\x37\xF3\x20\x2E" - "\xD8\xD8\x69\x65\x3A\x71\x2B\x1B\x1B\x4B\x21\x32\xEB\x27\xC9\xE0" - "\xA6\x48\xF6\x47\x78\x22\xE3\xFB\x06\x15\xA7\x65\x59\xE6\xC6\xA3" - "\xB1\x35\xE8\x82\x6D\xF7\xE6\xA9\x4D\x4A\x4A\x49\xB5\x56\xBA\x1A" - "\xD8\x87\x07\x1F\xA1\x67\x4A\x89\x3E\x19\xF0\xE0\xFF\x1E\x8A\x31" - "\x52\x29\xE5\x0D\xDC\xE3\x5C\x83\xC7\xA1\x10\x02\xE5\x9C\x99\xF1" - "\x01\xC6\x3A\x3C\x0E\xAD\xEB\xDA\xBB\xEC\x9D\x3A\xE7\x35\x80\xC7" - "\x21\x63\x0C\x79\xEF\x59\xC2\xFA\x60\xAC\xC1\xE3\x90\xD6\x9A\x9C" - "\x73\xB7\xC0\xE3\x90\x52\x8A\xAC\xB5\xB7\xC0\xFB\x2B\xA4\x84\x10" - "\xFD\xBC\x57\x01\xEC\xC3\x3B\x7E\xC4\xD7\x7F\xEF\x05\xFC\x4E\x08" - "\xFC\x0F\xA9\x38\xAE\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60" - "\x82", 241); - getPNGImage(png); - return; - } - else if (m_url == "expand.png") - { - const utf8 png ("\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52" - "\x00\x00\x00\x0D\x00\x00\x00\x0D\x08\x06\x00\x00\x00\x72\xEB\xE4" - "\x7C\x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x0B\x13\x00\x00\x0B" - "\x13\x01\x00\x9A\x9C\x18\x00\x00\x00\xCC\x49\x44\x41\x54\x28\xCF" - "\x95\x92\x41\x0A\x83\x30\x10\x45\xBD\x90\xB7\xF2\x66\xDE\xC2\x55" - "\x21\x1B\xC1\x85\x6E\xD4\x85\xA0\xA6\x0D\xBA\x51\x50\x77\x42\x65" - "\x9A\x1F\x3A\x31\x6D\x51\x6A\xE0\xC9\x38\xF9\x2F\x31\x12\x2F\x08" - "\x02\x5F\x73\xD3\x3C\x35\x74\xC2\xF3\x9D\xF3\x3D\xFD\x10\x61\x18" - "\xD2\x3C\xCF\xB4\x6D\x1B\x1D\x8D\x65\x59\x08\x39\xE4\x21\x49\xA5" - "\x14\xFD\x33\x86\x61\x80\x24\x8D\x84\x97\xAB\xD2\xBD\xEF\x7B\x9A" - "\xA6\xE9\x83\x75\x5D\x7F\x7A\x5D\xD7\x59\xE9\xD1\xB6\x2D\x8D\xE3" - "\x68\x0F\x8D\x9A\x71\x7B\x4D\xD3\xEC\x52\x59\x96\x84\xDD\x00\x87" - "\xBE\x6B\x80\x9C\x95\xD2\x34\xA5\xBA\xAE\x49\x4A\x69\x70\x7F\x35" - "\xF7\x30\x9F\x65\xD9\x2E\xC5\x71\x4C\x45\x51\x18\xAA\xAA\x32\x40" - "\xE0\x9A\xE7\x92\x24\xB1\x92\x12\x42\x98\x55\x98\x3C\xCF\x2D\x6E" - "\x1F\x8B\x1F\x4A\x47\xB8\x92\x88\xA2\x88\x70\xAE\x33\xF0\x99\xC8" - "\xF1\x8D\xB8\x7C\xF7\x5E\x5E\xA8\x08\x66\xFF\x94\x63\xFE\x00\x00" - "\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82", 282); - getPNGImage(png); - return; - } - else if (m_url == "builder") - { - uniFile::filenameType fn = gStartupDirectory + "config_builder/config_builder.html"; - size_t fileSize = uniFile::fileSize(fn); - uniFile::filenameType fn_js = gStartupDirectory + "config_builder/config_builder.js"; - size_t fileSizeJS = uniFile::fileSize(fn_js); - - utf8 header = MSG_NO_CLOSE_200, - body = "" - "" - ""\ - "Shoutcast Configuration Builder" - "" - "" - "" - // skip config_builder.js if the main setup.html cannot be found to load - + (fileSize > 0 ? utf8("") : "") + - "" - "" - "" - "" - "
Shoutcast Configuration Builder
" - "Shoutcast Server v" + - addWBR(gOptions.getVersionBuildStrings() + "/" SERV_OSNAME) + "" - "
" - "
 Help  |  " - " Documentation

"; - - // only process if the html and js files can be found - if (fileSize && fileSizeJS) - { - body += loadLocalFile(fn); - } - else - { - body += "
" - "
" - "
There was an error finding the files required for running the configuration builder.
" - "Check that there is a 'config_builder' folder in the same folder as the server.

" - "Click here to try loading the configuration builder files again. If this message
" - "remains, you will need to seek assistance via the help forum.

" - "
" - - "" + getfooterStr(); - } - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); - return; - } -#endif - else if (m_url == "setup") - { - uniFile::filenameType fn = gStartupDirectory + "setup/setup.html"; - size_t fileSize = uniFile::fileSize(fn); - uniFile::filenameType fn_js = gStartupDirectory + "setup/setup.js"; - size_t fileSizeJS = uniFile::fileSize(fn_js); - - utf8 header = MSG_NO_CLOSE_200, - body = "" - "" - ""\ - "Shoutcast DNAS Setup" - "" - "" - // skip setup.js if the main setup.html cannot be found to load - + (fileSize > 0 ? utf8("") : "") + - "" - "" - "" - "
Shoutcast DNAS Setup
" - "Shoutcast Server v" + - addWBR(gOptions.getVersionBuildStrings() + "/" SERV_OSNAME) + "" - "
" - "" - "
 Help  |  " - " Documentation
"; - - // only process if the html and js files can be found - if (fileSize && fileSizeJS) - { - body += loadLocalFile(fn); - } - else - { - body += "
" - "
" - "
There was an error finding the files required for running setup.
" - "Check there is a 'setup' folder in the same folder as the server.

" - "Click here to try loading the setup files again. If this message
" - "remains, you will need to seek assistance via the help forum.

" - "
" - - "" + getfooterStr(); - } - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); - return; - } - else - { - utf8::size_type pos; - if (((pos = m_referer.rfind(utf8("setup"))) != utf8::npos) || (m_url == "setup.txt")) - { - uniFile::filenameType fn = gStartupDirectory + "setup" + m_httpRequestInfo.m_url; - utf8 header = "HTTP/1.0 200 OK\r\n" - "Cache-Control:no-cache\r\n" - "Access-Control-Allow-Origin:*\r\n" - "Connection:close\r\n", - body = loadLocalFile(fn); - - if (!body.empty()) - { - utf8 mime = "text/plain"; - if ((pos = m_httpRequestInfo.m_url.rfind(utf8(".js"))) != utf8::npos) - { - mime = "text/javascript"; - } - header += "Content-Type:" + mime + "\r\n"; - } - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); - return; - } -#ifdef CONFIG_BUILDER - else if (((pos = m_referer.rfind(utf8("/builder"))) != utf8::npos) || (m_url == "/config_builder.txt")) - { - uniFile::filenameType fn = gStartupDirectory + "config_builder" + m_httpRequestInfo.m_url; - utf8 header = "HTTP/1.0 200 OK\r\n" - "Cache-Control:no-cache\r\n" - "Access-Control-Allow-Origin:*\r\n" - "Connection:close\r\n", - body = loadLocalFile(fn); - - if (!body.empty()) - { - utf8 mime = "text/plain"; - if ((pos = m_url.rfind(utf8(".js"))) != utf8::npos) - { - mime = "text/javascript"; - } - if ((pos = m_url.rfind(utf8(".css"))) != utf8::npos) - { - mime = "text/css"; - } - if ((pos = m_url.rfind(utf8(".png"))) != utf8::npos) - { - mime = "image/png"; - } - header += "Content-Type:" + mime + "\r\n"; - } - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); - return; - } -#endif - } - } - - // if we've gotten to here, try to look for the request coming from a browser - // and provide the related html page or fallback to serving up stream content - if ((m_httpRequestInfo.m_url == "/") && - // added in 2.4.8+ so we can force through based on the 'type' parameter - // which allows for url/?type=.flv to work correctly whilst we also allow - // for setting url/?type=html to force showing of the html pages provided - (type.empty() || (type == "html")) && - ((m_userAgentLowered.find(utf8("mozilla")) != utf8::npos) || - (m_userAgentLowered.find(utf8("opera")) != utf8::npos))) - { - if (webSetupAllowed) - { - // if in setup mode then force everything to the /setup page - sendMessageAndClose(redirect("setup", !!m_compressed)); - } - else - { - // if enabled then we need to block access to this page as it's not allowed to be public - path_redirect_url(sid, no_sid, false); - } - return; - } - - - // check here if we're ok to try to provide the stream to the client or not - // i.e. it's not a banned or not in the reserved ip list when that is enabled - bool htmlPage = false; - const streamData::streamID_t found_sid = streamData::getStreamIdFromPath(m_httpRequestInfo.m_url, htmlPage); - if (found_sid > 0) - { - sid = found_sid; - } - if (m_ssl) - { - streamData::streamInfo info; - streamData::extraInfo extra; - if (streamData::getStreamInfo (sid, info, extra)) - { - if (info.m_allowSSL == 0) - { - sendMessageAndClose(MSG_HTTP403); - return; - } - } - } - - - // bit convoluted but it allows us to check 'icy-host' and then the - // client's address since it came up in testing the CDN mode that - // it didn't allow through connections which were configured by IP - // only instead of DNS - was a bug in a few builds where this checked - // for the 'host' value instead of the actual client address (oops) - // 2.4.8+ - this also looks that 'XFF' header value if provided - const bool validXFF = !metrics::metrics_verifyDestIP(gOptions, true, XFF).empty(); - if (!validXFF || (isAccessAllowed(sid, XFF) == false)) - { - if (isAccessAllowed(sid, addr) == false) - { - if (isAccessAllowed(sid, host, true) == false) - { - sendMessageAndClose(MSG_HTTP403); - return; - } - } - } - - // now process things and redirect to the relevant page found - // though if it's the direct url and it's from the SC/YP tester - // then we really need to let it through as true stream access - - // changed in 2.4.8+ to follow the 'type' parameter so it will - // be able to force a specific usage type as required be that - // sc1, sc2, flv, http, m4a or just figure it out from headers - const bool uvox_agent = ((m_userAgentLowered.find(utf8("ultravox/2.1")) != utf8::npos) && - !(!type.empty() && ((type == ".flv") || (type == "flv") || (type == ".fla") || - (type == "fla") || (type == "http") || (type == "sc1")))) || - (!type.empty() && (type == "sc2")); - const bool officialAgent = isUserAgentOfficial(m_userAgentLowered); - if ((htmlPage && !officialAgent && !uvox_agent) || (!type.empty() && (type == "html"))) - { - sendMessageAndClose(redirect("index.html?sid=" + tos(found_sid), !!m_compressed)); - return; - } - - // try to redirect directly to the appropriate page based on the number of active streams - streamData::streamID_t lastSID = 0; - if (!found_sid && (streamData::totalActiveStreams(lastSID) == (streamData::streamID_t)DEFAULT_CLIENT_STREAM_ID)) - { - sid = lastSID; - } - - protocol_shoutcastClient *client = 0; - - // Force v1 connection for Winamp 5.5x clients which ident with ultravox/2.1 as they do not support title updates - if ((m_protocols & P_SHOUTCAST2CLIENT) && uvox_agent && - (m_userAgentLowered.find(utf8("winampmpeg/5.5")) == utf8::npos)) - { // go for Ultravox 2.1 - client = new protocol_shoutcast2Client (*this, sid, host, addr, XFF, mapGet(m_httpRequestInfo.m_HTTPHeaders, "cdn-slave", false)); - } - - if (!client && (m_protocols & P_SHOUTCAST1CLIENT)) - { - if (!type.empty() && ((type == ".flv") || (type == "flv") || (type == ".fla") || (type == "fla"))) - { - client = new protocol_flvClient (*this, sid, host, addr, XFF); // flv - } - /*else if ((type == ".m4a") || (type == ".mp4")) - { - client = new protocol_m4aClient(s, sid, host, addr, m_clientPort, m_userAgent, XFF, m_referer, HEAD_REQUEST); // m4a - }*/ - else - { - // from 2.4.8+, we now treat 1.x listener connections differently based on the - // requirement to send 1.x-style metadata or not, which if not we can go for a - // stipped down handler which will better frame-sync the output for reliabilty - // which is trickier to do with the metadata handling, hence the split handler - const bool sendMetadata = mapGet(m_httpRequestInfo.m_HTTPHeaders, "icy-metadata", false); - - // and this is used to look for what is essentially a Shoutcast player request - // and if we see icy=http then we force providing the HTTP listener client and - // not the SC 1.x listener client as we know the player won't use that data... - const utf8 &http = toLower(stripWhitespace(mapGet(m_httpRequestInfo.m_QueryParameters, "icy", (utf8)""))); - const bool forceHTTP = ((!http.empty() && (http == "http")) || (!type.empty() && (type == "http"))); - - if ((gOptions.getBackupLoop(sid) == 1 ? false : (!forceHTTP ? sendMetadata : false)) || - (!type.empty() && (type == "sc1"))) - { - client = new protocol_shoutcast1Client (*this, sid, host, addr, XFF); // shoutcast 1 with metadata - } - else - { - client = new protocol_HTTPClient (*this, sid, host, addr, XFF); // http (equivalent of shoutcast 1 without metadata) - } - } - } - - if (client) - { - client->m_queryParams = encodeVariables (m_httpRequestInfo.m_QueryParameters); - // to prevent some of the stats / logs getting skewed - // then we filter out the SHOUTcast site 'test' users - // and we only action for GET requests, not HEAD, etc - if (!officialAgent && (m_httpRequestInfo.m_request == HTTP_GET) && - // changed in #668 to skip doing auth on local clients - // as it will never provide an applicable advert group - // unless we're detecting a remote XFF value to use... - (isRemoteAddress(addr) || isRemoteAddress(XFF))) - { - DEBUG_LOG(m_clientLogString + "Starting client via auth."); - client->authForStream(); - } - else - { - DEBUG_LOG(m_clientLogString + "Starting client directly."); - threadedRunner::scheduleRunnable(client); - } - } - - m_result.done(); -} - -void protocol_HTTPStyle::state_GetLine() throw(exception) -{ - if (getHTTPStyleHeaderLine(DEFAULT_CLIENT_STREAM_ID, m_lineBuffer, m_clientLogString, m_postRequest == 2 ? m_postRequestLength : 0)) - { - m_state = m_nextState; - } -} - -// parse header line into key/value components and load into table -void protocol_HTTPStyle::state_AnalyzeHTTPHeaders() throw(exception) -{ - m_lastActivityTime = ::time(NULL); - - if ((int)m_httpRequestInfo.m_HTTPHeaders.size() >= gOptions.maxHeaderLineCount()) - { - ELOG(m_clientLogString + "Max HTTP header lines exceeded"); - sendMessageAndClose(MSG_HTTP400); - return; - } - - // since a POST will get a null line, we need to check and handle it as appropriate when stripping whitespace - if (!m_lineBuffer.empty() && ((m_postRequest == 0) || - ((m_postRequest == 1) && (m_lineBuffer[0] != '\n') && (m_lineBuffer[0] != '\r')))) - { - m_lineBuffer = stripWhitespace(m_lineBuffer); - } - - if (m_lineBuffer.empty()) - { - m_state = &protocol_HTTPStyle::state_DetermineAction; - m_result.run(); - } - else if ((m_postRequest == 1) && ((m_lineBuffer[0] == '\n') || (m_lineBuffer[0] == '\r'))) - { - m_postRequest = 2; - m_nextState = &protocol_HTTPStyle::state_AnalyzeHTTPHeaders; - m_state = &protocol_HTTPStyle::state_GetLine; - m_result.read(); - m_result.timeoutSID(); - m_lineBuffer.clear(); - } - else - { - // find the colon that divides header lines into key/value fields - const utf8::size_type pos = m_lineBuffer.find(utf8(":")); - // however in some cases (mainly found in the fire builds), the http headers may be split - // in a manner not expected so we have to look at the last key and append if there is one - // recorded which appears to be safe to do from testing vs killing the connection as was. - bool appended = false; - if ((pos == utf8::npos) && !m_postRequest) - { - if (!m_lastKey.empty()) - { - utf8 oldValue = m_httpRequestInfo.m_HTTPHeaders[m_lastKey]; - m_httpRequestInfo.m_HTTPHeaders[m_lastKey] = oldValue + stripWhitespace(m_lineBuffer.substr(pos+1)); - DEBUG_LOG(m_clientLogString + "Appending HTTP header string to previous key [" + m_lineBuffer + "]"); - appended = true; - } - else - { - DEBUG_LOG(m_clientLogString + "Bad HTTP header string [" + m_lineBuffer + "]"); - } - } - - if (m_postRequest < 2) - { - // make sure not to re-add if we're doing a header append (see above) - if (appended == false) - { - utf8 key = toLower(stripWhitespace(m_lineBuffer.substr(0,pos))); - m_lastKey = key; - // allow empty values. (for urls and what-not) - if (key.empty()) - { - ELOG(m_clientLogString + "Connection rejected. Bad HTTP header string [" + m_lineBuffer + "]"); - sendMessageAndClose(MSG_HTTP400); - return; - } - utf8 val = stripWhitespace(m_lineBuffer.substr(pos+1)); - m_httpRequestInfo.m_HTTPHeaders[key] = val; - if (toLower(key) == "content-length") - { - m_postRequestLength = atoi ((char*)&val[0]); - if (m_postRequestLength < 0 || m_postRequestLength > 5000000) - { - ELOG(m_clientLogString + "Connection rejected. Content length too large [" + m_lineBuffer + "]"); - sendMessageAndClose(MSG_HTTP400); - return; - } - } - } - } - else - { - m_state = &protocol_HTTPStyle::state_DetermineAction; - m_result.run(); - // copy the POST response - m_httpRequestInfo.m_PostLine = m_lineBuffer; - m_lineBuffer.clear(); - return; - } - - m_nextState = &protocol_HTTPStyle::state_AnalyzeHTTPHeaders; - m_state = &protocol_HTTPStyle::state_GetLine; - m_result.schedule(); - m_result.timeoutSID(); - m_lineBuffer.clear(); - } -} - -void protocol_HTTPStyle::state_Close() throw(exception) -{ - m_result.done(); -} - -// send buffer text -void protocol_HTTPStyle::state_Send() throw(exception) -{ - if (sendDataBuffer(DEFAULT_CLIENT_STREAM_ID, m_outBuffer, m_outBufferSize, m_clientLogString)) - { - m_state = m_nextState; - } -} - -void protocol_HTTPStyle::sendMessageAndClose(const utf8 &msg) throw() -{ - m_outMsg = msg; - m_outBuffer = m_outMsg.c_str(); - bandWidth::updateAmount(bandWidth::PUBLIC_WEB, (m_outBufferSize = (int)m_outMsg.size())); - m_state = &protocol_HTTPStyle::state_Send; - m_nextState = &protocol_HTTPStyle::state_Close; - m_result.write(); - m_result.run(); -} - -//////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////// - -utf8 protocol_HTTPStyle::getPlayedBody(const streamData::streamID_t sid) -{ - utf8 body = "" - ""; - - streamData::streamHistory_t songHistory; - streamData::getStreamSongHistory(sid, songHistory); - - if (songHistory.empty()) - { - body += ""; - } - else - { - for (streamData::streamHistory_t::const_iterator i = songHistory.begin(); i != songHistory.end(); ++i) - { - char buf[1024] = {0}; - struct tm lt; - time_t t = (*i).m_when; - ::localtime_s(<, &t); - snprintf(buf, sizeof(buf) - 1, "%02d:%02d:%02d", lt.tm_hour, lt.tm_min, lt.tm_sec); - body += "" + - (i == songHistory.begin() ? (streamData::isSourceConnected(sid) ? - "" : "") : "") + ""; - } - } - - body += "
Played @Song Title
No Songs Played
" + utf8(buf) + "" + getCurrentSong((*i).m_title) + "Current Song
"; - return body; -} - -// played history page -void protocol_HTTPStyle::path_played_html(const streamData::streamID_t sid, const utf8 &XFF) throw() -{ - cacheItem *item = m_htmlPlayedCache[sid]; - if (getCachedResponse(item, m_htmlPlayedLock)) - { - return; - } - - utf8 header = MSG_NO_CLOSE_200, - body = getStreamHeader(sid, "Stream History"); - - if (gOptions.getSongHistorySize(sid)) - { - body += getStreamMiddlePlayingHeader(sid); - } - - if (isAccessAllowed(sid, XFF) == true) - { - body += getStreamMiddleListenHeader(sid); - } - - body += getStreamEndHeader(sid) + getPlayedBody(sid) + getIEFlexFix() + getfooterStr(); - - sendCachedResponse(item, m_htmlPlayedCache, m_htmlPlayedLock, header, body, sid); -} - -utf8 protocol_HTTPStyle::getPlayedJSON(const streamData::streamID_t sid, utf8 &header, - const utf8 &callback, const bool allowed) throw() -{ - const bool jsonp = !callback.empty(); - header = "HTTP/1.0 200 OK\r\nContent-Type:application/json;charset=utf-8\r\n"; - utf8 body = (jsonp ? callback + "(" : "") + "["; - - if (allowed) - { - streamData::streamHistory_t songHistory; - streamData::getStreamSongHistory(sid, songHistory); - - bool first = true; - for (streamData::streamHistory_t::const_iterator i = songHistory.begin(); i != songHistory.end(); ++i) - { - body += (!first ? utf8(",") : "") + "{\"playedat\":" + - tos((*i).m_when) + "," "\"title\":\"" + escapeJSON((*i).m_title) + "\"" - ",\"metadata\":" + getCurrentJSONMetadataBody((*i).m_metadata) + "}"; - first = false; - } - } - - return (body + "]" + (jsonp ? utf8(")") : "")); -} - -void protocol_HTTPStyle::path_played_json(const streamData::streamID_t sid, const utf8 &callback, - const bool password, const utf8 &XFF) throw() -{ - cacheItem *item = m_jsonPlayedCache[sid]; - if (getCachedResponse(item, m_jsonPlayedLock)) - { - return; - } - - const bool jsonp = !callback.empty(); - utf8 header, body = getPlayedJSON(sid, header, callback, (password || (isAccessAllowed(sid, XFF) == true))); - sendCachedResponse(item, m_jsonPlayedCache, m_jsonPlayedLock, header, body, sid, jsonp); -} - -utf8 protocol_HTTPStyle::getPlayedXML(const streamData::streamID_t sid, utf8 &header, const bool allowed) throw() -{ - header = "HTTP/1.0 200 OK\r\nContent-Type:text/xml\r\n"; - utf8 body = "" - ""; - - if (allowed) - { - streamData::streamHistory_t songHistory; - streamData::getStreamSongHistory(sid, songHistory); - - for (streamData::streamHistory_t::const_iterator i = songHistory.begin(); i != songHistory.end(); ++i) - { - body += "" + tos((*i).m_when) + "" - "" + aolxml::escapeXML((*i).m_title) + "" + - getCurrentXMLMetadataBody(true, (*i).m_metadata) + ""; - } - } - - return (body + ""); -} - -void protocol_HTTPStyle::path_played_xml(const streamData::streamID_t sid, - const bool password, const utf8 &XFF) throw() -{ - cacheItem *item = m_xmlPlayedCache[sid]; - if (getCachedResponse(item, m_xmlPlayedLock)) - { - return; - } - - utf8 header, body = getPlayedXML(sid, header, (password || (isAccessAllowed(sid, XFF) == true))); - sendCachedResponse(item, m_xmlPlayedCache, m_xmlPlayedLock, header, body, sid); -} - -// flash x-domain file -void protocol_HTTPStyle::path_crossdomain() throw() -{ - cacheItem *item = m_crossdomainCache[0]; - if (getCachedResponse(item, m_crossdomainLock, 86400)) // 1 day - { - return; - } - - // return either the current song or the next song to be played (if known) - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:text/x-cross-domain-policy\r\n", - body = gOptions.getCrossDomainFile(!!m_compressed); - - // make sure there is a gzipped version available to send if signalled as supported - if (m_compressed && !gOptions.m_crossdomainStrGZ.empty()) - { - header += "Content-Encoding:gzip\r\n"; - body = gOptions.m_crossdomainStrGZ; - } - - sendCachedResponse(item, m_crossdomainCache, m_crossdomainLock, header, body); -} - -// flash swf file (assumes shoutcast.swf for ease of implementation / consistency) -void protocol_HTTPStyle::path_shoutcastswf() throw() -{ - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:application/x-shockwave-flash\r\n", - body = gOptions.getShoutcastSWF(!!m_compressed); - - // make sure there is a gzipped version available to send if signalled as supported - if (m_compressed && !gOptions.m_shoutcastSWFStrGZ.empty()) - { - header += "Content-Encoding:gzip\r\n"; - body = gOptions.m_crossdomainStrGZ; - } - - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -void protocol_HTTPStyle::path_redirect_url(const streamData::streamID_t sid, const bool no_sid, const bool isStats) throw() -{ - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(sid, info, extra); - - const utf8 redirectUrl = gOptions.getStreamRedirectURL((no_sid ? 0 : sid), isStats, !info.m_streamURL.empty(), !!m_compressed); - if (redirectUrl.empty()) - { - // try to redirect directly to the appropriate page based on the number of active streams - streamData::streamID_t lastSID = 0; - if (streamData::totalActiveStreams(lastSID) == (streamData::streamID_t)DEFAULT_CLIENT_STREAM_ID) - { - sendMessageAndClose(redirect("index.html?sid=" + tos(lastSID), !!m_compressed)); - } - else - { - sendMessageAndClose(redirect("index.html", !!m_compressed)); - } - } - else - { - sendMessageAndClose(redirectUrl); - } -} - -void protocol_HTTPStyle::path_root_summary(const utf8 &XFF, const bool force) throw() -{ - // if enabled then we need to block access to this page as it's not allowed to be public - if (gOptions.getStreamHideStats(0) == "all") - { - path_redirect_url(0, true, false); - } - else - { - utf8 header = MSG_NO_CLOSE_200, - body = "" - "" - ""\ - "Shoutcast Server" - "" - "" - "" - "" - "" - "
Shoutcast Streams Status
" - "Shoutcast Server v" + - addWBR(gOptions.getVersionBuildStrings() + "/" SERV_OSNAME) + "" - "
" - "" - "" - "
 Help  |  " - " DocumentationServer Login " - "\"Server" - "  
"; - - utf8 streamBody = ""; - size_t total = 0, known = streamData::totalStreams(); - - if (known > 0) - { - --known; // just makes it easier to know when to insert the
element - - size_t inc = 0; - streamData::streamID_t sid = 0; - do - { - streamData::streamInfo info; - streamData::extraInfo extra; - if (streamData::getStreamInfo((sid = streamData::enumStreams(inc)), info, extra)) - { - // increment our stream total now that we know we have one - ++total; - - utf8 tooltip = streamData::getContentType(info) + " @ " + - (info.m_streamBitrate > 0 ? tos(info.m_streamBitrate) : - "unknown") + " kbps" + (info.m_vbr ? " (VBR)" : "") + - ", " + sampleRateStr(info.m_streamSampleRate); - - streamBody += "" - "Stream #" + tos(sid) + " " - "(Stream Login)"; - - if (isAccessAllowed(sid, XFF) == true) - { - streamBody += " " - "\"Listen"; - - streamBody += " " - "\"History""; - } - - streamBody += "" + (info.m_streamPublic && extra.ypConnected ? - "" + aolxml::escapeXML(info.m_streamName) + "" : - (info.m_streamURL.empty() ? aolxml::escapeXML(info.m_streamName) : - urlLink(info.m_streamURL, info.m_streamName))) + "" - "" + tooltip + ""; - - if (!getHideState(sid)) - { - stats::statsData_t data; - stats::getStats(sid, data); - - const int maxUsers = ((info.m_streamMaxUser > 0) && (info.m_streamMaxUser < gOptions.maxUser()) ? info.m_streamMaxUser : gOptions.maxUser()); - streamBody += "" + tos(data.connectedListeners) + - (maxUsers > 0 ? " of " + tos(maxUsers) : "") + " listeners" + - (!maxUsers ? " (unlimited)" : "") + - (data.connectedListeners != data.uniqueListeners ? - (" (" + tos(data.uniqueListeners) + " unique)") : "") + ""; - } - - if (!info.m_currentSong.empty()) - { - streamBody += "Playing Now: " - "" + - getCurrentSong(info.m_currentSong) + ""; - - // only show if we have a valid current song - if (!info.m_comingSoon.empty()) - { - streamBody += "Playing Next: " + aolxml::escapeXML(info.m_comingSoon) + ""; - } - } - - if (!info.m_contentType.empty() && (info.m_uvoxDataType == MP3_DATA)) - { - streamBody += streamData::getHTML5Player(sid); - } - - if (inc < known) - { - // this allows us to only add between - // blocks and not below the very last - streamBody += "
"; - } - } - ++inc; - } - while (sid); - } - - // if only 1 stream is active then behave like a v1 DNAS and show that stream's summary page - if (total == 1 && !force) - { - sendMessageAndClose(redirect("index.html", !!m_compressed)); - } - else - { - body += "" - "
" - "Available Streams: " + tos(total) + "

" + - getNewVersionMessage() + - "" - // if there are any streams then we can add them in now we have the real total and finish off the page - "" + streamBody + "
" + - getHTML5Remover() + getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); - } - } -} - -// main admin page -void protocol_HTTPStyle::path_root(const streamData::streamID_t sid, const utf8 &XFF) throw() -{ - // if enabled then we need to block access to this page as it's not allowed to be public - if (gOptions.getStreamHideStats(sid) == "all") - { - path_redirect_url(sid, false, false); - } - else - { - utf8 header = MSG_NO_CLOSE_200, - body = getStreamHeader(sid, "Stream Status"); - - if (gOptions.getSongHistorySize(sid)) - { - body += getStreamMiddlePlayingHeader(sid); - } - - if (isAccessAllowed(sid, XFF) == true) - { - body += getStreamMiddleListenHeader(sid); - } - - body += getStreamEndHeader(sid) + "" - "
Current Stream " - "Information

" + getNewVersionMessage(); - - stats::statsData_t data; - stats::getStats(sid, data); - - streamData::streamInfo info; - streamData::extraInfo extra; - if (streamData::getStreamInfo(sid, info, extra)) - { - const int maxUsers = ((info.m_streamMaxUser > 0) && (info.m_streamMaxUser < gOptions.maxUser()) ? info.m_streamMaxUser : gOptions.maxUser()); - const bool isListable = streamData::isAllowedType(info.m_uvoxDataType); - body += "" - "" - "" - "" - ""; - - if (data.peakListeners > 0) - { - body += ""; - } - - const utf8 avgTime = timeString(data.avgUserListenTime); - if (!avgTime.empty()) - { - body += "" - ""; - } - - body += ""; - - if (!info.m_streamGenre[0].empty()) - { - body += "" - ""; - } - - if (!info.m_streamURL.empty()) - { - body += "" - ""; - } - - if (!info.m_currentSong.empty()) - { - body += "" - ""; - - // only show if we have a valid current song - if (!info.m_comingSoon.empty()) - { - body += "" - ""; - } - } - - if (!info.m_contentType.empty() && (info.m_uvoxDataType == MP3_DATA)) - { - body += streamData::getHTML5Player(sid); - } - - body += "
Listing Status: Stream is currently up " + - (info.m_streamPublic && isListable ? (!extra.ypConnected ? "" : utf8("and public")) : utf8("and private (not listed)")) + - (info.m_streamPublic && isListable ? (!extra.ypConnected ? - (extra.ypErrorCode == -1 ? "but unable to access the Directory.
Listeners are allowed and the stream will act like it is private until resolved." : - (extra.ypErrorCode == YP_MAINTENANCE_CODE ? "but received a Directory maintenance notification.
Listeners are allowed to connect and the stream will act like it is private." : - (!info.m_authHash.empty() ? - (extra.ypErrorCode != YP_NOT_VISIBLE ? "but is waiting on a Directory response." : "but is not visible on the internet " - "(YP error code: " + - tos(extra.ypErrorCode) + ").
Listeners are allowed and the stream will act like it is private until resolved.

" - "Resolving this issue will allow the stream to be listed in the Shoutcast Directory.") : - "but requires registration in the Shoutcast Directory.
" - "Listeners are allowed and the stream will act like it is private until resolved."))) : "") : "") + "
Stream Status: Stream is up (" + streamData::getContentType(info) + " @ " + - (info.m_streamBitrate > 0 ? tos(info.m_streamBitrate) : "unknown") + - " kbps" + (info.m_vbr ? " (VBR)" : "") + ", " + - sampleRateStr(info.m_streamSampleRate) + ") with " + - tos(data.connectedListeners) + (maxUsers > 0 ? " of " + - tos(maxUsers) : "") + " listeners" + (!maxUsers ? " (unlimited)" : "") + - (data.connectedListeners != data.uniqueListeners ? (" (" + - tos(data.uniqueListeners) + " unique)") : "") + "
Listener Peak: " + - tos(data.peakListeners) + "
Avg. Play Time: " + avgTime + "
Stream Name: " + - (info.m_streamPublic && extra.ypConnected ? - "" + - aolxml::escapeXML(info.m_streamName) + "" : - aolxml::escapeXML(info.m_streamName)) + "
Stream Genre(s): " + (info.m_streamPublic && extra.ypConnected ? - "" + - aolxml::escapeXML(info.m_streamGenre[0]) + "" : - aolxml::escapeXML(info.m_streamGenre[0])) + ""; - - for (int i = 1; i < 5; i++) - { - if (!info.m_streamGenre[i].empty()) - { - body += " , " + (info.m_streamPublic && extra.ypConnected ? "" + aolxml::escapeXML(info.m_streamGenre[i]) + "" : - aolxml::escapeXML(info.m_streamGenre[i])) + ""; - } - } - - body += "
Stream Website: " + urlLink(info.m_streamURL) + "
Playing Now: " + - getCurrentSong(info.m_currentSong) + "
Playing Next: " + - aolxml::escapeXML(info.m_comingSoon) + "
"; - } - else - { - body += ""; - - if (data.peakListeners > 0) - { - body += ""; - } - - const utf8 avgTime = timeString(data.avgUserListenTime); - if (!avgTime.empty()) - { - body += "" - ""; - } - - body += "
Stream Status: "; - const utf8 movedUrl = gOptions.stream_movedUrl(sid); - if (movedUrl.empty()) - { - const int maxUsers = ((info.m_streamMaxUser > 0) && (info.m_streamMaxUser < gOptions.maxUser()) ? info.m_streamMaxUser : gOptions.maxUser()); - body += "Stream is currently down" + (data.connectedListeners > 0 ? - " with " + tos(data.connectedListeners) + (maxUsers > 0 ? " of " + - tos(maxUsers) : "") + " listeners" + (!maxUsers ? " (unlimited)" : "") + - (data.connectedListeners != data.uniqueListeners ? (" (" + - tos(data.uniqueListeners) + " unique)") : "") : ".") + "
There is no " - "source connected or no stream is configured for stream #" + tos(sid); - } - else - { - body += "Stream has been moved to " + urlLink(movedUrl); - } - body += "
Listener Peak: " + - tos(data.peakListeners) + "
Avg. Play Time: " + avgTime + "
"; - } - - body += getIEFlexFix() + getHTML5Remover() + getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); - } -} - -// redirect to stream URL -void protocol_HTTPStyle::path_home(const streamData::streamID_t sid) throw() -{ - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(sid, info, extra); - - utf8 streamUrl = (!info.m_streamURL.empty() ? - ((info.m_streamURL.find(utf8("://")) == utf8::npos ? "http://" : "") + - info.m_streamURL) : "http://www.shoutcast.com"); - - sendMessageAndClose(redirect(streamUrl, !!m_compressed)); -} - -void protocol_HTTPStyle::path_track(const streamData::streamID_t sid, const int mode) throw() -{ - // this is a non-compressed response as most normal titles aren't - // long enough or contain enough data sans gzip header and footer - // to make it worth trying to create a gzipped response for this. - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:text/plain;charset=utf-8\r\n", currentSong, comingSoon; - std::vector nextSongs; - if (streamData::getStreamNextSongs(sid, currentSong, comingSoon, nextSongs)) - { - // return either the current song or the next song to be played (if known) - utf8 body = (!mode ? (currentSong.empty() ? "" : currentSong) : - (!currentSong.empty() ? comingSoon : "")); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); - } - else - { - sendMessageAndClose(header + "\r\n"); - } -} - -void protocol_HTTPStyle::path_tracks_json(const streamData::streamID_t sid, const utf8 &callback) throw() -{ - cacheItem *item = m_jsonTracksCache[sid]; - if (getCachedResponse(item, m_jsonTracksLock)) - { - return; - } - - const bool jsonp = !callback.empty(); - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:application/json;charset=utf-8\r\n", - body = (jsonp ? callback + "(" : "") + "[", currentSong, comingSoon; - std::vector nextSongs; - if (streamData::getStreamNextSongs(sid, currentSong, comingSoon, nextSongs)) - { - int index = 1; - for (std::vector::const_iterator i = nextSongs.begin(); i != nextSongs.end(); ++i, index++) - { - body += (i != nextSongs.begin() ? utf8(",") : "") + - "{\"title\":\"" + escapeJSON((*i).empty() ? "" : (*i)) + "\"}"; - } - } - - body += utf8("]") + (jsonp ? ")" : ""); - - sendCachedResponse(item, m_jsonTracksCache, m_jsonTracksLock, header, body, sid, jsonp); -} - -void protocol_HTTPStyle::path_tracks_xml(const streamData::streamID_t sid) throw() -{ - cacheItem *item = m_xmlTracksCache[sid]; - if (getCachedResponse(item, m_xmlTracksLock)) - { - return; - } - - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:text/xml\r\n", - body = "" - "", currentSong, comingSoon; - std::vector nextSongs; - if (streamData::getStreamNextSongs(sid, currentSong, comingSoon, nextSongs)) - { - int index = 1; - for (std::vector::const_iterator i = nextSongs.begin(); i != nextSongs.end(); ++i, index++) - { - body += "" + aolxml::escapeXML(*i) + ""; - } - } - - body += ""; - - sendCachedResponse(item, m_xmlTracksCache, m_xmlTracksLock, header, body, sid); -} - -uniString::utf8 protocol_HTTPStyle::getCurrentXMLMetadataBody(const bool mode, const utf8 &metadata) -{ - utf8 body = (!mode ? "" : ""); - - if (!metadata.empty()) - { - // strip out the metadata between the part - // so it'll instead go in our own part - const utf8::size_type pos1 = metadata.find(METADATA), // 10 chars - pos2 = metadata.find(E_METADATA); // 11 chars - if ((pos1 != utf8::npos) && (pos2 != utf8::npos)) - { - body += stripWhitespace(metadata.substr(pos1 + 10, pos2 - pos1 - 10)); - } - } - - return (body + (!mode ? "" : "")); -} - -void protocol_HTTPStyle::path_current_metadata_xml(const streamData::streamID_t sid) throw() -{ - cacheItem *item = m_xmlMetadataCache[sid]; - if (getCachedResponse(item, m_xmlMetadataLock)) - { - return; - } - - streamData::streamHistory_t songHistory; - streamData::getStreamSongHistory(sid, songHistory); - - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:text/xml\r\n", - body = "" - "" + getCurrentXMLMetadataBody(false, - (!songHistory.empty() ? songHistory[0].m_metadata : "")) + - ""; - - sendCachedResponse(item, m_xmlMetadataCache, m_xmlMetadataLock, header, body, sid); -} - -uniString::utf8 protocol_HTTPStyle::getCurrentJSONMetadataBody(const utf8 &metadata) -{ - utf8 body = "{"; - - if (!metadata.empty()) - { - // strip out the metadata between the part - // so it'll instead go in our own part - const utf8::size_type pos1 = metadata.find(METADATA), // 10 chars - pos2 = metadata.find(E_METADATA); // 11 chars - if ((pos1 != utf8::npos) && (pos2 != utf8::npos)) - { - // take the xml metadata, create a new xml block from it - const utf8 meta = "" + - stripWhitespace(metadata.substr(pos1 + 10, pos2 - pos1 - 10)) + ""; - - // then split down into node+text to be able to output - aolxml::node *n = 0; - try - { - n = aolxml::node::parse(meta); - if (n) - { - for (aolxml::node::const_childIterator_t i = n->childrenBegin(); i != n->childrenEnd(); ++i) - { - const utf8 node = toLower((*i)->name()); - body += (i != n->childrenBegin() ? utf8(",") : "") + - "\"" + escapeJSON(node) + - "\":" + ((*i)->childrenEmpty() ? "\"" + escapeJSON((*i)->pcdata()) + "\"" : ""); - // if we've got a child block it should be and so parse out - if (!(*i)->childrenEmpty()) - { - body += "["; - for (aolxml::node::const_childIterator_t c = (*i)->childrenBegin(); c != (*i)->childrenEnd(); ++c) - { - const utf8 nodec = toLower((*c)->name()) + (*c)->findAttributeString("seq"); - body += (c != (*i)->childrenBegin() ? utf8(",") : "") + - "{\"" + escapeJSON(nodec) + - "\":" + ((*c)->childrenEmpty() ? "\"" + escapeJSON((*c)->pcdata()) + "\"" : "") + "}"; - } - body += "]"; - } - } - } - } - catch(const exception &) - { - } - forget(n); - } - } - - return (body + "}"); -} - -void protocol_HTTPStyle::path_current_metadata_json(const streamData::streamID_t sid, const utf8 &callback) throw() -{ - cacheItem *item = m_jsonMetadataCache[sid]; - if (getCachedResponse(item, m_jsonMetadataLock)) - { - return; - } - - streamData::streamHistory_t songHistory; - streamData::getStreamSongHistory(sid, songHistory); - - const bool jsonp = !callback.empty(); - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:application/json;charset=utf-8\r\n", - body = (jsonp ? callback + "(" : "") + - getCurrentJSONMetadataBody((!songHistory.empty() ? songHistory[0].m_metadata : "")) + - (jsonp ? ")" : ""); - - sendCachedResponse(item, m_jsonMetadataCache, m_jsonMetadataLock, header, body, sid, jsonp); -} - -utf8 protocol_HTTPStyle::getStatsXMLBody(const streamData::streamID_t sid, const bool single, - const bool proceed, const socketOps::tSOCKET m_socket, - stats::statsData_t& data, const bool no_copy) -{ - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(sid, info, extra); - - if (!no_copy) - { - stats::getStats(sid, data); - } - - size_t maxUsers = gOptions.maxUser(); - - config::streamConfig stream; - if (gOptions.getStreamConfig(stream, sid)) - { - maxUsers = ((stream.m_maxStreamUser > 0) && (stream.m_maxStreamUser < gOptions.maxUser()) ? stream.m_maxStreamUser : gOptions.maxUser()); - } - - utf8 body = "" + tos(data.connectedListeners) + "" - "" + tos(data.peakListeners) + "" - "" + (maxUsers > 0 ? tos(maxUsers) : "UNLIMITED") + "" - "" + tos(data.uniqueListeners) + "" - "" + tos(data.avgUserListenTime) + ""; - - for (int n = 0; n < 5; n++) - { - const utf8 num = (n ? tos(n + 1) : ""); - body += "" + aolxml::escapeXML(info.m_streamGenre[n]) + ""; - } - - body += "" + aolxml::escapeXML(info.m_streamURL) + "" - "" + aolxml::escapeXML(info.m_streamName) + "" - "" + aolxml::escapeXML(info.m_currentSong.empty() ? "" : info.m_currentSong) + ""; - - if (!info.m_comingSoon.empty()) - { - body += "" + aolxml::escapeXML(info.m_comingSoon) + ""; - } - - if (!info.m_streamUser.empty()) - { - body += "" + aolxml::escapeXML(info.m_streamUser) + ""; - } - - if (!info.m_currentURL.empty()) - { - body += "" + aolxml::escapeXML(info.m_currentURL) + ""; - } - - body += "" + tos(data.totalStreamHits) + "" - "" + (extra.isConnected ? "1" : "0") + "" - "" + (extra.isBackup ? "1" : "0") + "" - "" + (extra.ypConnected ? "1" : "0") + ""; - if (!extra.ypConnected) - { - body += "" + tos(extra.ypErrorCode) + ""; - } - - // if a source is connected and we have a valid password then output this - if (proceed && extra.isConnected) - { - // strip down the source address for display output to an appropriate output based on settings - utf8 srcAddr = (extra.isBackup ? info.m_backupURL : (extra.isRelay ? info.m_relayURL : info.m_srcAddr)); - if (gOptions.nameLookups()) - { - if (!extra.isBackup && !extra.isRelay) - { - u_short port = 0; - string addr, hostName; - socketOps::getpeername(m_socket, addr, port); - - string src = (extra.isBackup ? info.m_backupURL : (extra.isRelay ? info.m_relayURL : info.m_srcAddr)).hideAsString(); - hostName = src; - if (!socketOps::addressToHostName(addr, port, hostName)) - { - srcAddr = hostName + " (" + (src) + ")"; - } - } - } - - body += "" + aolxml::escapeXML(srcAddr) + ""; - - if (!info.m_backupURL.empty()) - { - body += "" + aolxml::escapeXML(info.m_backupURL) + ""; - } - } - - body += "" + aolxml::escapeXML(getStreamPath(sid)) + "" + - (extra.isConnected ? ("" + tos(::time(NULL) - streamData::getStreamUptime(sid)) + "") : "") + - "" + tos(info.m_streamBitrate) + "" - "" + tos(info.m_streamSampleRate) + "" + - (info.m_vbr ? "1" : "") + - "" + aolxml::escapeXML(info.m_contentType) + ""; - - if (single) - { - body += "" + aolxml::escapeXML(gOptions.getVersionBuildStrings()) + " (" SERV_OSNAME ")"; - } - - return body; -} - -void protocol_HTTPStyle::path_stats_xml(streamData::streamID_t sid, bool proceed) throw() -{ - cacheItem *item = m_xmlStatsCache[sid]; - if (getCachedResponse(item, m_xmlStatsLock)) - { - return; - } - - stats::statsData_t data; - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:text/xml\r\n", - body = "" - "" + getStatsXMLBody(sid, true, proceed, m_socket, data) + ""; - - sendCachedResponse(item, m_xmlStatsCache, m_xmlStatsLock, header, body, sid); -} - -void protocol_HTTPStyle::path_statistics_xml(streamData::streamID_t sid, bool proceed) throw() -{ - cacheItem *item = m_xmlStatisticsCache[sid]; - if (getCachedResponse(item, m_xmlStatisticsLock)) - { - return; - } - - // this will generate a DNAS wide statistics report making it clearer on what is / isn't going on (requested by WaveStreaming) - size_t totalConnectedListeners = 0, - totalPeakListeners = 0, - totalMoved = 0; - time_t totalAvgUserListenTime = 0; - - streamData::streamIDs_t streamIds = streamData::getStreamIds(2); - config::streams_t streams; - gOptions.getStreamConfigs(streams); - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - if ((*i).second.m_streamID) - { - streamIds.insert((*i).second.m_streamID); - } - } - - utf8 block = ""; - for (streamData::streamIDs_t::const_iterator i = streamIds.begin(); i != streamIds.end(); ++i) - { - const utf8 movedUrl = gOptions.stream_movedUrl((*i)); - if (movedUrl.empty()) - { - stats::statsData_t data; - stats::getStats((*i), data); - - // increment the system wide totals - totalConnectedListeners += data.connectedListeners; - totalPeakListeners += data.peakListeners; - totalAvgUserListenTime += data.avgUserListenTime; - - block += "" + getStatsXMLBody((*i), false, proceed, m_socket, data, true) + ""; - } - else - { - ++totalMoved; - } - } - - const int maxUsers = gOptions.maxUser(); - streamData::streamID_t lastSID = 0; - const utf8 main = "" - "" + tos(streamIds.size() - totalMoved) + "" - "" + tos(streamData::totalActiveStreams(lastSID)) + "" - "" + tos(totalConnectedListeners) + "" - "" + tos(totalPeakListeners) + "" - "" + (maxUsers > 0 ? tos(maxUsers) : "UNLIMITED") + "" - "" + tos(stats::getTotalUniqueListeners()) + "" - "" + tos(totalConnectedListeners > 0 ? - (totalAvgUserListenTime / totalConnectedListeners) : 0) + "" - "" + aolxml::escapeXML(gOptions.getVersionBuildStrings()) + " (" SERV_OSNAME ")"; - - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:text/xml\r\n", - body = "" - "" + main + block + ""; - - sendCachedResponse(item, m_xmlStatisticsCache, m_xmlStatisticsLock, header, body, sid); -} - -utf8 protocol_HTTPStyle::getStatsJSONBody(const streamData::streamID_t sid, const bool single, - const bool proceed, const socketOps::tSOCKET m_socket, - stats::statsData_t& data, const bool no_copy) -{ - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(sid, info, extra); - - if (!no_copy) - { - stats::getStats(sid, data); - } - - size_t maxUsers = gOptions.maxUser(); - - config::streamConfig stream; - if (gOptions.getStreamConfig(stream, sid)) - { - maxUsers = ((stream.m_maxStreamUser > 0) && (stream.m_maxStreamUser < gOptions.maxUser()) ? stream.m_maxStreamUser : gOptions.maxUser()); - } - - utf8 body = (!single ? "\"id\":" + tos(sid) + "," : "") + - "\"currentlisteners\":" + tos(data.connectedListeners) + "," - "\"peaklisteners\":" + tos(data.peakListeners) + "," - "\"maxlisteners\":" + (maxUsers > 0 ? tos(maxUsers) : "\"unlimited\"") + "," - "\"uniquelisteners\":" + tos(data.uniqueListeners) + "," - "\"averagetime\":" + tos(data.avgUserListenTime) + ","; - - for (int n = 0; n < 5; n++) - { - const utf8 num = (n ? tos(n + 1) : ""); - body += "\"servergenre" + num + "\":\"" + aolxml::escapeXML(info.m_streamGenre[n]) + "\","; - } - - body += "\"serverurl\":\"" + escapeJSON(info.m_streamURL) + "\"," - "\"servertitle\":\"" + escapeJSON(info.m_streamName) + "\"," - "\"songtitle\":\"" + escapeJSON(info.m_currentSong.empty() ? "" : info.m_currentSong) + "\","; - - if (!info.m_comingSoon.empty()) - { - body += "\"nexttitle\":\"" + escapeJSON(info.m_comingSoon.empty() ? "" : info.m_comingSoon) + "\","; - } - - if (!info.m_streamUser.empty()) - { - body += "\"dj\":\"" + escapeJSON(info.m_streamUser) + "\","; - } - - if (!info.m_streamUser.empty()) - { - body += "\"songurl\":\"" + escapeJSON(info.m_currentURL) + "\","; - } - - body += "\"streamhits\":" + tos(data.totalStreamHits) + "," - "\"streamstatus\":" + (extra.isConnected ? "1" : "0") + "," - "\"backupstatus\":" + (extra.isBackup ? "1" : "0") + "," - "\"streamlisted\":" + (extra.ypConnected ? "1" : "0") + ","; - if (!extra.ypConnected) - { - body += "\"streamlistederror\":" + tos(extra.ypErrorCode) + ","; - } - - // if a source is connected and we have a valid password then output this - if (proceed && extra.isConnected) - { - // strip down the source address for display output to an appropriate output based on settings - utf8 srcAddr = (extra.isBackup ? info.m_backupURL : (extra.isRelay ? info.m_relayURL : info.m_srcAddr)); - if (gOptions.nameLookups()) - { - if (!extra.isBackup && !extra.isRelay) - { - u_short port = 0; - string addr, hostName; - socketOps::getpeername(m_socket, addr, port); - - string src = (extra.isBackup ? info.m_backupURL : (extra.isRelay ? info.m_relayURL : info.m_srcAddr)).hideAsString(); - hostName = src; - if (!socketOps::addressToHostName(addr, port, hostName)) - { - srcAddr = hostName + " (" + (src) + ")"; - } - } - } - - body += "\"streamsource\":\"" + escapeJSON(srcAddr) + "\","; - - if (!info.m_backupURL.empty()) - { - body += "\"streambackup\":\"" + escapeJSON(info.m_backupURL) + "\","; - } - } - - body += "\"streampath\":\"" + escapeJSON(getStreamPath(sid)) + "\"," + - (extra.isConnected ? ("\"streamuptime\":" + tos(::time(NULL) - streamData::getStreamUptime(sid)) + ",") : "") + - "\"bitrate\":\"" + tos(info.m_streamBitrate) + "\"," - "\"samplerate\":\"" + tos(info.m_streamSampleRate) + "\"," + - (info.m_vbr ? "\"vbr\":\"1\"," : "") + - "\"content\":\"" + escapeJSON(info.m_contentType) + "\""; - - if (single) - { - body += ",\"version\":\"" + escapeJSON(gOptions.getVersionBuildStrings()) + " (" SERV_OSNAME ")\""; - } - - return body; -} - -void protocol_HTTPStyle::path_stats_json(const streamData::streamID_t sid, const bool proceed, const utf8 &callback) throw() -{ - const bool jsonp = !callback.empty(); - cacheItem *item = m_jsonStatsCache[sid]; - if (getCachedResponse(item, m_jsonStatsLock)) - { - return; - } - - stats::statsData_t data; - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:application/json;charset=utf-8\r\n", - body = (jsonp ? callback + "(" : "") + "{" + - getStatsJSONBody(sid, true, proceed, m_socket, data) + - "}" + (jsonp ? ")" : ""); - - sendCachedResponse(item, m_jsonStatsCache, m_jsonStatsLock, header, body, sid, jsonp); -} - -void protocol_HTTPStyle::path_statistics_json(const streamData::streamID_t sid, const bool proceed, const utf8 &callback) throw() -{ - const bool jsonp = !callback.empty(); - cacheItem *item = m_jsonStatisticsCache[sid]; - if (getCachedResponse(item, m_jsonStatisticsLock)) - { - return; - } - - // this will generate a DNAS wide statistics report making it clearer on what is / isn't going on (requested by WaveStreaming) - size_t totalConnectedListeners = 0, - totalPeakListeners = 0, - totalMoved = 0; - time_t totalAvgUserListenTime = 0; - - streamData::streamIDs_t streamIds = streamData::getStreamIds(2); - config::streams_t streams; - gOptions.getStreamConfigs(streams); - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - if ((*i).second.m_streamID) - { - streamIds.insert((*i).second.m_streamID); - } - } - - utf8 block = ""; - bool read = false; - for (streamData::streamIDs_t::const_iterator i = streamIds.begin(); i != streamIds.end(); ++i) - { - const utf8 movedUrl = gOptions.stream_movedUrl((*i)); - if (movedUrl.empty()) - { - stats::statsData_t data; - stats::getStats((*i), data); - - // increment the system wide totals - totalConnectedListeners += data.connectedListeners; - totalPeakListeners += data.peakListeners; - totalAvgUserListenTime += data.avgUserListenTime; - - block += (read ? utf8(",") : "") + "{" + getStatsJSONBody((*i), false, proceed, m_socket, data, true) + + "}"; - read = true; - } - else - { - ++totalMoved; - } - } - - streamData::streamID_t lastSID = 0; - const size_t total = streamIds.size() - totalMoved, - activeTotal = streamData::totalActiveStreams(lastSID), - maxUser = gOptions.maxUser(); - const utf8 main = "\"totalstreams\":" + tos(total) + "," - "\"activestreams\":" + tos(activeTotal) + "," - "\"currentlisteners\":" + tos(totalConnectedListeners) + "," - "\"peaklisteners\":" + tos(totalPeakListeners) + "," - "\"maxlisteners\":" + (maxUser > 0 ? tos(maxUser) : "\"unlimited\"") + "," - "\"uniquelisteners\":" + tos(stats::getTotalUniqueListeners()) + "," - "\"averagetime\":" + tos(totalConnectedListeners > 0 ? (totalAvgUserListenTime / totalConnectedListeners) : 0) + "," - "\"version\":\"" + escapeJSON(gOptions.getVersionBuildStrings()) + " (" SERV_OSNAME ")\"" + - (total > 0 ? ",\"streams\":[" : ""); - - utf8 header = "HTTP/1.0 200 OK\r\nContent-Type:application/json;charset=utf-8\r\n", - body = (jsonp ? callback + "(" : "") + - "{" + main + block + (total > 0 ? "]" : "") + "}" + - (jsonp ? ")" : ""); - - sendCachedResponse(item, m_jsonStatisticsCache, m_jsonStatisticsLock, header, body, sid, jsonp); -} - -void protocol_HTTPStyle::path_art(const streamData::streamID_t sid, int mode) throw() -{ - cacheItem *item = (!mode ? m_streamArtCache[sid] : m_playingArtCache[sid]); - if (getCachedResponse(item, (!mode ? m_streamArtLock : m_playingArtLock))) - { - return; - } - - utf8 header = "HTTP/1.0 200 OK\r\n", body; - streamData *sd = streamData::accessStream(sid); - if (sd) - { - vector<__uint8> sc21_albumart = (mode == 0 ? sd->streamAlbumArt() : sd->streamPlayingAlbumArt()); - if (!sc21_albumart.empty()) - { - utf8 mimeType[] = { - "image/jpeg", - "image/png", - "image/bmp", - "image/gif" - }; - const size_t mime = (mode == 0 ? sd->streamAlbumArtMime() : sd->streamPlayingAlbumArtMime()); - // if not in the valid range then don't report the mime type in the generated response - if (mime < 4) - { - header += "Content-Type:" + mimeType[mime] + "\r\n"; - } - body += utf8(&sc21_albumart[0],sc21_albumart.size()); - } - sd->releaseStream(); - } - - sendCachedResponse(item, (!mode ? m_streamArtCache : m_playingArtCache), - (!mode ? m_streamArtLock : m_playingArtLock), header, - body, sid, false, false); -} diff --git a/Src/Plugins/DSP/sc_serv3/protocol_HTTPStyle.h b/Src/Plugins/DSP/sc_serv3/protocol_HTTPStyle.h deleted file mode 100644 index 88d04660..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_HTTPStyle.h +++ /dev/null @@ -1,152 +0,0 @@ -#pragma once -#ifndef protocol_HTTPStyle_H_ -#define protocol_HTTPStyle_H_ - -#include "threadedRunner.h" -#include "streamData.h" -#include "cache.h" -#include "stats.h" -#include - -/* - Runnable object that handles protocols which use the HTTP style - negotiation. Depending on the details this object will hand off - to others (actually HTTP get or maybe audio streaming) -*/ - -class protocol_HTTPStyle : public runnable -{ -friend class protocol_shoutcastClient; - -public: - enum { - ACCEPT_PLAIN = 0, - ACCEPT_GZIP = 1, - ACCEPT_DEFLATE = 2 - }; - - enum { - HTTP_UNKNOWN = -1, - HTTP_GET = 0, - HTTP_POST = 1, - HTTP_HEAD = 2 - }; - - struct HTTPRequestInfo - { - int m_request; // HTTP_GET, HTTP_POST, etc - int m_AcceptEncoding; // the received 'Accept-Encoding' values - uniString::utf8 m_url; // url portion of request, unescaped - ////////////////////////////// - httpHeaderMap_t m_QueryParameters; // unescaped - httpHeaderMap_t m_HTTPHeaders; // the received HTTP headers - uniString::utf8 m_PostLine; // received POST line - - HTTPRequestInfo() : m_request(HTTP_UNKNOWN), m_AcceptEncoding(ACCEPT_PLAIN) {} - }; - - const u_short m_clientPort; - const uniString::utf8 m_clientHostName; - const uniString::utf8 m_clientAddr; - const uniString::utf8 m_clientLogString; - -private: - microServer::AllowableProtocols_t m_protocols; - HTTPRequestInfo m_httpRequestInfo; - uniString::utf8 m_userAgent; - uniString::utf8 m_userAgentLowered; - uniString::utf8 m_referer; - uniString::utf8 m_hostIP; - uniString::utf8 m_url; - - uniString::utf8 m_outMsg; - const uniString::utf8::value_type *m_outBuffer; // for outgoing text lines - int m_outBufferSize; - int m_postRequestLength; - - short m_postRequest; - short m_compressed; - - uniString::utf8 m_lastKey; // received HTTP header line key (used to cope with some weird line splits) - uniString::utf8 m_lineBuffer; // received HTTP header line - - typedef void (protocol_HTTPStyle::*state_t)(); - - state_t m_state; - state_t m_nextState; - - const bool getCachedResponse(cacheItem *item, AOL_namespace::mutex &lock, const int limit = 1); - void sendCachedResponse(cacheItem *item, CacheMap_t &cache, AOL_namespace::mutex &lock, - uniString::utf8 &header, uniString::utf8 &body, - const streamData::streamID_t sid = 0, - const bool jsonp = false, const bool noCompress = false); - - void sendMessageAndClose(const uniString::utf8 &msg) throw(); - - void state_GetLine() throw(std::exception); - void state_AnalyzeHTTPHeaders() throw(std::exception); - void state_DetermineAction() throw(std::exception); - void state_Close() throw(std::exception); - void state_Send() throw(std::exception); - - void path_redirect_url(const streamData::streamID_t sid, const bool no_sid, const bool isStats) throw(); - void path_root_summary(const uniString::utf8 &XFF, const bool force = false) throw(); - void path_root(const streamData::streamID_t sid, const uniString::utf8 &XFF) throw(); - void path_played_html(const streamData::streamID_t sid, const uniString::utf8 &XFF) throw(); - void path_played_json(const streamData::streamID_t sid, const uniString::utf8 &callback, - const bool password = true, const uniString::utf8 &XFF = "") throw(); - void path_played_xml(const streamData::streamID_t sid, const bool password = true, - const uniString::utf8 &XFF = "") throw(); - void path_home(const streamData::streamID_t sid) throw(); - void path_track(const streamData::streamID_t sid, int mode) throw(); - void path_tracks_json(const streamData::streamID_t sid, const uniString::utf8 &callback) throw(); - void path_tracks_xml(const streamData::streamID_t sid) throw(); - void path_current_metadata_xml(const streamData::streamID_t sid) throw(); - void path_current_metadata_json(const streamData::streamID_t sid, const uniString::utf8 &callback) throw(); - void path_crossdomain() throw(); - void path_shoutcastswf() throw(); - void path_stats_xml(const streamData::streamID_t sid, const bool proceed) throw(); - void path_statistics_xml(const streamData::streamID_t sid, const bool proceed) throw(); - void path_stats_json(const streamData::streamID_t sid, const bool proceed, const uniString::utf8 &callback) throw(); - void path_statistics_json(const streamData::streamID_t sid, const bool proceed, const uniString::utf8 &callback) throw(); - void path_art(const streamData::streamID_t sid, const int mode) throw(); - - const bool isViewingAllowed(const streamData::streamID_t sid, const uniString::utf8 &password, const bool no_stream, - bool &adminOverride, const bool hide, bool &passworded) throw(); - const bool isAccessAllowed(const streamData::streamID_t sid, const uniString::utf8 &hostAddr, const bool showOutput) throw(); - const bool isAdminAccessAllowed(const uniString::utf8 &hostIP, const uniString::utf8 &hostName) throw(); - const bool findBaseStream(bool& no_sid, streamData::streamID_t& sid); - const uniString::utf8 getClientIP(const bool streamPublic, const uniString::utf8 &publicIP) throw(); - void getPNGImage(const uniString::utf8 &png) throw(); - -protected: - virtual void timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "protocol_HTTPStyle"; } - -public: - protocol_HTTPStyle (microConnection &mc, const string &firstLine) throw(std::exception); - - protocol_HTTPStyle(const socketOps::tSOCKET s, const uniString::utf8 &hostName, - const uniString::utf8 &addr, const u_short port, const string &firstLine, - const microServer::AllowableProtocols_t protocols) throw(std::exception); - virtual ~protocol_HTTPStyle() throw(); - - static uniString::utf8 getStatsXMLBody(const streamData::streamID_t sid, const bool single, - const bool proceed, const socketOps::tSOCKET m_socket, - stats::statsData_t& data, const bool no_copy = false); - static uniString::utf8 getStatsJSONBody(const streamData::streamID_t sid, const bool single, - const bool proceed, const socketOps::tSOCKET m_socket, - stats::statsData_t& data, const bool no_copy = false); - static uniString::utf8 getPlayedBody(const streamData::streamID_t sid); - - static uniString::utf8 getCurrentXMLMetadataBody(const bool mode, const uniString::utf8 &metadata); - static uniString::utf8 getCurrentJSONMetadataBody(const uniString::utf8 &metadata); - - static uniString::utf8 getPlayedJSON(const streamData::streamID_t sid, uniString::utf8 &header, - const uniString::utf8 &callback, const bool allowed) throw(); - static uniString::utf8 getPlayedXML(const streamData::streamID_t sid, uniString::utf8 &header, const bool allowed) throw(); -}; - -const uniString::utf8 getNewVersionMessage(const uniString::utf8& ending = "


"); - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_RTMPClient.cpp b/Src/Plugins/DSP/sc_serv3/protocol_RTMPClient.cpp deleted file mode 100644 index b0c5e136..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_RTMPClient.cpp +++ /dev/null @@ -1,1681 +0,0 @@ -#if 0 -#ifdef _WIN32 -#include -#endif -#include -#include "protocol_RTMPClient.h" -#include "ripList.h" -#include "stats.h" -#include "streamData.h" -#include "amf.h" -#include "w3cLog.h" -#include "log.h" -#include "global.h" -#include - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define C1_S1_C2_S2_PACKET_SIZE 1536 -#define DEFAULT_CHUNK_SIZE 128 - -#define RTMP_MSG__SET_CHUNK_SIZE 1 -#define RTMP_MSG__ABORT 2 -#define RTMP_MSG__ACKNOWLEDGEMENT 3 -#define RTMP_MSG__USER_CONTROL_MESSAGE 4 -#define RTMP_MSG__WINDOW_ACKNOWLEDGEMENT_SIZE 5 -#define RTMP_MSG__SET_PEER_BANDWIDTH 6 -#define RTMP_MSG__AUDIO_DATA 8 -#define RTMP_MSG__VIDEO_DATA 9 -#define RTMP_MSG__DATA_AMF3 15 -#define RTMP_MSG__COMMAND_AMF3 17 -#define RTMP_MSG__DATA_AMF0 18 -#define RTMP_MSG__COMMAND_AMF0 20 - -// user control messages -#define RTMP_UCM_STREAM_BEGIN 0 -#define RTMP_UCM_STREAM_EOF 1 -#define RTMP_UCM_STREAM_DRY 2 -#define RTMP_UCM_SET_BUFFER 3 -#define RTMP_UCM_STREAM_IS_RECORDED 4 -#define RTMP_UCM_PING_REQUEST 6 -#define RTMP_UCM_PING_RESPONSE 7 -///////////////////////// - -#define RTMP_PEER_BANDWIDTH_HARD 0 -#define RTMP_PEER_BANDWIDTH_SOFT 1 -#define RTMP_PEER_BANDWIDTH_DYNAMIC 2 - -#define DEFAULT_SERVER_WINDOW 0x2625a0 //(16 * 1024) - -#define DEBUG_LOG(x) { if (gOptions.RTMPClientDebug()) DLOG((x)); } - -#ifdef _WIN32 -#define TIMEFUNC ::timeGetTime -#else -#include -static unsigned long TIMEFUNC() throw() -{ - struct timeval tp; - ::gettimeofday(&tp,NULL); - return (tp.tv_sec * 1000) + (tp.tv_usec / 1000); -} -#endif - -static void createRTMPMsg(__uint8 msgType,long timestamp,int outboundChunkSize,const __uint8 *payload,size_t payloadSize,vector<__uint8> &result, - int chunkStreamID = 2,int msgStreamID = 0); -static void createRTMPMsg(const protocol_RTMPClient::message &msg,long timestamp,int outboundChunkSize,vector<__uint8> &result); - -//void getRTMPMsgInfo(const vector<__uint8> &msg,__uint8 &msgType,int &payloadLength,long ×tamp,int &streamID,int &payloadOffset); -static size_t decode4ByteValue(const __uint8 *data,size_t offset = 0) throw(); - -static utf8 prettyPrintMessage(const protocol_RTMPClient::message &msg) throw() -{ - utf8 EOL(eol()); - - utf8 result(EOL); - result += "msg type=" + tos((int)msg.m_messageType) + EOL; - - try - { - switch(msg.m_messageType) - { - case RTMP_MSG__SET_CHUNK_SIZE: - result += "chunk size=" + tos(decode4ByteValue(&(msg.m_messageData[0]))) + EOL; - break; - - case RTMP_MSG__ABORT: - result += "chunk stream id=" + tos(decode4ByteValue(&(msg.m_messageData[0]))) + EOL; - break; - - case RTMP_MSG__ACKNOWLEDGEMENT: - result += "sequence number=" + tos(decode4ByteValue(&(msg.m_messageData[0]))) + EOL; - break; - - case RTMP_MSG__USER_CONTROL_MESSAGE: - break; - - case RTMP_MSG__WINDOW_ACKNOWLEDGEMENT_SIZE: - result += "acknowledgement window size=" + tos(decode4ByteValue(&(msg.m_messageData[0]))) + EOL; - break; - - case RTMP_MSG__SET_PEER_BANDWIDTH: - result += "acknowledgement window size=" + tos(decode4ByteValue(&(msg.m_messageData[0]))) + EOL; - result += "limit type=" + tos(msg.m_messageData[4]) + EOL; - break; - - case RTMP_MSG__DATA_AMF0: - case RTMP_MSG__COMMAND_AMF0: - { - AMFEncoding amf0; - amf0.loadFromBitstream((const char *)&(msg.m_messageData[0]),(int)msg.m_messageData.size(),""); - result += amf0.prettyPrint(); - } - break; - - case RTMP_MSG__DATA_AMF3: - case RTMP_MSG__COMMAND_AMF3: - { - AMFEncoding amf3(3); - amf3.loadFromBitstream((const char *)&(msg.m_messageData[0]),(int)msg.m_messageData.size(),""); - result += amf3.prettyPrint(); - } - break; - } - } - catch(const exception &ex) - { - result += string("Exception: ") + ex.what() + EOL; - DEBUG_LOG(msg.packetDump()); - } - catch(...) - { - result += "Exception: " + EOL; - DEBUG_LOG(msg.packetDump()); - } - - return result; -} - -#define TEST_FILE "C:\\Documents and Settings\\nradisch\\My Documents\\programming\\shoutcast\\current\\sc_serv2\\test.aac" -FILE *fff = 0; - -utf8 protocol_RTMPClient::message::packetDump() const throw() -{ - ostringstream o; - - int x = 0; - for(std::vector<__uint8>::const_iterator i = m_messageData.begin(); i != m_messageData.end(); ++i) - { - if ((x++) % 16 == 0) o << stringUtil::eol(); - o << setw(2) << hex << (int)(*i) << " "; - } - return o.str(); -} - -protocol_RTMPClient::protocol_RTMPClient(socketOps::tSOCKET s,const utf8 &hostName,const utf8 &addr,int port,__uint8 C0)throw(exception) - :m_socket(s),m_clientHostName(hostName),m_clientAddr(addr),m_clientPort(port),m_clientLogString(dstAddrLogString(hostName,port)), - m_C0(C0), - m_S0(3), - m_inDataBuffer(0), - m_lastActivityTime(::time(0)),m_startTime(::time(0)), - m_lastInboundMessageStreamID(-1), - m_lastInboundMessageLength(-1), - m_lastInboundMessageTypeID(-1), - m_lastInboundTimestamp(-1), - m_windowSizeFromClient(-1), - m_bufferSizeFromClient(-1), - m_lastTitleTime(::time(0)), - m_bytesSentForCurrentTitle(0), - m_totalBytesSent(0), - m_objectEncodingMode(0), - m_removeClientFromStats(false), - //m_state(&protocol_RTMPClient::state_AttachToStream), - m_state(&protocol_RTMPClient::state_SendS0), - m_streamData(0) -{ -#ifdef TEST_FILE - if (fff) ::fclose(fff); - fff = 0; - fff = ::fopen(TEST_FILE,"rb"); -#endif - - DEBUG_LOG(__FUNCTION__); - - m_inDataBufferMax = 16 * 1024; - m_inDataBuffer = new __uint8[m_inDataBufferMax]; - m_inDataBufferAmt = 0; - - // intialize s1 to all zeros - m_S1orS2.resize(C1_S1_C2_S2_PACKET_SIZE,0); - memset(&(m_S1orS2[0]),0,m_S1orS2.size()); - - // set base time - m_serverBaseTime = TIMEFUNC(); - __uint32 sbt = htonl(m_serverBaseTime); - memcpy(&(m_S1orS2[0]),&sbt,4); - - // initialize from 10 bytes of random section to random stuff. Faster than - // doing entire 1528 byte block and still valid - for(int x = 0; x < 10; ++x) - { - m_S1orS2[8+x] = rand(); - } - m_outDataPtr = &m_S0; - m_outDataSize = 1; - m_inboundChunkSize = DEFAULT_CHUNK_SIZE; - m_outboundChunkSize = DEFAULT_CHUNK_SIZE; -} - -protocol_RTMPClient::~protocol_RTMPClient() throw() -{ -#ifdef TEST_FILE - if (fff) ::fclose(fff); - fff = 0; -#endif - DEBUG_LOG(__FUNCTION__); - - try - { - /*ILOG(m_clientLogString + " SHOUTcast 1 client connection closed (" + - tos(::time(0) - m_startTime).c_str() + " seconds). " + - mapGet(m_HTTPRequestInfo.m_HTTPHeaders,"user-agent",utf8("")) + - " [Bytes: " + tos(m_totalBytesSent).c_str() + "]");*/ - - if (m_removeClientFromStats) - stats::removeClient(m_streamID,this); - if (m_streamData) - { - m_streamData->abandonRTMPLimitTrigger(&m_limitTrigger); - streamData::streamClientLost(m_streamData); - m_streamData = 0; - - logW3C(); - } - } - catch(const exception &ex) - { - ELOG(ex.what()); - } - - delete [] m_inDataBuffer; - m_streamData = 0; - socketOps::forgetTCPSocket(m_socket); -} - -runnable::timeSliceResult protocol_RTMPClient::timeSlice() throw(exception) -{ - size_t listenerTime = gOptions.stream_listenerTime(DEFAULT_SHOUTCAST_SOURCE_STREAM); - if(!gOptions.read_stream_listenerTime(DEFAULT_SHOUTCAST_SOURCE_STREAM)) - { - listenerTime = gOptions.listenerTime(); - } - - listenerTime *= 60; // convert to seconds - bool timesUp = (listenerTime && ((::time(0) - m_startTime) > (int)listenerTime)); - - if (m_kickNextRound || timesUp || (m_streamData && m_streamData->isDead())) - { - if (timesUp) - { ILOG(m_clientLogString + " listener time exceeded.");} - else if (m_kickNextRound) - { ILOG(m_clientLogString + " kicked");} - timeSliceResult result; - result.m_done = true; - return result; - } - - return (this->*m_state)(); -} - -////////////////////////////////////////////////////////////////////////////////// -///////////////////// Initial Handshake States ////////////////////////////////// -///////////////////////////////////////////////////////////////////////////////// - -runnable::timeSliceResult protocol_RTMPClient::state_Send() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - timeSliceResult result; - - long to = sendDataBuffer(m_socket,m_outDataPtr,m_outDataSize,m_lastActivityTime,m_clientLogString); - if (to == 0) - { // done - m_state = m_nextState; - result.m_runImmediately = true; - } - else - { // some more - result.m_writeSet.insert(m_socket); - result.m_timeout.tv_sec = to; - } - return result; -} - -runnable::timeSliceResult protocol_RTMPClient::state_RecvFixedAmt() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - timeSliceResult result; - - assert(m_inDataRequested <= m_inDataBufferMax); - - size_t amt_left = m_inDataRequested - m_inDataBufferAmt; - size_t amt_left2 = amt_left; - - long to = getSocketData(m_socket,m_inDataBuffer,m_inDataBufferAmt,amt_left,m_lastActivityTime,m_clientLogString); - m_inDataBufferAmt += (amt_left2 - amt_left); - - if (to == 0) - { // got data - m_state = m_nextState; - result.m_runImmediately = true; - } - else - { // wait some more - result.m_readSet.insert(m_socket); - result.m_timeout.tv_sec = to; - } - return result; -} - -runnable::timeSliceResult protocol_RTMPClient::state_RecvMsg() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - timeSliceResult result; - - m_inMsg.clear(); - - long to = getMsg(m_inMsg); - - if (to == 0) - { - m_state = m_nextState; - result.m_runImmediately = true; - DEBUG_LOG(string(__FUNCTION__) + " received msg" + prettyPrintMessage(m_inMsg)); - } - else - { - result.m_readSet.insert(m_socket); - result.m_timeout.tv_sec = to; - } - - return result; -} - -#define NEXT_STATE timeSliceResult result; result.m_runImmediately = true; return result; - -runnable::timeSliceResult protocol_RTMPClient::state_SendS0() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - m_outDataPtr = &m_S0; - m_outDataSize = 1; - m_state = &protocol_RTMPClient::state_Send; - m_nextState = &protocol_RTMPClient::state_SendS1; - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::state_SendS1() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - m_outDataPtr = &m_S1orS2[0]; - m_outDataSize = m_S1orS2.size(); - m_state = &protocol_RTMPClient::state_Send; - m_nextState = &protocol_RTMPClient::state_WaitForC1; - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::state_WaitForC1() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - m_inDataBufferAmt = 0; - m_inDataRequested = C1_S1_C2_S2_PACKET_SIZE; - m_state = &protocol_RTMPClient::state_RecvFixedAmt; - m_nextState = &protocol_RTMPClient::state_GotC1; - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::state_GotC1() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - m_C1ReadTime = TIMEFUNC() - m_serverBaseTime; - m_C1.clear(); - m_C1.insert(m_C1.end(),m_inDataBuffer,m_inDataBuffer + C1_S1_C2_S2_PACKET_SIZE); - m_state = &protocol_RTMPClient::state_SendS2; - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::state_SendS2() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - m_S1orS2 = m_C1; - __uint32 t = htonl(m_C1ReadTime); - memcpy(&(m_S1orS2[4]),&t,4); - m_outDataPtr = &m_S1orS2[0]; - m_outDataSize = m_S1orS2.size(); - m_state = &protocol_RTMPClient::state_Send; - m_nextState = &protocol_RTMPClient::state_WaitForC2; - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::state_WaitForC2() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - m_inDataBufferAmt = 0; - m_inDataRequested = C1_S1_C2_S2_PACKET_SIZE; - m_state = &protocol_RTMPClient::state_RecvFixedAmt; - m_nextState = &protocol_RTMPClient::state_GotC2; - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::state_GotC2() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - m_C2.clear(); - m_C2.insert(m_C2.end(),m_inDataBuffer,m_inDataBuffer + C1_S1_C2_S2_PACKET_SIZE); - m_state = &protocol_RTMPClient::state_WaitForMessage; - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::state_WaitForMessage() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - m_inDataBufferAmt = 0; - m_state = &protocol_RTMPClient::state_RecvMsg; - m_nextState = &protocol_RTMPClient::state_GotMessage; - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::state_GotMessage() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - switch(m_inMsg.m_messageType) - { - case RTMP_MSG__USER_CONTROL_MESSAGE: - return handle_USER_CONTROL_message(); - - case RTMP_MSG__WINDOW_ACKNOWLEDGEMENT_SIZE: - { - if (m_inMsg.m_messageData.size() != 4) - throwEx(m_clientLogString + " Bad payload size for Window Acknowledgement message, got " + tos(m_inMsg.m_messageData.size()) + " expected 4."); - m_windowSizeFromClient = decode4ByteValue(&(m_inMsg.m_messageData[0]),0); - - DEBUG_LOG(m_clientLogString + " WAS from client is " + tos(m_windowSizeFromClient)); - m_state = &protocol_RTMPClient::state_WaitForMessage; - NEXT_STATE - } - break; - - case RTMP_MSG__COMMAND_AMF0: - return handle_AMF0_message(); - - default: - throwEx(m_clientLogString + " " + __FUNCTION__ + " cannot dispatch message type " + tos((int)m_inMsg.m_messageType)); - } - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::handle_USER_CONTROL_message() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - if (m_inMsg.m_messageData.size() < 2) - throwEx(m_clientLogString + " User control message has insufficient data."); - - __uint16 t = ntohs(*(const __uint16 *)(&m_inMsg.m_messageData[0])); - switch(t) - { - case RTMP_UCM_SET_BUFFER: - { - if (m_inMsg.m_messageData.size() < 10) - throwEx(m_clientLogString + " Set Buffer user control message has insufficient data."); - m_bufferSizeFromClient = ntohl(*(const __uint32*)&(m_inMsg.m_messageData[6])); - DEBUG_LOG(m_clientLogString + " Buffer size from client is " + tos(m_bufferSizeFromClient) + " milliseconds."); - m_state = &protocol_RTMPClient::state_WaitForMessage; - NEXT_STATE - } - break; - - case RTMP_UCM_STREAM_BEGIN: - //return handle_UCM_StreamBegin(); - break; - } - - throwEx(m_clientLogString + " User control message type " + tos(t) + " is not supported."); - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::handle_UCM_StreamBegin() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::handle_AMF0_message() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - AMFEncoding amf; - amf.loadFromBitstream((const char *)&(m_inMsg.m_messageData[0]),(int)m_inMsg.m_messageData.size(),m_clientLogString); - const AMFVal &v0 = amf.getValue(0); - if (v0.getString() == "connect") - return handle_AMF0_connect(amf); - if (v0.getString() == "createStream") - return handle_AMF0_createStream(amf); - if (v0.getString() == "play") - return handle_AMF0_play(amf); - - throwEx(m_clientLogString + " " + __FUNCTION__ + " Unknown AMF0 message " + v0.getString()); - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::handle_AMF0_connect(const AMFEncoding &amf) throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - -// const AMFVal &v0 = amf.getValue(0); - const AMFVal &v1 = amf.getValue(1); - const AMFVal &v2 = amf.getValue(2); - - if (v1.getNumber() != 1) - throwEx(m_clientLogString + " Unexpected transaction number. Wanted 1, got " + tos(v1.getNumber())); - const AMFObject &o = v2.getObject(); - - const AMFVal *pv = o.getProperty("tcUrl"); - if (!pv) throwEx(m_clientLogString + " Connect command has no tcUrl value."); - utf8 url = pv->getString(); // use this value to create stream accessor - - pv = o.getProperty("objectEncoding"); - m_objectEncodingMode = (pv ? (int)pv->getNumber() : 0); - - m_state = &protocol_RTMPClient::state_SendConnectResponse; - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::handle_AMF0_createStream(const AMFEncoding &amf) throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - -// const AMFVal &v0 = amf.getValue(0); - const AMFVal &v1 = amf.getValue(1); - - double transaction = v1.getNumber(); - - AMFEncoding amf0; - AMFObject obj; - amf0.appendValue(AMFVal(utf8("_result"))); // or "_error" - amf0.appendValue(AMFVal((double)transaction)); - amf0.appendValue(AMFVal()); - amf0.appendValue(AMFVal((double)1)); //1234)); /// stream ID for client - - vector<__uint8> resp; - amf0.serialize(resp,m_clientLogString); - message msg(m_inMsg); - msg.m_messageData = resp; - msg.m_messageType = RTMP_MSG__COMMAND_AMF0; - createRTMPMsg(msg,TIMEFUNC() - m_serverBaseTime,(int)m_outboundChunkSize,m_outDataBuffer); - //createRTMPMsg(RTMP_MSG__COMMAND_AMF0,m_outboundChunkSize,&(resp[0]),resp.size(),m_outDataBuffer); - - m_outDataPtr = &m_outDataBuffer[0]; - m_outDataSize = m_outDataBuffer.size(); - m_state = &protocol_RTMPClient::state_Send; - m_nextState = &protocol_RTMPClient::state_WaitForMessage; - - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::handle_AMF0_play(const AMFEncoding &amf) throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - AMFEncoding amf0; - amf0.appendValue(AMFVal(utf8("onStatus"))); // or "_error" - amf0.appendValue(AMFVal(utf8("NetStream.Play.Start"))); - - vector<__uint8> resp; - amf0.serialize(resp,m_clientLogString); - long ttt = TIMEFUNC(); - - createRTMPMsg(RTMP_MSG__COMMAND_AMF0,ttt - m_serverBaseTime,(int)m_outboundChunkSize,&(resp[0]),resp.size(),m_outDataBuffer,m_inMsg.m_chunkStreamID,m_inMsg.m_messageStreamID); - - amf0.clear(); - amf0.appendValue(AMFVal(utf8("onHeaderData"))); - AMFEMCAArray amfA; - amfA.addProperty("protocol",new AMFVal(utf8("ICY"))); - amfA.addProperty("content-type",new AMFVal(utf8("audio/aacp"))); - amf0.appendValue(AMFVal(amfA)); - resp.clear(); - amf0.serialize(resp,m_clientLogString); - createRTMPMsg(RTMP_MSG__DATA_AMF0,ttt - m_serverBaseTime,(int)m_outboundChunkSize,&(resp[0]),resp.size(),m_outDataBuffer,m_inMsg.m_chunkStreamID,m_inMsg.m_messageStreamID); - - m_outDataPtr = &m_outDataBuffer[0]; - m_outDataSize = m_outDataBuffer.size(); - m_state = &protocol_RTMPClient::state_Send; - m_nextState = &protocol_RTMPClient::state_SendAudio; - - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::state_SendConnectResponse() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - m_outDataBuffer.clear(); - - __uint8 data[5]; - - long ttt = TIMEFUNC(); - m_serverBaseTime = ttt; - - (*(__uint32*)data) = htonl(DEFAULT_SERVER_WINDOW); - createRTMPMsg(RTMP_MSG__WINDOW_ACKNOWLEDGEMENT_SIZE,ttt - m_serverBaseTime,(int)m_outboundChunkSize,data,4,m_outDataBuffer); - - data[4] = RTMP_PEER_BANDWIDTH_DYNAMIC; //_SOFT; - createRTMPMsg(RTMP_MSG__SET_PEER_BANDWIDTH,ttt - m_serverBaseTime,(int)m_outboundChunkSize,data,5,m_outDataBuffer); - - __uint8 streamBeginData[6] = {0,0,0,0,0,0}; - - createRTMPMsg(RTMP_MSG__USER_CONTROL_MESSAGE,ttt - m_serverBaseTime,(int)m_outboundChunkSize,streamBeginData,6,m_outDataBuffer); - - __int32 chunkSize = htonl((int)m_outboundChunkSize); - createRTMPMsg(RTMP_MSG__SET_CHUNK_SIZE,ttt - m_serverBaseTime,(int)m_outboundChunkSize,(const __uint8 *)&chunkSize,sizeof(chunkSize),m_outDataBuffer); - - AMFEncoding amf; //(m_objectEncodingMode > 1 ? 3 : 0); - AMFObject obj; - amf.appendValue(AMFVal(utf8("_result"))); // or "_error" - amf.appendValue(AMFVal((double)1.0)); - obj.addProperty("fmsVer",new AMFVal(utf8("FMS/3,5,3,824a"))); //new AMFVal(utf8("sc_serv " + version.first + " " + version.second))); - obj.addProperty("capabilities",new AMFVal((double)127)); //31)); // ???? - obj.addProperty("mode",new AMFVal((double)1)); - amf.appendValue(AMFVal(obj)); - obj.clearProperties(); - obj.addProperty("level",new AMFVal(utf8("status"))); - obj.addProperty("code",new AMFVal(utf8("NetConnection.Connect.Success"))); - obj.addProperty("description",new AMFVal(utf8("Connection succeeded."))); - obj.addProperty("clientid",new AMFVal((double)795525197.0)); - obj.addProperty("objectEncoding",new AMFVal((double)m_objectEncodingMode)); - AMFEMCAArray arry; - arry.addProperty("version",new AMFVal(utf8("FMS/3,5,3,824a"))); - obj.addProperty("data",new AMFVal(arry)); - - amf.appendValue(AMFVal(obj)); - vector<__uint8> resp; - amf.serialize(resp,m_clientLogString); - createRTMPMsg(RTMP_MSG__COMMAND_AMF0,ttt - m_serverBaseTime,(int)m_outboundChunkSize,&(resp[0]),resp.size(),m_outDataBuffer,m_inMsg.m_chunkStreamID,m_inMsg.m_messageStreamID); - - m_outDataPtr = &m_outDataBuffer[0]; - m_outDataSize = m_outDataBuffer.size(); - m_state = &protocol_RTMPClient::state_Send; - m_nextState = &protocol_RTMPClient::state_WaitForMessage; - //m_nextState = &protocol_RTMPClient::state_SendAudio; - - NEXT_STATE -} - -runnable::timeSliceResult protocol_RTMPClient::state_SendAudio() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - -#ifdef TEST_FILE - __uint8 buffer[1024]; - buffer[0] = 0xaf; //FLV audio header - buffer[1] = 0x01; - - if (::fread(&(buffer[2]),1,1022,fff) != 1022) - throwEx("Test done!"); - - m_outDataBuffer.clear(); - createRTMPMsg(RTMP_MSG__AUDIO_DATA,TIMEFUNC() - m_serverBaseTime,(int)m_outboundChunkSize,buffer,1024,m_outDataBuffer,m_inMsg.m_chunkStreamID,m_inMsg.m_messageStreamID); - - m_outDataPtr = &m_outDataBuffer[0]; - m_outDataSize = m_outDataBuffer.size(); - m_state = &protocol_RTMPClient::state_Send; - m_nextState = &protocol_RTMPClient::state_SendAudio; - -#endif - NEXT_STATE -} - -///////////////////////////////////////////////////// -///////////////////////////////////////////////////// - -static void encode3ByteValue(long v,__uint8 *data) throw() -{ - data[0] = (v >> 16) & 0xff; - data[1] = (v >> 8) & 0xff; - data[2] = (v & 0xff); -} - -static void encode4ByteValue(long v,__uint8 *data) throw() -{ - data[0] = (v >> 24) & 0xff; - data[1] = (v >> 16) & 0xff; - data[2] = (v >> 8) & 0xff; - data[3] = (v & 0xff); -} - -static void chunkify(int chunkStreamID,int msgStreamID,__uint8 msgTypeID,long timestamp,int outboundChunkSize,const __uint8 *data,size_t dataSize,vector<__uint8> &result) -{ - assert(chunkStreamID >= 2); - - size_t chunkCount = 1; - if (dataSize > 0) - chunkCount = ((dataSize-1) / outboundChunkSize)+1; - assert(chunkCount); - - for(size_t c = 0; c < chunkCount; ++c) - { - __uint8 header[18]; // largest possible header - __uint8 *h = header; - - // size basic header - if (chunkStreamID >=2 && chunkStreamID <= 63) - { - *(h++) = chunkStreamID; - } - else if (chunkStreamID >= 64 && chunkStreamID <= 319) - { - *(h++) = 0; - *(h++) = (chunkStreamID - 64); - } - else - { - h[0] = 1; - h[2] = ((chunkStreamID - 64) / 256); - h[1] = (chunkStreamID - 64 - (h[2] * 256)); - h+= 3; - } - - // fill in format bits and header - if (c) - { - header[0] |= 0xc0; // type 3 - } - else - { - // type zero, full header - encode3ByteValue(timestamp < 0x00ffffff ? timestamp : 0x00ffffff,h); - h += 3; - encode3ByteValue((int)dataSize,h); - h += 3; - *(h++) = msgTypeID; - encode4ByteValue(msgStreamID,h); - h += 4; - if (timestamp >= 0x00ffffff) - { - encode4ByteValue(timestamp,h); - h += 4; - } - } - - // put header into result - result.insert(result.end(),header,h); - - size_t payload_amt = min(dataSize,(size_t)outboundChunkSize); - // put payload into result - result.insert(result.end(),data,data + payload_amt); - dataSize -= payload_amt; - data += payload_amt; - } - - assert(dataSize == 0); -} - -static void createRTMPMsg(__uint8 msgType,long timestamp,int outboundChunkSize,const __uint8 *payload,size_t payloadSize,vector<__uint8> &result, - int chunkStreamID,int msgStreamID) -{ - //chunkify(chunkStreamID,msgStreamID,msgType,TIMEFUNC(),outboundChunkSize,payload,payloadSize,result); - protocol_RTMPClient::message msg; - msg.m_chunkStreamID = chunkStreamID; - msg.m_messageStreamID = msgStreamID; - msg.m_messageType = msgType; - msg.m_messageData.clear(); - msg.m_messageData.insert(msg.m_messageData.end(),payload,payload + payloadSize); - createRTMPMsg(msg,timestamp,outboundChunkSize,result); - - #if 0 - // create a buffer with the message - long t = TIMEFUNC(); - - vector<__uint8> m; - m.resize(11 + payloadSize); - - __uint8 *p = &m[0]; - memset(p,0,11); - (*(__uint32*)p) = htonl(payloadSize); - p[0] = msgType; - (*(__uint32*)(&(p[4]))) = htonl(t); - memmove(&(p[11]),payload,payloadSize); - - // chunkify - chunkify(2 /* chunk stream id */,0 /* msg stream ID */ ,msgType,t,outboundChunkSize,p,11 + payloadSize,result); - #endif -} - -static void createRTMPMsg(const protocol_RTMPClient::message &msg,long timestamp,int outboundChunkSize,vector<__uint8> &result) -{ - utf8 s = prettyPrintMessage(msg); - DEBUG_LOG(" send " + eol() + - "CSID=" + tos(msg.m_chunkStreamID) + eol() + - "MSID=" + tos(msg.m_messageStreamID) + eol() + - "Time=" + tos(timestamp) + eol() + - "MTYPE=" + tos((int)msg.m_messageType) + eol() + - "MLEN=" + tos(msg.m_messageData.size()) + eol() + - s); - chunkify(msg.m_chunkStreamID,msg.m_messageStreamID,msg.m_messageType,timestamp,outboundChunkSize,&(msg.m_messageData[0]),msg.m_messageData.size(),result); -} - -///////////////////////////////////////////////////// -///////////////////////////////////////////////////// - -static int decode3ByteValue(const __uint8 *data,size_t offset = 0) throw() -{ - int result = 0; - result += data[offset]; - result <<= 8; - result += data[offset + 1]; - result <<= 8; - result += data[offset + 2]; - return result; -} - -static size_t decode4ByteValue(const __uint8 *data,size_t offset) throw() -{ - size_t result = 0; - result += data[offset]; - result <<= 8; - result += data[offset + 1]; - result <<= 8; - result += data[offset + 2]; - result <<= 8; - result += data[offset + 3]; - return result; -} - -#if 0 -void getRTMPMsgInfo(const vector<__uint8> &msg,__uint8 &msgType,int &payloadLength,long ×tamp,int &streamID,int &payloadOffset) -{ - assert(msg.size() >= 11); - const __uint8 *p = &msg[0]; - msgType = *(p++); - payloadLength = decode3ByteValue(p); - p+=3; - timestamp = decode4ByteValue(p); - p += 4; - streamID = decode3ByteValue(p); - p += 3; - payloadOffset = 11; -} -#endif - -// get chunk type from first byte in basic header -static int chunkType(const __uint8 *basicHeader) throw() -{ - return (((*basicHeader) & 0xc0) >> 6); -} - -static int calculateBasicChunkHeaderSize(const __uint8 *basicHeader) throw() -{ - int b = ((*basicHeader) & 0x3f); - switch(b) - { - case 0: return 2; - case 1: return 3; - } - return 1; -} - -// look at complete basic header and determine how many bytes to expect in -// the chunk header -static int calculateChunkMsgHeaderSize(const __uint8 *basicHeader) throw() -{ - switch(chunkType(basicHeader)) - { - case 0: return 11; - case 1: return 7; - case 2: return 3; - } - return 0; -} - -// calculate the complete size of a chunk header -static int calculateCompleteChunkHeaderSize(const __uint8 *basicHeader) throw() -{ - return calculateChunkMsgHeaderSize(basicHeader) + calculateBasicChunkHeaderSize(basicHeader); -} - -// look at a complete chunk header (basic and msg header) and see if we need to get -// an extended timestamp for the chunk -static bool chunkNeedsExtendedTimestamp(const __uint8 *basicHeader) throw() -{ - int f = chunkType(basicHeader); - if (f == 3) return false; - int s = calculateBasicChunkHeaderSize(basicHeader); - // timestamp is always just after the basic header - return ((basicHeader[s] == 0xff) && (basicHeader[s+1] == 0xff) && (basicHeader[s+2] == 0xff)); -} - -// get chunkstream ID from the basic header -static int getChunkStreamIDFromBasicHeader(const __uint8 *basicHeader) throw() -{ - int b = ((*basicHeader) & 0x3f); - switch(b) - { - case 0: return (basicHeader[1] + 64); - case 1: return (basicHeader[2] * 256 + basicHeader[1] + 64); - } - return b; -} - -static int calculateMessageSize(const __uint8 *basicHeader) throw() -{ - if (chunkType(basicHeader) <= 1) - { - int s = calculateBasicChunkHeaderSize(basicHeader); - return decode3ByteValue(basicHeader + s + 3); - } - return -1; -} - -static int calculateMessageTypeID(const __uint8 *basicHeader) throw() -{ - if (chunkType(basicHeader) <= 1) - { - int s = calculateBasicChunkHeaderSize(basicHeader); - return basicHeader[s + 6]; - } - return -1; -} - -static int calculateMessageStreamID(const __uint8 *basicHeader) throw() -{ - if (chunkType(basicHeader) == 0) - { - int s = calculateBasicChunkHeaderSize(basicHeader); - return decode3ByteValue(basicHeader + s + 7); - } - return -1; -} - -static long calculateTimestamp(const __uint8 *basicHeader) throw() -{ - return (chunkType(basicHeader) < 3 ? decode3ByteValue(basicHeader + calculateBasicChunkHeaderSize(basicHeader)) : 0); -} - -// looks in inBuffer for a complete message. If it finds one it fills in msg and returns true. -// whether true or false, data from head of inBuffer should be removed based on amtToRemoveFromInBuffer -bool protocol_RTMPClient::chunkSequenceComplete(const __uint8 *inBuffer,size_t amtInBuffer,size_t &amtToRemoveFromInBuffer,size_t expectedChunkSize, - vector<__uint8> &msg,__uint8 &msgType,int &chunkStreamID,int &messageStreamID,const uniString::utf8 &logMsgPrefix) throw(std::exception) -{ - bool result = false; - msg.clear(); - amtToRemoveFromInBuffer = 0; - - // walk through chunks - const __uint8 *pBegin = inBuffer; - const __uint8 *pEnd = inBuffer + amtInBuffer; - const __uint8 *p = inBuffer; - - chunkStreamID = -1; - messageStreamID = -1; - int messageLength = -1; - int messageTypeID = -1; - int payloadDataSeen = 0; - int chunksConsolidated = 0; // for debugging - while(p != pEnd) - { - chunksConsolidated += 1; - - // do all calculations necessary to see if we have a complete chunk - int tmp; - - int hs = calculateCompleteChunkHeaderSize(p); - if ((p + hs) > pEnd) break; // not enough data - if (chunkNeedsExtendedTimestamp(p)) - hs += 4; - if ((p + hs) > pEnd) break; // not enough data - - // calculate timestamp - long tt = calculateTimestamp(p); - switch(chunkType(p)) - { - case 0: - m_lastInboundTimestamp = tt; - break; - - case 1: case 2: - m_lastInboundTimestamp += tt; - break; - } - - // gather and confirm chunk stream id - tmp = getChunkStreamIDFromBasicHeader(p); - if (chunkStreamID == -1) - chunkStreamID = tmp; - else if (chunkStreamID != tmp) - throwEx(logMsgPrefix + " expected chunk stream ID " + tos(chunkStreamID) + " but got " + tos(tmp) + " instead."); - - // gather and confirm message length for this chunk sequence - tmp = calculateMessageSize(p); - if ((tmp == -1) && (m_lastInboundMessageLength == -1)) throwEx(logMsgPrefix + " No message length for chunk with chunk stream ID " + tos(chunkStreamID)); - if ((tmp != -1) && (messageLength != -1) && (tmp != messageLength)) throwEx(logMsgPrefix + " mismatch message length for chunk with chunk stream ID " + tos(chunkStreamID) + " initially got " + tos(messageLength) + " then received " + tos(tmp)); - if (tmp != -1) - m_lastInboundMessageLength = messageLength = tmp; - - tmp = calculateMessageTypeID(p); - if ((tmp == -1) && (m_lastInboundMessageTypeID == -1)) throwEx(logMsgPrefix + " No message type ID for chunk with chunk stream ID " + tos(chunkStreamID)); - if ((tmp != -1) && (messageTypeID != -1) && (tmp != messageTypeID)) throwEx(logMsgPrefix + " mismatch message type ID for chunk with chunk stream ID " + tos(chunkStreamID) + " initially got " + tos(messageTypeID) + " then received " + tos(tmp)); - if (tmp != -1) - m_lastInboundMessageTypeID = messageTypeID = tmp; - - tmp = calculateMessageStreamID(p); - if ((tmp == -1) && (m_lastInboundMessageStreamID == -1)) throwEx(logMsgPrefix + " No message stream ID for chunk with chunk stream ID " + tos(chunkStreamID)); - if ((tmp != -1) && (messageStreamID != -1) && (tmp != messageStreamID)) throwEx(logMsgPrefix + " mismatch message stream ID for chunk with stream ID " + tos(chunkStreamID) + " initially got " + tos(messageStreamID) + " then received " + tos(tmp)); - if (tmp != -1) - m_lastInboundMessageStreamID = messageStreamID = tmp; - - // calculate data that should be in this chunk - tmp = m_lastInboundMessageLength - payloadDataSeen; - tmp = min(tmp,(int)expectedChunkSize); - - // see if we have enough - if ((p + hs + tmp) > pEnd) - break; // nope - - // yeah we do. Copy out data - msg.insert(msg.end(),p+hs,p+hs+tmp); - payloadDataSeen += tmp; - p = p + hs + tmp; - - // are we all done? - if (payloadDataSeen == m_lastInboundMessageLength) - { - // yes - amtToRemoveFromInBuffer = p - pBegin; - DEBUG_LOG(logMsgPrefix + " recv" + stringUtil::eol() + - " CSID=" + tos(chunkStreamID) + stringUtil::eol() + - " MSID=" + tos(m_lastInboundMessageStreamID) + stringUtil::eol() + - " Time=" + tos(m_lastInboundTimestamp) + stringUtil::eol() + - " MTYPE=" + tos(m_lastInboundMessageTypeID) + stringUtil::eol() + - " LEN=" + tos(m_lastInboundMessageLength) + stringUtil::eol() + - " REMOVED=" + tos(amtToRemoveFromInBuffer)); - - msgType = m_lastInboundMessageTypeID; - messageStreamID = m_lastInboundMessageStreamID; - return true; - } - } - - return result; -} - -// return zero if get a msg, otherwise return timeout for read -long protocol_RTMPClient::getMsg(message &msg) throw(exception) -{ - size_t amt_left = m_inDataBufferMax - m_inDataBufferAmt; - size_t amt_left2 = amt_left; - - long to = getSocketData(m_socket,m_inDataBuffer,m_inDataBufferAmt,amt_left,m_lastActivityTime,m_clientLogString); - m_inDataBufferAmt += (amt_left2 - amt_left); - - size_t amtToRemoveFromInBuffer = 0; - - bool seqComplete = chunkSequenceComplete(m_inDataBuffer,m_inDataBufferAmt,amtToRemoveFromInBuffer,m_inboundChunkSize,msg.m_messageData,msg.m_messageType,msg.m_chunkStreamID,msg.m_messageStreamID,m_clientLogString); - if (amtToRemoveFromInBuffer) - { - assert(m_inDataBufferAmt >= amtToRemoveFromInBuffer); - if (m_inDataBufferAmt == amtToRemoveFromInBuffer) - { - m_inDataBufferAmt = 0; - #ifndef NDEBUG - memset(m_inDataBuffer,0,m_inDataBufferMax); - #endif - } - else - { - memmove(m_inDataBuffer,m_inDataBuffer + amtToRemoveFromInBuffer,m_inDataBufferAmt - amtToRemoveFromInBuffer); - m_inDataBufferAmt -= amtToRemoveFromInBuffer; - #ifndef NDEBUG - memset(m_inDataBuffer + m_inDataBufferAmt,0,m_inDataBufferMax - m_inDataBufferAmt); - #endif - } - } - if (seqComplete) - { - to = 0; - } - else - { - if (m_inDataBufferAmt == m_inDataBufferMax) - throwEx(m_clientLogString + " inbound data buffer exceeded"); - assert(to != 0); // ??? not sure - if (to == 0) - to = 1; - } - - return to; -} - -///////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////// - -runnable::timeSliceResult protocol_RTMPClient::state_Close() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - timeSliceResult result; - result.m_done = true; - return result; -} - -void protocol_RTMPClient::logW3C() throw() -{ -} - -#if 0 -///////////////////////////////////// W3C Logging ////////////////////////////////////////////// - -static utf8 titleFromMetadata(const utf8 &md) throw() -{ - utf8 title; - - utf8::size_type p1 = utf8::npos; - utf8::size_type p2 = utf8::npos; - - p1 = md.find(utf8("itle='")); - if (p1 != utf8::npos) - { - p1 += 6; - p2 = md.find(utf8("';"),p1); - if (p2 != utf8::npos) - { - title = md.substr(p1,p2-p1); - } - } - return title; -} - -// create W3C entry. Entries describe the duration a client has listened to a specific title. -// the entry is generated on a title change, or when the client disconnects -void protocol_RTMPClient::logW3C() throw() -{ - if (gOptions.w3cEnable()) - { - time_t t(::time(0)); - time_t durationOfTitle = t - m_lastTitleTime; - int bitrateOfTitle = (int)(durationOfTitle ? (8 * m_bytesSentForCurrentTitle) / durationOfTitle : 0); - utf8 title = titleFromMetadata(m_lastSentMetadata); - - w3cLog::log(m_clientAddr, - m_clientHostName, - m_streamID, - title, - mapGet(m_HTTPRequestInfo.m_HTTPHeaders,"user-agent",utf8("")), - m_bytesSentForCurrentTitle, - durationOfTitle, - bitrateOfTitle); - - setW3CState(); - } -} - -// setup tracking variables for W3C log -void protocol_RTMPClient::setW3CState() throw() -{ - m_lastTitleTime = ::time(0); - m_bytesSentForCurrentTitle = 0; -} - -////////////////////////////////////////////////////////////////////////////// - -void protocol_RTMPClient::aquireIntroFile() throw() -{ - m_streamData->getIntroFile().getSc1Data(m_introFile); - m_introFileOffset = 0; -} - -void protocol_RTMPClient::aquireBackupFile() throw() -{ - m_streamData->getBackupFile().getSc1Data(m_backupFile); - m_backupFileOffset = 0; -} - -runnable::timeSliceResult protocol_RTMPClient::state_SendText() throw(exception) -{ - //DLOG(__FUNCTION__); - - timeSliceResult result; - long to = sendHTTPStyleText(m_socket,m_outBuffer,m_outBufferSize,m_lastActivityTime,m_clientLogString); - if (to == 0) - { // sent - m_state = m_nextState; - result.m_runImmediately = true; - } - else - { // try again - result.m_writeSet.insert(m_socket); - result.m_timeout.tv_sec = to; - } - return result; -} - -runnable::timeSliceResult protocol_RTMPClient::state_AttachToStream() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - timeSliceResult result; - - assert(!m_streamData); - - m_streamID = DEFAULT_CLIENT_STREAM_ID; - utf8::size_type pos = m_HTTPRequestInfo.m_url.find(utf8("/stream/")); - if (pos != utf8::npos) - m_streamID = atoi((const char *)m_HTTPRequestInfo.m_url.substr(pos + 8).c_str()); - - map stream_configs = gOptions.getStreamConfigs(); - for(map::const_iterator i = stream_configs.begin(); i != stream_configs.end(); ++i) - { - if ((*i).second.m_urlPath == m_HTTPRequestInfo.m_url) - { - m_streamID = (*i).first; - break; - } - - pos = m_HTTPRequestInfo.m_url.find((*i).second.m_urlPath); - if (pos != utf8::npos && pos == 0) - { - utf8 params = m_HTTPRequestInfo.m_url.substr(pos + (*i).second.m_urlPath.size()); - if(params.find(utf8(";")) == 0 || params.find(utf8("/")) == 0 || params.find(utf8("/;")) == 0) - { - m_streamID = (*i).first; - break; - } - } - } - - m_clientLogString = dstAddrLogString(m_clientHostName,m_clientPort,m_streamID); - - utf8 user_agent = toLower(mapGet(m_HTTPRequestInfo.m_HTTPHeaders,"user-agent",utf8(""))); - - bool isSourceActive = false; - m_streamData = streamData::accessStream(m_streamID,isSourceActive); - if (!m_streamData || !isSourceActive) - { - utf8 msg_icy401 = MSG_ICY401; - msg_icy401.replace(msg_icy401.find(utf8("^")),1,gOptions.getVersionBuildStrings()); - m_outBuffer = msg_icy401.c_str(); - m_outBufferSize = strlen(m_outBuffer); - - m_state = &protocol_RTMPClient::state_SendText; - m_nextState = &protocol_RTMPClient::state_Close; - result.m_writeSet.insert(m_socket); - result.m_timeout.tv_sec = gOptions.getAutoDumpSourceTime(); - ELOG(m_clientLogString + " SHOUTcast 1 client connection rejected. Stream not available. " + mapGet(m_HTTPRequestInfo.m_HTTPHeaders,"user-agent",utf8(""))); - } - else - { - // construct the response text - if (!stats::addClient(m_streamID,this,m_clientAddr,m_clientPort,mapGet(m_HTTPRequestInfo.m_HTTPHeaders,"user-agent",utf8("")),g_ripList.find(m_clientAddr))) - { - utf8 backup_server = m_streamData->streamBackupServer(); - if (backup_server.empty()) - { - utf8 msg_icy503 = MSG_ICY503; - msg_icy503.replace(msg_icy503.find(utf8("^")),1,gOptions.getVersionBuildStrings()); - m_outBuffer = msg_icy503.c_str(); - m_outBufferSize = strlen(m_outBuffer); - - ELOG(m_clientLogString + " SHOUTcast 1 client connection rejected. Max users reached. " + mapGet(m_HTTPRequestInfo.m_HTTPHeaders,"user-agent",utf8(""))); - } - else - { - m_redirectResponse = http302(backup_server); - m_outBuffer = m_redirectResponse.c_str(); - m_outBufferSize = m_redirectResponse.size(); - WLOG(m_clientLogString + " SHOUTcast 1 client connection rejected. Max users reached. Redirecting to " + backup_server + ". " + mapGet(m_HTTPRequestInfo.m_HTTPHeaders,"user-agent",utf8(""))); - } - m_state = &protocol_RTMPClient::state_SendText; - m_nextState = &protocol_RTMPClient::state_Close; - result.m_writeSet.insert(m_socket); - result.m_timeout.tv_sec = gOptions.getAutoDumpSourceTime(); - } - else - { - m_removeClientFromStats = true; - m_sendMetadata = mapGet(m_HTTPRequestInfo.m_HTTPHeaders,"icy-metadata",false); - - m_metaInterval = gOptions.metaInterval(); - if (m_metaInterval < 256) m_metaInterval = 256; // clamp - - m_ICYOKResponse = MSG_ICY200; - m_ICYOKResponse += "icy-name:" + m_streamData->streamName() + "\r\n"; - m_ICYOKResponse += "icy-genre:" + m_streamData->streamGenre() + "\r\n"; - m_ICYOKResponse += "icy-url:" + m_streamData->streamURL() + "\r\n"; - m_ICYOKResponse += "content-type:" + m_streamData->streamContentType() + "\r\n"; - - if (isUserAgentRelay(user_agent) && (!m_streamData->allowPublicRelay())) - m_ICYOKResponse += "icy-pub:0\r\n"; - else - m_ICYOKResponse += "icy-pub:" + tos(m_streamData->streamPublic()) + "\r\n"; - if (m_sendMetadata) - m_ICYOKResponse += "icy-metaint:" + tos(m_metaInterval) + "\r\n"; - m_ICYOKResponse += "icy-br:" + m_streamData->streamName() + "\r\n"; - m_ICYOKResponse += "\r\n"; - - DEBUG_LOG(m_clientLogString + " sending [" + m_ICYOKResponse + "]"); - m_outBuffer = m_ICYOKResponse.c_str(); - m_outBufferSize = strlen(m_outBuffer); - m_state = &protocol_RTMPClient::state_SendText; - m_nextState = &protocol_RTMPClient::state_InitiateStream; - result.m_writeSet.insert(m_socket); - result.m_timeout.tv_sec = gOptions.getAutoDumpSourceTime(); - ILOG(m_clientLogString + " SHOUTcast 1 client connection accepted. " + mapGet(m_HTTPRequestInfo.m_HTTPHeaders,"user-agent",utf8(""))); - } - } - - return result; - } - -// set read pointer to a nice distance from the write pointer. Return that distance -streamData::ringBufferAccess_t protocol_RTMPClient::resetReadPtr() throw() -{ - m_readPtr = m_streamData->getSc1ClientStartPosition(); - return m_streamData->getSc1RingBuffer().m_writePtr - m_readPtr; -} - -runnable::timeSliceResult protocol_RTMPClient::state_InitiateStream() throw(exception) -{ - DEBUG_LOG(__FUNCTION__); - - assert(m_streamData); - - m_metaIntervalCounter = 0; - resetReadPtr(); - - m_underruns = 0; - - // if we have an intro file send it, otherwise start streaming - aquireIntroFile(); - - m_state = (m_introFile.empty() ? &protocol_RTMPClient::state_Stream : &protocol_RTMPClient::state_SendIntroFile); - - setW3CState(); - - timeSliceResult result; - result.m_runImmediately = true; - return result; -} - -// construct the necessary metadata information and load into outbound buffers. -void protocol_RTMPClient::sendICYMetadata(const utf8 &md) throw() -{ - m_ICYMetadata.clear(); - m_ICYMetadata.push_back(1); // placeholder - if (md != m_lastSentMetadata) // don't sent duplicates - { - m_ICYMetadata.insert(m_ICYMetadata.end(),md.begin(),md.end()); - if (!m_lastSentMetadata.empty()) - logW3C(); - m_lastSentMetadata = md; - } - unsigned int dlen = m_ICYMetadata.size(); - if (dlen == 1) dlen = 0; - unsigned int l1=((dlen+15)&~15); - m_ICYMetadata[0] = l1/16; - unsigned int send_len = l1+1; - m_ICYMetadata.insert(m_ICYMetadata.end(),send_len - m_ICYMetadata.size(),0); - assert(m_ICYMetadata.size() == ((m_ICYMetadata[0] * 16)+1)); - m_metaIntervalCounter = 0; - - m_outBuffer = &m_ICYMetadata[0]; - m_outBufferSize = m_ICYMetadata.size(); - m_state = &protocol_RTMPClient::state_SendText; -} - -// handle state where we are sending intro files -runnable::timeSliceResult protocol_RTMPClient::state_SendIntroFile() throw(exception) -{ - assert(m_streamData); - assert(!m_introFile.empty()); - - timeSliceResult result; - - int autoDumpTime = gOptions.getAutoDumpSourceTime(); // don't want this value to change during this call - - m_limitTrigger.clear(); - - size_t amt = m_introFile.size() - m_introFileOffset; - - if (amt == 0) - { - // we're done with the intro file - m_introFile.clear(); - m_state = &protocol_RTMPClient::state_Stream; - resetReadPtr(); - result.m_runImmediately = true; - } - else if ((m_metaIntervalCounter == m_metaInterval) && m_sendMetadata) // check to see if we have to send the metadata - { - sendICYMetadata("StreamTitle='';"); - - m_nextState = &protocol_RTMPClient::state_SendIntroFile; - result.m_writeSet.insert(m_socket); - result.m_timeout.tv_sec = autoDumpTime; - } - else - { - // clamp amount to send if we are supporting metadata - if (m_sendMetadata) - { - amt = min(amt,(m_metaInterval - m_metaIntervalCounter)); - } - - // send - time_t cur_time = ::time(0); - if (autoDumpTime > 0 && (cur_time - m_lastActivityTime) >= autoDumpTime) - throwEx(m_clientLogString + " Timeout waiting to send data (" + - tos(cur_time) + " " + tos(m_lastActivityTime) + " [" + tos(cur_time - m_lastActivityTime) + "] )"); - - if (!amt) - { - // nothing in the source - result.m_runImmediately = true; - } - else - { - int rval = ::send(m_socket,(const char *)&(m_introFile[m_introFileOffset]),amt,0); - if (rval == 0) - { - throwEx(m_clientLogString + " Remote socket closed while sending data."); - } - else if (rval < 0) - { - rval = socketOps::errCode(); - if (rval != SOCKETOPS_WOULDBLOCK) - throwEx((( - #ifdef _WIN32 - rval == WSAECONNABORTED || rval == WSAECONNRESET - #else - rval == ECONNABORTED || rval == ECONNRESET || rval == EPIPE - #endif - ) ? uniString::utf8("") : m_clientLogString + "Socket error while waiting to send data. " + socketErrString(rval))); - result.m_timeout.tv_sec = (long)(autoDumpTime - (cur_time - m_lastActivityTime)); - result.m_writeSet.insert(m_socket); - } - else - { - m_bytesSentForCurrentTitle += rval; - m_totalBytesSent += rval; - m_lastActivityTime = ::time(NULL); - m_metaIntervalCounter += rval; - m_introFileOffset += rval; - assert((!m_sendMetadata) || (m_metaIntervalCounter <= m_metaInterval)); - result.m_writeSet.insert(m_socket); - result.m_timeout.tv_sec = autoDumpTime; - } - } - } - return result; -} - -// handle state where we are sending backup files -runnable::timeSliceResult protocol_RTMPClient::state_SendBackupFile() throw(exception) -{ - assert(m_streamData); - assert(!m_backupFile.empty()); - - timeSliceResult result; - - int autoDumpTime = gOptions.getAutoDumpSourceTime(); // don't want this value to change during this call - - m_limitTrigger.clear(); - - size_t amt = m_backupFile.size() - m_backupFileOffset; - - if (streamData::isSourceConnected(m_streamData)) - { - // we're done with the backup file - m_backupFile.clear(); - resetReadPtr(); - m_state = &protocol_RTMPClient::state_Stream; - - result.m_runImmediately = true; - } - else if (amt == 0) - { - // we're done with the backup file. get more data - aquireBackupFile(); - if (m_backupFile.empty()) - { // it got cleared out from under us? Try and stream - resetReadPtr(); - m_state = &protocol_RTMPClient::state_Stream; - } - - result.m_runImmediately = true; - } - else if ((m_metaIntervalCounter == m_metaInterval) && m_sendMetadata) // check to see if we have to send the metadata - { - sendICYMetadata("StreamTitle='';"); - - m_nextState = &protocol_RTMPClient::state_SendBackupFile; - result.m_writeSet.insert(m_socket); - result.m_timeout.tv_sec = autoDumpTime; - } - else - { - // clamp amount to send if we are supporting metadata - if (m_sendMetadata) - { - amt = min(amt,(m_metaInterval - m_metaIntervalCounter)); - } - - // send - time_t cur_time = ::time(0); - if (autoDumpTime > 0 && (cur_time - m_lastActivityTime) >= autoDumpTime) - throwEx(m_clientLogString + " Timeout waiting to send data (" + - tos(cur_time) + " " + tos(m_lastActivityTime) + " [" + tos(cur_time - m_lastActivityTime) + "] )"); - - if (!amt) - { - // nothing in the source - result.m_runImmediately = true; - } - else - { - int rval = ::send(m_socket,(const char *)&(m_backupFile[m_backupFileOffset]),amt,0); - if (rval == 0) - { - throwEx(m_clientLogString + " Remote socket closed while sending data."); - } - else if (rval < 0) - { - rval = socketOps::errCode(); - if (rval != SOCKETOPS_WOULDBLOCK) - throwEx((( - #ifdef _WIN32 - rval == WSAECONNABORTED || rval == WSAECONNRESET - #else - rval == ECONNABORTED || rval == ECONNRESET || rval == EPIPE - #endif - ) ? uniString::utf8("") : m_clientLogString + "Socket error while waiting to send data. " + socketErrString(rval))); - result.m_timeout.tv_sec = (long)(autoDumpTime - (cur_time - m_lastActivityTime)); - result.m_writeSet.insert(m_socket); - } - else - { - m_bytesSentForCurrentTitle += rval; - m_totalBytesSent += rval; - m_lastActivityTime = ::time(NULL); - m_metaIntervalCounter += rval; - m_backupFileOffset += rval; - assert((!m_sendMetadata) || (m_metaIntervalCounter <= m_metaInterval)); - result.m_writeSet.insert(m_socket); - result.m_timeout.tv_sec = autoDumpTime; - } - } - } - return result; -} - -runnable::timeSliceResult protocol_RTMPClient::state_Stream() throw(exception) -{ - assert(m_streamData); - - timeSliceResult result; - - int autoDumpTime = gOptions.getAutoDumpSourceTime(); // don't want this value to change during this call - - m_limitTrigger.clear(); - - // check to see if we have to send the metadata - if ((m_metaIntervalCounter == m_metaInterval) && m_sendMetadata) - { - // send metadata - sendICYMetadata(m_streamData->getSc1Metadata(m_readPtr).m_songTitle); - - m_nextState = &protocol_RTMPClient::state_Stream; - result.m_writeSet.insert(m_socket); - result.m_timeout.tv_sec = autoDumpTime; - } - else - { - streamData::ringBuffer_t rb = m_streamData->getSc1RingBuffer(); - - streamData::ringBufferAccess_t amt = rb.m_writePtr - m_readPtr; - if (amt > rb.m_bufferSize) - { - // the pointers are too far apart. Underrun - m_underruns += 1; - amt = resetReadPtr(); - } - - // clamp amount to send if we are supporting metadata - if (m_sendMetadata) - { - amt = min(amt,(streamData::ringBufferAccess_t)(m_metaInterval - m_metaIntervalCounter)); - } - - streamData::ringBufferAccess_t offset = m_readPtr & rb.m_ptrMask; - // clamp again so we don't read passed end of buffer - amt = min(amt,rb.m_bufferSize - offset); - - // send - time_t cur_time = ::time(0); - if (autoDumpTime > 0 && (cur_time - m_lastActivityTime) >= autoDumpTime) - throwEx(m_clientLogString + " Timeout waiting to send data (" + - tos(cur_time) + " " + tos(m_lastActivityTime) + " [" + tos(cur_time - m_lastActivityTime) + "] )"); - - if (!amt) - { - // nothing in the source - // If the source has gone away, and we have a backup file, send it. - bool sendBackupFile = false; - - if (!streamData::isSourceConnected(m_streamData)) - { - aquireBackupFile(); - sendBackupFile = !m_backupFile.empty(); - } - if (sendBackupFile) - { - m_state = &protocol_RTMPClient::state_SendBackupFile; - result.m_runImmediately = true; - } - else - { - result.m_timeout.tv_sec = (long)(autoDumpTime - (cur_time - m_lastActivityTime)); - m_limitTrigger.clear(); - result.m_readSet.insert(m_limitTrigger.test()); - m_streamData->scheduleSc1LimitTrigger(&m_limitTrigger,m_readPtr); - } - } - else - { - int rval = ::send(m_socket,(const char *)&(rb.m_data[offset]),amt,0); - if (rval == 0) - { - throwEx(m_clientLogString + " Remote socket closed while sending data."); - } - else if (rval < 0) - { - rval = socketOps::errCode(); - if (rval != SOCKETOPS_WOULDBLOCK) - throwEx((( - #ifdef _WIN32 - rval == WSAECONNABORTED || rval == WSAECONNRESET - #else - rval == ECONNABORTED || rval == ECONNRESET || rval == EPIPE - #endif - ) ? uniString::utf8("") : m_clientLogString + "Socket error while waiting to send data. " + socketErrString(rval))); - result.m_timeout.tv_sec = (long)(autoDumpTime - (cur_time - m_lastActivityTime)); - result.m_writeSet.insert(m_socket); - } - else - { - m_bytesSentForCurrentTitle += rval; - m_totalBytesSent += rval; - m_lastActivityTime = ::time(NULL); - m_metaIntervalCounter += rval; - assert((!m_sendMetadata) || (m_metaIntervalCounter <= m_metaInterval)); - m_readPtr += rval; - result.m_writeSet.insert(m_socket); - result.m_timeout.tv_sec = autoDumpTime; - } - } - } - return result; -} - -#endif -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_RTMPClient.h b/Src/Plugins/DSP/sc_serv3/protocol_RTMPClient.h deleted file mode 100644 index 457bab95..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_RTMPClient.h +++ /dev/null @@ -1,170 +0,0 @@ -#pragma once -#if 0 -#ifndef protocol_RTMPClient_H_ -#define protocol_RTMPClient_H_ - -#include "threadedRunner.h" -#include "streamData.h" -#include -#include - -class streamData; - -class AMFEncoding; - -class protocol_RTMPClient: public runnable, public clientProtocol -{ -public: - class message - { - public: - int m_chunkStreamID; - int m_messageStreamID; - __uint8 m_messageType; - std::vector<__uint8> m_messageData; - - void clear() throw() { m_messageData.clear(); } - uniString::utf8 packetDump() const throw(); - }; - -private: - // the limit trigger is used when the client readPtr butts up against the write ptr. - // In this case we can't select against the socket, because it will always be ready and we'll - // end up in a CPU intenstive spin loop. Instead, we create a signal and give it to the streamData - // object with the value of our readPtr. The streamData object will signal the trigger when there - // is data available - pipeDrivenSignal m_limitTrigger; - - socketOps::tSOCKET m_socket; - const uniString::utf8 m_clientHostName; - const uniString::utf8 m_clientAddr; - const int m_clientPort; - uniString::utf8 m_clientLogString; - const __uint8 m_C0; // C0 packet sent from client. Has version number - const __uint8 m_S0; // my response - std::vector<__uint8> m_C1; // C1 packet from client - std::vector<__uint8> m_C2; // C2 packet from client - std::vector<__uint8> m_S1orS2; // S1 or S2 packet from me - - __uint8 *m_inDataBuffer; - size_t m_inDataBufferMax; // max allocated - size_t m_inDataBufferAmt; // amt in buffer - size_t m_inDataRequested; // amt we want to read for a fixed read (C1 or C2) - message m_inMsg; - - const __uint8 *m_outDataPtr; // for outgoing text lines - size_t m_outDataSize; - std::vector<__uint8> m_outDataBuffer; - - __uint32 m_serverBaseTime; // for RTMP protocol - __uint32 m_C1ReadTime; - - time_t m_lastActivityTime; - - time_t m_startTime; // when connection started, used to implement listenerTime - - // inbound state - size_t m_inboundChunkSize; - int m_lastInboundMessageStreamID; - int m_lastInboundMessageLength; - int m_lastInboundMessageTypeID; - long m_lastInboundTimestamp; - size_t m_windowSizeFromClient; - int m_bufferSizeFromClient; - - // outbound state - size_t m_outboundChunkSize; - - long getMsg(message &msg) throw(std::exception); - - //// stats for w3c logs - time_t m_lastTitleTime; // time of last title update used for w3c logs - __uint64 m_bytesSentForCurrentTitle; // bytes sent since last title change. used for w3c logs - __uint64 m_totalBytesSent; // total bytes sent whilst the connection is open - uniString::utf8 m_lastSentMetadata; // no need to send duplicates. Also used for w3C tracking - - int m_objectEncodingMode; - /////////////////////////// - - ////////// HTTP message buffer for 302 redirect -// uniString::utf8 m_redirectResponse; - ////////////////////////////////////////// - -// const protocol_HTTPStyle::HTTPRequestInfo m_HTTPRequestInfo; // the received request and headers -// uniString::utf8 m_ICYOKResponse; -// std::vector<__uint8> m_ICYMetadata; // metadata buffer - - streamData::streamID_t m_streamID; // stream ID for this connection - - streamData::ringBufferAccess_t m_readPtr; // pointer into ring buffer - int m_underruns; // client too slow - bool m_removeClientFromStats; // do we have to do a stats::removeClient - - bool m_sendMetadata; - size_t m_metaInterval; - size_t m_metaIntervalCounter; // counter for metadata updates - - std::vector<__uint8> m_introFile; - size_t m_introFileOffset; - std::vector<__uint8> m_backupFile; - size_t m_backupFileOffset; - - void aquireIntroFile() throw(); - void aquireBackupFile() throw(); - - streamData::ringBufferAccess_t resetReadPtr() throw(); // return distance between read and write pointer - void sendICYMetadata(const uniString::utf8 &md) throw(); - - void logW3C() throw(); - void setW3CState() throw(); - - typedef runnable::timeSliceResult (protocol_RTMPClient::*state_t)(); // throw(std::exception); - - state_t m_state; - state_t m_nextState; - - streamData *m_streamData; - - bool chunkSequenceComplete(const __uint8 *inBuffer,size_t amtInBuffer,size_t &amtToRemoveFromInBuffer,size_t expectedChunkSize, - std::vector<__uint8> &msg,__uint8 &msgType,int &chunkStreamID,int &messageStreamID,const uniString::utf8 &logMsgPrefix) throw(std::exception); - - runnable::timeSliceResult state_Send() throw(std::exception); - runnable::timeSliceResult state_RecvFixedAmt() throw(std::exception); - runnable::timeSliceResult state_RecvMsg() throw(std::exception); - - runnable::timeSliceResult state_WaitForC1() throw(std::exception); - runnable::timeSliceResult state_GotC1() throw(std::exception); - runnable::timeSliceResult state_WaitForC2() throw(std::exception); - runnable::timeSliceResult state_GotC2() throw(std::exception); - runnable::timeSliceResult state_SendS0() throw(std::exception); - runnable::timeSliceResult state_SendS1() throw(std::exception); - runnable::timeSliceResult state_SendS2() throw(std::exception); - - runnable::timeSliceResult state_WaitForMessage() throw(std::exception); - runnable::timeSliceResult state_GotMessage() throw(std::exception); - - runnable::timeSliceResult state_SendAudio() throw(std::exception); - - runnable::timeSliceResult handle_AMF0_message() throw(std::exception); - runnable::timeSliceResult handle_AMF0_connect(const AMFEncoding &amf) throw(std::exception); - runnable::timeSliceResult handle_AMF0_createStream(const AMFEncoding &amf) throw(std::exception); - runnable::timeSliceResult handle_AMF0_play(const AMFEncoding &amf) throw(std::exception); - - runnable::timeSliceResult handle_USER_CONTROL_message() throw(std::exception); - runnable::timeSliceResult handle_UCM_StreamBegin() throw(std::exception); - - runnable::timeSliceResult state_SendConnectResponse() throw(std::exception); - - runnable::timeSliceResult state_Close() throw(std::exception); - - virtual runnable::timeSliceResult timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "protocol_RTMPClient"; } - -public: - protocol_RTMPClient(socketOps::tSOCKET s,const uniString::utf8 &hostName,const uniString::utf8 &addr,int port, - __uint8 C0 /* initial client packet */) throw(std::exception); - virtual ~protocol_RTMPClient() throw(); -}; - -#endif -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_admincgi.cpp b/Src/Plugins/DSP/sc_serv3/protocol_admincgi.cpp deleted file mode 100644 index 8b4b9070..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_admincgi.cpp +++ /dev/null @@ -1,6390 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include -#include "protocol_shoutcastClient.h" -#include "protocol_admincgi.h" -#include "protocol_HTTPStyle.h" -#include "protocol_relay.h" -#include "base64.h" -#include "banList.h" -#include "ripList.h" -#include "adminList.h" -#include "agentList.h" -#include "uvox2Common.h" -#include "w3cLog.h" -#include "yp2.h" -#include "updater.h" -#include "aolxml/aolxml.h" -#include "webNet/urlUtils.h" -#include "file/fileUtils.h" -#include "services/stdServiceImpl.h" -#include "bandwidth.h" -#include "cpucount.h" - -using namespace std; -using namespace stringUtil; -using namespace uniString; - -time_t last_update_check = 0; -utf8 logId, logTailId, listenerId; - -#define DEBUG_LOG(...) do { if (gOptions.httpStyleDebug()) DLOG(__VA_ARGS__); } while (0) -#define LOG_NAME "ADMINCGI" -#define LOGNAME "[" LOG_NAME "] " - -#define HEAD_REQUEST (m_httpRequestInfo.m_request == protocol_HTTPStyle::HTTP_HEAD) -#define SHRINK (m_httpRequestInfo.m_AcceptEncoding & protocol_HTTPStyle::ACCEPT_GZIP) -#define COMPRESS(header, body) if (SHRINK && compressData(body)) header += "Content-Encoding:gzip\r\n" - -static bool sortUniqueClientDataByTime(const stats::uniqueClientData_t &a, const stats::uniqueClientData_t &b) -{ - return (a.m_connectTime < b.m_connectTime); -} - -utf8 getStreamAdminHeader(const streamData::streamID_t sid, const utf8& headerTitle, - const int refreshRequired = 0, const bool style = false) -{ - return "" - "" - "" - "Shoutcast Administrator" - "" - "" + (abs(refreshRequired) > 0 ? - "" : "") + - - (style ? "" : (utf8)"") + - - "" - "" - "" - "" - "
Shoutcast " + headerTitle + "
" - "
Shoutcast Server v" + - addWBR(gOptions.getVersionBuildStrings() + "/" SERV_OSNAME) + "
" - "
" - "" - "
 | 
" - "" - "
 | 
" - + (!(gOptions.read_stream_adminPassword(sid) && !gOptions.stream_adminPassword(sid).empty()) ? - "
Log " - "(Tailing" - " | Save)
" - "
 | 
" : "") + - /*+ utf8(info.m_radionomyID.empty() ? warningImage(false) + "  Please Register Your Authhash

" : "") +*/ - "" - "
 | 
" - "" - "
 | 
" - "" - "
 | 
" - "" - "
 | 
" - "" - "
 | 
" - "" - "
"; -} - -utf8 getServerAdminHeader(const utf8& headerTitle, const int refreshRequired = 0, - const utf8& childPage = "", const int style = 0) -{ - return "" - "" - "" - "Shoutcast Server Administrator" - "" - "" + - - (abs(refreshRequired) > 0 ? "" : "") + - - (style ? "" : (utf8)"") + - - "" - "" - "" - "" - "
Shoutcast " + headerTitle + "
" - "
Shoutcast Server v" + - addWBR(gOptions.getVersionBuildStrings() + "/" SERV_OSNAME) + "
" - "" - "
" - "" - "
 | 
" - "" - "
 | 
" - "
Log " - "(Tailing | " - "Save)
" - "
 | 
" - "" - "
 | 
" - "" - "
 | 
" - "" - "
 | 
" - "" - "
 | 
" - "" - "
"; -} - -static utf8 formatSizeString(const __uint64 size) -{ - utf8::value_type buf[128] = {0}; - if (size < 1024) - { - snprintf((char *)buf, sizeof(buf), "%llu B", size); - } - else if(size < 1048576) - { - snprintf((char *)buf, sizeof(buf), "%.02f KiB", size/1024.0f); - } - else if(size < 1073741824) - { - snprintf((char *)buf, sizeof(buf), "%.02f MiB", size/1048576.0f); - } - else if(size < 1099511627776LL) - { - snprintf((char *)buf, sizeof(buf), "%.02f GiB", size/1073741824.0f); - } - else - { - snprintf((char *)buf, sizeof(buf), "%.02f TiB", size/1099511627776.0f); - } - return buf; -} - -utf8 getCheckedDuration(const size_t time) -{ - if (time >= 60) - { - if (time < 3600) - { - size_t min = (time / 60); - return (tos(min) + " minute" + (min != 1 ? "s" : "") + " ago"); - } - else if (time < 86400) - { - size_t hour = (time / 3600); - return (tos(hour) + " hour" + (hour != 1 ? "s" : "") + " ago"); - } - else - { - size_t week = (time / 86400); - return (tos(week) + " week" + (week != 1 ? "s" : "") + " ago"); - } - } - return "less than a minute ago"; -} - -utf8 niceURL(utf8 srcAddr) -{ - if (!srcAddr.empty()) - { - utf8::size_type pos = srcAddr.find(utf8("://")); - if (pos != utf8::npos && ((pos == 4) || (pos == 5))) - { - srcAddr = srcAddr.substr(pos + 3); - } - srcAddr = aolxml::escapeXML(srcAddr); - - // look for a /stream/x/ path and strip off the end / so the - // link goes to the admin page instead of playing the stream - if (!srcAddr.empty()) - { - utf8::size_type pos2 = srcAddr.find(utf8("/stream/")), - pos3 = srcAddr.rfind(utf8("/")); - if ((pos2 != utf8::npos) && - ((pos3 != utf8::npos) && (pos3 > pos2) && - (pos3 == srcAddr.size()-1))) - { - srcAddr = srcAddr.substr(0, pos3); - } - } - } - return srcAddr; -} - -void restartRelay(const config::streamConfig &info) throw() -{ - bool noEntry = false; - const int relayActive = (streamData::isRelayActive(info.m_streamID, noEntry) & 12); - if (!relayActive || !noEntry) - { - threadedRunner::scheduleRunnable(new protocol_relay(info)); - } -} - -void checkVersion(const time_t t) -{ - utf8 tempId; - httpHeaderMap_t queryParameters; - queryParameters["id"] = randomId(tempId); - - yp2::runAuthHashAction(tempId, yp2::VER_CHECK, "/yp2", queryParameters, - ""\ - ""\ - "" + gOptions.getVersionBuildStrings() + "/" SERV_OSNAME ""); - - last_update_check = t; -} - -utf8 getUptimeScript(const bool base = false, const bool stream = false, const time_t streamUptime = 0) -{ - // TODO need to consider improving this to better deal with leap years, etc - // used to increment the uptime value on the server admin page - return (!base ? "" : ""); -} - -const bool reloadConfig(const int force) -{ - bool m_reloadRefresh = false; - - ILOG(gOptions.logSectionName() + "Starting stream config reload from `" + fileUtil::getFullFilePath(gOptions.confFile()) + "'"); - config newOptions; - newOptions.load(gOptions.confFile()); - vector relays; - - // to ease testing, especially on remote systems, will - // allow toggling of the debugging options for v2.1+ - ILOG(gOptions.logSectionName() + "Processing global configuration settings..."); - - if (newOptions.cdn() != gOptions.cdn()) - { - ILOG(gOptions.logSectionName() + "Changing CDN mode from " + (!gOptions.cdn().empty() ? gOptions.cdn() : "off") + - " to " + (!newOptions.cdn().empty() ? newOptions.cdn() : "off")); - try - { - gOptions.setOption(utf8("cdn"),utf8(newOptions.cdn())); - } - catch(const exception &) - { - } - } - - if (newOptions.maxUser() != gOptions.maxUser()) - { - const int old_maxUser = gOptions.maxUser(), - new_maxUser = newOptions.maxUser(); - ILOG(gOptions.logSectionName() + "Changing server maxuser from " + - (old_maxUser > 0 ? tos(old_maxUser) : "unlimited") + " to " + - (new_maxUser > 0 ? tos(new_maxUser) : "unlimited")); - gOptions.setOption(utf8("maxuser"),utf8(tos(newOptions.maxUser()))); - } - - if (newOptions.maxBitrate() != gOptions.maxBitrate()) - { - ILOG(gOptions.logSectionName() + "Changing server maxbitrate from " + - (gOptions.maxBitrate() > 0 ? tos(gOptions.maxBitrate()) + "bps" : "unlimited") + " to " + - (newOptions.maxBitrate() > 0 ? tos(newOptions.maxBitrate()) + "bps" : "unlimited")); - gOptions.setOption(utf8("maxbitrate"),utf8(tos(newOptions.maxBitrate()))); - } - - if (newOptions.minBitrate() != gOptions.minBitrate()) - { - ILOG(gOptions.logSectionName() + "Changing server minbitrate from " + - (gOptions.minBitrate() > 0 ? tos(gOptions.minBitrate()) + "bps" : "unlimited") + " to " + - (newOptions.minBitrate() > 0 ? tos(newOptions.minBitrate()) + "bps" : "unlimited")); - gOptions.setOption(utf8("minbitrate"),utf8(tos(newOptions.minBitrate()))); - } - - bool publicChanged = false; - if (newOptions.publicServer() != gOptions.publicServer()) - { - ILOG(gOptions.logSectionName() + "Changing state of publicserver - killing sources as applicable"); - gOptions.setOption(utf8("publicserver"),newOptions.publicServer()); - publicChanged = true; - } - - // update the server-wide hiding and redirection options - if (newOptions.hideStats() != gOptions.hideStats()) - { - ILOG(gOptions.logSectionName() + "Changing 'hidestats'"); - gOptions.setOption(utf8("hidestats"),utf8(newOptions.hideStats())); - } - - if (newOptions.redirectUrl() != gOptions.redirectUrl()) - { - ILOG(gOptions.logSectionName() + "Changing 'redirecturl'"); - gOptions.setOption(utf8("redirecturl"),utf8(newOptions.redirectUrl())); - } - - if (newOptions.ripOnly() != gOptions.ripOnly()) - { - ILOG(gOptions.logSectionName() + "Changing 'riponly'"); - gOptions.setOption(utf8("riponly"),utf8(tos(newOptions.ripOnly()))); - } - - if (newOptions.blockEmptyUserAgent() != gOptions.blockEmptyUserAgent()) - { - ILOG(gOptions.logSectionName() + "Changing 'blockemptyuseragent'"); - gOptions.setOption(utf8("blockemptyuseragent"),utf8(tos(newOptions.blockEmptyUserAgent()))); - } - - if (newOptions.metricsMaxQueue() != gOptions.metricsMaxQueue()) - { - ILOG(gOptions.logSectionName() + "Changing 'metricsmaxqueue'"); - gOptions.setOption(utf8("metricsmaxqueue"),utf8(tos(newOptions.metricsMaxQueue()))); - } - - metrics::metrics_apply(newOptions); - - if (newOptions.relayReconnectTime() != gOptions.relayReconnectTime()) - { - ILOG(gOptions.logSectionName() + "Changing 'relayreconnecttime'"); - gOptions.setOption(utf8("relayreconnecttime"),utf8(tos(newOptions.relayReconnectTime()))); - } - - if (newOptions.relayConnectRetries() != gOptions.relayConnectRetries()) - { - ILOG(gOptions.logSectionName() + "Changing 'relayconnectretries'"); - gOptions.setOption(utf8("relayconnectretries"),utf8(tos(newOptions.relayConnectRetries()))); - } - - if (newOptions.backupLoop() != gOptions.backupLoop()) - { - ILOG(gOptions.logSectionName() + "Changing 'backuploop'"); - gOptions.setOption(utf8("backuploop"),utf8(tos(newOptions.backupLoop()))); - } - - if (newOptions.songHistory() != gOptions.songHistory()) - { - ILOG(gOptions.logSectionName() + "Changing 'songhistory'"); - gOptions.setOption(utf8("songhistory"),utf8(tos(newOptions.songHistory()))); - } - - if (newOptions.adminFile() != gOptions.adminFile()) - { - ILOG(gOptions.logSectionName() + "Changing 'adminfile'"); - gOptions.setOption(utf8("adminfile"),newOptions.adminFile()); - } - - if (newOptions.clacks() != gOptions.clacks()) - { - ILOG(gOptions.logSectionName() + "Changing 'clacks'"); - gOptions.setOption(utf8("clacks"),utf8(tos(newOptions.clacks()))); - } - - if (newOptions.startInactive() != gOptions.startInactive()) - { - ILOG(gOptions.logSectionName() + "Changing 'startinactive'"); - gOptions.setOption(utf8("startinactive"),utf8(tos(newOptions.startInactive()))); - } - - if (newOptions.rateLimit() != gOptions.rateLimit()) - { - ILOG(gOptions.logSectionName() + "Changing 'rateLimit'"); - gOptions.setOption(utf8("ratelimit"),utf8(tos(newOptions.rateLimit()))); - } - - if (newOptions.adTestFile() != gOptions.adTestFile()) - { - ILOG(gOptions.logSectionName() + "Changing 'adtestfile'"); - gOptions.setOption(utf8("adtestfile"),utf8(newOptions.adTestFile())); - } - - if (newOptions.adTestFile2() != gOptions.adTestFile2()) - { - ILOG(gOptions.logSectionName() + "Changing 'adtestfile2'"); - gOptions.setOption(utf8("adtestfile2"),utf8(newOptions.adTestFile2())); - } - - if (newOptions.adTestFile3() != gOptions.adTestFile3()) - { - ILOG(gOptions.logSectionName() + "Changing 'adtestfile3'"); - gOptions.setOption(utf8("adtestfile3"),utf8(newOptions.adTestFile3())); - } - - if (newOptions.adTestFile4() != gOptions.adTestFile4()) - { - ILOG(gOptions.logSectionName() + "Changing 'adtestfile4'"); - gOptions.setOption(utf8("adtestfile4"),utf8(newOptions.adTestFile4())); - } - - if (newOptions.adTestFileLoop() != gOptions.adTestFileLoop()) - { - ILOG(gOptions.logSectionName() + "Changing 'adtestfileloop'"); - gOptions.setOption(utf8("adtestfileloop"),utf8(tos(newOptions.adTestFileLoop()))); - } - - if (newOptions.metaInterval() != gOptions.metaInterval()) - { - ILOG(gOptions.logSectionName() + "Changing 'metainterval'"); - gOptions.setOption(utf8("metainterval"),utf8(tos(newOptions.metaInterval()))); - } - - if (newOptions.useXFF() != gOptions.useXFF()) - { - ILOG(gOptions.logSectionName() + "Changing 'usexff'"); - gOptions.setOption(utf8("usexff"),utf8(tos(newOptions.useXFF()))); - } - - if (newOptions.forceShortSends() != gOptions.forceShortSends()) - { - ILOG(gOptions.logSectionName() + "Changing 'forceshortsends'"); - gOptions.setOption(utf8("forceshortsends"),utf8(tos(newOptions.forceShortSends()))); - } - - if (newOptions.adminNoWrap() != gOptions.adminNoWrap()) - { - ILOG(gOptions.logSectionName() + "Changing 'adminnowrap'"); - gOptions.setOption(utf8("adminnowrap"),utf8(tos(newOptions.adminNoWrap()))); - } - - if (newOptions.adminCSSFile() != gOptions.adminCSSFile()) - { - ILOG(gOptions.logSectionName() + "Changing 'admincssfile'"); - gOptions.setOption(utf8("admincssfile"),utf8(newOptions.adminCSSFile())); - gOptions.m_styleCustomStr.clear(); - gOptions.m_styleCustomStrGZ.clear(); - gOptions.m_styleCustomHeaderTime = 0; - } - - if (newOptions.destIP() != gOptions.destIP()) - { - utf8 destBindAddr = metrics::metrics_verifyDestIP(newOptions, false); - ILOG(gOptions.logSectionName() + "Changing 'destip'"); - gOptions.setOption(utf8("destip"), destBindAddr); - - // if we're updating then attempt to behave like it was a new load - g_IPAddressForClients = destBindAddr; - - if (g_IPAddressForClients.empty()) - { - char s[MAXHOSTNAMELEN] = {0}; - if (!::gethostname(s,MAXHOSTNAMELEN - 1)) - { - g_IPAddressForClients = socketOps::hostNameToAddress(s,g_portForClients); - } - } - } - - if (newOptions.publicIP() != gOptions.publicIP()) - { - utf8 publicAddr = stripWhitespace(newOptions.publicIP()); - publicAddr = stripHTTPprefix(publicAddr); - ILOG(gOptions.logSectionName() + "Changing 'publicip'"); - gOptions.setOption(utf8("publicip"),publicAddr); - } - - if (newOptions.autoDumpTime() != gOptions.autoDumpTime()) - { - ILOG(gOptions.logSectionName() + "Changing 'autodumptime'"); - gOptions.setOption(utf8("autodumptime"),utf8(tos(newOptions.autoDumpTime()))); - } - - if (newOptions.nameLookups() != gOptions.nameLookups()) - { - ILOG(gOptions.logSectionName() + "Changing 'namelookups'"); - gOptions.setOption(utf8("namelookups"),utf8(tos(newOptions.nameLookups()))); - } - - // update the YP details (can do on fly without any actual updates) - bool ypChanged = false; - bool https = ((gOptions.ypAddr() == DEFAULT_YP_ADDRESS) && uniFile::fileExists(gOptions.m_certPath)); - utf8 oldYP = (https ? "https://" : "http://") + gOptions.ypAddr() + ":" + tos(gOptions.ypPort()) + gOptions.ypPath(); - if (newOptions.ypAddr() != gOptions.ypAddr()) - { - ypChanged = true; - gOptions.setOption(utf8("ypaddr"),utf8(newOptions.ypAddr())); - } - if (newOptions.ypPort() != gOptions.ypPort()) - { - ypChanged = true; - gOptions.setOption(utf8("ypport"),utf8(tos(newOptions.ypPort()))); - } - if (newOptions.ypPath() != gOptions.ypPath()) - { - ypChanged = true; - gOptions.setOption(utf8("yppath"),utf8(newOptions.ypPath())); - } - - if (ypChanged) - { - bool https = ((newOptions.ypAddr() == DEFAULT_YP_ADDRESS) && uniFile::fileExists(gOptions.m_certPath)); - utf8 newYP = (https ? "https://" : "http://") + newOptions.ypAddr() + ":" + tos(newOptions.ypPort()) + newOptions.ypPath(); - ILOG(gOptions.logSectionName() + "Changing YP details from " + oldYP + " to " + newYP); - } - - gOptions.setOption(utf8("yp2debug"),utf8(newOptions.yp2Debug()?"1":"0")); - gOptions.setOption(utf8("shoutcastsourcedebug"),utf8(newOptions.shoutcastSourceDebug()?"1":"0")); - gOptions.setOption(utf8("uvox2sourcedebug"),utf8(newOptions.uvox2SourceDebug()?"1":"0")); - gOptions.setOption(utf8("httpsourcedebug"),utf8(newOptions.HTTPSourceDebug()?"1":"0")); - gOptions.setOption(utf8("shoutcast1clientdebug"),utf8(newOptions.shoutcast1ClientDebug()?"1":"0")); - gOptions.setOption(utf8("shoutcast2clientdebug"),utf8(newOptions.shoutcast2ClientDebug()?"1":"0")); - gOptions.setOption(utf8("httpclientdebug"),utf8(newOptions.HTTPClientDebug()?"1":"0")); - gOptions.setOption(utf8("flvclientdebug"),utf8(newOptions.flvClientDebug()?"1":"0")); - gOptions.setOption(utf8("m4aclientdebug"),utf8(newOptions.m4aClientDebug()?"1":"0")); - gOptions.setOption(utf8("relayshoutcastdebug"),utf8(newOptions.relayShoutcastDebug()?"1":"0")); - gOptions.setOption(utf8("relayuvoxdebug"),utf8(newOptions.relayUvoxDebug()?"1":"0")); - gOptions.setOption(utf8("relaydebug"),utf8(newOptions.relayDebug()?"1":"0")); - gOptions.setOption(utf8("streamdatadebug"),utf8(newOptions.streamDataDebug()?"1":"0")); - gOptions.setOption(utf8("httpstyledebug"),utf8(newOptions.httpStyleDebug()?"1":"0")); - gOptions.setOption(utf8("statsdebug"),utf8(newOptions.statsDebug()?"1":"0")); - gOptions.setOption(utf8("microserverdebug"),utf8(newOptions.microServerDebug()?"1":"0")); - gOptions.setOption(utf8("threadrunnerdebug"),utf8(newOptions.threadRunnerDebug()?"1":"0")); - gOptions.setOption(utf8("admetricsdebug"),utf8(newOptions.adMetricsDebug()?"1":"0")); - gOptions.setOption(utf8("authdebug"),utf8(newOptions.authDebug()?"1":"0")); - - ILOG(gOptions.logSectionName() + "Processed global configuration settings."); - - // test for the source password having changed this will be - // applied in general though per stream changes are likely - // to have been set in the earlier checks before we got here - if (newOptions.password() != gOptions.password()) - { - gOptions.setOption(utf8("password"),newOptions.password()); - streamData *sd = streamData::accessStream(DEFAULT_SOURCE_STREAM); - if (sd) - { - ILOG(gOptions.logSectionName() + "Killing all stream sources due to change of relay options."); - sd->killAllSources(); - m_reloadRefresh = true; - sd->releaseStream(); - } - } - - config::streams_t new_streams, old_streams; - newOptions.getStreamConfigs(new_streams, false); - gOptions.getStreamConfigs(old_streams, false); - - config::streams_t::const_iterator iNSC = new_streams.begin(), iOSC = old_streams.begin(); - - // if no configurations found then we can just remove everything - if (new_streams.empty()) - { - // kick the source and clients as required on a removal - for (; iOSC != old_streams.end(); ++iOSC) - { - size_t streamID = (*iOSC).second.m_streamID; - streamData *sd = streamData::accessStream(streamID); - if (sd) - { - sd->killSource(streamID, sd); - m_reloadRefresh = true; - } - gOptions.removeStreamConfig((*iOSC).second); - } - } - - // otherwise if the same or more then we can update / add as required - else if (new_streams.size() >= old_streams.size()) - { - // if no configs specified and we're starting to add new stream configs - // then we really need to kick any existing sources otherwise it'll stay - // with the current details which will prevent a YP connection with extra - // checks in build 21+ to make sure it only works if there was a change. - if ((new_streams.size() != old_streams.size()) && - (old_streams.size() == DEFAULT_SOURCE_STREAM)) - { - // kick the source and clients as required on a complete addition - // (wouldn't have a valid config via authhash, etc so is sensible) - streamData *sd = streamData::accessStream(DEFAULT_SOURCE_STREAM); - if (sd) - { - ILOG(gOptions.logSectionName() + "Forcing stream source disconnect due to addition of stream config(s)."); - sd->killAllSources(); - m_reloadRefresh = true; - sd->releaseStream(); - } - } - - for (; iNSC != new_streams.end(); ++iNSC) - { - config::streams_t::const_iterator iOSC2 = old_streams.find((*iNSC).first); - if (iOSC2 != old_streams.end()) - { - // update required - __uint64 updated = gOptions.updateStreamConfig(newOptions, (*iNSC).second); - size_t streamID = (*iNSC).second.m_streamID; - streamData *sd = streamData::accessStream(streamID); - if (sd) - { - // otherwise do an in-place update as long as it is applicable - bool isRelay = sd->isRelayStream(streamID); - if (publicChanged || force || - (!force && (updated & RELAY_URL || updated & SOURCE_PWD || - updated & PUBLIC_SRV || (updated & ALLOW_RELAY && isRelay) || - (updated & ALLOW_PUBLIC_RELAY && isRelay) || updated & CIPHER_KEY || - updated & INTRO_FILE || updated & BACKUP_FILE || - updated & BACKUP_URL || updated & MOVED_URL))) - { - sd->killSource(streamID); - m_reloadRefresh = true; - - if (!(*iNSC).second.m_relayUrl.url().empty() && - !sd->isSourceConnected(streamID) && - gOptions.stream_movedUrl(streamID).empty()) - { - relays.push_back((*iNSC).second); - } - } - // otherwise do an in-place update as long as it is applicable - else - { - sd->streamUpdate(streamID, (*iNSC).second.m_authHash, (*iNSC).second.m_maxStreamUser, - (*iNSC).second.m_maxStreamBitrate, (*iNSC).second.m_minStreamBitrate); - } - - // refresh the played history size as needed - if (updated & SONG_HIST) - { - sd->updateSongHistorySize(); - } - - if (updated & ARTWORK_FILE) - { - if (gOptions.read_stream_artworkFile(streamID)) - { - gOptions.m_artworkBody[streamID] = loadLocalFile(fileUtil::getFullFilePath(gOptions.stream_artworkFile(streamID)), LOGNAME, 523872/*32 x (16384 - 6 - 6 - 1)*/); - } - else - { - gOptions.m_artworkBody[streamID].clear(); - sd->clearCachedArtwork(0); - } - } - sd->releaseStream(); - } - // otherwise if no proper update or a relay was added / is known and not connected then bump it - else - { - // force flag a source relay kick if this is called - bool noEntry = false; - if ((streamData::isRelayActive(streamID, noEntry) & 12)) - { - // if there is a relay attempt and no new one - // then we need to signal it to abort trying - if ((*iNSC).second.m_relayUrl.url().empty()) - { - streamData::setRelayActiveFlags (streamID, noEntry, 2); - } - // otherwise we need update the relay url - // which the attempt is trying to join to - // which is done by the relay handling. - } - - if (((*iOSC2).second.m_relayUrl.url() != (*iNSC).second.m_relayUrl.url() || - (updated & MOVED_URL)) && !(*iNSC).second.m_relayUrl.url().empty()) - { - relays.push_back((*iNSC).second); - m_reloadRefresh = true; - } - } - } - else - { - // addition required - // no need to do anything else as there shouldn't be anything connected on this at the time - gOptions.addStreamConfig(newOptions, (*iNSC).second); - m_reloadRefresh = true; - - // only attempt to start a relay url if added and a relay url exists - if (!(*iNSC).second.m_relayUrl.url().empty()) - { - relays.push_back((*iNSC).second); - } - } - } - } - - // otherwise if there are fewer stream configurations then we can update / remove as required - else - { - for (; iOSC != old_streams.end(); ++iOSC) - { - config::streams_t::const_iterator iOSC2 = new_streams.find((*iOSC).first); - if (iOSC2 != new_streams.end()) - { - // update required - __uint64 updated = gOptions.updateStreamConfig(newOptions, (*iOSC2).second); - size_t streamID = (*iOSC2).second.m_streamID; - streamData *sd = streamData::accessStream(streamID); - if (sd) - { - // check what has been updated and kick the source as applicable - bool isRelay = sd->isRelayStream(streamID); - if (publicChanged || force || - (!force && (updated & RELAY_URL || updated & SOURCE_PWD || - updated & PUBLIC_SRV || (updated & ALLOW_RELAY && isRelay) || - (updated & ALLOW_PUBLIC_RELAY && isRelay) || updated & CIPHER_KEY || - updated & INTRO_FILE || updated & BACKUP_FILE || - updated & BACKUP_URL || updated & MOVED_URL))) - { - sd->killSource(streamID); - m_reloadRefresh = true; - - if (!(*iOSC2).second.m_relayUrl.url().empty() && - !sd->isSourceConnected(streamID) && - gOptions.stream_movedUrl(streamID).empty()) - { - relays.push_back((*iOSC2).second); - } - } - // otherwise do an in-place update as long as it is applicable - else - { - sd->streamUpdate(streamID, (*iOSC2).second.m_authHash, (*iOSC2).second.m_maxStreamUser, - (*iOSC2).second.m_maxStreamBitrate, (*iOSC2).second.m_minStreamBitrate); - } - - // refresh the played history size as needed - if (updated & SONG_HIST) - { - sd->updateSongHistorySize(); - } - - if (updated & ARTWORK_FILE) - { - if (gOptions.read_stream_artworkFile(streamID)) - { - gOptions.m_artworkBody[streamID] = loadLocalFile(fileUtil::getFullFilePath(gOptions.stream_artworkFile(streamID)), LOGNAME, 523872/*32 x (16384 - 6 - 6 - 1)*/); - } - else - { - gOptions.m_artworkBody[streamID].clear(); - sd->clearCachedArtwork(0); - } - } - sd->releaseStream(); - } - } - else - { - // kick the source and clients as required on a removal - size_t streamID = (*iOSC).second.m_streamID; - streamData *sd = streamData::accessStream(streamID); - if (sd) - { - sd->killSource(streamID, sd); - m_reloadRefresh = true; - } - // removal required - gOptions.removeStreamConfig((*iOSC).second); - } - } - } - - // test for the require stream configs having changed - // only need to kick streams not known if enabled - if (newOptions.requireStreamConfigs() != gOptions.requireStreamConfigs()) - { - gOptions.setOption(utf8("requirestreamconfigs"),utf8(newOptions.requireStreamConfigs()?"1":"0")); - if (newOptions.requireStreamConfigs()) - { - size_t inc = 0; - size_t sid; - do - { - sid = streamData::enumStreams(inc); - config::streams_t streams; - gOptions.getStreamConfigs(streams, false); - - config::streams_t::const_iterator ics = streams.find(sid); - if (ics == streams.end()) - { - streamData *sd = streamData::accessStream(sid); - if (sd) - { - ILOG(gOptions.logSectionName() + "Killing source for stream #" + tos(sid) + " as it is not in the known stream config(s).", LOG_NAME, sid); - sd->killSource(sid, sd); - m_reloadRefresh = true; - } - } - ++inc; - } - while (sid); - } - } - - // finally we refresh the passwords so they're correct after any changes - config::streams_t streams; - gOptions.getStreamConfigs(streams, false); - gOptions.setupPasswords(streams); - - // if a force was done then we really need to restart any relays - if (force) - { - // schedule relays - vector relayList(gOptions.getRelayList()); - if (!relayList.empty()) - { - for_each(relayList.begin(),relayList.end(),restartRelay); - } - } - // otherwise only attempt to restart any which were added, changed, etc - else - { - if (!relays.empty()) - { - for_each(relays.begin(),relays.end(),restartRelay); - } - } - - ILOG(gOptions.logSectionName() + "Completed stream config reload from `" + fileUtil::getFullFilePath(gOptions.confFile())); - return m_reloadRefresh; -} - -void reloadBanLists() -{ - // load up ban file - int loaded = g_banList.load(gOptions.banFile(),0), - count = loaded; - - // per-stream options - config::streams_t streams; - gOptions.getStreamConfigs(streams); - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - // load up ban file - if (gOptions.read_stream_banFile((*i).first)) - { - ++count; - if (g_banList.load(gOptions.stream_banFile((*i).first),(*i).first)) - { - ++loaded; - } - } - } - - if (!count) - { - ILOG("[BAN] No banned lists reloaded."); - } - else - { - if (count == loaded) - { - ILOG("[BAN] Reloaded all banned list(s)."); - } - else - { - ILOG("[BAN] Partially reloaded banned list(s) - check error messages above."); - } - } -} - -void reloadRipLists() -{ - // load up rip file - int loaded = g_ripList.load(gOptions.ripFile(),0), - count = loaded; - - // per-stream options - config::streams_t streams; - gOptions.getStreamConfigs(streams); - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - // load up rip file - if (gOptions.read_stream_ripFile((*i).first)) - { - ++count; - if (g_ripList.load(gOptions.stream_ripFile((*i).first),(*i).first)) - { - ++loaded; - } - } - } - - if (!count) - { - ILOG("[RIP] No reserved lists reloaded."); - } - else - { - if (count == loaded) - { - ILOG("[RIP] Reloaded all reserved list(s)."); - } - else - { - ILOG("[RIP] Partially reloaded reserved list(s) - check error messages above."); - } - } -} - -void reloadAdminAccessList() -{ - // load up admin access file - g_adminList.load(gOptions.adminFile()); - ILOG("[ADMINCGI] Reloaded admin access list."); -} - -void reloadAgentLists() -{ - // load up agent file - int loaded = g_agentList.load(gOptions.agentFile(),0), - count = loaded; - - // per-stream options - config::streams_t streams; - gOptions.getStreamConfigs(streams); - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - // load up agent file - if (gOptions.read_stream_agentFile((*i).first)) - { - ++count; - if (g_agentList.load(gOptions.stream_agentFile((*i).first),(*i).first)) - { - ++loaded; - } - } - } - - if (!count) - { - ILOG("[AGENT] No user agent lists reloaded."); - } - else - { - if (count == loaded) - { - ILOG("[AGENT] Reloaded all user agent list(s)."); - } - else - { - ILOG("[AGENT] Partially reloaded user agent list(s) - check error messages above."); - } - } -} - -void printUpdateMessage() -{ - // display update message where applicable - updater::verInfo ver; - if (updater::getNewVersion(ver)) - { - ULOG(string(YP2_LOGNAME) + "A new DNAS version is now available: " + ver.ver); - ULOG(string(YP2_LOGNAME) + "The suggested download for your setup is: " + ver.url); - ULOG(string(YP2_LOGNAME) + "See " + ver.log + " for more information about this update and alternative download links"); - } -} - -utf8 warningImage(const bool right = true) -{ - return utf8(right ? " " : "") + ""; -} - -utf8 baseImage(const utf8& image, const utf8& title, const bool left = false, const bool prefix = true) -{ - return (prefix ? " " : (utf8)"") + ""; -} - -#define xffImage() baseImage("xff", "XFF", true) -#define mplayerImage() baseImage("mplayer", "MPlayer Client") -#define psImage() baseImage("ps", "PlayStation Client") -#define radioToolboxImage() baseImage("rtb", "Radio Toolbox Monitor / Player") -#define v1Image() baseImage("v1", "v1 Client") -#define v2Image() baseImage("v2", "v2 Client") -#define relayImage() baseImage("relay", "Relay Connection", false, false) -#define html5Image() baseImage("html5", "HTTP / HTML5 Client") -#define flashImage() baseImage("flash", "Flash Client") -#define icecastImage() baseImage("icecast", "Icecast Client / Relay") -#define vlcImage() baseImage("vlc", "VLC Client") -#define waImage() baseImage("wa", "Winamp Client") -#define scImage() baseImage("", "Shoutcast Client / Relay") -#define iOSImage() baseImage("", "iOS Client") -#define curlImage() baseImage("curl", "cURL / libcurl Based Client") -#define radionomyImage() baseImage("radionomy", "Radionomy Stats Collector") -#define fb2kImage() baseImage("fb2k", "Foobar2000 Client") -#define rokuImage() baseImage("roku", "Roku Streaming Player") -#define WiiMCImage() baseImage("v1", "Wii Media Centre Player") -#define synologyImage() baseImage("synology", "Audio Station (Synology) Player") -#define appleImage() baseImage("apple", "Apple Device / OS / Client") -#define iTunesImage() baseImage("itunes", "iTunes Client") -#define wmpImage() baseImage("wmp", "Windows Media Player Client") -#define chromeImage() baseImage("chrome", "Chrome Web Browser") -#define safariImage() baseImage("safari", "Safari Web Browser") -#define ieImage() baseImage("ie", "Internet Explorer Web Browser") -#define firefoxImage() baseImage("firefox", "Firefox Web Browser") - -utf8 advertImage(const streamData::streamID_t sid, const int group, const size_t count) -{ - if (streamData::knownAdvertGroup(sid, group)) - { - if (count > 0) - { - return baseImage("adplayed", (tos(count) + " Advert Breaks Have Been Played\nAdvert Group: " + tos(group)), false, false); - } - return baseImage("adavail", ("Waiting For First Advert Break To Play\nAdvert Group: " + tos(group)), false, false); - } - if (count > 0) - { - return baseImage("", (tos(count) + " Advert Breaks Have Been Played\nNo Applicable " - "Adverts Currently Available\nAdvert Group: " + tos(group)), false, false); - } - - return baseImage("noadavail", ("No Applicable Adverts Available\nAdvert Group: " + tos(group)), false, false); -} - -utf8 getClientImage(const streamData::source_t type) -{ - return ((type & streamData::RADIONOMY) ? radionomyImage() : - ((type & streamData::FLV) ? flashImage() : - ((type & streamData::CURL_TOOL) ? curlImage() : - ((type & streamData::HTTP) ? html5Image() : - //((type & streamData::M4A) ? m4aImage() : - ((type & streamData::SHOUTCAST2) ? ((type & streamData::RELAY) ? scImage() : waImage()) : - ((type & streamData::ICECAST) ? icecastImage() : - ((type & streamData::VLC) ? vlcImage() : - ((type & streamData::WINAMP) ? waImage() : - ((type & streamData::APPLE) ? appleImage() : - ((type & streamData::ITUNES) ? iTunesImage() : - ((type & streamData::WMP) ? wmpImage() : - ((type & streamData::ROKU) ? rokuImage() : - ((type & streamData::WIIMC) ? WiiMCImage() : - ((type & streamData::SYNOLOGY) ? synologyImage() : - ((type & streamData::CHROME) ? chromeImage() : - ((type & streamData::SAFARI) ? safariImage() : - ((type & streamData::IE) ? ieImage() : - ((type & streamData::FIREFOX) ? firefoxImage() : - ((type & streamData::MPLAYER) ? mplayerImage() : - ((type & streamData::PS) ? psImage() : - ((type & streamData::RADIO_TOOLBOX) ? radioToolboxImage() : - ((type & streamData::HTML5) ? html5Image() : - ((type & streamData::WARNING) ? warningImage() : - ((type & streamData::SC_IRADIO) ? iOSImage() : - ((type & streamData::FB2K) ? fb2kImage() : v1Image() - ))))))))))))))))))))))))) + - ((type & streamData::RELAY) ? relayImage() : ""); -} - -/* - Handles all HTTP requests to admin.cgi -*/ - -protocol_admincgi::protocol_admincgi(const socketOps::tSOCKET s, const streamData::streamID_t sid, const bool no_sid, - const bool zero_sid, const utf8 &clientLogString, - const uniString::utf8 &password, const uniString::utf8 &referer, - const uniString::utf8 &hostIP, const uniString::utf8 &userAgent, - const protocol_HTTPStyle::HTTPRequestInfo &httpRequestInfo) throw(std::exception) - : runnable(s), m_noSID(no_sid), m_zeroSID(zero_sid), - m_saveLogFile(0), m_clientLogString(clientLogString), - m_httpRequestInfo(httpRequestInfo), m_password(password), - m_referer(referer), m_hostIP(hostIP), m_userAgent(userAgent), - m_sid(sid), m_state(&protocol_admincgi::state_ConfirmPassword), - m_nextState(0), m_outBuffer(0), m_outBufferSize(0), - m_tailLogFile(false), lastChar(-1), inMsg(false), - first(false), m_logFile(0) -{ - memset(&m_stream, 0, sizeof(m_stream)); - - // check for updates weekly from the last update - // so we're taking into account manual checks... - if ((m_lastActivityTime - last_update_check) > 604800) - { - checkVersion(m_lastActivityTime); - } - - DEBUG_LOG(utf8(LOGNAME) + __FUNCTION__); -} - -protocol_admincgi::~protocol_admincgi() throw() -{ - DEBUG_LOG(utf8(LOGNAME) + __FUNCTION__); - - socketOps::forgetTCPSocket(m_socket); - if (m_logFile) - { - ::fclose(m_logFile); - m_logFile = 0; - } -} - -void protocol_admincgi::timeSlice() throw(exception) -{ - (this->*m_state)(); -} - -void protocol_admincgi::state_Close() throw(exception) -{ - m_result.done(); -} - -// send buffer text -void protocol_admincgi::state_Send() throw(exception) -{ - if (sendDataBuffer(DEFAULT_CLIENT_STREAM_ID, m_outBuffer, m_outBufferSize, m_clientLogString)) - { - m_state = m_nextState; - } -} - -void protocol_admincgi::sendMessageAndClose(const utf8 &msg) throw() -{ - m_outMsg = msg; - m_outBuffer = m_outMsg.c_str(); - bandWidth::updateAmount(bandWidth::PRIVATE_WEB, (m_outBufferSize = (int)m_outMsg.size())); - m_state = &protocol_admincgi::state_Send; - m_nextState = &protocol_admincgi::state_Close; - m_result.write(); - m_result.run(); -} - -/// update the metatdata in the shoutcast ring buffer -void protocol_admincgi::state_UpdateMetadata() throw(exception) -{ - DEBUG_LOG(utf8(LOGNAME) + __FUNCTION__); - - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(m_sid, info, extra); - - utf8 titleMsg, urlMsg, djMsg, nextMsg; - - if (!m_updinfoSong.empty()) - { - // use this as a way to try to ensure we've got a utf-8 - // encoded title to improve legacy source title support - if (!m_updinfoSong.isValid()) - { - m_updinfoSong = asciiToUtf8(m_updinfoSong.toANSI(true)); - } - - if (streamData::validateTitle(m_updinfoSong)) - { - titleMsg = ("[ADMINCGI sid=" + tos(m_sid) + "] Title updated [" + m_updinfoSong + "]"); - } - else - { - WLOG("Title update rejected - value not allowed: " + m_updinfoSong, LOG_NAME, m_sid); - m_updinfoSong = info.m_currentSong; - } - } - else - { - if (!info.m_currentSong.empty()) - { - titleMsg = ("[ADMINCGI sid=" + tos(m_sid) + "] Title cleared"); - } - } - - if (!m_updinfoURL.empty()) - { - urlMsg = ("[ADMINCGI sid=" + tos(m_sid) + "] Song url updated [" + m_updinfoURL + "]"); - } - else - { - if (!info.m_currentURL.empty()) - { - // TODO if there's a custom image then indicate using it or do not show this - urlMsg = ("[ADMINCGI sid=" + tos(m_sid) + "] Song url cleared"); - } - } - - if (!m_updinfoDJ.empty()) - { - djMsg = ("[ADMINCGI sid=" + tos(m_sid) + "] DJ name updated [" + m_updinfoDJ + "]"); - } - else - { - if (!info.m_streamUser.empty()) - { - djMsg = ("[ADMINCGI sid=" + tos(m_sid) + "] DJ name cleared"); - } - } - - if (!m_updinfoNext.empty()) - { - // use this as a way to try to ensure we've got a utf-8 - // encoded title to improve legacy source title support - if (!m_updinfoNext.isValid()) - { - m_updinfoNext = asciiToUtf8(m_updinfoNext.toANSI(true)); - } - - if (streamData::validateTitle(m_updinfoNext)) - { - titleMsg = ("[ADMINCGI sid=" + tos(m_sid) + "] Next title updated [" + m_updinfoNext + "]"); - } - else - { - WLOG("[ADMINCGI sid=" + tos(m_sid) + "] Next title update rejected - value not allowed: " + m_updinfoNext); - m_updinfoNext = info.m_comingSoon; - } - } - else - { - if (!info.m_comingSoon.empty()) - { - nextMsg = ("[ADMINCGI sid=" + tos(m_sid) + "] Next title cleared"); - } - } - - streamData *sd = streamData::accessStream(m_sid); - if (sd) - { - utf8 sourceIdent = (!m_userAgent.empty() ? m_userAgent : utf8("Legacy / Unknown")); - sd->updateSourceIdent(sourceIdent, sd->isRelayStream(m_sid)); - sd->addSc1MetadataAtCurrentPosition(LOGNAME, m_updinfoSong, m_updinfoURL, m_updinfoNext); - sd->updateStreamUser(m_updinfoDJ); - // this will call streamData::releaseStream(..) - streamData::streamClientLost(LOGNAME, sd, m_sid); - - // we'll output any earlier generated messages now that we've sent - // the details to be used as otherwise they were being reported as - // ok which if there was an issue (e.g. bad sid#) was confusing - if (!titleMsg.empty()) - { - ILOG(titleMsg, LOG_NAME, m_sid); - } - if (!nextMsg.empty()) - { - ILOG(nextMsg, LOG_NAME, m_sid); - } - if (!urlMsg.empty()) - { - ILOG(urlMsg, LOG_NAME, m_sid); - } - if (!djMsg.empty()) - { - ILOG(djMsg, LOG_NAME, m_sid); - } - } - else - { - WLOG("[ADMINCGI sid=" + tos(m_sid) + "] Metadata update rejected as the stream does not exist", LOG_NAME, m_sid); - } - - m_updinfoSong.clear(); - m_updinfoURL.clear(); - m_updinfoDJ.clear(); - - sendMessageAndClose(MSG_200); -} - -/// update the metatdata in the shoutcast ring buffer -void protocol_admincgi::state_UpdateXMLMetadata() throw(exception) -{ - DEBUG_LOG(utf8(LOGNAME) + __FUNCTION__); - - if (!m_updinfoSong.empty()) - { - ILOG("XML title update [" + m_updinfoSong + "]", LOG_NAME, m_sid); - streamData *sd = streamData::accessStream(m_sid); - if (sd) - { - vector<__uint8> assembledData; - assembledData.insert(assembledData.end(), m_updinfoSong.begin(), m_updinfoSong.end()); - utf8 sourceIdent = (!m_userAgent.empty() ? m_userAgent : utf8("Legacy / Unknown")); - sd->updateSourceIdent(sourceIdent); - sd->addUvoxMetadataAtCurrentPosition(MSG_METADATA_XML_NEW, assembledData); - // this will call streamData::releaseStream(..) - streamData::streamClientLost(LOGNAME, sd, m_sid); - } - else - { - WLOG("XML title update rejected as stream #" + tos(m_sid) + " does not exist", LOG_NAME, m_sid); - } - m_updinfoSong.clear(); - m_updinfoURL.clear(); - } - - sendMessageAndClose(MSG_200); -} - -void protocol_admincgi::state_ConfirmPassword() throw(std::exception) -{ - DEBUG_LOG(utf8(LOGNAME) + __FUNCTION__); - - // this will see if we've been refered from the base admin.cgi and will allow through - // if the password / auth matches with the key admin account so the page is useable. - utf8::size_type pos; - if ((pos = m_referer.rfind(utf8("admin.cgi"))) != utf8::npos) - { - m_referer = m_referer.substr(pos); - } - - const utf8& mode = mapGet(m_httpRequestInfo.m_QueryParameters, "mode", (utf8)""); - const bool updinfo = (mode == "updinfo"); - const bool viewxml = (mode == "viewxml"); - const bool viewjson = (mode == "viewjson"); - const bool _register = (mode == "register"); - - // on the root admin summary page we can only allow referer admin through if looking at the stats - const bool adminRefer = (m_referer.find(utf8("admin.cgi")) == 0 || m_referer.find(utf8("admin.cgi?sid=0")) == 0); - int okReferer = (adminRefer && (viewxml || viewjson || _register)); - - // on the root admin summary page we can check if it's an authhash action and allow - // through if things match up + also allow updinfo (not ideal but maintains legacy) - if ((!okReferer && ((mode == "manualauthhash") || _register)) || updinfo) - { - if (!m_referer.empty()) - { - okReferer = (m_referer.find(utf8("admin.cgi?sid=" + tos(m_sid) + "&mode=")) != utf8::npos); - } - } - - DEBUG_LOG(LOGNAME "Referrer status: " + tos(okReferer)); - - // fixed in Build 18 to revert to the master passwords if there's nothing for the stream - utf8 streamPassword = gOptions.stream_password(m_sid); - if (!gOptions.read_stream_password(m_sid) && streamPassword.empty()) - { - streamPassword = gOptions.password(); - } - - utf8 streamAdminPassword = gOptions.stream_adminPassword(m_sid); - if (!gOptions.read_stream_adminPassword(m_sid) && streamAdminPassword.empty()) - { - streamAdminPassword = gOptions.adminPassword(); - } - - // this is so we can allow source password connections access to the - // mode=viewxml&page=1 (/stats) and mode=viewxml&page=4 (/played) so - // we maintain compatibility with 1.x DNAS which only had these ones - int page = 0; - bool compat_mode = false; - if (viewxml || viewjson) - { - page = mapGet(m_httpRequestInfo.m_QueryParameters, "page", (int)page); - // this will act like /stats or / played (or both - // if page=0)so as to better emulate the 1.x DNAS - if ((page == 0) || (page == 1) || (page == 4)) - { - compat_mode = true; - } - } - - bool proceed = (((!streamPassword.empty() && (updinfo || compat_mode) && (m_password == streamPassword)) || - (!streamAdminPassword.empty() && (m_password == streamAdminPassword)) || - (!gOptions.adminPassword().empty() && (m_password == gOptions.adminPassword())))); - - DEBUG_LOG(LOGNAME "Password status: " + tos(proceed)); - - if (proceed) - { - const streamData::streamID_t this_sid = (m_zeroSID || m_noSID ? 0 : m_sid); - const utf8& p1 = mapGet(m_httpRequestInfo.m_QueryParameters, mode, (utf8)""); - DEBUG_LOG(LOGNAME "Requested mode: " + (!mode.empty() ? mode : "Not Specified")); - if (updinfo) - { - m_updinfoSong = stripWhitespace(mapGet(m_httpRequestInfo.m_QueryParameters, "song", (utf8)"")); - m_updinfoURL = stripWhitespace(mapGet(m_httpRequestInfo.m_QueryParameters, "url", (utf8)"")); - m_updinfoDJ = stripWhitespace(mapGet(m_httpRequestInfo.m_QueryParameters, "dj", (utf8)"")); - m_updinfoNext = stripWhitespace(mapGet(m_httpRequestInfo.m_QueryParameters, "next", (utf8)"")); - m_state = ((m_updinfoSong.find(utf8("streamUpdate(m_sid, (utf8)"", sd->streamMaxUser(), - sd->streamMaxBitrate(), sd->streamMinBitrate()); - sd->releaseStream(); - } - } - } - else - { - connected = true; - - // sanity checks to ensure that we're not re-adding when there is one, etc - streamData::streamInfo info; - streamData::extraInfo extra; - if (!streamData::getStreamInfo(m_sid, info, extra)) - { - info.m_authHash = gOptions.stream_authHash(m_sid); - } - - if (connected == true || extra.isRelay) - { - mode_register(m_sid, info); - } - } - - if (connected == false) - { - sendMessageAndClose(redirect("admin.cgi?sid=" + tos(this_sid), SHRINK)); - } - } - } - else if (mode == "listeners") - { - mode_listeners(this_sid); - } - else if (mode == "kicksrc") - { - if (m_noSID) - { - if (adminRefer) - { - sendMessageAndClose(redirect("index.html", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - else - { - // kick source off system - streamData::killStreamSource(m_sid); - - if (!m_referer.empty()) - { - utf8 check = ("admin.cgi?sid=" + tos(m_sid)); - // if the referer is the server summary page then we need to go back to it - sendMessageAndClose(redirect((m_referer == check ? check : "admin.cgi?sid=0"), SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - } - else if (mode == "kickdst" && (!p1.empty())) - { - if (m_noSID) - { - if (adminRefer) - { - sendMessageAndClose(redirect("index.html", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - else - { - mode_kickdst(m_sid, p1); - } - } - else if (mode == "viewban") - { - mode_viewban(this_sid); - } - else if (mode == "bandst" && (!p1.empty())) - { - const int mask = mapGet(m_httpRequestInfo.m_QueryParameters, "banmsk", (int)255); - mode_ban(this_sid, p1, mask); - } - else if (mode == "banip") - { - const utf8 &ip1 = mapGet(m_httpRequestInfo.m_QueryParameters, "ip1", (utf8)""), - &ip2 = mapGet(m_httpRequestInfo.m_QueryParameters, "ip2", (utf8)""), - &ip3 = mapGet(m_httpRequestInfo.m_QueryParameters, "ip3", (utf8)""), - &ip4 = mapGet(m_httpRequestInfo.m_QueryParameters, "ip4", (utf8)""), - &mask = mapGet(m_httpRequestInfo.m_QueryParameters, "banmsk", (utf8)""); - if (ip1.empty() || ip2.empty() || ip3.empty() || ip4.empty() || mask.empty()) - { - if ((m_referer != utf8("admin.cgi?sid=" + tos(this_sid) + "&mode=viewban")) && - (m_referer != utf8("admin.cgi?mode=viewban"))) - { - sendMessageAndClose(MSG_STD200 + utf8(!HEAD_REQUEST ? "" - "Shoutcast Server" - "Invalid resource" : "")); - } - else - { - if (!m_referer.empty()) - { - sendMessageAndClose(redirect("admin.cgi?sid=" + tos(this_sid) + "&mode=viewban", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - } - else - { - mode_ban(this_sid, (ip1 + "." + ip2 + "." + ip3 + "." + ip4), strtol((const char *)mask.c_str(),0,10)); - } - } - else if (mode == "unbandst") - { - const utf8 &ip = mapGet(m_httpRequestInfo.m_QueryParameters, "bandst", (utf8)""), - &mask = mapGet(m_httpRequestInfo.m_QueryParameters, "banmsk", (utf8)""); - if (ip.empty() || mask.empty()) - { - if ((m_referer != utf8("admin.cgi?sid=" + tos(this_sid) + "&mode=viewban")) && - (m_referer != utf8("admin.cgi?mode=viewban"))) - { - sendMessageAndClose(MSG_STD200 + utf8(!HEAD_REQUEST ? "" - "Shoutcast Server" - "Invalid resource" : "")); - } - else - { - if (!m_referer.empty()) - { - sendMessageAndClose(redirect("admin.cgi?sid=" + tos(this_sid) + "&mode=viewban", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - } - else - { - mode_unban(this_sid, ip, strtol((const char *)mask.c_str(), 0, 10)); - } - } - else if (mode == "viewrip") - { - mode_viewrip(this_sid); - } - else if (mode == "ripip") - { - const utf8 &ip1 = mapGet(m_httpRequestInfo.m_QueryParameters, "ip1", (utf8)""), - &ip2 = mapGet(m_httpRequestInfo.m_QueryParameters, "ip2", (utf8)""), - &ip3 = mapGet(m_httpRequestInfo.m_QueryParameters, "ip3", (utf8)""), - &ip4 = mapGet(m_httpRequestInfo.m_QueryParameters, "ip4", (utf8)""); - if (ip1.empty() || ip2.empty() || ip3.empty() || ip4.empty()) - { - // see if we've got a host add attempt and handle as appropriately - if (m_hostIP.empty()) - { - if ((m_referer != utf8("admin.cgi?sid=" + tos(m_sid) + "&mode=viewrip")) && - (m_referer != utf8("admin.cgi?mode=viewrip"))) - { - sendMessageAndClose(MSG_STD200 + utf8(!HEAD_REQUEST ? "" - "Shoutcast Server" - "Invalid resource" : "")); - } - else - { - if (!m_referer.empty()) - { - sendMessageAndClose(redirect("admin.cgi?sid=" + tos(m_sid) + "&mode=viewrip", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - } - else - { - const utf8 &raw = mapGet(m_httpRequestInfo.m_QueryParameters, "ripdstraw", (utf8)""); - mode_rip(this_sid, m_hostIP, raw); - } - } - else - { - const utf8 &raw = mapGet(m_httpRequestInfo.m_QueryParameters, "ripdstraw", (utf8)""); - mode_rip(this_sid, (ip1 + "." + ip2 + "." + ip3 + "." + ip4), raw); - } - } - else if (mode == "unripdst") - { - const utf8 &ip = mapGet(m_httpRequestInfo.m_QueryParameters, "ripdst", (utf8)""), - &raw = mapGet(m_httpRequestInfo.m_QueryParameters, "ripdstraw", (utf8)""); - if (!isAddress(ip)) - { - if ((m_referer != utf8("admin.cgi?sid=" + tos(m_sid) + "&mode=viewrip")) && - (m_referer != utf8("admin.cgi?mode=viewrip"))) - { - sendMessageAndClose(MSG_STD200 + utf8(!HEAD_REQUEST ? "" - "Shoutcast Server" - "Invalid resource" : "")); - } - else - { - if (!m_referer.empty()) - { - sendMessageAndClose(redirect("admin.cgi?sid=" + tos(m_sid) + "&mode=viewrip", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - } - else - { - mode_unrip(this_sid, ip, raw); - } - } - else if (mode == "ripdst" && (!p1.empty())) - { - const utf8 &raw = mapGet(m_httpRequestInfo.m_QueryParameters, "ripdstraw", (utf8)""); - mode_rip(this_sid, p1, raw); - } - else if (mode == "viewagent") - { - mode_viewagent(this_sid); - } - else if (mode == "unagent") - { - const utf8 &agent = mapGet(m_httpRequestInfo.m_QueryParameters, "agent", (utf8)""); - if (agent.empty()) - { - if ((m_referer != utf8("admin.cgi?sid=" + tos(m_sid) + "&mode=viewagent")) && - (m_referer != utf8("admin.cgi?mode=viewagent"))) - { - sendMessageAndClose(MSG_STD200 + utf8(!HEAD_REQUEST ? "" - "Shoutcast Server" - "Invalid resource" : "")); - } - else - { - sendMessageAndClose(redirect("admin.cgi?sid=" + tos(m_sid) + "&mode=viewagent", SHRINK)); - } - } - else - { - mode_unagent(this_sid, agent); - } - } - else if (mode == "agent") - { - const utf8 &agent = mapGet(m_httpRequestInfo.m_QueryParameters, "agent", (utf8)""); - mode_agent(this_sid, agent); - } - else if (mode == "resetxml") - { - if (m_noSID) - { - if (adminRefer) - { - sendMessageAndClose(redirect("index.html", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - else - { - stats::resetStats(m_sid); - if (!m_referer.empty()) - { - sendMessageAndClose(redirect("admin.cgi?sid=" + tos(m_sid), SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - } - else if (mode == "clearcache") - { - // TODO consider clearing out the intro / backup files as ell as part of this... - - // clear out all cached resource copies - gOptions.m_crossdomainStr.clear(); - gOptions.m_crossdomainStrGZ.clear(); - gOptions.m_shoutcastSWFStr.clear(); - gOptions.m_shoutcastSWFStrGZ.clear(); - gOptions.m_robotsTxtBody.clear(); - gOptions.m_robotsTxtBodyGZ.clear(); - - gOptions.m_faviconBody.clear(); - gOptions.m_faviconBodyGZ.clear(); - gOptions.m_favIconTime = 0; - - gOptions.m_styleCustomStr.clear(); - gOptions.m_styleCustomStrGZ.clear(); - gOptions.m_styleCustomHeaderTime = 0; - - DeleteAllCaches(); - - last_update_check = 0; - - ILOG(LOGNAME "Cleared resource cache(s)."); - if (adminRefer) - { - sendMessageAndClose(redirect("admin.cgi", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - else if (mode == "bannedlist") - { - reloadBanLists(); - if (adminRefer) - { - sendMessageAndClose(redirect("admin.cgi", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - else if (mode == "reservelist") - { - reloadRipLists(); - if (adminRefer) - { - sendMessageAndClose(redirect("admin.cgi", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - else if (mode == "adminlist") - { - reloadAdminAccessList(); - if (adminRefer) - { - sendMessageAndClose(redirect("admin.cgi", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - else if (mode == "useragentlist") - { - reloadAgentLists(); - if (adminRefer) - { - sendMessageAndClose(redirect("admin.cgi", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - else if (mode == "reload") - { - const int force = mapGet(m_httpRequestInfo.m_QueryParameters, "force", (int)0); - if (adminRefer) - { - sendMessageAndClose(redirect((reloadConfig(force) == true ? "admin.cgi?sid=0&refresh=3" : "admin.cgi?sid=0"), SHRINK)); - } - else - { - reloadConfig(force); - sendMessageAndClose(MSG_200); - } - } - else if (mode == "viewlog") - { - if (m_noSID) - { - const utf8 &server = mapGet(m_httpRequestInfo.m_QueryParameters, "server", (utf8)""); - if (!server.empty() && ((server == logId) || (server == logTailId))) - { - mode_viewlog(m_sid, (p1 == "tail"), (p1 == "save"), true); - } - else - { - sendMessageAndClose(redirect("index.html", SHRINK)); - } - } - else - { - mode_viewlog(m_sid, (p1 == "tail"), (p1 == "save"), false); - } - } - else if (mode == "history") - { - if (m_noSID) - { - if (adminRefer) - { - sendMessageAndClose(redirect("index.html", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - else - { - const utf8 &type = mapGet(m_httpRequestInfo.m_QueryParameters, "type", (utf8)""); - const bool json = (type == "json"), xml = (type == "xml"); - if (!json && !xml) - { - mode_history(m_sid); - } - else - { - utf8 header, body; - if (json) - { - const utf8& callback = mapGet(m_httpRequestInfo.m_QueryParameters, "callback", (utf8)""); - body = protocol_HTTPStyle::getPlayedJSON(m_sid, header, callback, true); - } - else - { - body = protocol_HTTPStyle::getPlayedXML(m_sid, header, true); - } - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); - } - } - } - else if (mode == "art") - { - if (m_noSID) - { - if (adminRefer) - { - sendMessageAndClose(redirect("index.html", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - else - { - mode_art(m_sid, (p1 == "playing")); - } - } - else if (mode == "manualauthhash") - { - bool handled = false; - const utf8 &authhash = mapGet(m_httpRequestInfo.m_QueryParameters, "authhash", (utf8)""); - // make sure that we're only allow valid values - if (authhash.empty() || yp2::isValidAuthhash(authhash)) - { - bool idHandled = false; - if (gOptions.editConfigFileEntry(m_sid, gOptions.confFile(), authhash, "", - true, handled, idHandled, true) == false) - { - handled = false; - } - - // changed in b69 to force the change through even if there is a config saving issue - // as there are cases where the authhash is gone but only updating on success would - // end up in the inability to start things over again e.g. with CentroCast v3 quirks - gOptions.setOption(utf8("streamauthhash_" + tos(m_sid)), authhash); - } - - streamData *sd = streamData::accessStream(m_sid); - if (sd) - { - if (sd->isSourceConnected(m_sid)) - { - utf8 oldAuthhash = sd->streamAuthhash(); - sd->streamUpdate(m_sid, authhash, sd->streamMaxUser(), - sd->streamMaxBitrate(), sd->streamMinBitrate()); - - ILOG(gOptions.logSectionName() + "Changed authhash for stream #" + - tos(m_sid) + " to " + (authhash.empty() ? "empty" : authhash) + - " [was " + (oldAuthhash.empty() ? "empty" : oldAuthhash) + "]"); - } - sd->releaseStream(); - } - - // now attempt to update internal states as appropriate if all went ok - if (handled == true) - { - sendMessageAndClose("HTTP/1.1 200 OK\r\n" - "Content-Type:text/plain\r\n" - "Content-Length:5\r\n" - "Cache-Control:no-cache\r\n" - "Access-Control-Allow-Origin:*\r\n" - "Connection:close\r\n\r\n200\r\n"); - } - else - { - utf8 message = "Error saving changes to the configuration file.
" - "Check that you have write access and the
" - "specified configuration file still exists.

" - "The requested authhash change was applied."; - utf8 header = "HTTP/1.1 667\r\n" - "Content-Type:text/plain\r\n" - "Access-Control-Allow-Origin:*\r\n" - "Connection:close\r\n"; - COMPRESS(header, message); - header += "Content-Length:" + tos(message.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? message : "")); - } - } - else if (mode == "rotate") - { - const utf8 &files = mapGet(m_httpRequestInfo.m_QueryParameters, "files", (utf8)""), - &rotateType = (!(files == "log" || files == "w3c") ? "all " : (files == "log" ? "": "W3C ")); - ILOG(LOGNAME "Rotating " + rotateType + "log file(s)"); - - if ((files == "log") || (files == "")) - { - ROTATE; - printUpdateMessage(); - if (m_logFile) - { - ::fclose(m_logFile); - m_logFile = 0; - } - } - - // and now rotate the w3c logs (going upto the configured number of old copies to be like the log rotate) - rotatew3cFiles(files); - - ILOG(LOGNAME "Rotated " + rotateType + "log file(s) [PID: " + tos(getpid()) + "]"); - if (adminRefer) - { - sendMessageAndClose(redirect("admin.cgi", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - else if (mode == "startrelay") - { - if (m_noSID) - { - if (adminRefer) - { - sendMessageAndClose(redirect("index.html", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - else - { - // only attempt a source relay connection if it is not signaled - // as active or pending to prevent multiple attempts being run. - bool noEntry = false, active = (streamData::isRelayActive(m_sid, noEntry) == 1); - if (!active) - { - config::streamConfig stream; - if (gOptions.getStreamConfig(stream, m_sid)) - { - restartRelay(stream); - } - } - - if (!m_referer.empty()) - { - utf8 check = ("admin.cgi?sid=" + tos(m_sid)); - // if the referer is the server summary page then we need to go back to it - sendMessageAndClose(redirect((m_referer == check ? check : "admin.cgi?sid=0") + - (!active ? "&refresh=3" : ""), SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - } - else if (mode == "startrelays") - { - bool refresh = false; - config::streams_t streams; - gOptions.getStreamConfigs(streams); - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - if (!(*i).second.m_relayUrl.url().empty() && !streamData::isSourceConnected((*i).first)) - { - // only attempt a source relay connection if it is not signaled - // as active or pending to prevent multiple attempts being run. - bool noEntry = false, active = (streamData::isRelayActive((*i).first, noEntry) == 1); - if (!active) - { - ILOG(gOptions.logSectionName() + "Starting source for stream #" + tos((*i).first) + "."); - restartRelay((*i).second); - refresh = true; - } - } - } - - if (adminRefer) - { - sendMessageAndClose(redirect("admin.cgi?sid=0" + (refresh ? "&refresh=3" : (utf8)""), SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - else if (mode == "kicksources") - { - bool refresh = false; - streamData::streamIDs_t streamIds = streamData::getStreamIds(true); - if (!streamIds.empty()) - { - for (streamData::streamIDs_t::const_iterator i = streamIds.begin(); i != streamIds.end(); ++i) - { - // kick source off system - streamData::killStreamSource((*i)); - refresh = true; - } - } - - if (adminRefer) - { - sendMessageAndClose(redirect("admin.cgi?sid=0" + (refresh ? "&refresh=1" : (utf8)""), SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - else if(mode == "bandwidth") - { - const utf8 &type = mapGet(m_httpRequestInfo.m_QueryParameters, "type", (utf8)""); - const bool json = (type == "json"), xml = (type == "xml"); - - if (!json && !xml) - { - const int refresh = mapGet(m_httpRequestInfo.m_QueryParameters, "refresh", 0); - mode_bandwidth_html(refresh); - } - else - { - if (json) - { - const utf8 &callback = mapGet(m_httpRequestInfo.m_QueryParameters, "callback", (utf8)""); - mode_bandwidth_json(callback); - } - else - { - mode_bandwidth_xml(); - } - } - } - else if (mode == "ypstatus") - { - const utf8 &type = mapGet(m_httpRequestInfo.m_QueryParameters, "type", (utf8)""); - if ((type == "json")) - { - const utf8 &callback = mapGet(m_httpRequestInfo.m_QueryParameters, "callback", (utf8)""); - mode_ypstatus_json(callback); - } - else - { - mode_ypstatus_xml(); - } - } - else if (mode == "sources") - { - mode_sources(m_hostIP); - } - else if (mode == "adgroups") - { - mode_adgroups(); - } - else if (mode == "debug") - { - const utf8 &option = mapGet(m_httpRequestInfo.m_QueryParameters, "option", (utf8)""); - if (!option.empty() && !adminRefer) - { - // prevent direct access to being able to edit this - // and force a redirection to the non-param version - sendMessageAndClose(redirect("admin.cgi?mode=debug", SHRINK)); - return; - } - - const utf8 &on_off = mapGet(m_httpRequestInfo.m_QueryParameters, "on", (utf8)""); - mode_debug(option, (on_off == "true"), adminRefer); - } - else if (mode == "help") - { - mode_help(); - } - else if (mode == "config") - { - mode_config(); - } -#if 0 - else if (mode == "logs") - { - mode_logs(result); - } -#endif - else if (mode == "version") - { - // only allow from the admin page to avoid possible spamming sttempts - if (adminRefer) - { - checkVersion(m_lastActivityTime); - sendMessageAndClose(redirect("admin.cgi?sid=0&refresh=-3", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } - else - { - if (m_noSID) - { - // do a sanity check so that we're only accessing this with the true adminpassword - if (m_zeroSID) - { - mode_summary(mapGet(m_httpRequestInfo.m_QueryParameters, "refresh", 0)); - } - // not matching the master password so show the simple summary - else - { - sendMessageAndClose(redirect("index.html", SHRINK)); - } - } - else - { - const int refresh = mapGet(m_httpRequestInfo.m_QueryParameters, "refresh", 0); - mode_none(m_sid, refresh); - } - } - } - else - { - sendMessageAndClose(MSG_AUTHFAILURE401 + utf8(!HEAD_REQUEST ? - "UnauthorizedShoutcast " - "Administrator" : "")); - } -} - -void protocol_admincgi::state_SendFileHeader() throw(std::exception) -{ - if ((!m_saveLogFile && SHRINK) && - compressDataStart(m_logFileBodyPrefix, &m_stream, (Bytef*)"sc_serv.log\0", false)) - { - m_logFileHeader += "Content-Encoding:gzip\r\n"; - } - m_logFileHeader += "\r\n"; - - m_outMsg = m_logFileHeader + (!m_saveLogFile ? tohex(m_logFileBodyPrefix.size()) + "\r\n" + m_logFileBodyPrefix + "\r\n" : ""); - m_outBuffer = m_outMsg.c_str(); - bandWidth::updateAmount(bandWidth::PRIVATE_WEB, (m_outBufferSize = (int)m_outMsg.size())); - m_state = &protocol_admincgi::state_Send; - m_nextState = &protocol_admincgi::state_SendFileContents; - m_result.write(); - - if (m_tailLogFile) - { - m_result.read(fileno(m_logFile)); - } -} - -void protocol_admincgi::state_SendFileFooter() throw(std::exception) -{ - if (SHRINK) - { - compressDataCont(m_logFileBodyFooter, &m_stream); - } - m_logFileBodyFooter = tohex(m_logFileBodyFooter.size()) + "\r\n" + m_logFileBodyFooter + "\r\n"; - m_outBuffer = m_logFileBodyFooter.c_str(); - bandWidth::updateAmount(bandWidth::PRIVATE_WEB, (m_outBufferSize = (int)m_logFileBodyFooter.size())); - m_state = &protocol_admincgi::state_Send; - m_nextState = &protocol_admincgi::state_SendFileEnd; - m_result.write(); -} - -void protocol_admincgi::state_SendFileEnd() throw(std::exception) -{ - strncpy((char*)&(m_logFileBuffer[0]), "0\r\n\r\n", 1024); - m_outBuffer = &(m_logFileBuffer[0]); - m_outBufferSize = 5; - m_nextState = &protocol_admincgi::state_Close; - bandWidth::updateAmount(bandWidth::PRIVATE_WEB, m_outBufferSize); - compressDataEnd(&m_stream); - - m_state = &protocol_admincgi::state_Send; - m_nextState = &protocol_admincgi::state_Close; - m_result.write(); -} - -// this will only be receiving an already converted -// string so no need to do the commented part again -utf8 protocol_admincgi::escapeText(const std::vector &s) throw() -{ - utf8 result; - result.resize(0); - bool inHead = false; - int headCount = 0; - const size_t amt = s.size(); - - for (size_t x = 0; x < amt; ++x) - { - if ((s[x] == '*') && (((x + 1) < amt) && (s[x + 1] == '*'))) - { - inHead = true; - } - else if (s[x] == '\n') - { - if (!inHead) - { - if ((((x + 1) < amt) && isdigit(s[x + 1]))) - { - if (inMsg) - { - result += ""; - } - result += "\n"; - inMsg = false; - } - else - { - if (((x + 1) == amt)) - { - if (inMsg) - { - result += ""; - } - result += "\n"; - inMsg = false; - } - else - { - result += "\n\t\t\t"; - } - } - } - else - { - ++headCount; - } - } - else if ((s[x] == 'D') && - (((x > 0) && (s[x - 1] == '\t')) || - (!x && (lastChar == '\t')))) - { - result += "D"; - inMsg = true; - } - else if ((s[x] == 'E') && - (((x > 0) && (s[x - 1] == '\t')) || - (!x && (lastChar == '\t')))) - { - result += "E"; - inMsg = true; - } - else if ((s[x] == 'W') && - (((x > 0) && (s[x - 1] == '\t')) || - (!x && (lastChar == '\t')))) - { - result += "W"; - inMsg = true; - } - else if ((s[x] == 'U') && - (((x > 0) && (s[x-1] == '\t')) || - (!x && (lastChar == '\t')))) - { - result += "U"; - inMsg = true; - } - else if ((s[x] == 'I') && - (((x > 0) && (s[x-1] == '\t')) || - (!x && (lastChar == '\t')))) - { - if (!inHead) - { - result += "I"; - inMsg = true; - } - } - else - { - if (!inHead) - { - if (s[x] == '<') - { - result += "<"; - } - else if (s[x] == '>') - { - result += ">"; - } - else if (s[x] == '&') - { - result += "&"; - } - else if (s[x] == '\'') - { - result += "'"; - } - else if (s[x] == '"') - { - result += """; - } - else - { - result += s[x]; - } - } - else - { - if (inHead && (headCount > 3) && (s[x] == '\t')) - { - inHead = false; - headCount = 0; - x += 5; - } - } - } - if (!s[x]) - { - break; - } - } - - lastChar = s[amt - 1]; - return result; -} - -void protocol_admincgi::state_SendFileContents() throw(std::exception) -{ - m_logFileBuffer.clear(); - m_logFileBuffer.resize(SEND_SIZE); - const size_t amt = fread(&(m_logFileBuffer[0]), 1, (SEND_SIZE - 1), m_logFile); - if (amt > 0) - { - static utf8 out; - out.clear(); - - if (!m_saveLogFile) - { - m_logFileBuffer.resize(amt); - out = escapeText(m_logFileBuffer); - } - else - { - out = utf8(&(m_logFileBuffer[0]), amt); - } - - if (!out.empty()) - { - if (m_saveLogFile || (SHRINK)) - { - if (m_saveLogFile == 1) - { - if (compressDataStart(out, &m_stream, (Bytef*)m_logFileName.c_str())) - { - m_saveLogFile = 2; - } - } - else - { - compressDataCont(out, &m_stream); - } - } - out = tohex(out.size()) + "\r\n" + out + "\r\n"; - m_outBuffer = out.c_str(); - bandWidth::updateAmount(bandWidth::PRIVATE_WEB, (m_outBufferSize = (int)out.size())); - m_nextState = &protocol_admincgi::state_SendFileContents; - } - else - { - m_nextState = (m_saveLogFile ? &protocol_admincgi::state_SendFileEnd : &protocol_admincgi::state_SendFileFooter); - } - - m_state = &protocol_admincgi::state_Send; - m_result.write(); - - if (m_tailLogFile) - { - m_result.timeout(1); - m_result.read(fileno(m_logFile)); - } - } - else if (ferror(m_logFile) || !m_logFile) - { - m_state = &protocol_admincgi::state_Close; - m_result.run(); - } - else if (feof(m_logFile) && (!m_tailLogFile)) - { - if (m_saveLogFile) - { - static utf8 out; - out.clear(); - compressDataFinish(out, &m_stream); - out = tohex(out.size()) + "\r\n" + out + "\r\n"; - m_outBuffer = out.c_str(); - bandWidth::updateAmount(bandWidth::PRIVATE_WEB, (m_outBufferSize = (int)out.size())); - - m_state = &protocol_admincgi::state_Send; - m_nextState = &protocol_admincgi::state_SendFileEnd; - } - else - { - m_state = &protocol_admincgi::state_SendFileFooter; - } - - m_result.write(); - m_result.run(); - } - else - { - m_result.timeout(10); - } -} - -// display log -void protocol_admincgi::mode_viewlog(const streamData::streamID_t sid, const bool tail, const bool save, const bool server) throw() -{ - if (!save) - { - utf8 headerTitle = utf8(utf8("Server Log") + (tail ? " (Tailing)":"")); - m_logFileHeader = MSG_NO_CLOSE_200; - - m_logFileBodyPrefix += (server ? getServerAdminHeader(headerTitle) : - getStreamAdminHeader(sid, headerTitle)) + getUptimeScript() + - (tail ? "
Showing log output from the current log " - "position and onwards. Click here to view the complete log output or here " - "to save the complete log output. When tailing the log output, there may be " - "a delay before any new log output will appear and it may also stop updating if " - "there is no log activity depending on configured timeouts. Reload the page if this " - "should happens.
" : "") + getIEFlexFix() + - "
";
-
-		// doing to just make sure that the end of the output should be correct
-		m_logFileBodyFooter = "\n
" + getfooterStr(); - m_tailLogFile = tail; - - if (server || !(gOptions.read_stream_adminPassword(sid) && !gOptions.stream_adminPassword(sid).empty())) - { - const utf8 &file = mapGet(m_httpRequestInfo.m_QueryParameters, "file", gOptions.realLogFile()); - - m_logFile = uniFile::fopen(file, "r"); - if (m_logFile) - { - m_logFileName = fileUtil::stripPath(file); - m_logFileName.push_back('\0'); - - if (m_tailLogFile) - { - ::fseek(m_logFile, 0, SEEK_END); - } - } - } - else - { - utf8 body = m_logFileBodyPrefix + "Viewing Not Allowed With Current Permissions" + m_logFileBodyFooter; - COMPRESS(m_logFileHeader, body); - m_logFileHeader += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(m_logFileHeader + (!HEAD_REQUEST ? body : "")); - return; - } - - if (!m_logFile) - { - utf8 body = m_logFileBodyPrefix + "Log File Not Found (" + - stripWhitespace(errMessage()) + ")" + - m_logFileBodyFooter; - COMPRESS(m_logFileHeader, body); - m_logFileHeader += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(m_logFileHeader + (!HEAD_REQUEST ? body : "")); - } - else - { - m_logFileHeader += "Transfer-Encoding:chunked\r\n"; - m_state = &protocol_admincgi::state_SendFileHeader; - m_result.run(); - } - } - else - { - if (server || !(gOptions.read_stream_adminPassword(sid) && !gOptions.stream_adminPassword(sid).empty())) - { - const utf8 &file = mapGet(m_httpRequestInfo.m_QueryParameters, "file", gOptions.realLogFile()); - - m_logFile = uniFile::fopen(file, "r"); - if (m_logFile) - { - m_logFileName = fileUtil::stripPath(file); - m_logFileHeader = "HTTP/1.1 200 OK\r\n" - "Content-Type:application/x-gzip-compressed\r\n" - "Content-Disposition:attachment;filename=\"" + - m_logFileName + ".gz\"\r\n"; - m_saveLogFile = true; - } - } - else - { - sendMessageAndClose(MSG_HTTP403); - return; - } - - if (!m_logFile) - { - sendMessageAndClose(MSG_HTTP404); - } - else - { - m_logFileHeader += "Transfer-Encoding:chunked\r\n"; - m_state = &protocol_admincgi::state_SendFileHeader; - m_result.run(); - } - } -} - -// shown played history (as is also shown on the public pages if enabled) -void protocol_admincgi::mode_history(const streamData::streamID_t sid) throw() -{ - utf8 header = MSG_NO_CLOSE_200, - body = getStreamAdminHeader(sid, "Stream History") + - "
" + - protocol_HTTPStyle::getPlayedBody(sid) + "
" + - getUptimeScript() + getIEFlexFix() + getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -// remove an IP from the rip list -void protocol_admincgi::mode_unrip(const streamData::streamID_t sid, const utf8 &ripAddr, const utf8 &rawIpAddr) throw() -{ - utf8 msg; - try - { - size_t stream_ID = ((gOptions.read_stream_ripFile(sid) && !gOptions.stream_ripFile(sid).empty()) ? sid : 0); - if (isAddress(ripAddr)) - { - bool ret = g_ripList.remove(ripAddr,stream_ID,false), usingRaw = false; - if (!ret && !rawIpAddr.empty()) - { - ret = g_ripList.remove(rawIpAddr,stream_ID,false); - if (ret) usingRaw = true; - } - if (ret) - { - ILOG("[RIP] Removed `" + (!usingRaw ? ripAddr : rawIpAddr) + "' from " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " rip list"); - - if (gOptions.saveRipListOnExit()) - { - if (stream_ID && gOptions.read_stream_ripFile(stream_ID) && !gOptions.stream_ripFile(stream_ID).empty()) - { - g_ripList.save(gOptions.stream_ripFile(stream_ID),stream_ID); - } - else - { - g_ripList.save(gOptions.ripFile(),0); - } - } - - stats::updateRipClients(stream_ID, (!usingRaw ? ripAddr : rawIpAddr), false); - } - else - { - ILOG("[RIP] Unable to remove `" + ripAddr + "' from " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " rip list"); - } - } - else - { - ILOG("[RIP] `" + ripAddr + "' is not a valid value. Skipping removing from the " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " rip list"); - } - - msg = (!m_referer.empty() ? redirect("admin.cgi?sid=" + tos(sid) + (m_referer == "admin.cgi?sid=" + tos(sid) ? "" : "&mode=viewrip"), SHRINK) : MSG_200); - } - catch(const exception &ex) - { - msg = (!m_referer.empty() ? redirect("admin.cgi?sid=" + tos(sid) + (m_referer != utf8("admin.cgi?sid=" + tos(sid) + "&mode=viewrip") ? "" : "&mode=viewrip"), SHRINK) : MSG_200); - ELOG(ex.what()); - } - - sendMessageAndClose(msg); -} - -// add an IP / hostname to the rip list -void protocol_admincgi::mode_rip(const streamData::streamID_t sid, const utf8 &ripAddr, const utf8 &rawIpAddr) throw() -{ - utf8 msg; - try - { - const size_t stream_ID = ((gOptions.read_stream_ripFile(sid) && !gOptions.stream_ripFile(sid).empty()) ? sid : 0); - if (isAddress(ripAddr)) - { - if (!g_ripList.find(ripAddr,stream_ID)) - { - bool added = g_ripList.add(ripAddr,stream_ID, true), usingRaw = false; - if (!added && !rawIpAddr.empty()) - { - if (g_ripList.add(rawIpAddr,stream_ID, false)) - { - usingRaw = true; - } - } - - ILOG("[RIP] Added `" + (!usingRaw ? ripAddr : rawIpAddr) + "' to " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " rip list"); - - if (gOptions.saveRipListOnExit()) - { - if (stream_ID && gOptions.read_stream_ripFile(stream_ID) && !gOptions.stream_ripFile(stream_ID).empty()) - { - g_ripList.save(gOptions.stream_ripFile(stream_ID),stream_ID); - } - else - { - g_ripList.save(gOptions.ripFile(),0); - } - } - stats::updateRipClients(stream_ID, (!usingRaw ? ripAddr : rawIpAddr), true); - } - else - { - ILOG("[RIP] `" + ripAddr + "' already in the " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " rip list"); - } - } - else - { - ILOG("[RIP] `" + ripAddr + "' is not a valid value. Skipping adding to the " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " rip list"); - } - - msg = (!m_referer.empty() ? redirect("admin.cgi?sid=" + tos(sid) + (m_referer == "admin.cgi?sid=" + tos(sid) ? "" : "&mode=viewrip"), SHRINK) : MSG_200); - } - catch(const exception &ex) - { - msg = (!m_referer.empty() ? redirect("admin.cgi?sid=" + tos(sid) + (m_referer != utf8("admin.cgi?sid=" + tos(sid) + "&mode=viewrip") ? "" : "&mode=viewrip"), SHRINK) : MSG_200); - ELOG(ex.what()); - } - - sendMessageAndClose(msg); -} - -// show rip list -void protocol_admincgi::mode_viewrip(const streamData::streamID_t sid) throw() -{ - vector rip_list; - g_ripList.get(rip_list,((gOptions.read_stream_ripFile(sid) && !gOptions.stream_ripFile(sid).empty()) ? sid : 0)); - - utf8 header = MSG_NO_CLOSE_200, - headerTitle = (!sid ? "Server Reserved List" : "Stream Reserved List"), - body = (!sid ? getServerAdminHeader(headerTitle) : getStreamAdminHeader(sid, headerTitle)) + - "" - "" - "" - "" - "
"; - - if (rip_list.empty()) - { - body += " No Reserved Entries
"; - } - else - { - body += " Reserved Entry List:
    "; - for (vector::const_iterator i = rip_list.begin(); i != rip_list.end(); ++i) - { - body += "
  1. " + aolxml::escapeXML((*i).m_numericIP) + "" + - (!(*i).m_hostIP.empty() ? " (" + aolxml::escapeXML((*i).m_hostIP) + ")" : "") + - " - remove"; - } - body += "
"; - } - - body += - "

" - "" - "" - "" - "" - "" - "" - "" - "" - "
Reserve Connection Slot by IP
" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "
Enter the IP address:
(example: 127.0.0.1)
" - "" - "" - "." - "." - "." - "" - "
" - " 
" - "
" - "

" - "" - "" - "" - "" - "" - "" - "" - "" - "
Reserve Connection Slot by Host
" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "
Enter the hostname:
(example: my.example.com)
" - "" - "" - "" - "
" - " 
" - "
" - "
" + - getUptimeScript() + - getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -// show ban lists -void protocol_admincgi::mode_viewban(const streamData::streamID_t sid) throw() -{ - vector ban_list; - g_banList.get(ban_list,((gOptions.read_stream_banFile(sid) && !gOptions.stream_banFile(sid).empty()) ? sid : 0)); - - utf8 header = MSG_NO_CLOSE_200, - headerTitle = (!sid ? "Server Ban List" : "Stream Ban List"), - body = (!sid ? getServerAdminHeader(headerTitle) : getStreamAdminHeader(sid, headerTitle)) + - "" - "" - "" - "" - "
"; - - if (ban_list.empty()) - { - body += " No Banned Entries
"; - } - else - { - body += " Ban Entry List:
    "; - for (vector::const_iterator i = ban_list.begin(); i != ban_list.end(); ++i) - { - body += "
  1. " + aolxml::escapeXML((*i).m_numericIP) + "" + - (!(*i).m_comment.empty() ? " : " + aolxml::escapeXML((*i).m_comment) + "" : "") + - " - " + ((*i).m_mask == 255 ? "Single IP" : "Subnet") + " ban - " - "remove"; - } - body += "
"; - } - - body += - "

" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "
Ban a Single IP
" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "
Enter the IP address:
(example: 127.0.0.1)
" - "" - "" - "." - "." - "." - "" - "
" - " 
" - "
" - "

" - "" - "" - "" - "" - "" - "" - "" - "" - "
Ban an Entire Subnet
" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "
Enter the Subnet address:
(example: 255.255.255)
" - "" - "" - "." - "." - ".0-255" - "" - "
" - " 
" - "
" - "
" + - getUptimeScript() + - getIEFlexFix() + - getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -// remove an IP and mask from the ban list -void protocol_admincgi::mode_unban(const streamData::streamID_t sid, const utf8 &banAddr, const int banMask) throw() -{ - utf8 msg; - try - { - const size_t stream_ID = ((gOptions.read_stream_banFile(sid) && !gOptions.stream_banFile(sid).empty()) ? sid : 0); - if (isAddress(banAddr)) - { - if (g_banList.remove(banAddr,banMask,stream_ID,false)) - { - ILOG("[BAN] Removed `" + banAddr + "/" + tos(banMask) + "' from " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " ban list"); - - if (gOptions.saveBanListOnExit()) - { - if (stream_ID && gOptions.read_stream_banFile(stream_ID) && !gOptions.stream_banFile(stream_ID).empty()) - { - g_banList.save(gOptions.stream_banFile(stream_ID),stream_ID); - } - else - { - g_banList.save(gOptions.banFile(),0); - } - } - } - else - { - ILOG("[BAN] Unable to remove `" + banAddr + "' from " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " ban list"); - } - } - else - { - ILOG("[BAN] `" + banAddr + "' is not a valid value. Skipping removing from the " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " ban list"); - } - - msg = (!m_referer.empty() ? redirect("admin.cgi?sid=" + tos(sid) + (m_referer == "admin.cgi?sid=" + tos(sid) ? "" : "&mode=viewban"), SHRINK) : MSG_200); - } - catch(const exception &ex) - { - msg = (!m_referer.empty() ? redirect("admin.cgi?sid=" + tos(sid) + (m_referer != utf8("admin.cgi?sid=" + tos(sid) + "&mode=viewban") ? "" : "&mode=viewban"), SHRINK) : MSG_200); - ELOG(ex.what()); - } - - sendMessageAndClose(msg); -} - -// add an IP and mask to the ban list -void protocol_admincgi::mode_ban(const streamData::streamID_t sid, const utf8 &banAddrs, const int banMask) throw() -{ - utf8 msg; - try - { - const size_t stream_ID = ((gOptions.read_stream_banFile(sid) && !gOptions.stream_banFile(sid).empty()) ? sid : 0); - if (!g_banList.find(banAddrs,banMask,stream_ID)) - { - g_banList.add(banAddrs,banMask,"",stream_ID); - ILOG("[BAN] Added `" + banAddrs + "/" + tos(banMask) + "' to " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " ban list"); - - if (gOptions.saveBanListOnExit()) - { - if (stream_ID && gOptions.read_stream_banFile(stream_ID) && !gOptions.stream_banFile(stream_ID).empty()) - { - g_banList.save(gOptions.stream_banFile(stream_ID),stream_ID); - } - else - { - g_banList.save(gOptions.banFile(),0); - } - } - } - else - { - ILOG("[BAN] `" + banAddrs + "' already in the " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " ban list"); - } - - msg = (!m_referer.empty() ? redirect("admin.cgi?sid=" + tos(sid) + (m_referer == "admin.cgi?sid=" + tos(sid) ? "" : "&mode=viewban"), SHRINK) : MSG_200); - } - catch(const exception &ex) - { - msg = (!m_referer.empty() ? redirect("admin.cgi?sid=" + tos(sid) + (m_referer != utf8("admin.cgi?sid=" + tos(sid) + "&mode=viewban") ? "" : "&mode=viewban"), SHRINK) : MSG_200); - ELOG(ex.what()); - } - - // additionally when a ban happens then we attempt to kick the client(s) at the same time - const utf8 &p1 = mapGet(m_httpRequestInfo.m_QueryParameters, "kickdst", (utf8)""); - if (!p1.empty()) - { - // split out multiple clients to kick (split by a ,) - std::vector addrs = tokenizer(p1, ','); - for (vector::const_iterator i = addrs.begin(); i != addrs.end(); ++i) - { - if ((*i).find(utf8(".")) == utf8::npos) - { - stats::kickClient(sid, atoi((*i).hideAsString().c_str())); - } - else - { - stats::kickClient(sid, (*i)); - } - } - } - - sendMessageAndClose(msg); -} - -// remove an agent from the agent list -void protocol_admincgi::mode_unagent(const streamData::streamID_t sid, const utf8 &agent) throw() -{ - utf8 msg; - try - { - const size_t stream_ID = ((gOptions.read_stream_agentFile(sid) && !gOptions.stream_agentFile(sid).empty()) ? sid : 0); - bool ret = g_agentList.remove(agent,stream_ID,false); - if (!ret && !agent.empty()) - { - ret = g_agentList.remove(agent,stream_ID,false); - } - if (ret) - { - ILOG("[AGENT] Removed `" + agent + "' from " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " user agent list"); - - if (gOptions.saveAgentListOnExit()) - { - if (stream_ID && gOptions.read_stream_agentFile(stream_ID) && !gOptions.stream_agentFile(stream_ID).empty()) - { - g_agentList.save(gOptions.stream_agentFile(stream_ID),stream_ID); - } - else - { - g_agentList.save(gOptions.agentFile(),0); - } - } - } - else - { - ILOG("[AGENT] Unable to remove `" + agent + "' from " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " user agent list"); - } - - msg = (!m_referer.empty() ? redirect("admin.cgi?sid=" + tos(sid) + (m_referer == "admin.cgi?sid=" + tos(sid) ? "" : "&mode=viewagent"), SHRINK) : MSG_200); - } - catch(const exception &ex) - { - msg = (!m_referer.empty() ? redirect("admin.cgi?sid=" + tos(sid) + (m_referer != utf8("admin.cgi?sid=" + tos(sid) + "&mode=viewagent") ? "" : "&mode=viewagent"), SHRINK) : MSG_200); - ELOG(ex.what()); - } - - sendMessageAndClose(msg); -} - -// add an IP / hostname to the user agent list -void protocol_admincgi::mode_agent(const streamData::streamID_t sid, const utf8 &agent) throw() -{ - utf8 msg; - try - { - const size_t stream_ID = ((gOptions.read_stream_agentFile(sid) && !gOptions.stream_agentFile(sid).empty()) ? sid : 0); - if (!g_agentList.find(agent,stream_ID)) - { - if (g_agentList.add(agent, stream_ID, true)) - { - ILOG("[AGENT] Added `" + agent + "' to " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " user agent list"); - } - - stats::kickClientList_t kick_data; - stats::getClientDataForKicking(stream_ID, kick_data); - for (stats::kickClientList_t::const_iterator i = kick_data.begin(); i != kick_data.end(); ++i) - { - if (!(*i)->m_kicked && ((*i)->m_userAgent == agent)) - { - stats::kickClient(sid, (*i)->m_unique); - } - delete (*i); - } - - if (gOptions.saveAgentListOnExit()) - { - if (stream_ID && gOptions.read_stream_agentFile(stream_ID) && !gOptions.stream_agentFile(stream_ID).empty()) - { - g_agentList.save(gOptions.stream_agentFile(stream_ID),stream_ID); - } - else - { - g_agentList.save(gOptions.agentFile(),0); - } - } - } - else - { - ILOG("[AGENT] `" + agent + "' already in the " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " user agent list"); - } - msg = (!m_referer.empty() ? redirect("admin.cgi?sid=" + tos(sid) + (m_referer == "admin.cgi?sid=" + tos(sid) ? "" : "&mode=viewagent"), SHRINK) : MSG_200); - } - catch(const exception &ex) - { - msg = (!m_referer.empty() ? redirect("admin.cgi?sid=" + tos(sid) + (m_referer != utf8("admin.cgi?sid=" + tos(sid) + "&mode=viewagent") ? "" : "&mode=viewagent"), SHRINK) : MSG_200); - ELOG(ex.what()); - } - - sendMessageAndClose(msg); -} - -// show agent list -void protocol_admincgi::mode_viewagent(const streamData::streamID_t sid) throw() -{ - vector agent_list; - g_agentList.get(agent_list,((gOptions.read_stream_agentFile(sid) && !gOptions.stream_agentFile(sid).empty()) ? sid : 0)); - - utf8 header = MSG_NO_CLOSE_200, - headerTitle = (!sid ? "Server Blocked User Agent List" : - "Stream Blocked User Agent List"), - body = (!sid ? getServerAdminHeader(headerTitle, 0, "", 2) : getStreamAdminHeader(sid, headerTitle, 0, true)) + - "" - "" - "" - "" - "
"; - - if (agent_list.empty()) - { - body += " No Blocked User Agents
"; - } - else - { - body += " Blocked User Agent List:
    "; - for (vector::const_iterator i = agent_list.begin(); i != agent_list.end(); ++i) - { - const streamData::source_t clientType = ((streamData::source_t)streamData::UNKNOWN); - body += "
  1. " + getClientImage(streamData::getClientType(clientType, stringUtil::toLower((*i).m_agent))) + - " " + aolxml::escapeXML((*i).m_agent) + " - remove"; - } - body += "
"; - } - - body += - "

" - "" - "" - "" - "" - "" - "" - "" - "" - "
Block User Agent
" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "
Enter the user agent:
(example: streamripper)
" - "" - "" - "" - "
" - " 
" - "
" - "
" + - getUptimeScript() + - getIEFlexFix() + - getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -// kick client(s) -void protocol_admincgi::mode_kickdst(const streamData::streamID_t sid, const utf8 &kickAddrs) throw() -{ - bool refresh = false; - if (kickAddrs == "all") - { - // check if this is set to kick all - refresh = stats::kickAllClients(sid); - } - else if (kickAddrs == "duplicates") - { - // check if this is set to kick all - // duplicates (doing oldest first). - refresh = stats::kickDuplicateClients(sid); - } - else - { - // split out multiple clients to kick (split by a ,) - std::vector addrs = tokenizer(kickAddrs,','); - for (vector::const_iterator i = addrs.begin(); i != addrs.end(); ++i) - { - if ((*i).find(utf8(".")) == utf8::npos) - { - stats::kickClient(sid, atoi((*i).hideAsString().c_str())); - } - else - { - stats::kickClient(sid,(*i)); - } - } - } - - if (!m_referer.empty()) - { - const utf8 check = ("admin.cgi?sid=" + tos(sid)); - // if the referer is the server summary page then we need to go back to it - sendMessageAndClose(redirect((m_referer == check ? check : "admin.cgi?sid=0") + (refresh ? "&refresh=1" : ""), SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } -} - -void protocol_admincgi::mode_art(const streamData::streamID_t sid, const int mode) throw() -{ - utf8 header = "HTTP/1.1 200 OK\r\n", body; - streamData *sd = streamData::accessStream(sid); - if (sd) - { - vector<__uint8> sc21_albumart = (mode == 0 ? sd->streamAlbumArt() : sd->streamPlayingAlbumArt()); - if (!sc21_albumart.empty()) - { - utf8 mimeType[] = { - "image/jpeg", - "image/png", - "image/bmp", - "image/gif" - }; - const size_t mime = (mode == 0 ? sd->streamAlbumArtMime() : sd->streamPlayingAlbumArtMime()); - // if not in the valid range then don't report the mime type in the generated response - if (mime < 4) - { - header += "Content-Type:" + mimeType[mime] + "\r\n"; - } - body += utf8(&sc21_albumart[0],sc21_albumart.size()); - } - sd->releaseStream(); - } - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -void protocol_admincgi::mode_register(const streamData::streamID_t sid, const streamData::streamInfo &info) throw() -{ - // construct a temp id for this action - utf8 tempId = ""; - randomId(tempId); - - bool loaded = false; - streamData *sd = streamData::accessStream(sid); - if (sd) - { - int addFailIgnore = 0, errorCode = 0; - loaded = sd->YP2_addSuccessful(addFailIgnore, errorCode); - sd->releaseStream(); - } - - utf8 header = "HTTP/1.1 200 OK\r\n" - "Content-Type:text/html;charset=utf-8\r\n" - "Cache-Control:no-cache\r\n", - authhash = (!info.m_authHash.empty() ? info.m_authHash.substr(0, 36) : (utf8)""), - body = getStreamAdminHeader(sid, "Stream Authhash") + "
" - "
" - - "
" - - "
" - "
" - "
Information
" - "This page allows you to enter or amend the authhash to be used for this stream." - "



Authhash information is now managed online. " - "Login " - "to create an authhash or update the details of an existing authhash." - - "



The same authhash should be used for all stream instances of a station " - "(e.g. 128kbps MP3 and 64kbps AAC streams for 'Super Awesome Radio').

This also includes all DNAS " - "providing the stream(s) for a station to ensure the correct listing of all stream instances." - - // TODO need to have a link to the account page... - "



If you remove an authhash by mistake then you can either recover it from your " - "Shoutcast account or you will need " - "to contact support directly for " - "assistance.

" - - // TODO need to consider customising some of this ?? or just above ?? - "
" - "
" - "" - - "" - "" - "" - "" - "" - "" - "" - "" - "
" + utf8(!authhash.empty() && - loaded && (info.m_streamSampleRate > 0) && info.m_radionomyID.empty() ? - warningImage(false) + "  Please Register Your Authhash

" : "") + - - "
" - "
" - "The authhash currently configured for this stream is " + authhash + "


" - "To change the authhash, enter it below and click 'Save'." : - "Create Authhash\">" - "An authhash needs to be created for this stream.


" - "If you have just created an authhash via your " - "account " - "or have an existing one for the stream, please enter it below and click 'Save'.") + - - "

Authhash:

" - "  " - "  " - "
" - "
" - "
" - "
" - - "" + - getUptimeScript() + - getIEFlexFix() + - getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -void protocol_admincgi::mode_listeners(const streamData::streamID_t sid) throw() -{ - utf8 header = MSG_NO_CLOSE_200, body; - // just to make sure we came from an appropriate page - const utf8 &server = mapGet(m_httpRequestInfo.m_QueryParameters, "server", (utf8)""), - &check = ("admin.cgi?sid=" + tos(sid)); - const bool nowrap = mapGet(m_httpRequestInfo.m_QueryParameters, "nw", (bool)gOptions.adminNoWrap()); - const int fh = mapGet(m_httpRequestInfo.m_QueryParameters, "fh", (int)0); - if ((sid > 0) && (m_referer.find(check) == 0) && !server.empty() && (listenerId == server)) - { - stats::currentClientList_t client_data; - stats::getClientDataForStream(sid, client_data); - if (!client_data.empty()) - { - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(sid, info, extra); - - stats::statsData_t data; - stats::getStats(sid, data); - - utf8 clientsBody = "
" - "" - "" - "" - "" - "" + utf8(!info.m_radionomyID.empty() ? - "" : "") + - (data.connectedListeners != data.uniqueListeners ? "" : (utf8)"") + - "" - ""; - - const time_t t = ::time(NULL); - size_t rowCount = 0; - // if we have non-unique clients then we need to process the list differently so as to group - // them together and then re-sort the output by client listener duration on the first match - // otherwise we revert the code back to the original un-grouped method to not waste resources - if (data.connectedListeners != data.uniqueListeners) - { - map unique_clients; - for (stats::currentClientList_t::const_iterator i = client_data.begin(); i != client_data.end(); ++i) - { - // if set to kicked then no need to show those (since they may re-appear if in-progress) - if (!(*i)->m_kicked) - { - stats::uniqueClientData_t client; - const bool localhost = ((*i)->m_ipAddr.find(utf8("127.")) == 0); - - // look for existing instances and append the new details to the existing details - const map::const_iterator im = unique_clients.find((*i)->m_ipAddr); - if (im != unique_clients.end()) - { - client = (*im).second; - client.m_userAgent += "m_ripClient || localhost ? utf8(" style=\"font-style:italic;\"") : "") + ">"; - client.m_unique += ","; - ++client.m_total; - } - else - { - client.m_connectTime = (*i)->m_startTime; - client.m_ipAddr = (*i)->m_ipAddr; - client.m_hostName = (*i)->m_hostName; - client.m_XFF = (*i)->m_XFF; - client.m_total = 1; - } - - const int slave = ((*i)->m_clientType & streamData::SC_CDN_SLAVE); - client.m_userAgent += ""; - if ((*i)->m_ripClient) - { - client.m_ripAddr = true; - } - - const time_t connected = (t - (*i)->m_startTime); - utf8 timer = timeString(connected, true), timerTip; - if (timer.empty()) - { - timer = "Starting..."; - } - else - { - timerTip = timeString(connected); - } - - client.m_userAgent += "" + aolxml::escapeXML(timer) + ""; - client.m_unique = (*i)->m_ipAddr; - if (!info.m_radionomyID.empty()) - { - client.m_userAgent += "" + (((*i)->m_group > 0) || - (*i)->m_triggers ? advertImage(sid, (*i)->m_group, (*i)->m_triggers) : - "
N/A
") + ""; - } - client.m_userAgent += "m_unique) + "\">Kick" + - (client.m_total == 1 ? "" : "") + "" + ((*i)->m_userAgent.empty() || ((*i)->m_userAgent == EMPTY_AGENT) ? "N/A" : - "m_userAgent) + "\">Block") + ""; - - unique_clients[(*i)->m_ipAddr] = client; - } - - delete (*i); - } - - // take the map and convert to a vector so we can then re-sort the list back into longest to least duration - vector clients; - for (map::const_iterator i = unique_clients.begin(); i != unique_clients.end(); ++i) - { - clients.push_back((*i).second); - } - - std::sort(clients.begin(), clients.end(), sortUniqueClientDataByTime); - - // and now we dump the generated list - for (vector::const_iterator i = clients.begin(); i != clients.end(); ++i) - { - const utf8 host = ((*i).m_hostName != (*i).m_ipAddr ? aolxml::escapeXML((*i).m_hostName) + " (" + (*i).m_ipAddr + ")" : (*i).m_ipAddr); - const bool localhost = ((*i).m_ipAddr.find(utf8("127.")) == 0); - - // if we have a multiple client block then re-process so the relevant parts can - // be listed individually with adjustment of some of the visual styles as needed - utf8 multiBlock = (*i).m_userAgent; - uniString::utf8::size_type tpos = multiBlock.find(utf8(" 1 ? "")); - if (tpos != uniString::utf8::npos) - { - const bool hasHostName = ((*i).m_hostName != (*i).m_ipAddr); - utf8 endBlock = " 1 ? " rowspan=\"" + tos((*i).m_total) + "\"" : (utf8)"") + ">" + - (!localhost ? "Ban" : "N/A") + " 1 ? " rowspan=\"" + - tos((*i).m_total) + "\"" : (utf8)"") + ">" + (!localhost ? "Ban " : "N/A") + "" - " 1 ? " rowspan=\"" + tos((*i).m_total) + "\"" : (utf8)"") + ">" + - (!localhost ? "" + ((*i).m_ripAddr ? "Remove" : "Add") + "" : "N/A") + ""; - - multiBlock.replace(tpos, 6, utf8(((*i).m_total > 1 ? - "
" + - endBlock : "" + endBlock))); - } - - rowCount += (*i).m_total; - clientsBody += "" - " 1 ? " rowspan=\"" + tos((*i).m_total) + "\"" : "") + ">" + - (gOptions.useXFF() && !(*i).m_XFF.empty() ? xffImage() + " " : "") + host + "" + multiBlock; - } - } - else - { - for (stats::currentClientList_t::const_iterator i = client_data.begin(); i != client_data.end(); ++i) - { - // if set to kicked then no need to show those (since they may re-appear if in-progress) - if (!(*i)->m_kicked) - { - const time_t connected = (::time(NULL) - (*i)->m_startTime); - utf8 timer = timeString(connected, true), timerTip; - if (timer.empty()) - { - timer = "Starting..."; - } - else - { - timerTip = timeString(connected); - } - - const utf8 host = ((*i)->m_hostName != (*i)->m_ipAddr ? aolxml::escapeXML((*i)->m_hostName) + - " (" + (*i)->m_ipAddr + ")" : (*i)->m_ipAddr); - const bool localhost = ((*i)->m_ipAddr.find(utf8("127.")) == 0); - const bool hasHostName = ((*i)->m_hostName != (*i)->m_ipAddr); - - ++rowCount; - const int slave = ((*i)->m_clientType & streamData::SC_CDN_SLAVE); - clientsBody += "m_ripClient || localhost ? utf8(" style=\"font-style:italic;\"") : "") + ">" - "" + aolxml::escapeXML(timer) + ""; - - if (!info.m_radionomyID.empty()) - { - clientsBody += "" + (((*i)->m_group > 0) || - (*i)->m_triggers ? advertImage(sid, (*i)->m_group, (*i)->m_triggers) : - "
N/A
") + ""; - } - - const utf8 unique = tos((*i)->m_unique); - clientsBody += "Kick
" + ((*i)->m_userAgent.empty() || ((*i)->m_userAgent == EMPTY_AGENT) ? "N/A" : - "m_userAgent) + "\">Block") + ""; - } - - delete (*i); - } - } - - if (rowCount > 0) - { - if (rowCount > 1) - { - clientsBody += ""; - } - - // only output the table if we actually had clients to show - body += clientsBody + "
Current Listeners
Listener Address
(Host Address)
User AgentConnected
Duration
" + baseImage("adavail", "Advert Status", false, false) + "Kick
Client
Kick
IP
Ban
IP
Ban
Subnet
Reserve
Listener
Block
User Agent
" + (((*i)->m_clientType & streamData::RADIONOMY) ? - "Radionomy Stats Collector" : (!nowrap ? addWBR((*i)->m_userAgent) : "
" + - aolxml::escapeXML((*i)->m_userAgent)) + "
") + "
" + - getClientImage((*i)->m_clientType) + "
Kickm_XFF.empty() ? "title=\"XFF: " + - aolxml::escapeXML((*i)->m_XFF) + "\">" + xffImage() + " " : ">") + host + "m_XFF.empty() ? "title=\"XFF: " + aolxml::escapeXML((*i)->m_XFF) + "\" " : "") + - "style=\"" + (!nowrap ? "" : "white-space:nowrap;") + "\"" + utf8(slave ? " class=\"thr\"" : - "") + ">" + (((*i)->m_clientType & streamData::RADIONOMY) ? "Radionomy Stats Collector" : - (!nowrap ? addWBR((*i)->m_userAgent) : "
" + - aolxml::escapeXML((*i)->m_userAgent)) + "
") + "
" + - getClientImage((*i)->m_clientType) + "
" + "
" + - (!localhost ? "m_ipAddr) + "&banmsk=255" + "&kickdst=" + unique + - "\">Ban" : "N/A") + "" + (!localhost ? "m_ipAddr) + "&banmsk=0" - "&kickdst=" + unique + "\">Ban " : "N/A") + "" + (!localhost ? - "" + ((*i)->m_ripClient ? - "Remove" : "Add") + "" : "N/A") + "
Kick Duplicates" - "" + timeString(data.avgUserListenTime, true) + "Kick All
"; - } - } - } - else - { - body = "
The current " - "listener list could not be loaded.
Click here to reload this page. If this issue " - "
persists, try logging out and back in again.
"; - } - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -const utf8 protocol_admincgi::getClientIP(const bool streamPublic, const utf8 &publicIP) throw() -{ - // test for potentially invalid IPs or ones that will cause the playlist link generation to fail - // attempting to use the server path provided by the YP if in public mode, otherwise uses 'host' - return (!streamPublic || publicIP.empty() ? - ((g_IPAddressForClients.find(utf8("0.")) == 0 || - // allow localhost / loopback connections through for admin access - ((!g_IPAddressForClients.empty() && g_IPAddressForClients.find(utf8("127.")) == 0)) || - g_IPAddressForClients.empty()) && !m_hostIP.empty() ? - m_hostIP : (!m_hostIP.empty() ? m_hostIP : g_IPAddressForClients)) : publicIP); -} - -void protocol_admincgi::mode_none(const streamData::streamID_t sid, const int refreshRequired) throw() -{ - utf8 header = MSG_NO_CLOSE_200, - body = getStreamAdminHeader(sid, "Stream Status & Listeners", refreshRequired); - - time_t streamUptime = 0; - bool hasListeners = false, isConnected = false; - - if (refreshRequired > 0) - { - body += "
" - "
" - "
Waiting " + tos(refreshRequired) + " second" + ((refreshRequired > 1) ? "s" : (utf8)"") + - " for any configuration changes to take effect.
" - "If not automatically redirected or do not want to wait, " - "click here." - "

"; - } - else - { - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(sid, info, extra); - - stats::statsData_t data; - stats::getStats(sid, data); - - isConnected = extra.isConnected; - hasListeners = (data.connectedListeners > 0); - - // this is a placeholder for the listener details which we grab asynchronously for speed since #615 - body += "
" + (data.connectedListeners > 0 ? - "
Loading current " - "listener list...
" : (utf8)"") + "
Current Stream Information
"; - - utf8 detailsBody = ""; - bool showing = false; - if (!(gOptions.read_stream_adminPassword(sid) && !gOptions.stream_adminPassword(sid).empty())) - { - utf8 log = gOptions.realLogFile(); - utf8::size_type pos = log.rfind(fileUtil::getFilePathDelimiter()); - if ((pos != utf8::npos)) - { - log = log.substr(pos + 1); - } - - utf8 conf = gOptions.confFile(); - pos = conf.rfind(fileUtil::getFilePathDelimiter()); - if ((pos != utf8::npos)) - { - conf = conf.substr(pos + 1); - } - - // trim down the file paths shown to make things less cluttered on hosted setups - // places the full path in the 'title' so it can still be found if required, etc - detailsBody += "Log file: " + aolxml::escapeXML(fileUtil::stripPath(log)) + "
" - "Configuration file: " + aolxml::escapeXML(fileUtil::stripPath(conf)) + "
"; - - showing = true; - } - - utf8 introFile = gOptions.stream_introFile(sid); - if (!gOptions.read_stream_introFile(sid)) - { - introFile = gOptions.introFile(); - } - - utf8 backupFile = gOptions.stream_backupFile(sid); - if (!gOptions.read_stream_backupFile(sid)) - { - backupFile = gOptions.backupFile(); - } - - utf8 backupTitle = gOptions.stream_backupTitle(sid); - if (!gOptions.read_stream_backupTitle(sid)) - { - backupTitle = gOptions.backupTitle(); - } - - streamData *sd = streamData::accessStream(sid); - detailsBody += utf8(showing ? "


" : "") + "Intro file is getIntroFile().gotData()) ? (!introFile.empty() ? - fileUtil::getFullFilePath(introFile) : (utf8)"") : (utf8)"") + "\">" + - aolxml::escapeXML((!introFile.empty() || (sd && sd->getIntroFile().gotData()) ? (!introFile.empty() ? - fileUtil::stripPath(introFile) : "from source") : "empty")) + "
Backup file is getBackupFile().gotData())) ? (!backupFile.empty() ? - fileUtil::getFullFilePath(backupFile) : (utf8)"") : (utf8)"") + "\">" + - aolxml::escapeXML((!backupFile.empty() || (sd && sd->getBackupFile().gotData())) ? - (!backupFile.empty() ? fileUtil::stripPath(backupFile) : "from source") : "empty")) + "
"; - - if (!backupTitle.empty() && !backupFile.empty() && !extra.isConnected) - { - detailsBody += "Backup title is: " + aolxml::escapeXML(backupTitle) + "
"; - } - - detailsBody += "


Idle timeouts are " + tos(gOptions.getAutoDumpTime(sid)) + "s
"; - - if (extra.isConnected) - { - detailsBody += "


Source connection type: " + - utf8(info.m_sourceType == streamData::SHOUTCAST1 ? "v1" : - (info.m_sourceType == streamData::SHOUTCAST2 ? "v2" : "HTTP")) + - (extra.isRelay ? " relay" + (extra.isBackup ? utf8(" backup") : "") : - (extra.isBackup ? utf8(" backup") : "")) + "
Source user agent: " + - addWBR((!info.m_sourceIdent.empty() ? info.m_sourceIdent : - "Legacy / Unknown")) + """
"; - } - - if (sd) - { - detailsBody += (extra.isConnected ? "


" : "
"); - - if (sd->streamAlbumArt().empty()) - { - detailsBody += "Stream artwork not available"; - } - else - { - detailsBody += "Stream artwork availableview ]
"; - } - - detailsBody += "
"; - - if (sd->streamPlayingAlbumArt().empty()) - { - detailsBody += "Playing artwork not available"; - } - else - { - detailsBody += "Playing artwork availableview ]
"; - } - - if (!info.m_currentURL.empty() && (info.m_currentURL.find(utf8("DNAS/")) == utf8::npos)) - { - detailsBody += "



Song url from source [ view ]
" - "
Note: " - "This may not be a valid url and is intended for internal use.
"; - } - - sd->releaseStream(); - } - - const utf8& message = streamData::getStreamMessage(sid); - if (!message.empty()) - { - detailsBody += "
" - "
" - "
" - "Official Message Received
" + message + ""; - } - - body += "

" - ""; - - const utf8 movedUrl = gOptions.stream_movedUrl(sid); - if (movedUrl.empty()) - { - body += ""; - } - - const int maxUsers = ((info.m_streamMaxUser > 0) && (info.m_streamMaxUser < gOptions.maxUser()) ? info.m_streamMaxUser : gOptions.maxUser()); - if (extra.isConnected) - { - const bool isListable = streamData::isAllowedType(info.m_uvoxDataType); - utf8 listenLink = "" + - (sd && !sd->radionomyID().empty() && sd->streamAdvertMode() ? - " " : (utf8)""); - - body += "
" - "
Stream Details
" + - detailsBody + "
" - "" - "" - "" - ""; - - if (data.peakListeners > 0) - { - body += ""; - } - - const utf8 avgTime = timeString(data.avgUserListenTime); - if (!avgTime.empty()) - { - body += "" - ""; - } - - body += "" + - - (info.m_streamPublic && extra.ypConnected ? "" : ""); - - if (!info.m_streamGenre[0].empty()) - { - body += "" - ""; - } - - if (!info.m_streamUser.empty()) - { - body += "" - ""; - } - - if (!info.m_streamURL.empty()) - { - body += "" - ""; - } - - if (!info.m_currentSong.empty()) - { - body += "" - ""; - - // only show if we have a valid current song - if (!info.m_comingSoon.empty()) - { - body += "" - ""; - } - } - - // strip down the source address for display output to an appropriate output based on settings - utf8 srcAddr = niceURL(extra.isBackup ? info.m_backupURL : (extra.isRelay ? info.m_relayURL : info.m_srcAddr)); - if (gOptions.nameLookups()) - { - if (!extra.isBackup && !extra.isRelay) - { - u_short port = 0; - string addr, hostName; - socketOps::getpeername(m_socket, addr, port); - - string src = (extra.isBackup ? info.m_backupURL : (extra.isRelay ? info.m_relayURL : info.m_srcAddr)).hideAsString(); - hostName = src; - if (!socketOps::addressToHostName(addr,port,hostName)) - { - srcAddr = hostName + " (" + niceURL(src) + ")"; - } - } - } - - body += "" - "" - ""; - - if (!info.m_contentType.empty() && (info.m_uvoxDataType == MP3_DATA)) - { - body += streamData::getHTML5Player(sid); - } - - body += "
" + getNewVersionMessage() + "
Listing Status: Stream is currently up " + - (info.m_streamPublic && isListable ? (extra.ypConnected != 1 ? "" : utf8("and public") + listenLink) : utf8("and private (not listed)") + listenLink) + - (info.m_streamPublic && isListable ? (extra.ypConnected != 1 ? (!yp2::isValidAuthhash(info.m_authHash) ? - string(info.m_authHash.empty() ? "but requires registration in the Shoutcast Directory.
" : - "but not listed due to an invalid authhash.
") + - - (info.m_authHash.empty() ? "Listeners are allowed and the stream will act like it is private until resolved." - "

To create an authhash you will need to register the stream with us.
If you already have an existing authhash " - "then you can enter it here.

" : - "Listeners are allowed and the stream will act like it is private until resolved.") : - (extra.ypErrorCode == 200 ? "waiting on a Directory response." : - (extra.ypErrorCode == YP_COMMS_FAILURE ? "unable to access the Directory.
Listeners are allowed and the stream will act like it is private until resolved." : - (extra.ypErrorCode == YP_MAINTENANCE_CODE ? "received a Directory maintenance notification: " + tos(extra.ypErrorCode) + - "
Listeners will be allowed though the stream will not be listed in the Directory." : - "received Directory error code: " + tos(extra.ypErrorCode) + "
" + - (extra.ypConnected != 2 ? "" : - "during a listing update. The stream may no longer appear.") + - "
Check the server log and / or contact the server administrator.")))) : "") : "") + "
Stream Status: Stream is up (" + streamData::getContentType(info) + " @ " + - (info.m_streamBitrate > 0 ? tos(info.m_streamBitrate) : "unknown") + - " kbps" + (info.m_vbr ? " (VBR)" : "") + ", " + - sampleRateStr(info.m_streamSampleRate) + ") with " + - tos(data.connectedListeners) + (maxUsers > 0 ? " of " + - tos(maxUsers) : "") + " listeners" + (!maxUsers ? " (unlimited)" : "") + - (data.connectedListeners != data.uniqueListeners ? (" (" + - tos(data.uniqueListeners) + " unique)") : "") + "
Listener Peak: " + - tos(data.peakListeners) + "
Avg. Play Time: " + avgTime + "
Stream Name: " + - (info.m_streamPublic && extra.ypConnected ? "" + aolxml::escapeXML(info.m_streamName) + "" : - aolxml::escapeXML(info.m_streamName)) + "
" - " ID: "+info.m_stationID+"
Stream Genre(s): " + (info.m_streamPublic && extra.ypConnected ? - "" + - aolxml::escapeXML(info.m_streamGenre[0]) + "" : - aolxml::escapeXML(info.m_streamGenre[0])) + ""; - - for (int i = 1; i < 5; i++) - { - if (!info.m_streamGenre[i].empty()) - { - body += " , " + (info.m_streamPublic && extra.ypConnected ? "" + aolxml::escapeXML(info.m_streamGenre[i]) + "" : - aolxml::escapeXML(info.m_streamGenre[i])) + ""; - } - } - - body += "
Stream DJ: " + aolxml::escapeXML(info.m_streamUser) + "
Stream Website: " + urlLink(info.m_streamURL) + "
Playing Now: " + - getCurrentSong(info.m_currentSong) + "
Playing Next: " + - aolxml::escapeXML(info.m_comingSoon) + "
Stream Source: " + (extra.isRelay || extra.isBackup ? urlLink(srcAddr) : srcAddr) + " " + - (extra.isRelay ? "(relaying" + (extra.isBackup ? utf8(" backup") : "") + ") " : (extra.isBackup ? "(backup) " : "")) + "" - "[ " + (extra.isRelay || extra.isBackup ? "stop" : "kick") + - " ]
Stream Uptime: " + timeString((streamUptime = ::time(NULL) - streamData::getStreamUptime(sid))) + "
"; - } - else - { - body += "" - "" - "" - ""; - - if (data.peakListeners > 0) - { - body += ""; - } - - utf8 avgTime = timeString(data.avgUserListenTime); - if (!avgTime.empty()) - { - body += "" - ""; - } - - // add in an option to restart a relay url... - if (!gOptions.stream_relayURL(sid).empty() && movedUrl.empty()) - { - // strip down the source address for display output - utf8 srcAddr = niceURL(gOptions.stream_relayURL(sid)); - - // make sure we're not exposing the option to try re-connecting to a pending source relay - bool noEntry = false; - if (!(streamData::isRelayActive(sid, noEntry) == 1)) - { - body += ""; - } - else - { - body += ""; - } - } - - body += "
" + getNewVersionMessage("
") + "
Stream Status: "; - - if (movedUrl.empty()) - { - body += "Stream is currently down" + (data.connectedListeners > 0 ? - " with " + tos(data.connectedListeners) + (maxUsers > 0 ? " of " + - tos(maxUsers) : "") + " listeners" + (!maxUsers ? " (unlimited)" : "") + - (data.connectedListeners != data.uniqueListeners ? (" (" + - tos(data.uniqueListeners) + " unique)") : "") : ".") + "
There is no " - "source connected or no stream is configured for stream #" + tos(sid) + "."; - } - else - { - body += "Stream has been moved to " + urlLink(movedUrl) + "
No source connections will be allowed for this stream."; - } - body += "
Listener Peak: " + - tos(data.peakListeners) + "
Avg. Play Time: " + avgTime + "

Start Relay:

" + urlLink(srcAddr) + " " - "[ start relay ]

Starting Relay:

Connection pending to " + - urlLink(srcAddr) + " [ abort ]
"; - } - - body += "
"; - } - - // for a refresh, we'll show a countdown so it's obvious that something is happening - if (refreshRequired) - { - body += ""; - } - - body += getUptimeScript(false, isConnected, streamUptime) + getIEFlexFix() + - getHTML5Remover() + (!refreshRequired && hasListeners ? - getStreamListeners(sid, mapGet(m_httpRequestInfo.m_QueryParameters, "nw", (bool)gOptions.adminNoWrap()), - mapGet(m_httpRequestInfo.m_QueryParameters, "fh", (int)0)) : "") + getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length: " + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -utf8 getCDNMessage(const bool master, const bool slave) -{ - if (slave && !master) - { - return "Configured as a CDN slave
Authhash inheritance enabled from master"; - } - else if (master && !slave) - { - return "Configured as a CDN master
Authhash inheritance enabled for slaves"; - } - return "Configured as a CDN intermediary
Authhash inheritance enabled both ways"; -} - -utf8 getBadAuthhashMessage(const streamData::streamID_t sid, const utf8 &authHash) -{ - return "
" - "Invalid Authhash Detected   

" - "Clear Authhash" - "  |  Manage Authhash
"; -} - -void protocol_admincgi::mode_summary(const int refreshRequired) throw() -{ - utf8 header = MSG_NO_CLOSE_200, - streams = "", - body = getServerAdminHeader("Server Summary", refreshRequired); - - size_t totalListeners = 0, - totalPeakListeners = 0, - streamTotal = 0, - movedTotal = 0; - map streamBlocks; - - if (refreshRequired == 0) - { - size_t inc = 0, sid = DEFAULT_SOURCE_STREAM; - do - { - utf8 streamBody = ""; - sid = streamData::enumStreams(inc); - - // check if we have an active source and valid sid before attempting to add - if (sid >= DEFAULT_SOURCE_STREAM) - { - streamData::streamInfo info; - streamData::extraInfo extra; - if (streamData::getStreamInfo(sid, info, extra)) - { - stats::statsData_t data; - stats::getStats(sid, data); - - // increment our stream total now that we know we have one - totalListeners += data.connectedListeners; - totalPeakListeners += data.peakListeners; - - utf8 streamBody2 = ""; - const bool slave = isCDNSlave(sid); - const bool master = isCDNMaster(sid); - if (master || slave) - { - streamBody2 += "
" + - getCDNMessage(master, slave) + "


"; - } - - const bool isListable = streamData::isAllowedType(info.m_uvoxDataType); - if (!isListable) - { - streamBody2 += "
" + - (info.m_uvoxDataType == OGG_DATA ? "OGG Vorbis based streams are not fully supported
and will not" : - utf8("NSV based streams are no longer able
to ")) + - " be listed in the Shoutcast Directory.

"; - } - /*else if (!info.m_streamPublic && gOptions.cdn().empty() && !slave && !master) - { - streamBody2 += "
" - "An authhash is not required for private streams.


"; - }*/ - - if (isListable) - { - if (info.m_authHash.empty()) - { - streamBody2 += ""; - } - else - { - // check that the authhash is a valid length - if (!yp2::isValidAuthhash(info.m_authHash)) - { - streamBody2 += getBadAuthhashMessage(sid, info.m_authHash); - } - else - { - streamBody2 += "
" - + utf8((master || slave || info.m_streamPublic) && (info.m_streamSampleRate > 0) && - info.m_radionomyID.empty() && ((extra.ypErrorCode != YP_NOT_VISIBLE) && - (extra.ypErrorCode != YP_AUTH_ISSUE_CODE) && (extra.ypErrorCode != -1)) ? - warningImage(false) + "  Please Register Your Authhash

" : "") + - "Update Authhash  | " - " Manage Authhash
"; - } - } - } - else - { - streamBody2 += ""; - } - streamBody2 += ""; - - streamData *sd = streamData::accessStream(sid); - - streamBody += "" + - (sd && !sd->radionomyID().empty() && sd->streamAdvertMode() ? - " " : (utf8)"") + - "Stream #" + tos(sid) + " " - "(Stream Login)" + - " " + - (sd && !sd->streamAlbumArt().empty() ? " " - "\"View" : "") + - (sd && !sd->streamPlayingAlbumArt().empty() ? " " - "\"View" : "") + - - "" + - (!info.m_contentType.empty() && (info.m_uvoxDataType == MP3_DATA) ? - streamData::getHTML5Player(sid) : "") + streamBody2; - - utf8 content = streamData::getContentType(info); - if (!info.m_streamUser.empty()) - { - content = info.m_streamUser + " - " + content; - } - - const int maxUsers = ((info.m_streamMaxUser > 0) && (info.m_streamMaxUser < gOptions.maxUser()) ? info.m_streamMaxUser : gOptions.maxUser()); - const utf8 listeners = (data.connectedListeners ? (tos(data.connectedListeners) + - (data.connectedListeners != data.uniqueListeners ? - (" (" + tos(data.uniqueListeners) + " unique)") : "")) : "0") + - (maxUsers > 0 ? " of " + tos(maxUsers) : " (unlimited)"); - - const utf8 listenLink = ""; - - streamBody += "" + - (info.m_streamPublic && extra.ypConnected ? "" + aolxml::escapeXML(info.m_streamName) + "" : - aolxml::escapeXML(info.m_streamName)) + " (" + content + " @ " + - (info.m_streamBitrate > 0 ? tos(info.m_streamBitrate) : "unknown") + - " kbps" + (info.m_vbr ? " (VBR)" : "") + ", " + - sampleRateStr(info.m_streamSampleRate) + ")" + - - (!info.m_currentSong.empty() ? "Playing: " - "" + - aolxml::escapeXML(info.m_currentSong) + "" + - (!info.m_comingSoon.empty() ? "Coming: " - "" + - aolxml::escapeXML(info.m_comingSoon) + "" : "") : "") + - - "" - "
" - "
Listeners: " + listeners + "" + - (data.peakListeners > 0 ? "
Peak: " + tos(data.peakListeners) + "" : "") + - (data.connectedListeners > 0 ? " [ kick all ]" : "") + - "
   Status: " + - string(info.m_streamPublic && isListable ? (extra.ypConnected != 1 ? "" : string("Public
" - - "")) + - - (extra.ypConnected != 1 ? (!yp2::isValidAuthhash(info.m_authHash) ? - " Not Listed - " + string(info.m_authHash.empty() ? "Empty" : "Invalid") + " Authhash" : - (extra.ypErrorCode == 200 ? " Waiting on a Directory response" : - (extra.ypErrorCode == -1 ? "Unable to access the Directory.
Check the server log for more details.
The stream will behave like it is private." : - (extra.ypErrorCode == YP_MAINTENANCE_CODE ? "Directory is down for maintenance: " + - tos(extra.ypErrorCode) + "
Listeners are allowed, stream will not be listed" : - (extra.ypErrorCode == YP_AUTH_ISSUE_CODE ? " Please contact support as there is an issue with the authhash" : " Directory returned error code: " + tos(extra.ypErrorCode) + "
" + - (extra.ypConnected != 2 ? "" : "during a listing update. The stream may not
appear in the Directory due to the error. The
server will attempt to re-list the stream.")))))) : "") : - "Private") + "
   Source: " + - utf8(info.m_sourceType == streamData::SHOUTCAST1 ? "v1" : - (info.m_sourceType == streamData::SHOUTCAST2 ? "v2" : "HTTP")) + - (extra.isRelay ? " relay" + (extra.isBackup ? utf8(" backup") : "") : - (extra.isBackup ? " backup" : "")) + "" + (extra.isRelay || extra.isBackup ? "stop" : "kick") + - " ]
" - - "" - "
" - "Summary  |  " - - "  |  " - - "History  |  " - "Metadata  |  " - "Statistics " - "
"; - - if (sd) - { - sd->releaseStream(); - } - - const utf8& message = streamData::getStreamMessage(sid); - if (!message.empty()) - { - streamBody += "" - "

" - "
" - "Official Message Received
" + message + "
"; - } - - streamBlocks[sid] = streamBody; - } - } - ++inc; - } - while (sid); - - // now we check through for any known but inactive relays and then get them listed as well - vector relayList(gOptions.getRelayList()); - if (!relayList.empty()) - { - for (vector::const_iterator i = relayList.begin(); i != relayList.end(); ++i) - { - sid = (*i).m_streamID; - const bool exists = !(*i).m_relayUrl.url().empty(); - if (exists && !streamData::isSourceConnected(sid)) - { - stats::statsData_t data; - stats::getStats(sid, data); - - // increment our stream total now that we know we have one - totalListeners += data.connectedListeners; - totalPeakListeners += data.peakListeners; - - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(sid, info, extra); - utf8 listeners, content, streamBody2, - streamBody = "" - "Stream #" + tos(sid) + " " - "(Stream Login)"; - - const utf8 movedUrl = gOptions.stream_movedUrl(sid); - if (movedUrl.empty()) - { - const bool slave = isCDNSlave(sid); - const bool master = isCDNMaster(sid); - if (master || slave) - { - streamBody2 = "
" + - getCDNMessage(master, slave) + "


"; - } - else - { - if ((*i).m_authHash.empty()) - { - streamBody2 += ""; - } - else - { - // check that the authhash is a valid length - if (!yp2::isValidAuthhash((*i).m_authHash)) - { - streamBody2 += getBadAuthhashMessage(sid, info.m_authHash); - } - else - { - streamBody2 += "
" - + utf8((master || slave || info.m_streamPublic) && (info.m_streamSampleRate > 0) && - info.m_radionomyID.empty() && ((extra.ypErrorCode != YP_NOT_VISIBLE) && - (extra.ypErrorCode != YP_AUTH_ISSUE_CODE) && (extra.ypErrorCode != -1)) ? - warningImage(false) + "  Please Register Your Authhash

" : "") + - "Update Authhash  | " - " Manage Authhash
"; - } - } - - if (!streamBody2.empty()) - { - streamBody2 += "
"; - } - } - } - else - { - streamBody2 = "This stream is configured as having been moved or retired.
" - "No source connections will be allowed for this stream.

" - "All client connections received will be redirected to:
" + - urlLink(movedUrl) + "
"; - ++movedTotal; - } - - if (!streamBody2.empty()) - { - streamBody += "" + streamBody2 + ""; - } - - // strip down the source address for display output - const utf8 srcAddr = niceURL(gOptions.stream_relayURL(sid)); - if (movedUrl.empty()) - { - bool noEntry = false; - const bool isListable = streamData::isAllowedType(info.m_uvoxDataType); - streamBody += "" - "Status: " + string(info.m_streamPublic && isListable ? (extra.ypConnected != 1 ? "" : string("Public")) + - (extra.ypConnected != 1 ? (!yp2::isValidAuthhash(info.m_authHash) ? - " Not Listed - " + string(info.m_authHash.empty() ? "Empty" : "Invalid") + " Authhash" : - (extra.ypErrorCode == 200 ? " Waiting on a Directory response" : - (extra.ypErrorCode == -1 ? "Unable to access the Directory.
Check the error server for more details.
The stream will behave like it is private." : - (extra.ypErrorCode == YP_MAINTENANCE_CODE ? "Directory is down for maintenance: " + - tos(extra.ypErrorCode) + "
Listeners are allowed, stream will not be listed" : - (extra.ypErrorCode == YP_AUTH_ISSUE_CODE ? " Please contact support as there is an issue with the authhash" : " Directory returned " - "error code: " + tos(extra.ypErrorCode) + "
" + - (extra.ypConnected != 2 ? "" : "during a listing update. The stream may not
appear in the Directory due to the error. The
server will attempt to re-list the stream.")))))) : "") : - "Private") + "
   " - "
" + (data.connectedListeners > 0 ? "" - "" : "") + - "
" - "Source: " + (!(streamData::isRelayActive(sid, noEntry) == 1) ? - "Inactive relaystart relay ]
Using: " + urlLink(srcAddr) + "" : - "Connection pending to " + urlLink(srcAddr) + "" - " [ abort ]") + - - // if it's an inactive stream then we also want to show any remaining connections - "
Listeners: " + - tos(data.connectedListeners) + "" + (data.peakListeners > 0 ? "  |  Peak: " + - tos(data.peakListeners) + "" : "") + " [ kick all ]" + "
"; - } - streamBlocks[sid] = streamBody; - } - } - } - - // now we check through for any known but in-active sources & then get them listed as well - // new to build 70 but for fire builds makes it easier to see if a feed stream is inactive - config::streams_t stream_configs; - gOptions.getStreamConfigs(stream_configs); - if (!stream_configs.empty()) - { - for (config::streams_t::const_iterator i = stream_configs.begin(); i != stream_configs.end(); ++i) - { - if (streamBlocks.find((*i).first) == streamBlocks.end()) - { - stats::statsData_t data; - stats::getStats((*i).first, data); - - // increment our stream total now that we know we have one - totalListeners += data.connectedListeners; - totalPeakListeners += data.peakListeners; - - utf8 streamBody = "" - "Stream #" + tos((*i).first) + " " - "(Stream Login)", - streamBody2; - - const utf8 movedUrl = gOptions.stream_movedUrl((*i).first); - if (movedUrl.empty()) - { - utf8 authhash = (*i).second.m_authHash; - if (authhash.empty()) - { - authhash = gOptions.stream_authHash((*i).first); - } - - if (authhash.empty()) - { - streamBody2 += ""; - } - else - { - // check that the authhash is a valid length - if (!yp2::isValidAuthhash(authhash)) - { - streamBody2 += getBadAuthhashMessage((*i).first, authhash); - } - else - { - streamBody2 += "
" - // TODO if the stream is not active then we don't know the admode - // status and so it's easier to not show the warning until - // we've got something that will allow us to check authhash. - //+ utf8(info.m_radionomyID.empty() ? warningImage(false) + "  Please Register Your Authhash

" : "") + - "Update Authhash" - "  | Manage Authhash
"; - } - } - - if (!streamBody2.empty()) - { - streamBody2 += "
"; - } - streamBody2 += "This stream is configured but has no source connected." + - (data.connectedListeners > 0 ? "
Listeners: " - "" + tos(data.connectedListeners) + "" + (data.peakListeners > 0 ? "  |  " - "Peak: " + tos(data.peakListeners) + "" : "") + " [ kick all ]" + "
" : ""); - } - else - { - streamBody2 += "This stream is configured as having been moved or retired.
" - "No source connections will be allowed for this stream.

" - "All client connections received will be redirected to:
" + - urlLink(movedUrl) + "
"; - ++movedTotal; - } - - if (!streamBody2.empty()) - { - streamBody += "" + streamBody2 + ""; - } - - streamBlocks[(*i).first] = streamBody; - } - } - } - - // this will now do a final check for any listeners which are on - // an un-confiured stream but are being provided a 'backupfile'. - const streamData::streamIDs_t activeIds = stats::getActiveStreamIds(); - if (!activeIds.empty()) - { - for (streamData::streamIDs_t::const_iterator i = activeIds.begin(); i != activeIds.end(); ++i) - { - if (streamBlocks.find((*i)) == streamBlocks.end()) - { - stats::statsData_t data; - stats::getStats((*i), data); - - // increment our stream total now that we know we have one - totalListeners += data.connectedListeners; - totalPeakListeners += data.peakListeners; - - utf8 streamBody = "" - "Stream #" + tos((*i)) + " " - "(Stream Login)", - streamBody2; - streamBody2 += "This stream is not configured and has no source connected." + - (data.connectedListeners > 0 ? "
Listeners: " - "" + tos(data.connectedListeners) + "" + (data.peakListeners > 0 ? "  |  " - "Peak: " + tos(data.peakListeners) + "" : "") + " [ kick all ]" + "
" : ""); - - if (!streamBody2.empty()) - { - streamBody += "" + streamBody2 + ""; - } - - streamBlocks[(*i)] = streamBody; - } - } - } - - // now build up the output since if we've factored in inactive relay connections - // then we could otherwise be showing the streams in an out of order manner - for (map::const_iterator i = streamBlocks.begin(); i != streamBlocks.end(); ++i) - { - if (!(*i).second.empty()) - { - if (streamTotal > 0) - { - streams += "


"; - } - streams += (*i).second; - ++streamTotal; - } - } - - // output a refresh option if there were no active streams found - if (!streamTotal) - { - if (isPostSetup() && isPostSetup() <= 2) - { - streams += "" - "
" - "Setup Successfully Completed
" - "No stream sources are currently connected.
" - "To find newly connected sources, click here."; - setPostSetup(isPostSetup() + 1); - } - else - { - streams += "No stream sources are currently connected.
" - "To find newly connected sources, click here.

"; - } - } - else - { - setPostSetup(0); - } - } - else if (refreshRequired > 0) - { - streams += "" - "Waiting " + tos(refreshRequired) + " second" + ((refreshRequired > 1) ? "s" : (utf8)"") + - " for any configuration changes to take effect.
" - "If not automatically redirected or do not want to wait, " - "click here.

"; - } - else if (refreshRequired < 0) - { - streams += "" - "Waiting " + tos(abs(refreshRequired)) + " second" + ((abs(refreshRequired) > 1) ? "s" : (utf8)"") + - " whilst checking for any DNAS updates.
If not automatically redirected or do not want to wait, " - "click here.

"; - } - - utf8 log = gOptions.realLogFile(); - utf8::size_type pos = log.rfind(fileUtil::getFilePathDelimiter()); - if ((pos != utf8::npos)) - { - log = log.substr(pos + 1); - } - - utf8 conf = gOptions.confFile(); - pos = conf.rfind(fileUtil::getFilePathDelimiter()); - if ((pos != utf8::npos)) - { - conf = conf.substr(pos + 1); - } - - const bool requires = gOptions.requireStreamConfigs(); - body += "" - "
" - "Available Streams: " + tos(streamTotal - movedTotal) + - "   |   " - "Server Listeners: " + tos(totalListeners) + - "   |   " - "Peak Server Listeners: " + tos(totalPeakListeners) + - "   |   " - "Unique Listeners: " + tos(stats::getTotalUniqueListeners()) + - "
" - - "
" - "
" - ""; - } - - body += "
" - - "" - "
" - "
Server Management
" - "Rotate Log File(s):" - " [ All ]" - "  [ Log ]" - "  [ W3C ]" - "

" - - // trim down the file paths shown to make things less cluttered on hosted setups - // places the full path in the 'title' so it can still be found if required, etc - "Log File: " + aolxml::escapeXML(fileUtil::stripPath(log)) + "

" - "Configuration File: " + aolxml::escapeXML(fileUtil::stripPath(conf)) + "
" - "[ View ]" - "  [ Update ]" - "  [ Forced ]" - - "



Source Connection Details:" - " [ View ]
" + - - (requires ? "
Note: Only pre-configured streams are " - "allowed to connect / be run on this server.
" : "") + - - "
Advert Group Details:" - " [ View ]
" - - "


Stream Configuration(s):" - " [ JSON ]" - "  [ XML ]
" - - "
View Stream Statistics:" - " [ JSON ]" - "  [ XML ]
" - - "


Manage Stream Source(s):
" - "[ Start Relays ]" - "  [ Kick / Stop All ]
" - - "


Reload Banned List(s):" - " [ Update ]
" - - "
Reload Reserved List(s):" - " [ Update ]
" - - "
Reload User Agent List(s):" - " [ Update ]
" - - "
Reload Admin Access List:" - " [ Update ]
" - - "
Clear Resource / Page Cache:" - " [ Clear ]
" - - "


Debugging Options:
" - "[ Enable All ]" - "  [ Disable All ]" - "  [ Edit ]" - - "



New DNAS Release: [ Check ]
" - "Last checked: " + getCheckedDuration((size_t)(m_lastActivityTime - last_update_check)) + "" - "
"; - - // display update message where applicable - updater::verInfo ver; - utf8 update_msg; - if (updater::getNewVersion(ver)) - { - update_msg += "
" - "
" - "
New DNAS Version Available
A new version of the DNAS is now available:" - " " + ver.ver + "

" + - (!ver.url.empty() ? - ((ver.downloaded && !ver.fn.empty()) ? "The new version has been automatically downloaded to:

" + aolxml::escapeXML(ver.fn) + "

" - "Please install this update as soon as possible, thank you.

" - "Specific changes for this version can be found here." - : - "Click here to download the new version of the DNAS.

" - "Please install this update as soon as possible, thank you.

" - "Specific changes for this version can be found here.") : "") + - (!ver.message.empty() ? "
" + ver.message : - (!ver.log.empty() ? "
For more details of the changes in this version see " + - "here." : "")) + "



" + - update_msg + streams + "
" + - "" + - getIEFlexFix() + getHTML5Remover() + getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length: " + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -void protocol_admincgi::mode_bandwidth_html(const int refreshRequired) throw() -{ - const __uint64 all = bandWidth::getAmount(bandWidth::ALL), - sent = bandWidth::getAmount(bandWidth::ALL_SENT), - recv = bandWidth::getAmount(bandWidth::ALL_RECV); - const time_t running = (::time(NULL) - g_upTime); - - utf8 header = MSG_NO_CLOSE_200, - body = getServerAdminHeader("Server Bandwidth Usage", refreshRequired, "&mode=bandwidth&refresh=" + tos(abs(refreshRequired)), 1) + - "" - "
" - "Total: " + formatSizeString(all) + (all > 0 ? " (~" + formatSizeString((all / running) * 86400) + " / day)" : "") + "" - "   |   " - "Sent: " + formatSizeString(sent) + (sent > 0 ? " (~" + formatSizeString((sent / running) * 86400) + " / day)" : "") + "" - "   |   " - "Received: " + formatSizeString(recv) + (recv > 0 ? " (~" + formatSizeString((recv / running) * 86400) + " / day)" : "") + "" - "

" - - "" - - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" -#if 0 - "" - "" -#endif - "" - - "" - "" - "" - "" - "" - "" - "" - - "" - "" - "" - "" - "" - "" - "" - - "" - "" - "" - "" - "" - "" - "" - "" - "" - - "" - "" - "" - "" - "" - "" - "" - - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - - "
 Total Client Data Sent" + formatSizeString(bandWidth::getAmount(bandWidth::ALL_CLIENT_SENT)) + "
v2 Client(s)" + formatSizeString(bandWidth::getAmount(bandWidth::CLIENT_V2_SENT)) + "
v1 Client(s)" + formatSizeString(bandWidth::getAmount(bandWidth::CLIENT_V1_SENT)) + "
HTTP Client(s)" + formatSizeString(bandWidth::getAmount(bandWidth::CLIENT_HTTP_SENT)) + "
FLV Client(s)" + formatSizeString(bandWidth::getAmount(bandWidth::CLIENT_FLV_SENT)) + "
M4A Client(s)" + formatSizeString(bandWidth::getAmount(bandWidth::CLIENT_M4A_SENT)) + "
 
 Total Source Data Received" + formatSizeString(bandWidth::getAmount(bandWidth::ALL_SOURCE_RECV)) + "
v2 Source(s)" + formatSizeString(bandWidth::getAmount(bandWidth::SOURCE_V2_RECV)) + "
v1 Source(s)" + formatSizeString(bandWidth::getAmount(bandWidth::SOURCE_V1_RECV)) + "
 
 Total Source Data Sent" + formatSizeString(bandWidth::getAmount(bandWidth::ALL_SOURCE_SENT)) + "
v2 Source(s)" + formatSizeString(bandWidth::getAmount(bandWidth::SOURCE_V2_SENT)) + "
v1 Source(s)" + formatSizeString(bandWidth::getAmount(bandWidth::SOURCE_V1_SENT)) + "
 
 Total Relay Data Received" + formatSizeString(bandWidth::getAmount(bandWidth::ALL_RELAY_RECV)) + "
Handshaking" + formatSizeString(bandWidth::getAmount(bandWidth::RELAY_MISC_RECV)) + "
v2 Relay(s)" + formatSizeString(bandWidth::getAmount(bandWidth::RELAY_V2_RECV)) + "
v1 Relay(s)" + formatSizeString(bandWidth::getAmount(bandWidth::RELAY_V1_RECV)) + "
 
 Total Web Page, XML and Resoures  " + formatSizeString(bandWidth::getAmount(bandWidth::ALL_WEB)) + "
Public (e.g. /stats or index.html)" + formatSizeString(bandWidth::getAmount(bandWidth::PUBLIC_WEB)) + "
Private (e.g. /admin.cgi pages)" + formatSizeString(bandWidth::getAmount(bandWidth::PRIVATE_WEB)) + "
 
 Total Other Data" + formatSizeString(bandWidth::getAmount(bandWidth::ALL_OTHER)) + "
Flash Policy Server" + formatSizeString(bandWidth::getAmount(bandWidth::FLASH_POLICY)) + "
v2 Relay(s) Sent" + formatSizeString(bandWidth::getAmount(bandWidth::RELAY_V2_SENT)) + "
YP Sent" + formatSizeString(bandWidth::getAmount(bandWidth::YP_SENT)) + "
YP Received" + formatSizeString(bandWidth::getAmount(bandWidth::YP_RECV)) + "
Listener Authentication and Metrics" + formatSizeString(bandWidth::getAmount(bandWidth::AUTH_AND_METRICS)) + "
Advert Retrieval" + formatSizeString(bandWidth::getAmount(bandWidth::ADVERTS)) + "
" + getUptimeScript() + getIEFlexFix() + getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length: " + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -void protocol_admincgi::mode_bandwidth_xml() throw() -{ - utf8 header = "HTTP/1.1 200 OK\r\nContent-Type:text/xml\r\n", - body = "" - "" - - "" + tos(bandWidth::getAmount(bandWidth::ALL)) + "" - "" + tos(bandWidth::getAmount(bandWidth::ALL_SENT)) + "" - "" + tos(bandWidth::getAmount(bandWidth::ALL_RECV)) + "" - "" - - "" - "" + tos(bandWidth::getAmount(bandWidth::ALL_CLIENT_SENT)) + "" - "" + tos(bandWidth::getAmount(bandWidth::CLIENT_V2_SENT)) + "" - "" + tos(bandWidth::getAmount(bandWidth::CLIENT_V1_SENT)) + "" - "" + tos(bandWidth::getAmount(bandWidth::CLIENT_HTTP_SENT)) + "" - "" + tos(bandWidth::getAmount(bandWidth::CLIENT_FLV_SENT)) + "" -#if 0 - "" + tos(bandWidth::getAmount(bandWidth::CLIENT_M4A_SENT)) + "" -#endif - "" - - "" - "" + tos(bandWidth::getAmount(bandWidth::ALL_SOURCE_RECV)) + "" - "" + tos(bandWidth::getAmount(bandWidth::SOURCE_V2_RECV)) + "" - "" + tos(bandWidth::getAmount(bandWidth::SOURCE_V1_RECV)) + "" - "" - - "" - "" + tos(bandWidth::getAmount(bandWidth::ALL_SOURCE_SENT)) + "" - "" + tos(bandWidth::getAmount(bandWidth::SOURCE_V2_SENT)) + "" - "" + tos(bandWidth::getAmount(bandWidth::SOURCE_V1_SENT)) + "" - "" - - "" - "" + tos(bandWidth::getAmount(bandWidth::ALL_RELAY_RECV)) + "" - "" + tos(bandWidth::getAmount(bandWidth::RELAY_MISC_RECV)) + "" - "" + tos(bandWidth::getAmount(bandWidth::RELAY_V2_RECV)) + "" - "" + tos(bandWidth::getAmount(bandWidth::RELAY_V1_RECV)) + "" - "" - - "" - "" + tos(bandWidth::getAmount(bandWidth::ALL_WEB)) + "" - "" + tos(bandWidth::getAmount(bandWidth::PUBLIC_WEB)) + "" - "" + tos(bandWidth::getAmount(bandWidth::PRIVATE_WEB)) + "" - "" - - "" - "" + tos(bandWidth::getAmount(bandWidth::ALL_OTHER)) + "" - "" + tos(bandWidth::getAmount(bandWidth::FLASH_POLICY)) + "" - "" + tos(bandWidth::getAmount(bandWidth::RELAY_V2_SENT)) + "" - "" + tos(bandWidth::getAmount(bandWidth::YP_SENT)) + "" - "" + tos(bandWidth::getAmount(bandWidth::YP_RECV)) + "" - "" + tos(bandWidth::getAmount(bandWidth::AUTH_AND_METRICS)) + "" - "" + tos(bandWidth::getAmount(bandWidth::ADVERTS)) + "" - "" - ""; - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -void protocol_admincgi::mode_bandwidth_json(const uniString::utf8& callback) throw() -{ - const bool jsonp = !callback.empty(); - utf8 header = "HTTP/1.1 200 OK\r\nContent-Type:application/json;charset=utf-8\r\n", - body = (jsonp ? callback + "(" : "") + - "{" - "\"total\":" + tos(bandWidth::getAmount(bandWidth::ALL)) + "," - "\"sent\":" + tos(bandWidth::getAmount(bandWidth::ALL_SENT)) + "," - "\"recv\":" + tos(bandWidth::getAmount(bandWidth::ALL_RECV)) + "," - "\"time\":" + tos((::time(NULL) - g_upTime)) + "," - "\"clientsent\":{" - "\"total\":" + tos(bandWidth::getAmount(bandWidth::ALL_CLIENT_SENT)) + "," - "\"v2\":" + tos(bandWidth::getAmount(bandWidth::CLIENT_V2_SENT)) + "," - "\"v1\":" + tos(bandWidth::getAmount(bandWidth::CLIENT_V1_SENT)) + "," - "\"http\":" + tos(bandWidth::getAmount(bandWidth::CLIENT_HTTP_SENT)) + "," - "\"flv\":" + tos(bandWidth::getAmount(bandWidth::CLIENT_FLV_SENT)) + -#if 0 - "," - "\"m4a\":" + tos(bandWidth::getAmount(bandWidth::CLIENT_M4A_SENT)) + -#endif - "},\"sourcerecv\":{" - "\"total\":" + tos(bandWidth::getAmount(bandWidth::ALL_SOURCE_RECV)) + "," - "\"v2\":" + tos(bandWidth::getAmount(bandWidth::SOURCE_V2_RECV)) + "," - "\"v1\":" + tos(bandWidth::getAmount(bandWidth::SOURCE_V1_RECV)) + - "},\"sourcesent\":{" - "\"total\":" + tos(bandWidth::getAmount(bandWidth::ALL_SOURCE_SENT)) + "," - "\"v2\":" + tos(bandWidth::getAmount(bandWidth::SOURCE_V2_SENT)) + "," - "\"v1\":" + tos(bandWidth::getAmount(bandWidth::SOURCE_V2_SENT)) + - "},\"relayrecv\":{" - "\"total\":" + tos(bandWidth::getAmount(bandWidth::ALL_SOURCE_RECV)) + "," - "\"misc\":" + tos(bandWidth::getAmount(bandWidth::RELAY_MISC_RECV)) + "," - "\"v2\":" + tos(bandWidth::getAmount(bandWidth::RELAY_V2_RECV)) + "," - "\"v1\":" + tos(bandWidth::getAmount(bandWidth::RELAY_V1_RECV)) + - "},\"webpages\":{" - "\"total\":" + tos(bandWidth::getAmount(bandWidth::ALL_WEB)) + "," - "\"public\":" + tos(bandWidth::getAmount(bandWidth::PUBLIC_WEB)) + "," - "\"private\":" + tos(bandWidth::getAmount(bandWidth::PRIVATE_WEB)) + - "},\"other\":{" - "\"total\":" + tos(bandWidth::getAmount(bandWidth::ALL_OTHER)) + "," - "\"flash\":" + tos(bandWidth::getAmount(bandWidth::FLASH_POLICY)) + "," - "\"relaysentv2\":" + tos(bandWidth::getAmount(bandWidth::RELAY_V2_SENT)) + "," - "\"ypsent\":" + tos(bandWidth::getAmount(bandWidth::YP_SENT)) + "," + - "\"yprecv\":" + tos(bandWidth::getAmount(bandWidth::YP_RECV)) + "," + - "\"auth_metrics\":" + tos(bandWidth::getAmount(bandWidth::AUTH_AND_METRICS)) + "," + - "\"adverts\":" + tos(bandWidth::getAmount(bandWidth::ADVERTS)) + - "}}" + (jsonp ? utf8(")") : ""); - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -void protocol_admincgi::mode_ypstatus_xml() throw() -{ - utf8 header = "HTTP/1.1 200 OK\r\nContent-Type:text/xml\r\n", - body = "" - ""; - - streamData::streamIDs_t streamIds = streamData::getStreamIds(); - config::streams_t streams; - gOptions.getStreamConfigs(streams); - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - if ((*i).second.m_streamID) - { - streamIds.insert((*i).second.m_streamID); - } - } - - for (streamData::streamIDs_t::const_iterator i = streamIds.begin(); i != streamIds.end(); ++i) - { - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo((*i), info, extra); - - const utf8 movedUrl = gOptions.stream_movedUrl((*i)); - if (movedUrl.empty()) - { - body += "" + - (!extra.isConnected ? "NOSOURCE" : - (info.m_streamPublic ? (extra.ypConnected != 1 ? (!yp2::isValidAuthhash(info.m_authHash) ? - (info.m_authHash.empty() ? "EMPTY_AUTHHASH" : "INVALID_AUTHHASH") : - (extra.ypErrorCode == 200 ? "WAITING" : - (extra.ypErrorCode == YP_COMMS_FAILURE ? "YP_NOT_FOUND" : - (extra.ypErrorCode == YP_MAINTENANCE_CODE ? "YP_MAINTENANCE" : - "ERROR" + tos(extra.ypErrorCode) + "")))) : - "PUBLIC" + info.m_stationID + "") : - "PRIVATE")) + ""; - } - else - { - body += "MOVED"; - } - } - - body += ""; - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -void protocol_admincgi::mode_ypstatus_json(const uniString::utf8& callback) throw() -{ - utf8 header = "HTTP/1.1 200 OK\r\nContent-Type:application/json;charset=utf-8\r\n"; - - streamData::streamIDs_t streamIds = streamData::getStreamIds(); - config::streams_t streams; - gOptions.getStreamConfigs(streams); - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - if ((*i).second.m_streamID) - { - streamIds.insert((*i).second.m_streamID); - } - } - - const bool jsonp = !callback.empty(); - utf8 body = (jsonp ? callback + "(" : "") + "{" + - (!streamIds.empty() ? "\"streams\":[" : ""); - - bool read = false; - for (streamData::streamIDs_t::const_iterator i = streamIds.begin(); i != streamIds.end(); ++i) - { - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo((*i), info, extra); - - const utf8 movedUrl = gOptions.stream_movedUrl((*i)); - if (movedUrl.empty()) - { - body += (read ? utf8(",") : "") + - "{" - "\"id\":" + tos((*i)) + "," + - (!extra.isConnected ? "\"status\":\"" + escapeJSON("nosource") + "\"" : - (info.m_streamPublic ? (extra.ypConnected != 1 ? (!yp2::isValidAuthhash(info.m_authHash) ? - (info.m_authHash.empty() ? "\"status\":\"" + escapeJSON("empty_authhash") + "\"" : - "\"status\":\"" + escapeJSON("invalid_authhash") + "\"") : - (extra.ypErrorCode == 200 ? "\"status\":\"" + escapeJSON("waiting") + "\"" : - (extra.ypErrorCode == YP_COMMS_FAILURE ? "\"status\":\"" + escapeJSON("yp_not_found") + "\"" : - (extra.ypErrorCode == YP_MAINTENANCE_CODE ? "\"status\":\"" + escapeJSON("yp_maintenance") + "\"" : - "\"status\":\"" + escapeJSON("error") + "\",\"code\":" + tos(extra.ypErrorCode))))) : - "\"status\":\"" + escapeJSON("public") + "\",\"stnid\":" + info.m_stationID) : - "\"status\":\"" + escapeJSON("private") + "\"")) + "}"; - } - else - { - body += (read ? utf8(",") : "") + "{\"id\":" + tos((*i)) + "," - "\"status\":\"" + escapeJSON("moved") + "\"}"; - } - read = true; - } - - body += (!streamIds.empty() ? utf8("]") : "") + "}" + (jsonp ? utf8(")") : ""); - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -void protocol_admincgi::mode_viewxml(const streamData::streamID_t sid, int page, - const bool iponly, const bool ipcount) throw() -{ - // abort as there's nothing generated for this now - if (page == 2) - { - sendMessageAndClose("HTTP/1.1 200 OK\r\nContent-Type:text/xml\r\n\r\n"); - return; - } - - if ((page > 6) || (page < 0)) - { - page = 0; - } - - utf8 header = "HTTP/1.1 200 OK\r\nContent-Type:text/xml\r\n", - body = ""; - - if (page < 2) - { - stats::statsData_t data; - body += protocol_HTTPStyle::getStatsXMLBody(sid, true, true, m_socket, data); - } - - if ((page == 0) || (page == 3)) - { - time_t t = ::time(NULL); - body += ""; - - stats::currentClientList_t client_data; - stats::getClientDataForStream(sid, client_data); - map ip_counts; - for (stats::currentClientList_t::const_iterator i = client_data.begin(); i != client_data.end(); ++i) - { - const utf8& host = ((*i)->m_hostName != (*i)->m_ipAddr ? (*i)->m_hostName : (*i)->m_ipAddr); - - if (!ipcount) - { - if (!iponly) - { - body += "" - "" + aolxml::escapeXML(host) + "" - "" + aolxml::escapeXML((*i)->m_userAgent) + "" - "" + tos(t - (*i)->m_startTime) + "" - "" + tos((*i)->m_unique) + "" - "" + tos((*i)->m_clientType) + "" - "" + aolxml::escapeXML((*i)->m_referer) + "" - "" + aolxml::escapeXML((*i)->m_XFF) + "" - "" + tos((*i)->m_group) + "" - "" + tos((*i)->m_triggers) + "" - ""; - } - else - { - body += "" - "" + aolxml::escapeXML(host) + "" - ""; - } - } - else - { - ++ip_counts[host]; - } - - delete (*i); - } - - if (ipcount) - { - for (map::const_iterator i = ip_counts.begin(); i != ip_counts.end(); ++i) - { - body += "" - "" + aolxml::escapeXML((*i).first) + "" - "" + tos((*i).second) + "" - ""; - } - } - - body += ""; - } - - if ((page == 0) || (page == 4) || (page == 5)) - { - streamData::streamHistory_t songHistory; - streamData::getStreamSongHistory(sid, songHistory); - - // only provide this as an option feature so as not to bloat the main xml stats unnecessarily - if (!(page == 5)) - { - body += ""; - for (streamData::streamHistory_t::const_iterator i = songHistory.begin(); i != songHistory.end(); ++i) - { - body += "" + tos((*i).m_when) + "" - "" + aolxml::escapeXML((*i).m_title) + "" + - protocol_HTTPStyle::getCurrentXMLMetadataBody(true, (*i).m_metadata) + ""; - } - body += ""; - } - else - { - body += protocol_HTTPStyle::getCurrentXMLMetadataBody(false, (!songHistory.empty() ? songHistory[0].m_metadata : "")); - } - } - - if (page == 6) - { - const int maxUsers = gOptions.maxUser(); - body += "" - "" + tos(gOptions.requireStreamConfigs()) + "" - "" + (maxUsers > 0 ? tos(maxUsers) : "UNLIMITED") + "" - "" + tos(gOptions.minBitrate()) + "" - "" + tos(gOptions.maxBitrate()) + "" - ""; - - config::streams_t streams; - gOptions.getStreamConfigs(streams); - - utf8 block = ""; - size_t moved = 0; - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - const utf8 movedUrl = gOptions.stream_movedUrl((*i).second.m_streamID); - if (movedUrl.empty()) - { - utf8 streamTag = ((*i).second.m_streamID > 1 ? "/stream/" + tos((*i).second.m_streamID) + "/" : "/"); - if (!(*i).second.m_urlPath.empty()) - { - streamTag = (*i).second.m_urlPath; - } - - const utf8& authhash = (*i).second.m_authHash; - block += "" - "" + aolxml::escapeXML(authhash.empty() ? "EMPTY" : !yp2::isValidAuthhash(authhash) ? "INVALID" : authhash) + "" - "" + aolxml::escapeXML(streamTag) + "" - "" + aolxml::escapeXML((*i).second.m_relayUrl.url()) + "" - "" + aolxml::escapeXML((*i).second.m_backupUrl.url()) + "" - "" + ((*i).second.m_maxStreamUser > 0 && (*i).second.m_maxStreamUser < gOptions.maxUser() ? tos((*i).second.m_maxStreamUser) : "SERVERMAXLISTENERS") + "" - "" + ((*i).second.m_minStreamBitrate > 0 ? tos((*i).second.m_minStreamBitrate) : "SERVERMINBITRATE") + "" - "" + ((*i).second.m_maxStreamBitrate > 0 ? tos((*i).second.m_maxStreamBitrate) : "SERVERMAXBITRATE") + "" - "" + aolxml::escapeXML((*i).second.m_publicServer) + "" - "" + tos((*i).second.m_allowRelay) + "" - "" + tos((*i).second.m_allowPublicRelay) + "" - ""; - } - else - { - ++moved; - } - } - - body += tos((streams.size() - moved)) + "" + block + ""; - } - - body += ""; - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -void protocol_admincgi::mode_viewjson(const streamData::streamID_t sid, int page, - const bool iponly, const bool ipcount, - const uniString::utf8& callback) throw() -{ - // abort as there's nothing generated for this now - if (page == 2) - { - sendMessageAndClose("HTTP/1.1 200 OK\r\nContent-Type:application/json;charset=utf-8\r\n\r\n"); - return; - } - - if (page > 6 || page < 0) - { - page = 0; - } - - const bool jsonp = !callback.empty(); - utf8 header = "HTTP/1.1 200 OK\r\nContent-Type:application/json;charset=utf-8\r\n", - body = (jsonp ? callback + "(" : "") + (page < 2 ? "{" : ""); - - if (page < 2) - { - stats::statsData_t data; - body += protocol_HTTPStyle::getStatsJSONBody(sid, true, true, m_socket, data); - } - - if ((page == 0) || (page == 3)) - { - time_t t = ::time(NULL); - body += (!page ? utf8(",\"listeners\":[") : "["); - - stats::currentClientList_t client_data; - stats::getClientDataForStream(sid, client_data); - map ip_counts; - for (stats::currentClientList_t::const_iterator i = client_data.begin(); i != client_data.end(); ++i) - { - const utf8& host = ((*i)->m_hostName != (*i)->m_ipAddr ? (*i)->m_hostName : (*i)->m_ipAddr); - - if (!ipcount) - { - if (!iponly) - { - body += (i != client_data.begin() ? utf8(",") : "") + - "{" - "\"hostname\":\"" + escapeJSON(host) + "\"," - "\"useragent\":\"" + escapeJSON((*i)->m_userAgent) + "\"," - "\"connecttime\":" + tos(t - (*i)->m_startTime) + "," - "\"uid\":" + tos((*i)->m_unique) + "," - "\"type\":" + tos((*i)->m_clientType) + "," - "\"referer\":\"" + escapeJSON((*i)->m_referer) + "\"," - "\"xff\":\"" + escapeJSON((*i)->m_XFF) + "\"," - "\"grid\":" + tos((*i)->m_group) + "," - "\"triggers\":" + tos((*i)->m_triggers) + "" - "}"; - } - else - { - body += (i != client_data.begin() ? utf8(",") : "") + - "{" - "\"hostname\":\"" + escapeJSON(host) + "\"" - "}"; - } - } - else - { - ++ip_counts[host]; - } - - delete (*i); - } - - if (ipcount) - { - for (map::const_iterator i = ip_counts.begin(); i != ip_counts.end(); ++i) - { - body += (i != ip_counts.begin() ? utf8(",") : "") + - "{" - "\"hostname\":\"" + escapeJSON((*i).first) + "\"," - "\"total\":" + tos((*i).second) + "" - "}"; - } - } - - body += "]"; - } - - if ((page == 0) || (page == 4) || (page == 5)) - { - streamData::streamHistory_t songHistory; - streamData::getStreamSongHistory(sid, songHistory); - - // only provide this as an option feature so as not to bloat the main xml stats unnecessarily - if (!(page == 5)) - { - bool first = true; - body += (!page ? utf8(",\"songs\":[") : "["); - for (streamData::streamHistory_t::const_iterator i = songHistory.begin(); i != songHistory.end(); ++i) - { - body += (!first ? utf8(",") : "") + "{\"playedat\":" + - tos((*i).m_when) + "," "\"title\":\"" + - escapeJSON((*i).m_title) + "\",\"metadata\":" + - protocol_HTTPStyle::getCurrentJSONMetadataBody((*i).m_metadata) + "}"; - first = false; - } - body += "]"; - } - else - { - body += protocol_HTTPStyle::getCurrentJSONMetadataBody((!songHistory.empty() ? songHistory[0].m_metadata : "")); - } - } - - if (page == 6) - { - const int maxUsers = gOptions.maxUser(); - body += "{" - "\"requireconfigs\":" + tos(gOptions.requireStreamConfigs()) + "," - "\"maxlisteners\":" + (maxUsers > 0 ? tos(maxUsers) : "\"unlimited\"") + "," - "\"minbitrate\":" + tos(gOptions.minBitrate()) + "," - "\"maxbitrate\":" + tos(gOptions.maxBitrate()) + ","; - - config::streams_t streams; - gOptions.getStreamConfigs(streams); - - bool read = false; - utf8 block = ""; - size_t moved = 0; - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - const utf8 movedUrl = gOptions.stream_movedUrl((*i).second.m_streamID); - if (movedUrl.empty()) - { - utf8 streamTag = ((*i).second.m_streamID > 1 ? "/stream/" + tos((*i).second.m_streamID) + "/" : "/"); - if (!(*i).second.m_urlPath.empty()) - { - streamTag = (*i).second.m_urlPath; - } - - utf8 authhash = (*i).second.m_authHash; - block += (read ? utf8(",") : "") + - "{" - "\"id\":" + tos((*i).second.m_streamID) + "," - "\"authhash\":\"" + escapeJSON(authhash.empty() ? "empty" : !yp2::isValidAuthhash(authhash) ? "invalid" : authhash) + "\"," - "\"path\":\"" + escapeJSON(streamTag) + "\"," - "\"relayurl\":\"" + escapeJSON((*i).second.m_relayUrl.url()) + "\"," - "\"backupurl\":\"" + escapeJSON((*i).second.m_backupUrl.url()) + "\"," - "\"maxlisteners\":\"" + escapeJSON(((*i).second.m_maxStreamUser > 0) && ((*i).second.m_maxStreamUser < gOptions.maxUser()) ? tos((*i).second.m_maxStreamUser) : escapeJSON("maxlisteners")) + "\"," - "\"minbitrate\":\"" + escapeJSON((*i).second.m_minStreamBitrate > 0 ? tos((*i).second.m_minStreamBitrate) : escapeJSON("minbitrate")) + "\"," - "\"maxbitrate\":\"" + escapeJSON((*i).second.m_maxStreamBitrate > 0 ? tos((*i).second.m_maxStreamBitrate) : escapeJSON("maxbitrate")) + "\"," - "\"public\":\"" + escapeJSON((*i).second.m_publicServer) + "\"," - "\"allowrelay\":\"" + tos((*i).second.m_allowRelay) + "\"," - "\"publicrelay\":\"" + tos((*i).second.m_allowPublicRelay) + "\"" - "}"; - read = true; - } - else - { - ++moved; - } - } - const size_t total = (streams.size() - moved); - body += "\"total\":\"" + tos(total) + "\"" + - (total > 0 ? ",\"streams\":[" : "") + block + - (total > 0 ? utf8("]") : "") + "}"; - } - - body += (page < 2 ? utf8("}") : "") + (jsonp ? ")" : ""); - - COMPRESS(header, body); - header += "Content-Length:" + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -void protocol_admincgi::mode_sources(const uniString::utf8& host) throw() -{ - utf8 header = MSG_NO_CLOSE_200, - body = getServerAdminHeader("Server Source Connection Details") + - "" - "
" + - utf8(gOptions.requireStreamConfigs() ? "Sources are only able to connect on the configured streams shown" : - "Sources are able to connect on any \"Stream ID\" (using the appropriate details)") + - "
" - "

" - - "
" - "
Information
" - "Here are the login details to enter in your chosen source software so it can then be used to connect to the server.

" - "Note: Names of options in the source software may vary from those shown.

" - - "* This may not be correct and is a best guess from the current connection.



" - "The 'Legacy Password' is for use with legacy sources (which are sources that are not able to directly specify the " - "desired stream number).

This allows for use of any Shoutcast compatible source on any of the currently configured streams.

" - "If connecting a legacy source to stream #1, the 'Password' value can be used.



" - "The example JSON-P response uses callback=func which can be changed to a custom value as required for usage.



" - - "For further information on connecting sources to the server, as well as ensuring that all of the required ports have been opened, " - "see this wiki page.

"; - - config::streams_t streams; - gOptions.getStreamConfigs(streams); - - utf8 ids = ""; - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - ids += (i != streams.begin() ? ", ": "") + tos((*i).second.m_streamID); - - // skip over moved streams as they cannot be used, though we include the - // streamid above (whether or not that'll confuse people i do not know). - const utf8 movedUrl = gOptions.stream_movedUrl((*i).second.m_streamID); - if (movedUrl.empty()) - { - int maxbitrate = ((*i).second.m_maxStreamBitrate > 0 ? (*i).second.m_maxStreamBitrate : gOptions.maxBitrate()), - minbitrate = ((*i).second.m_minStreamBitrate > 0 ? (*i).second.m_minStreamBitrate : gOptions.minBitrate()); - - // test for being a relay which is active - if so then we need to not show - // direct source login details as they will not be able to connect anyway - bool noEntry = false, isRelay = (*i).second.m_relayUrl.isSet(); - if (isRelay && streamData::isRelayActive((*i).second.m_streamID, noEntry)) - { - body += "
" - "
" - "Stream #" + tos((*i).second.m_streamID) + "
" - "This stream has been configured for use as a relay which is currently active.

" - "Any source connections attempted will be blocked whilst the relay is active.

" - "Password: " + aolxml::escapeXML((*i).second.m_password) + "
" - "Source: " + urlLink(niceURL((*i).second.m_relayUrl.url())) + "
" + - (!(*i).second.m_backupUrl.url().empty() ? "Backup Source: " + - urlLink(niceURL((*i).second.m_backupUrl.url())) + "
" : ""); - } - // otherwise show direct source login details for specific as well as generic stream - // logins (even if configured to be a relay as long as it is inactive at the time) - else - { - body += "
" - "
Stream #" + tos((*i).second.m_streamID) + "
" + - (isRelay ? "Note: Configured as a relay to use:
" + - niceURL((*i).second.m_relayUrl.url()) + "

" : "") + - "Stream ID: " + tos((*i).second.m_streamID) + "
" - "Server Address: " + (!host.empty() ? host : "") + " (*)
" - "Source Port: " + tos(gOptions.portBase()) + "

" + - "Password: " + aolxml::escapeXML((*i).second.m_password) + "
" + - ((*i).second.m_streamID > 1 && (g_legacyPort > 0) ? "Legacy Password: " + - aolxml::escapeXML((*i).second.m_password) + ":#" + tos((*i).second.m_streamID) + "

" : "
") + - "Min Bitrate Allowed: " + (!minbitrate ? "Unlimited" : tos(minbitrate / 1000) + " kbps") + "
" - "Max Bitrate Allowed: " + (!maxbitrate ? "Unlimited" : tos(maxbitrate / 1000) + " kbps") + "

" - "Protocol Mode: " + ((g_legacyPort > 0) ? "v2, v1" : "v2") + "
"; - } - - const utf8 address = "http://" + ((!host.empty() ? host : "") + ":" + tos(gOptions.portBase())), - params = "?sid=" + tos((*i).second.m_streamID) + "&pass=" + aolxml::escapeXML((*i).second.m_password); - body += "


Listener Playlist(s):
" - "PLS,  " - "M3U,  " - "ASX,  " - "XSPF,  " - "QTL" - - "

Direct Stream URL(s):
" - "" - " FLV,  " - "" - " HTTP,  " - "" - " 1.x,  " - "" - " 2.x" - - "

History:
" - "XML,  " - "JSON,  " - "JSON-P" - - "

Stream Statistics:
" - "XML,  " - "JSON,  " - "JSON-P
"; - } - } - - if (!gOptions.requireStreamConfigs()) - { - const int minbitrate = gOptions.minBitrate(), maxbitrate = gOptions.maxBitrate(); - body += "
" - "
All" + (!ids.empty() ? " Other" : (utf8)"") + " Streams
" - "Stream ID: <any value" + (!ids.empty() ? " other than " + ids : "") + ">
" - "Server Address: " + aolxml::escapeXML(!host.empty() ? host : "") + " (*)
" - "Server Port: " + tos(gOptions.portBase()) + "

" + - "Password: " + aolxml::escapeXML(gOptions.password()) + "
" + - ((g_legacyPort > 0) ? "Legacy Password: " + aolxml::escapeXML(gOptions.password()) + ":#xx

" : "
") + - "Min Bitrate Allowed: " + (!minbitrate ? "Unlimited" : tos(minbitrate / 1000) + " kbps") + "
" - "Max Bitrate Allowed: " + (!maxbitrate ? "Unlimited" : tos(maxbitrate / 1000) + " kbps") + "

" - "Protocol Mode: " + ((g_legacyPort > 0) ? "v2, v1" : "v2") + "
"; - - const utf8 address = "http://" + ((!host.empty() ? host : "") + ":" + tos(gOptions.portBase())), - params = "?sid=xx&pass=" + aolxml::escapeXML(gOptions.password()); - body += "


Listener Playlist(s):
" - "PLS,  " - "M3U,  " - "ASX,  " - "XSPF,  " - "QTL" - - "

History:
" - "XML,  " - "JSON,  " - "JSON-P" - - "

Stream Statistics:
" - "XML,  " - "JSON,  " - "JSON-P" - "

Note: Replace the 'xx' in 'sid=xx' in all of the example links " - "and in the 'Legacy Password' with the stream number.
"; - } - - body += "
" + getUptimeScript() + getIEFlexFix() + getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length: " + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -void protocol_admincgi::mode_adgroups() throw() -{ - utf8 header = MSG_NO_CLOSE_200, - body = getServerAdminHeader("Server Advert Group Details") + - "

" - "" - "
" - "
" - "
" - "
Information
" - "Here you can see which active stream(s) have adverts enabled and their status of obtaining the advert details." - "

This can help to see if a listener should be receiving adverts or not by " - "checking for the listener's group id with the group ids shown for the required stream.

" - - "
" - ""; - - const streamData::streamIDs_t streamIds = streamData::getStreamIds(); - if (!streamIds.empty()) - { - body += "" - ""; - - for (streamData::streamIDs_t::const_iterator i = streamIds.begin(); i != streamIds.end(); ++i) - { - streamData *sd = streamData::accessStream((*i)); - if (sd) - { - if (sd->isSourceConnected((*i))) - { - body += "" - ""; - } - sd->releaseStream(); - } - } - } - else - { - body += ""; - } - body += "
Stream #Advert Group(s)
" + tos((*i)) + "" + - sd->getAdvertGroup() + "
There are no active streams.
" + - getUptimeScript() + getIEFlexFix() + getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length: " + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -void protocol_admincgi::mode_debug(const uniString::utf8& option, const int on_off, const bool adminRefer) throw() -{ - struct debug_options { - utf8 option; - utf8 desc; - utf8 msg; - bool value; - }; - debug_options debug[] = { - {"Listener Connections", "", ""}, - {"shoutcast1clientdebug", "Shoutcast 1.x Listener Connections", "Used to diagnose connection issues with listener connections using the legacy Shoutcast 1.x protocol" - "
(e.g. HTTP connections indicating they support icy-metadata).", gOptions.shoutcast1ClientDebug()}, - {"shoutcast2clientdebug", "Shoutcast 2.x Listener Connections", "Used to diagnose connection issues with listener connections using the Shoutcast 2.x protocol.", gOptions.shoutcast2ClientDebug()}, - {"httpclientdebug", "HTTP Listener Connections", "Used to diagnose connection issues with listener connections using the HTTP protocol.", gOptions.HTTPClientDebug()}, - {"flvclientdebug", "FLV Listener Connections", "Used to diagnose connection issues with listener connections using the FLV encapsulation.", gOptions.flvClientDebug()}, -#if 0 - {"m4aclientdebug", "M4A Listener Connections", "Used to diagnose connection issues with listener connections using the M4A encapsulation.", gOptions.m4aClientDebug()}, -#endif - {"Direct Source Connections", "", ""}, - {"shoutcastsourcedebug", "Shoutcast 1.x Source Connections", "Used to diagnose connection issues with source connections using the legacy Shoutcast 1.x protocol.", gOptions.shoutcastSourceDebug()}, - {"uvox2sourcedebug", "Shoutcast 2.x Source Connections", "Used to diagnose connection issues with source connections using the Shoutcast 2.x protocol.", gOptions.uvox2SourceDebug()}, - {"httpsourcedebug", "HTTP Source Connections", "Used to diagnose connection issues with source connections using HTTP PUT protocol (e.g. Icecast sources).", gOptions.HTTPSourceDebug()}, - {"Relay Source Connections", "", ""}, - {"relayshoutcastdebug", "Shoutcast 1.x Relay Connections", "Used to diagnose connection issues with relay connections using the legacy Shoutcast 1.x protocol.", gOptions.relayShoutcastDebug()}, - {"relayuvoxdebug", "Shoutcast 2.x Relay Connections", "Used to diagnose connection issues with relay connections using the Shoutcast 2.x protocol.", gOptions.relayUvoxDebug()}, - {"relaydebug", "Common Relay Handling", "Used to diagnose issues with general relay handling when a relay connection begins (non-protcool specific).", gOptions.relayDebug()}, - {"HTTP Connections", "", ""}, - {"httpstyledebug", "HTTP Requests", "Used to inspect HTTP requests made to the server (e.g. listener or statistic requests).", gOptions.httpStyleDebug()}, - {"webclientdebug", "HTTP Connections", "Used to inspect and diagnose issues with HTTP connections issued by the server.", gOptions.webClientDebug()}, - {"Shoutcast Services", "", ""}, - {"admetricsdebug", "Advert & Metrics Handling", "Used to inspect and diagnose issues with the advert and metric activity for client connections.", gOptions.adMetricsDebug()}, - {"yp2debug", "YP / Directory Connections", "Used to diagnose failures to connect to the Directory servers or to be listed.", gOptions.yp2Debug()}, -#if defined(_DEBUG) || defined(DEBUG) - // this is not enabled as we don't really want to promote the existence of this - {"authdebug", "Listener Auth Handling", "Used to diagnose issues with the client auth handling when clients connect to the stream.", gOptions.authDebug()}, -#endif - {"Miscellaneous", "", ""}, - {"streamdatadebug", "Common Stream Handling", "Used to diagnose issues with general streaming code (non-protcool specific).", gOptions.streamDataDebug()}, - {"statsdebug", "Client Statistics", "Used to inspect client statistics tracked by the server.", gOptions.statsDebug()}, - {"microserverdebug", "Common Server Activity", "Used to diagnose and track common server activity.", gOptions.microServerDebug()}, - {"threadrunnerdebug", "Thread Manager", "Used to diagnose and track the processing of threads by the thread manager.", gOptions.threadRunnerDebug()}, - }; - - if (option.empty()) - { - utf8 header = "HTTP/1.1 200 OK\r\n" - "Cache-Control:no-cache\r\n" - "Content-Type:text/html;charset=utf-8\r\n", - body = getServerAdminHeader("Server Debugging Options") + - "

" - "" - "
" - "
" - "
" - "
Information
" - "Here you can find are all debugging options provided by the " - "DNAS server.

Changing the debugging options will update " - "the value saved in the DNAS server configuration file(s) as " - "needed.

Any changes are applied immediately.



" - - "
All Options

" - "" - "   " - "



" - - "
Listener Options

" - "" - "   " - "



" - - "
Source Options

" - "" - "   " - "



" - - "
Force Short Sends
[" + (gOptions.forceShortSends() ? "Enabled" : - "Disabled") + "]


This inserts delays into sending stream(s)" - "to replicate network limiting and bandwidth issues (Default: Disabled).

" - "" - "   " - "



" - - "
Rate Limiting
" - "[" + (gOptions.rateLimit() ? "Enabled" : "Disabled") + - "]


Controls the rate of output to even " - "it out and prefer sending larger blocks in one go instead of " - "doing smaller blocks more often (Default: Enabled).

" - "" - "   " - - "
"; - - for (size_t i = 0; i < sizeof(debug) / sizeof(debug[0]); i++) - { - if (!debug[i].desc.empty()) - { - body += "" "" - "
" + debug[i].msg + "

"; - } - else - { - body += (i ? "
" : (utf8)"") + "" + debug[i].option + ":

"; - } - } - - body += "
" - + getUptimeScript() + - "" + getIEFlexFix() + getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length: " + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); - } - else - { - if (option == "all") - { - ILOG(LOGNAME + utf8(on_off ? "Enabling" : "Disabling") + " all debugging options"); - for (size_t i = 0; i < sizeof(debug) / sizeof(debug[0]); i++) - { - if (!debug[i].desc.empty()) - { - // always set even if the saving fails so we've got something working - try - { - gOptions.setOption(debug[i].option, utf8(tos(on_off))); - } - catch(const exception &) - { - } - - bool handled = false, idHandled = false; - // if we get a clear then just remove from the config and reload the page - if (gOptions.editConfigFileEntry(0, gOptions.confFile(), debug[i].option, tos(on_off), - true, handled, idHandled, true) == false) - { - ELOG(LOGNAME "Error saving debug option: `" + debug[i].option + "'"); - } - } - } - } - else if (option == "listener") - { - ILOG(LOGNAME + utf8(on_off ? "Enabling" : "Disabling") + " all listener debugging options"); - const utf8 options[] = {"shoutcast1clientdebug", "shoutcast2clientdebug", "httpclientdebug", "flvclientdebug"/*, "m4aclientdebug"*/}; - for (size_t i = 0; i < sizeof(options) / sizeof(options[0]); i++) - { - // always set even if the saving fails so we've got something working - try - { - gOptions.setOption(options[i], utf8(tos(on_off))); - } - catch(const exception &) - { - } - - bool handled = false, idHandled = false; - // if we get a clear then just remove from the config and reload the page - if (gOptions.editConfigFileEntry(0, gOptions.confFile(), options[i], tos(on_off), - true, handled, idHandled, true) == false) - { - ELOG(LOGNAME "Error saving debug option: `" + options[i] + "'"); - } - } - } - else if (option == "source") - { - ILOG(LOGNAME + utf8(on_off ? "Enabling" : "Disabling") + " all source debugging options"); - const utf8 options[] = {"shoutcastsourcedebug", "uvox2sourcedebug", "httpsourcedebug", - "relayshoutcastdebug", "relayuvoxdebug", "relaydebug"}; - for (size_t i = 0; i < sizeof(options) / sizeof(options[0]); i++) - { - // always set even if the saving fails so we've got something working - try - { - gOptions.setOption(options[i], utf8(tos(on_off))); - } - catch(const exception &) - { - } - - bool handled = false, idHandled = false; - // if we get a clear then just remove from the config and reload the page - if (gOptions.editConfigFileEntry(0, gOptions.confFile(), options[i], tos(on_off), - true, handled, idHandled, true) == false) - { - ELOG(LOGNAME "Error saving debug option: `" + options[i] + "'"); - } - } - } - else - { - ILOG(LOGNAME + utf8(on_off ? "Enabling" : "Disabling") + " the `" + option + "' debugging options"); - - // always set even if the saving fails so we've got something working - gOptions.setOption(option, utf8(tos(on_off))); - - bool handled = false, idHandled = false; - // if we get a clear then just remove from the config and reload the page - if (gOptions.editConfigFileEntry(0, gOptions.confFile(), option, tos(on_off), - true, handled, idHandled, true) == false) - { - ELOG(LOGNAME "Error saving debug option: `" + option + "'"); - } - } - - if (adminRefer) - { - sendMessageAndClose(redirect("admin.cgi", SHRINK)); - } - else - { - sendMessageAndClose(MSG_200); - } - } -} - -void protocol_admincgi::mode_help() throw() -{ - utf8 libs = "Supporting Libraries:

"; - std::vector parts = tokenizer(utf8(curl_version()), ' '); - for (vector::const_iterator i = parts.begin(); i != parts.end(); ++i) - { - utf8::size_type pos = (*i).find('/'); - if (pos != utf8::npos) - { - libs += (*i).substr(0, pos) + utf8(": ") + (*i).substr(pos + 1) + utf8(""); - } - else - { - libs += "" + (*i) + ""; - } - - - if ((*i).find((utf8)"libcurl") != utf8::npos) - { - libs += " (site)"; - } - else if ((*i).find((utf8)"OpenSSL") != utf8::npos) - { - libs += " (site)"; - } - else if ((*i).find((utf8)"zlib") != utf8::npos) - { - libs += " (site)"; - } - libs += "
"; - } - - const int cpu_count = gOptions.getCPUCount(); - const utf8 cpu = "CPU Count: " + tos(cpucount()) + " -> " + - (cpu_count == cpucount() ? "using " + utf8(cpu_count > 1 ? "all" : "the") + - " available CPU" + (cpu_count > 1 ? "s" : "") : tos(cpu_count) + - " specified to be used") + "

"; - - XML_Expat_Version expat = XML_ExpatVersionInfo(); - utf8 header = MSG_NO_CLOSE_200, - body = getServerAdminHeader("Server Help & Documentation") + - - "

" - - "
" - "
Help
" - "If you are having issues, you should first try to contact your " - "hosting provider.

If running the DNAS server yourself (or if instructed " - "to do so), then you can use our forum " - "or you can contact " - "Shoutcast support directly (e.g. if the issue relates to an " - "account / authhash issue).

Note: If using the forum, " - "do not post any information which could be used to compromise " - "your account / authhash / etc (e.g. passwords and authhash(s)).

" - - "
" - "
Documentation
" - "Supporting documentation for using the DNAS server from setup " - "to getting statistics from the server are online.

" - "Otherwise a local copy can usually be found on the host machine at:

" - "
" + aolxml::escapeXML(gStartupDirectory) + - "

Note: The local copy is usually correct for the version being " - "used and the " - "online version will be for the most recent release.

" - - "
" - "
About
" - "Information about the DNAS server and the supporting libraries currently used.

" - "Version: " + addWBR(gOptions.getVersionBuildStrings()) + "
" - "Platform: " + SERV_OSNAME "
" - "Built: " __DATE__"

" - + libs + // libcurl, openssl, zlib - "expat: " + tos(expat.major) + "." + tos(expat.minor) + "." + tos(expat.micro) + "" - " (site)" - //#ifdef _WIN32 - //"
pthread-win32: " PTW32_VERSION_STR "-mod" - //" (site)" - //#endif - "

" - - "
Diagnostics
" + cpu + - "Current thread & runner usage:

" + - threadedRunner::getRunnabledetails() + "
" - - + getUptimeScript() + getIEFlexFix() + getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length: " + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -void protocol_admincgi::mode_config() throw() -{ - utf8 conf = gOptions.confFile(); - utf8::size_type pos = conf.rfind(fileUtil::getFilePathDelimiter()); - if ((pos != utf8::npos)) - { - conf = conf.substr(pos + 1); - } - - utf8 header = MSG_NO_CLOSE_200, - body = getServerAdminHeader("Server Configuration Settings") + - "
This page shows the custom configuration settings " - "that this DNAS server is currently using. (Settings which match DNAS server defaults " - "may not be shown.)

Note #1: To change these values, you will need to edit the " - "" + - (!conf.empty() ? conf : "sc_serv.conf") + " file on your server. See here " - "for more information.

Note #2: This is not the same as the actual configuration file " - "(i.e. the structure of the configuration file(s) being used is not shown)
" + - gOptions.dumpConfigFile() + "
" + getUptimeScript() + getIEFlexFix() + getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length: " + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} - -#if 0 -void protocol_admincgi::mode_logs() throw() -{ - utf8 header = "HTTP/1.1 200 OK\r\n" - "Cache-Control:no-cache\r\n" - "Content-Type:text/html;charset=utf-8\r\n", - headerTitle = "Server Log Management", childPage = ""; - - bool bwstyle = false; - int refreshRequired = 0; - utf8 body = s_serverAdminHeading; - - body += "

" - "" - "
" - "
" - "
" - "
Information
" - "Here you can find are all debugging options provided by the DNAS server.

Changing the debugging " - "options will update the value saved in the DNAS server configuration file(s) as needed.

" - "Any changes are applied immediately.

" - - "
"; - - utf8 logfile = gOptions.realLogFile(); - - body += "
Current log file:
"; - body += "
" + - aolxml::escapeXML(fileUtil::stripPath(logfile)) + "" - "   View" - "   Save" - "
Size: " + formatSizeString(uniFile::fileSize(logfile)) + "

"; - - utf8 rotated = fileUtil::stripSuffix(logfile) + "_*." + fileUtil::getSuffix(logfile); - body += "
Older log file(s):
"; - body += "
"; - #ifdef _WIN32 - vector fileList = fileUtil::directoryFileList(utf8(fileUtil::getFullFilePath(rotated)).toWString(), L"", true, true); - #else - vector fileList = fileUtil::directoryFileList(fileUtil::getFullFilePath(rotated), ""); - #endif - if (!fileList.empty()) - { - #ifdef _WIN32 - for (vector::const_iterator i = fileList.begin(); i != fileList.end(); ++i) - #else - for (vector::const_iterator i = fileList.begin(); i != fileList.end(); ++i) - #endif - { - #ifdef _WIN32 - utf32 u32file(*i); - utf8 u8f(u32file.toUtf8()); - body += "
" + fileUtil::stripPath(u8f) + "" - "
   View   " - "Save

Size: " + - formatSizeString(uniFile::fileSize(u8f)) + "" - "
Last Modified: " + getRFCDate(uniFile::fileTime(u8f)) + "

"; - #else - body += "
" + fileUtil::stripPath(*i) + "   " - "Save
"; - #endif - } - } - body += "
"; -#if 0 - utf8 archived = fileUtil::stripSuffix(logfile) + "_*.gz"; - body += "
Log file (archived): "/* + aolxml::escapeXML(fileUtil::getFullFilePath(archived)) + */"

"; - body += "
"; - #ifdef _WIN32 - fileList = fileUtil::directoryFileList(utf8(fileUtil::getFullFilePath(archived)).toWString(), L"", true, true); - #else - fileList = fileUtil::directoryFileList(fileUtil::getFullFilePath(archived), ""); - #endif - if (!fileList.empty()) - { - #ifdef _WIN32 - for (vector::const_iterator i = fileList.begin(); i != fileList.end(); ++i) - #else - for (vector::const_iterator i = fileList.begin(); i != fileList.end(); ++i) - #endif - { - #ifdef _WIN32 - utf32 u32file(*i); - utf8 u8f(u32file.toUtf8()); - body += "
" + fileUtil::stripPath(u8f) + "
"; - #else - body += "
" + fileUtil::stripPath(*i) + "
"; - #endif - } - } - body += "
"; - - body += "
"; - - utf8 w3cfile = gOptions.w3cLog(); - body += "
W3C file: " + aolxml::escapeXML(fileUtil::getFullFilePath(w3cfile)) + "

"; - utf8 archived = fileUtil::stripSuffix(w3cfile) + "_*.gz"; - body += "
W3C file (archived): " + aolxml::escapeXML(fileUtil::getFullFilePath(archived)) + "

"; - archived = fileUtil::stripSuffix(w3cfile) + "_*_w3c.gz"; - body += "
W3C file (archived 2): " + aolxml::escapeXML(fileUtil::getFullFilePath(archived)) + "

"; - body += "
"; - config::streams_t streams; - gOptions.getStreamConfigs(streams); - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - // w3c logging - if (gOptions.read_stream_w3cLog((*i).first)) - { - body += "
Stream W3C file: " + aolxml::escapeXML(fileUtil::getFullFilePath(gOptions.stream_w3cLog((*i).first))) + "

"; - } - } - body += "
"; - body += "
"; - body += "
"; - #ifdef _WIN32 - fileList = fileUtil::directoryFileList(gStartupDirectory.toWString() + L"sc_w3c*.log", L"", true, true); - #else - fileList = fileUtil::directoryFileList(gStartupDirectory.hideAsString() + "sc_w3c*.log", ""); - #endif - if (!fileList.empty()) - { - #ifdef _WIN32 - for (vector::const_iterator i = fileList.begin(); i != fileList.end(); ++i) - #else - for (vector::const_iterator i = fileList.begin(); i != fileList.end(); ++i) - #endif - { - #ifdef _WIN32 - utf32 u32file(*i); - utf8 u8f(u32file.toUtf8()); - body += "
" + fileUtil::stripPath(u8f) + "
"; - #else - body += "
" + fileUtil::stripPath(*i) + "
"; - #endif - } - } - body += "
"; -#endif - body += "
" - + getUptimeScript() + - "" + getfooterStr(); - - COMPRESS(header, body); - header += "Content-Length: " + tos(body.size()) + "\r\n\r\n"; - sendMessageAndClose(header + (!HEAD_REQUEST ? body : "")); -} -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_admincgi.h b/Src/Plugins/DSP/sc_serv3/protocol_admincgi.h deleted file mode 100644 index eeec9327..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_admincgi.h +++ /dev/null @@ -1,115 +0,0 @@ -#pragma once -#ifndef protocol_admincgi_H_ -#define protocol_admincgi_H_ - -#include "threadedRunner.h" -#include "protocol_HTTPStyle.h" -#include "streamData.h" - -// this class takes any necessary actions indicated by an HTTP -// call with the /admin.cgi url -class protocol_admincgi: public runnable -{ -private: - const bool m_noSID; - const bool m_zeroSID; - short m_saveLogFile; - - const uniString::utf8 m_clientLogString; - const protocol_HTTPStyle::HTTPRequestInfo m_httpRequestInfo; - const uniString::utf8 m_password; - uniString::utf8 m_referer; - const uniString::utf8 m_hostIP; - const uniString::utf8 m_userAgent; - const streamData::streamID_t m_sid; - - virtual uniString::utf8 name() const throw() { return "protocol_admincgi"; } - void timeSlice() throw(std::exception); - typedef void (protocol_admincgi::*state_t)(); - - state_t m_state; - state_t m_nextState; - - const uniString::utf8::value_type *m_outBuffer; // for outgoing text lines - int m_outBufferSize; - - bool m_tailLogFile; - // for log file output colouring - char lastChar; - bool inMsg; - bool first; - - uniString::utf8 m_outMsg; - uniString::utf8 m_updinfoSong; // for the updinfo so we're not re-processing after checking - uniString::utf8 m_updinfoURL; // for the updinfo so we're not re-processing after checking - uniString::utf8 m_updinfoDJ; // for the updinfo so we're not re-processing after checking - uniString::utf8 m_updinfoNext; // for the updinfo so we're not re-processing after checking - - // for log file transmission - FILE* m_logFile; - uniString::utf8 m_logFileName; - uniString::utf8 m_logFileHeader; - uniString::utf8 m_logFileBodyPrefix; - uniString::utf8 m_logFileBodyFooter; - std::vector m_logFileBuffer; - z_stream m_stream; - - void state_ConfirmPassword() throw(std::exception); - void state_Send() throw(std::exception); - void state_Close() throw(std::exception); - void state_UpdateMetadata() throw(std::exception); - void state_UpdateXMLMetadata() throw(std::exception); - void state_SendFileHeader() throw(std::exception); - void state_SendFileFooter() throw(std::exception); - void state_SendFileContents() throw(std::exception); - void state_SendFileEnd() throw(std::exception); - - void sendMessageAndClose(const uniString::utf8 &msg) throw(); - - void mode_none(const streamData::streamID_t sid, const int refreshRequired) throw(); - void mode_kickdst(const streamData::streamID_t sid, const uniString::utf8 &kickAddrs) throw(); - void mode_ban(const streamData::streamID_t sid, const uniString::utf8 &banAddrs, const int banMask) throw(); - void mode_unban(const streamData::streamID_t sid, const uniString::utf8 &banAddr, const int banMask) throw(); - void mode_viewban(const streamData::streamID_t sid) throw(); - void mode_viewrip(const streamData::streamID_t sid) throw(); - void mode_rip(const streamData::streamID_t sid, const uniString::utf8 &ripAddr, const uniString::utf8 &rawIpAddr) throw(); - void mode_unrip(const streamData::streamID_t sid, const uniString::utf8 &ripAddr, const uniString::utf8 &rawIpAddr) throw(); - void mode_viewagent(const streamData::streamID_t sid) throw(); - void mode_agent(const streamData::streamID_t sid, const uniString::utf8 &agent) throw(); - void mode_unagent(const streamData::streamID_t sid, const uniString::utf8 &agent) throw(); - void mode_viewxml(const streamData::streamID_t sid, int page, const bool iponly, const bool ipcount) throw(); - void mode_viewjson(const streamData::streamID_t sid, int page, const bool iponly, const bool ipcount, const uniString::utf8& callback) throw(); - void mode_viewlog(const streamData::streamID_t sid, const bool tail, const bool save, const bool server) throw(); - void mode_art(const streamData::streamID_t sid, const int mode) throw(); - void mode_register(const streamData::streamID_t sid, const streamData::streamInfo &info) throw(); - void mode_listeners(const streamData::streamID_t sid) throw(); - void mode_summary(const int refreshRequired) throw(); - void mode_bandwidth_html(const int refreshRequired) throw(); - void mode_bandwidth_xml() throw(); - void mode_bandwidth_json(const uniString::utf8& callback) throw(); - void mode_ypstatus_xml() throw(); - void mode_ypstatus_json(const uniString::utf8& callback) throw(); - void mode_sources(const uniString::utf8& host) throw(); - void mode_adgroups() throw(); - void mode_debug(const uniString::utf8& option, const int on_off, const bool adminRefer) throw(); - void mode_logs() throw(); - void mode_history(const streamData::streamID_t sid) throw(); - void mode_help() throw(); - void mode_config() throw(); - - const uniString::utf8 getClientIP(const bool streamPublic, const uniString::utf8 &publicIP) throw(); - uniString::utf8 escapeText(const std::vector &s) throw(); - -public: - protocol_admincgi(const socketOps::tSOCKET s, const streamData::streamID_t sid, const bool no_sid, - const bool zero_sid, const uniString::utf8 &clientLogString, - const uniString::utf8 &password, const uniString::utf8 &referer, - const uniString::utf8 &hostIP, const uniString::utf8 &m_userAgent, - const protocol_HTTPStyle::HTTPRequestInfo &httpRequestInfo) throw(std::exception); - ~protocol_admincgi() throw(); -}; - -extern uniString::utf8 logId; -const uniString::utf8 randomId(uniString::utf8 &temp); - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_backup.cpp b/Src/Plugins/DSP/sc_serv3/protocol_backup.cpp deleted file mode 100644 index 2ebe5562..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_backup.cpp +++ /dev/null @@ -1,538 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include -#include "protocol_backup.h" -#include "protocol_relay_shoutcast.h" -#include "protocol_relay_uvox.h" -#include "bandwidth.h" -#include "streamData.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace stringUtil; -using namespace uniString; - -#define LOGNAME "BACKUP" - -#define DEBUG_LOG(...) do { if (gOptions.relayDebug()) DLOG(__VA_ARGS__); } while (0) - -protocol_backup::protocol_backup(const config::streamConfig &info, const int originalBitrate, const uniString::utf8& originalMimeType) throw() - : m_originalMimeType(originalMimeType), m_outBuffer(0), - m_outBufferSize(0), m_originalBitrate(originalBitrate), m_retryCount(0), - m_backupWaitingToReconnect(false), m_backupSentConnectWait(false), - m_skip(false), m_tryRelaySource(false), m_backupReconnectStartTime(0), - m_state(&protocol_backup::state_Initial), m_nextState(0), - m_backupInfo(info), m_originalbackupInfo(info), m_redirectCount(0) -{ - m_srcPort = m_backupInfo.m_backupUrl.port(); - m_srcAddrName = m_backupInfo.m_backupUrl.server(); - m_srcURLpart = m_backupInfo.m_backupUrl.path(); - m_srcLogString = "[BACKUP " + m_srcAddrName + ":" + tos(m_srcPort) + - (m_srcURLpart == "/" ? "" : m_srcURLpart) + - " sid=" + tos(m_backupInfo.m_streamID) + "] "; - - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalbackupInfo.m_streamID); -} - -protocol_backup::~protocol_backup() throw() -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalbackupInfo.m_streamID); - - socketOps::forgetTCPSocket(m_socket); -} - -void protocol_backup::timeSlice() throw(exception) -{ - // check if the DNAS has stopped or that the relay hasn't been stopped as - // otherwise this'll sit and keep making backup attempts when not needed, - // making sure that we've given the backup at least an attempt to connect - - bool serverDown = iskilled(); - bool noEntry = false, inactive = ((streamData::isRelayActive(m_backupInfo.m_streamID, noEntry) & 8) != 8); - - if (serverDown || noEntry || inactive) - { - bool noEntry = false; - streamData::setRelayActiveFlags (m_backupInfo.m_streamID, noEntry, 0, 8); - - ILOG (m_srcLogString + "Termination for source backup detected", LOGNAME, m_originalbackupInfo.m_streamID); - m_result.done(); - return; - } - - if (m_backupWaitingToReconnect && (::time(NULL) < m_backupReconnectStartTime)) - { - // an error occured in the past and we are waiting for the appropriate time interval before we do anything - m_result.schedule(350); - return; - } - else - { - // normal running - try - { - (this->*m_state)(); - } - catch(const exception &ex) - { - // close socket and move into waiting state for reconnect - socketOps::forgetTCPSocket(m_socket); - - // but first see if we've hit the retry limit (which can be set as zero to keep on going) - ++m_retryCount; - int retryLimit = gOptions.relayConnectRetries(); - DEBUG_LOG(m_srcLogString + __FUNCTION__ + utf8(" m_retryCount:") + tos(m_retryCount) + " retryLimit:" + tos(retryLimit) + " m_tryRelaySource: " + tos(m_tryRelaySource), LOGNAME, m_originalbackupInfo.m_streamID); - if ((retryLimit == 0) || (m_retryCount < retryLimit && retryLimit > 0)) - { - utf8 msg = ex.what(); - if (!msg.empty()) - { - ELOG(ex.what()); - } - - m_backupWaitingToReconnect = true; - m_state = &protocol_backup::state_Initial; - m_backupInfo = m_originalbackupInfo; - m_backupReconnectStartTime = ::time(NULL) + gOptions.relayReconnectTime(); - m_result.schedule (550); - } - else - { - bool noEntry = false; - streamData::setRelayActiveFlags (m_backupInfo.m_streamID, noEntry, 0, 8); - - throwEx(m_srcLogString + ex.what()); - } - } - } -} - -// parse out backupInfo object -void protocol_backup::state_Initial() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalbackupInfo.m_streamID); - - // if m_retryCount is over 1 then pull the stream relay url from - // the config details as we could be in a re-try or having done - // a config reload and the stream relay url has then since changed - // - this primarily aids a config change for a pending relay join - if (m_retryCount > 0) - { - m_backupInfo.m_backupUrl = gOptions.stream_backupURL (m_backupInfo.m_streamID); - m_backupInfo.m_relayUrl = gOptions.stream_relayURL (m_backupInfo.m_streamID); - } - - m_srcAddrName = m_backupInfo.m_backupUrl.server(); - m_srcPort = m_backupInfo.m_backupUrl.port(); - m_srcURLpart = m_backupInfo.m_backupUrl.path(); - - m_srcLogString = "[BACKUP " + m_srcAddrName + ":" + tos(m_srcPort) + - (m_srcURLpart == "/" ? "" : m_srcURLpart) + - " sid=" + tos(m_backupInfo.m_streamID) + "] "; - - // make sure we're not trying to run a backup which is the same relay as failed - if (m_backupInfo.m_relayUrl.isSet()) - { - // check on individual parts as the general url may not be formatted the same - // as well as checking against the 'streampath' version is specified for the - // /stream/x/ alternative (am sure someone is going to try to hack on that). - if (!m_tryRelaySource && - (m_backupInfo.m_relayUrl.server() == m_srcAddrName) && - (m_backupInfo.m_relayUrl.port() == m_srcPort) && - (m_backupInfo.m_relayUrl.path() == m_srcURLpart)) - { - bool noEntry = false; - streamData::setRelayActiveFlags (m_backupInfo.m_streamID, noEntry, 0, 8); - - ELOG(m_srcLogString + "Backup source rejected. The backup cannot be the same as the original relay source.", LOGNAME, m_originalbackupInfo.m_streamID); - m_result.done(); - return; - } - else - { - if ((m_backupInfo.m_relayUrl.server() == m_srcAddrName) && - (m_backupInfo.m_relayUrl.port() == m_srcPort)) - { - utf8::size_type pos = (!m_srcURLpart.empty() ? m_srcURLpart.find(utf8("/stream/")) : utf8::npos); - streamData::streamID_t streamID = 0; - if (pos != utf8::npos) - { - streamID = atoi((const char *)m_srcURLpart.substr(pos + 8).c_str()); - } - - if (streamID > 0) - { - bool htmlPage = false; - if (!m_tryRelaySource && streamData::getStreamIdFromPath(m_backupInfo.m_relayUrl.path(), htmlPage) == streamID) - { - bool noEntry = false; - streamData::setRelayActiveFlags (m_backupInfo.m_streamID, noEntry, 0, 8); - - ELOG(m_srcLogString + "Backup source rejected. The backup cannot be the same as the original relay source.", LOGNAME, m_originalbackupInfo.m_streamID); - m_result.done(); - return; - } - } - } - } - } - - m_state = &protocol_backup::state_ResolveServer; - m_result.run(); -} - -// resolve server name to numeric address -void protocol_backup::state_ResolveServer() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalbackupInfo.m_streamID); - - assert(m_socket == socketOps::cINVALID_SOCKET); - m_socket = socketOps::createTCPSocketTHROW(); - socketOps::setNonblock(m_socket,true); - m_srcAddrNumeric = socketOps::hostNameToAddress(m_srcAddrName.hideAsString(), m_srcPort); - if (m_srcAddrNumeric.empty()) - { - bool noEntry = false; - streamData::setRelayActiveFlags (m_backupInfo.m_streamID, noEntry, 0, 8); - - m_result.done(); - return; - } - - m_state = &protocol_backup::state_Connect; - m_result.run(); -} - -// TCP connect -void protocol_backup::state_Connect() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalbackupInfo.m_streamID); - - assert(m_socket != socketOps::cINVALID_SOCKET); - - bool isSourceActive = false, relayRunning = false; - streamData *sd = streamData::accessStream(m_backupInfo.m_streamID, isSourceActive); - if (sd) - { - relayRunning = sd->isRelayStream(m_backupInfo.m_streamID); - sd->releaseStream(); - } - - if ((isSourceActive == false) || relayRunning) - { - if ((m_retryCount > 0) && !m_skip) - { - ILOG(m_srcLogString + "Connecting to source backup [attempt #" + tos(m_retryCount+1) + "]", LOGNAME, m_originalbackupInfo.m_streamID); - } - - m_skip = false; - socketOps::connect(m_socket, m_srcAddrNumeric, m_srcPort); - - m_lastActivityTime = ::time(NULL); - m_state = &protocol_backup::state_ConnectWait; - m_result.run(); - } - else - { - bool noEntry = false; - streamData::setRelayActiveFlags (m_backupInfo.m_streamID, noEntry, 0, 8); - - m_result.done(); - } -} - -// wait for connect to complete -void protocol_backup::state_ConnectWait() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalbackupInfo.m_streamID); - - assert(m_socket != socketOps::cINVALID_SOCKET); - - time_t cur_time; - const int autoDumpSourceTime = detectAutoDumpTimeout (cur_time, m_originalbackupInfo.m_streamID, m_srcLogString + "Timeout trying to connect"); - - if (streamData::isSourceConnected (m_backupInfo.m_streamID)) - { - bool noEntry = false; - streamData::setRelayActiveFlags (m_backupInfo.m_streamID, noEntry, 0, 8); - - ILOG (m_srcLogString + "Original stream available, Abort trying to " + - (m_retryCount > 0 ? "re-" : "") + - "connect to the source backup", LOGNAME, m_originalbackupInfo.m_streamID); - m_result.done(); - return; - } - - // not pretty but the 'sent' checks allow this to work within the expected timeouts - // irrespective of being run on Windows or Linux as it could just sit and do nothing - // for a few minutes if there was no network activity on the DNAS causing there to be - // no attempt made to re-connect to the backup source (hopefully resolved in build 56) - string error; - socketOps::nonBlockConnect_t connectResult = socketOps::nonBlockingConnectWait(m_socket, error); - switch (connectResult) - { - case socketOps::NBC_ERROR: - { - throwEx(m_srcLogString + error); - break; - } - case socketOps::NBC_INPROGRESS: - { - // try again but wait a bit - m_result.schedule(100); - m_result.timeout((autoDumpSourceTime - (int)(cur_time - m_lastActivityTime))); - break; - } - case socketOps::NBC_CONNECTED: - { - m_lastActivityTime = ::time(NULL); - m_state = &protocol_backup::state_SendGreeting; - m_result.run(); - break; - } - default: - { - ELOG(m_srcLogString + "Unknown non-blocking connect state.", LOGNAME, m_originalbackupInfo.m_streamID); - throwEx(""); - } - } -} - -void protocol_backup::state_SendGreeting() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalbackupInfo.m_streamID); - - m_HTTPHeaders.clear(); - m_HTTPGreetingResponse.clear(); - - string cdn; - if (isCDNSlave(m_backupInfo.m_streamID)) - { - cdn = "cdn-slave:1\r\n"; - } - - m_lineBuffer = "GET " + m_srcURLpart + " " + "HTTP/1.1\r\n" + - "Host:" + stripHTTPprefix(m_srcAddrName) + ":" + tos(m_srcPort) + "\r\n" + - "User-Agent:" + g_userAgent + " Relay" + - (!m_tryRelaySource ? " Backup" : "") + "\r\n" + - "Ultravox transport type:TCP\r\n" + - "Accept:*/*\r\n" + - "icy-metadata:1\r\n" + - cdn + - "icy-host:" + metrics::metrics_verifyDestIP(gOptions) + "\r\n\r\n"; - - DEBUG_LOG(m_srcLogString + "Sending request [" + eol() + stripWhitespace(m_lineBuffer) + eol() + "]", LOGNAME, m_originalbackupInfo.m_streamID); - m_outBuffer = &(m_lineBuffer[0]); - bandWidth::updateAmount(bandWidth::RELAY_MISC_RECV, (m_outBufferSize = (int)m_lineBuffer.size())); - - m_lastActivityTime = ::time(NULL); - m_state = &protocol_backup::state_Send; - m_nextState = &protocol_backup::state_GetGreetingResponse; - - m_result.write(); - m_result.timeoutSID(m_originalbackupInfo.m_streamID); -} - -// send whatever is in outBuffer -void protocol_backup::state_Send() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalbackupInfo.m_streamID); - - if (sendDataBuffer(m_backupInfo.m_streamID, m_outBuffer, m_outBufferSize, m_srcLogString)) - { - m_state = m_nextState; - m_lineBuffer.clear(); - } -} - -void protocol_backup::state_GetLine() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalbackupInfo.m_streamID); - - if (getHTTPStyleHeaderLine(m_backupInfo.m_streamID, m_lineBuffer, m_srcLogString)) - { - m_state = m_nextState; - } -} - -void protocol_backup::state_GetGreetingResponse() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalbackupInfo.m_streamID); - - m_state = &protocol_backup::state_GetLine; - m_nextState = &protocol_backup::state_AnalyzeGreetingResponse; - - m_lastActivityTime = ::time(NULL); - m_result.read(); - m_result.timeoutSID(m_originalbackupInfo.m_streamID); -} - -// analyze header lines in greeting response -void protocol_backup::state_AnalyzeGreetingResponse() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalbackupInfo.m_streamID); - - m_lastActivityTime = ::time(NULL); - - if ((int)m_HTTPHeaders.size() >= gOptions.maxHeaderLineCount()) - { - ELOG (m_srcLogString + "Max HTTP header lines exceeded", LOGNAME, m_originalbackupInfo.m_streamID); - throwEx(""); - } - - m_lineBuffer = stripWhitespace(m_lineBuffer); - if (m_lineBuffer.empty()) - { - m_state = &protocol_backup::state_DetermineProtocol; - m_result.run(); - } - else - { - if (m_HTTPGreetingResponse.empty()) - { - m_HTTPGreetingResponse = m_lineBuffer; - } - else - { - // find the colon that divides header lines into key/value fields - utf8::size_type pos = m_lineBuffer.find(utf8(":")); - if (pos == utf8::npos) - { - ELOG (m_srcLogString + "Connection rejected. Bad HTTP header string [" + m_lineBuffer + "]", LOGNAME, m_originalbackupInfo.m_streamID); - throwEx(""); - } - - utf8 key = toLower(stripWhitespace(m_lineBuffer.substr(0, pos))); - utf8 value = stripWhitespace(m_lineBuffer.substr(pos + 1)); - // allow empty values. (for urls and what-not) - if (key.empty()) - { - ELOG (m_srcLogString + "Connection rejected. Bad HTTP header string [" + m_lineBuffer + "]", LOGNAME, m_originalbackupInfo.m_streamID); - throwEx(""); - } - m_HTTPHeaders[key] = value; - } - - m_state = &protocol_backup::state_GetLine; - m_nextState = &protocol_backup::state_AnalyzeGreetingResponse; - m_result.read(); - m_result.timeoutSID(m_originalbackupInfo.m_streamID); - m_lineBuffer.clear(); - } -} - -void protocol_backup::state_DetermineProtocol() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalbackupInfo.m_streamID); - - if (m_HTTPGreetingResponse.empty()) - { - ELOG (m_srcLogString + "Empty greeting response", LOGNAME, m_originalbackupInfo.m_streamID); - throwEx(""); - } - - // parse into three fields - utf8 s = m_HTTPGreetingResponse; - - utf8::size_type pos = (!s.empty() ? s.find(utf8(" ")) : utf8::npos); - if (pos == utf8::npos) - { - ELOG (m_srcLogString + "Badly formed response line [" + m_HTTPGreetingResponse + "]", LOGNAME, m_originalbackupInfo.m_streamID); - throwEx(""); - } - - s = stripWhitespace(s.substr(pos)); - pos = (!s.empty() ? s.find(utf8(" ")) : utf8::npos); - if (pos == utf8::npos) - { - ELOG (m_srcLogString + "Badly formed response line [" + m_HTTPGreetingResponse + "]", LOGNAME, m_originalbackupInfo.m_streamID); - throwEx(""); - } - - int resultCode = utf8(s.substr(0, pos)).toInt(); - if (resultCode == 200) - { - utf8 diag; - for (httpHeaderMap_t::const_iterator i = m_HTTPHeaders.begin(); i != m_HTTPHeaders.end(); ++i) - { - diag += (*i).first + ": " + (*i).second + eol(); - } - DEBUG_LOG(m_srcLogString + "Received headers [" + eol() + stripWhitespace(diag) + eol() + "]", LOGNAME, m_originalbackupInfo.m_streamID); - - const socketOps::tSOCKET s = m_socket; - m_socket = socketOps::cINVALID_SOCKET; - - // changed order of this in build 19 so that all uvox2 is reported as misc/ultravox - // and we then base things off the user-agent containing 'Ultravox/2.1' - // we look at content-type to determine the protocol - if ((m_HTTPHeaders["content-type"] == "misc/ultravox") && - (m_HTTPHeaders["server"].find(utf8("Ultravox/2.1")) != utf8::npos)) - { - // uvox 2.1 - threadedRunner::scheduleRunnable(new protocol_relay_uvox(s, m_originalbackupInfo, m_srcAddrName, m_srcAddrNumeric, - m_srcPort, (m_srcURLpart == "/" ? "" : m_srcURLpart), - m_HTTPHeaders, m_originalBitrate, m_originalMimeType, - !m_tryRelaySource)); - } - else - { - // shoutcast - threadedRunner::scheduleRunnable(new protocol_relay_shoutcast(s, m_originalbackupInfo, m_srcAddrName, m_srcAddrNumeric, - m_srcPort, (m_srcURLpart == "/" ? "" : m_srcURLpart), - m_HTTPHeaders, m_originalBitrate, m_originalMimeType, - !m_tryRelaySource)); - } - - m_result.done(); - } - else if ((resultCode >= 300) && (resultCode < 400)) - { - utf8 location = m_HTTPHeaders["location"]; - - // do we maybe have a /stream/x url and gotten a /index.html?sid=# redirect? - // if so then we should attempt to access a relay on /stream/x/ (note end / ) - utf8::size_type pos = (!location.empty() ? location.find(utf8("/index.html?sid=")) : utf8::npos); - if (pos != utf8::npos) - { - streamData::streamID_t foundID = atoi((const char *)location.substr(pos + 16).c_str()); - utf8::size_type pos2 = m_backupInfo.m_backupUrl.path().find(utf8("/stream/")); - if (pos2 != utf8::npos) - { - streamData::streamID_t origID = atoi((const char *)m_backupInfo.m_backupUrl.path().substr(pos2 + 8).c_str()); - if (foundID == origID) - { - m_backupInfo.m_backupUrl = m_backupInfo.m_backupUrl.url() + "/"; - gOptions.setOption(utf8("streambackupurl_" + tos(m_originalbackupInfo.m_streamID)), - m_backupInfo.m_backupUrl.url()); - - m_skip = true; - m_state = &protocol_backup::state_Initial; - socketOps::forgetTCPSocket(m_socket); - m_result.run(); - WLOG(m_srcLogString + "Received an invalid redirect to `" + location + "' - trying " + m_backupInfo.m_backupUrl.url(), LOGNAME, m_originalbackupInfo.m_streamID); - return; - } - } - } - - ILOG(m_srcLogString + "Received redirect to " + location, LOGNAME, m_originalbackupInfo.m_streamID); - if (++m_redirectCount > gOptions.maxHTTPRedirects()) - { - WLOG (m_srcLogString + "Max redirects exceeded", LOGNAME, m_originalbackupInfo.m_streamID); - throwEx(""); - } - - m_skip = true; - m_backupInfo.m_backupUrl = location; - m_state = &protocol_backup::state_Initial; - socketOps::forgetTCPSocket(m_socket); - m_result.run(); - } - else - { - WLOG (m_srcLogString + (resultCode >= 400 ? "Source responded with error [" : "Unsupported HTTP response code [") + - m_HTTPGreetingResponse + "]", LOGNAME, m_originalbackupInfo.m_streamID); - throwEx(""); - } -} diff --git a/Src/Plugins/DSP/sc_serv3/protocol_backup.h b/Src/Plugins/DSP/sc_serv3/protocol_backup.h deleted file mode 100644 index 5f83bf18..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_backup.h +++ /dev/null @@ -1,73 +0,0 @@ -#pragma once -#ifndef protocol_backup_H_ -#define protocol_backup_H_ - -#include "threadedRunner.h" - -/* - Runnable object that handles the initial part of a backup connection - which is basically the same as a relay connection bar a different name. - Makes the connection to the source and determines what type of protocol - should be used, then hands off to the particular relay protocol - (shoutcast or uvox relay) -*/ - -class protocol_backup: public runnable -{ -private: - uniString::utf8 m_srcAddrName; // server DNS name or value as specified in backupInfo - std::string m_srcAddrNumeric; // resolved numeric addr - uniString::utf8 m_srcURLpart; // server - - uniString::utf8 m_originalMimeType; // original mimetype for checking - - uniString::utf8 m_srcLogString; - httpHeaderMap_t m_HTTPHeaders; - uniString::utf8 m_HTTPGreetingResponse; // first line of response - - const uniString::utf8::value_type *m_outBuffer; // for outgoing text lines - int m_outBufferSize; - const int m_originalBitrate; // original bitrate for checking - - uniString::utf8 m_lineBuffer; // in/out lines - - int m_retryCount; - bool m_backupWaitingToReconnect; - bool m_backupSentConnectWait; - bool m_skip; - bool m_tryRelaySource; - - time_t m_backupReconnectStartTime; - - typedef void (protocol_backup::*state_t)(); - - state_t m_state; - state_t m_nextState; - - config::streamConfig m_backupInfo; - const config::streamConfig m_originalbackupInfo; // used for reconnects later on - - u_short m_srcPort; // server port - short m_redirectCount; - - void state_Initial() throw(std::exception); - void state_ResolveServer() throw(std::exception); - void state_Connect() throw(std::exception); - void state_ConnectWait() throw(std::exception); - void state_SendGreeting() throw(std::exception); - void state_GetGreetingResponse() throw(std::exception); - void state_AnalyzeGreetingResponse() throw(std::exception); - void state_DetermineProtocol() throw(std::exception); - void state_Send() throw(std::exception); - void state_GetLine() throw(std::exception); - -protected: - virtual void timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "protocol_backup"; } - -public: - protocol_backup(const config::streamConfig &info, const int originalBitrate, const uniString::utf8& originalMimeType) throw(); - virtual ~protocol_backup() throw(); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_flvClient.cpp b/Src/Plugins/DSP/sc_serv3/protocol_flvClient.cpp deleted file mode 100644 index 205621e9..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_flvClient.cpp +++ /dev/null @@ -1,275 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include -#include "protocol_flvClient.h" -#include "ripList.h" -#include "stats.h" -#include "streamData.h" -#include "w3cLog.h" -#include "global.h" -#include "bandwidth.h" -#include "MP3Header.h" -#include "ADTSHeader.h" -#include "FLV.h" -#include "file/fileUtils.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define DEBUG_LOG(...) do { if (gOptions.flvClientDebug()) DLOG(__VA_ARGS__); } while (0) -#define AD_DEBUG_LOG(...) do { if (gOptions.adMetricsDebug()) DLOG(__VA_ARGS__); } while (0) - -protocol_flvClient::protocol_flvClient (protocol_HTTPStyle &hs, const streamData::streamID_t streamID, - const uniString::utf8 &hostName, const uniString::utf8 &addr, const uniString::utf8 &XFF) throw (std::exception) - - : protocol_shoutcastClient (hs, streamID, hostName, addr, XFF, streamData::FLV) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - m_timestamp = 0; - m_fileOffset = 0; - setCallback (&protocol_shoutcastClient::state_AttachToStream); -} - -protocol_flvClient::~protocol_flvClient() throw() -{ - cleanup("FLV", gOptions.flvClientDebug(), false, true); -} - -////////////////////////////////////////////////////////////////////////////// - -void protocol_flvClient::timeSlice() throw(exception) -{ - int ret = doTimeSlice(); - if (ret == 1) - { - m_state = &protocol_flvClient::state_Stream; - return; - } - else if (ret == 2) - { - return; - } - - (this->*m_state)(); -} - - -void protocol_flvClient::setCallback (protocol_shoutcastClient::state_t callback, protocol_shoutcastClient::state_t next) -{ - m_state = callback ? callback : m_nextState; - m_nextState = callback ? next : NULL; -} - - -void protocol_flvClient::state_Close() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - m_result.done(); -} - -void protocol_flvClient::state_SendText() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(m_clientLogString + __FUNCTION__); -#endif - - if (sendText()) - { - m_metaIntervalCounter = 0; - m_state = m_nextState; - } -} - -// find the appropriate stream and try to attach to it -void protocol_flvClient::state_AttachToStream() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - int read_bitrate = 0; - m_streamData = streamData::accessStream(m_streamID); - if (!m_streamData) - { - if (processReject("FLV", bandWidth::CLIENT_FLV_SENT, MSG_ICY_HTTP401, - MSG_ICY_HTTP401_LEN, &read_bitrate)) - { - goto fall_through; - } - - m_state = &protocol_shoutcastClient::state_SendText; - m_nextState = &protocol_shoutcastClient::state_Close; - } - else - { -fall_through: - - // for FLV, we can only support specific sample rates before we - // have playback / compatibility issues vs what the spec wants. - if (m_streamData) - { - const unsigned int samplerate = m_streamData->streamSampleRate(); - if ((m_streamData->streamUvoxDataType() == MP3_DATA) && - ((samplerate != 44100) && (samplerate != 22050) && (samplerate != 11025))) - { - m_outBuffer = MSG_ICY_HTTP401.c_str(); - bandWidth::updateAmount(bandWidth::CLIENT_FLV_SENT, (m_outBufferSize = MSG_ICY_HTTP401_LEN)); - - m_state = &protocol_shoutcastClient::state_SendText; - m_nextState = &protocol_shoutcastClient::state_Close; - m_result.write(); - m_result.timeoutSID(m_streamID); - m_ignoreDisconnect = true; - - if (gOptions.logClients()) - { - ELOG(m_clientLogString + "FLV client connection rejected. Stream samplerate is " + - sampleRateStr(samplerate) + " which is not supported for MP3-in-FLV streaming " + - "(only 44.1 kHz, 22.05 kHz and 11.025 kHz samplerates are allowed)."); - } - - return; - } - } - - const utf8 movedUrl = gOptions.stream_movedUrl(m_streamID); - if (movedUrl.empty()) - { - const int add = processAdd("FLV", bandWidth::CLIENT_FLV_SENT, - MSG_ICY_HTTP401, MSG_ICY_HTTP401_LEN, movedUrl, - (m_streamData ? m_streamData->streamBackupServer() : "")); - if (add != 1) - { - m_state = &protocol_shoutcastClient::state_SendText; - m_nextState = &protocol_shoutcastClient::state_Close; - } - else - { - const bool isPodcast = (!m_streamData && (gOptions.getBackupLoop(m_streamID) == 1)); - m_OKResponse = MSG_ICY_HTTP200 + "Content-Type:video/x-flv\r\n"; - - if (!m_streamData) - { - utf8 path = getStreamPath(m_streamID); - if (!path.empty() && path.find(utf8("/")) == 0) - { - path = path.substr(1); - } - - if (isPodcast) - { - m_OKResponse += "Content-Disposition:attachment;filename=\"" + path + "\"\r\n" - "Content-Length:" + tos(m_backupFile.size()) + "\r\n"; - } - } - - if (gOptions.clacks()) - { - m_OKResponse += "X-Clacks-Overhead:GNU Terry Pratchett\r\n"; - } - m_OKResponse += "\r\n"; - - DEBUG_LOG(m_clientLogString + "Sending [" + eol() + stripWhitespace(m_OKResponse) + eol() + "]"); - m_outBuffer = m_OKResponse.c_str(); - bandWidth::updateAmount(bandWidth::CLIENT_FLV_SENT, (m_outBufferSize = (int)m_OKResponse.size())); - m_state = &protocol_shoutcastClient::state_SendText; - if (!m_headRequest) - { - m_nextState = &protocol_shoutcastClient::state_InitiateStream; - } - else - { - m_removeClientFromStats = false; - m_ignoreDisconnect = true; - m_nextState = &protocol_shoutcastClient::state_Close; - } - m_result.write(); - m_result.timeoutSID(m_streamID); - m_result.run(); - - // when the client is added, we get back the unique id of the connection - // but we now check for being > 0 as we need to filter out some of the - // YP connections from being counted as valid clients for stats, etc - reportNewListener("FLV"); - } - } - else - { - // if we get to here then we attempt to redirect the clients to the moved url - // which is useful if the stream has moved hosting or it has been deprecated. - streamMovedOrRejected("FLV", bandWidth::CLIENT_FLV_SENT, movedUrl, 2); - m_state = &protocol_shoutcastClient::state_SendText; - m_nextState = &protocol_shoutcastClient::state_Close; - } - } -} - -void protocol_flvClient::state_SendIntro() throw(exception) -{ - state_SendIntroFile(); - if (m_introFile.empty()) - { - acquireIntroFile(); - if (m_introFile.empty()) - { - m_state = &protocol_shoutcastClient::state_Stream; - } - else - { - m_state = &protocol_shoutcastClient::state_SendIntroFile; - } - } -} - -void protocol_flvClient::state_InitiateStream() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - resetReadPtr(); - - if (!m_streamData || m_introFile.empty()) - { - // send intro file if we have it - acquireIntroFile(); - m_state = (m_introFile.empty() ? &protocol_shoutcastClient::state_Stream : &protocol_shoutcastClient::state_SendIntroFile); - } - else - { - m_state = &protocol_shoutcastClient::state_SendIntro; - } - - setW3CState(); - - m_result.run(); -} - - -void protocol_flvClient::processFrame (int type, const unsigned char *buf, unsigned int len) -{ - bool is_mp3 = (type == MP3_DATA); - unsigned int read_samplerate = 0; - int read_bitrate = 0; - bool read_mono = true; - __uint8 asc_header[2] = {0}; - - if (len < 7) - return; - if (is_mp3) - getMP3FrameInfo ((char*)buf, &read_samplerate, &read_bitrate, &read_mono); - else - getADTSFrameInfo ((char*)buf, &read_samplerate, asc_header); - - createFLVTag (m_output, (char*)&buf [is_mp3 ? 0 : 7], len - (is_mp3 ? 0 : 7), - m_timestamp, is_mp3, read_mono, read_samplerate, read_bitrate, asc_header, m_streamID); -} - - - -void protocol_flvClient::return_403(void) -{ - protocol_shoutcastClient::return_403(); - m_state = &protocol_shoutcastClient::state_SendText; - m_nextState = &protocol_shoutcastClient::state_Close; -} diff --git a/Src/Plugins/DSP/sc_serv3/protocol_flvClient.h b/Src/Plugins/DSP/sc_serv3/protocol_flvClient.h deleted file mode 100644 index 11105bf7..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_flvClient.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once -#ifndef protocol_flvClient_H_ -#define protocol_flvClient_H_ - -#include "protocol_shoutcastClient.h" -#include - -class streamData; - -class protocol_flvClient: public protocol_shoutcastClient -{ -private: - - typedef void (protocol_flvClient::*state_t)(); - state_t m_state; - state_t m_nextState; - - int m_timestamp; - int m_fileOffset; - - void state_AttachToStream() throw(std::exception); - void state_Close() throw(std::exception); - void state_SendText() throw(std::exception); - void state_InitiateStream() throw(std::exception); - void state_SendIntro() throw(std::exception); - - virtual void timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "protocol_flvClient"; } - -public: - protocol_flvClient (protocol_HTTPStyle &hs, const streamData::streamID_t streamID, const uniString::utf8 &hostName, const uniString::utf8 &addr, const uniString::utf8 &XFF) throw(std::exception); - - protocol_flvClient(const socketOps::tSOCKET s, const streamData::streamID_t streamID, - const uniString::utf8 &hostName, const uniString::utf8 &addr, - const u_short port, const uniString::utf8 &userAgent, - const uniString::utf8 &XFF, const uniString::utf8 &referer, - const bool headRequest) throw(std::exception); - virtual ~protocol_flvClient() throw(); - - virtual void setCallback (protocol_shoutcastClient::state_t callback = NULL, protocol_shoutcastClient::state_t next = NULL); - void processFrame (int type, const unsigned char *buf, unsigned int len); - - void return_403(void); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_m4aClient.cpp b/Src/Plugins/DSP/sc_serv3/protocol_m4aClient.cpp deleted file mode 100644 index 11dad38c..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_m4aClient.cpp +++ /dev/null @@ -1,674 +0,0 @@ -#if 0 -#ifdef _WIN32 -#include -#endif -#include -#include "protocol_m4aClient.h" -#include "ripList.h" -#include "stats.h" -#include "streamData.h" -#include "w3cLog.h" -#include "global.h" -#include "bandwidth.h" -#include "MP3Header.h" -#include "ADTSHeader.h" -#include "file/fileUtils.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define DEBUG_LOG(x) { if (gOptions.m4aClientDebug()) DLOG((x)); } -#define AD_DEBUG_LOG(x) { if (gOptions.adMetricsDebug()) DLOG((x)); } - -protocol_m4aClient::protocol_m4aClient(const socketOps::tSOCKET s, const streamData::streamID_t streamID, - const utf8 &hostName, const utf8 &addr, const u_short port, - const utf8 &userAgent, const utf8 &XFF, const utf8 &referer, - const bool headRequest) throw(exception) - : protocol_shoutcastClient(s, port, streamData::M4A, hostName, - (streamID <= 0 || streamID > INT_MAX ? DEFAULT_CLIENT_STREAM_ID : streamID), - stats::getNewClientId(), userAgent, referer, addr, XFF, headRequest), - - m_state(&protocol_m4aClient::state_AttachToStream), m_nextState(0) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); -} - -protocol_m4aClient::~protocol_m4aClient() throw() -{ - cleanup("M4A", gOptions.m4aClientDebug()); -} - -////////////////////////////////////////////////////////////////////////////// - -void protocol_m4aClient::timeSlice() throw(exception) -{ - int ret = doTimeSlice(result); - if (ret == 1) - { - m_state = &protocol_m4aClient::state_Stream; - return; - } - else if (ret == 2) - { - return; - } - - (this->*m_state)(); -} - -void protocol_m4aClient::state_Close() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - m_result.done(); -} - -void protocol_m4aClient::state_SendText() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(m_clientLogString + __FUNCTION__); -#endif - - if (sendText()) - { - m_metaIntervalCounter = 0; - m_state = m_nextState; - } -} - -// find the appropriate stream and try to attach to it -void protocol_m4aClient::state_AttachToStream() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - m_streamData = streamData::accessStream(m_streamID); - if (!m_streamData) - { - if (processReject("M4A", bandWidth::CLIENT_M4A_SENT, MSG_ICY_HTTP401, - MSG_ICY_HTTP401_LEN, &read_bitrate, &dataType)) - { - goto fall_through; - } - - m_state = &protocol_m4aClient::state_SendText; - m_nextState = &protocol_m4aClient::state_Close; - } - else - { -fall_through: - const utf8 movedUrl = gOptions.stream_movedUrl(m_streamID); - if (movedUrl.empty()) - { - const int add = processAdd("FLV", bandWidth::CLIENT_M4A_SENT, - MSG_ICY_HTTP401, MSG_ICY_HTTP401_LEN, movedUrl, - (m_streamData ? m_streamData->streamBackupServer() : "")); - if (add != 1) - { - m_state = &protocol_m4aClient::state_SendText; - m_nextState = &protocol_m4aClient::state_Close; - } - else - { - const bool isPodcast = (!m_streamData && (gOptions.getBackupLoop(m_streamID) == 1)); - m_OKResponse = MSG_ICY_HTTP200 + "Content-Type:audio/mp4\r\n"; - - if (!m_streamData) - { - utf8 path = getStreamPath(m_streamID); - if (!path.empty() && path.find(utf8("/")) == 0) - { - path = path.substr(1); - } - - if (isPodcast) - { - m_OKResponse += "Content-Disposition:attachment;filename=\"" + path + "\"\r\n" - "Content-Length:" + tos(m_backupFile.size()) + "\r\n"; - } - } - - if (gOptions.clacks()) - { - m_OKResponse += "X-Clacks-Overhead:GNU Terry Pratchett\r\n"; - } - m_OKResponse += "\r\n"; - - DEBUG_LOG(m_clientLogString + "Sending [" + eol() + stripWhitespace(m_OKResponse) + eol() + "]"); - m_outBuffer = m_OKResponse.c_str(); - bandWidth::updateAmount(bandWidth::CLIENT_M4A_SENT, (m_outBufferSize = (int)m_OKResponse.size())); - m_state = &protocol_m4aClient::state_SendText; - if (!m_headRequest) - { - m_nextState = &protocol_m4aClient::state_InitiateStream; - } - else - { - m_removeClientFromStats = false; - m_ignoreDisconnect = true; - m_nextState = &protocol_m4aClient::state_Close; - } - m_result.write(); - m_result.timeoutSID(m_streamID); - m_result.run(); - - // when the client is added, we get back the unique id of the connection - // but we now check for being > 0 as we need to filter out some of the - // YP connections from being counted as valid clients for stats, etc - reportNewListener("M4A"); - } - } - else - { - // if we get to here then we attempt to redirect the clients to the moved url - // which is useful if the stream has moved hosting or it has been deprecated. - streamMovedOrRejected("M4A", bandWidth::CLIENT_M4A_SENT, movedUrl, 2); - m_state = &protocol_m4aClient::state_SendText; - m_nextState = &protocol_m4aClient::state_Close; - } - } -} - -void protocol_m4aClient::state_SendIntro() throw(exception) -{ - state_SendIntroFile(); - if (m_introFile.empty()) - { - acquireIntroFile(); - if (m_introFile.empty()) - { - m_state = &protocol_m4aClient::state_Stream; - } - else - { - m_state = &protocol_m4aClient::state_SendIntroFile; - } - } -} - -void protocol_m4aClient::state_InitiateStream() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - resetReadPtr(); - - if (!m_streamData || (m_streamData && m_introFile.empty())) - { - // send intro file if we have it - acquireIntroFile(); - m_state = (m_introFile.empty() ? &protocol_m4aClient::state_Stream : &protocol_m4aClient::state_SendIntroFile); - } - else - { - m_state = &protocol_m4aClient::state_SendIntro; - } - - setW3CState(); - - m_result.run(); -} - -// handle state where we are sending intro files -void protocol_m4aClient::state_SendIntroFile() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - resetCommon(); - - time_t cur_time; - const bool debug = gOptions.m4aClientDebug(); - const int autoDumpTime = detectAutoDumpTimeout(cur_time, m_lastActivityTime, (m_clientLogString + - "Timeout waiting to send data"), - (!m_ignoreDisconnect && debug), m_streamID); - - if (m_shortSend.empty() && (m_frameCount > calculateFrameLimit(cur_time))) - { - if (calculateDelay((autoDumpTime - (int)(cur_time - m_lastActivityTime)))) - { - // if we're at the limit then we're going to need to sit and spin - // which will need to be a bit short of the required frame rate - // so that we've got a bit of leeway on scheduling delays, etc - return; - } - } - - int amt = (int)(m_introFile.size() - m_introFileOffset); - if (amt == 0) - { - // we're done with the intro file - m_introFile.clear(); - m_introFile.resize(0); - m_introFileOffset = 0; - m_lastActivityTime = ::time(NULL); - m_state = &protocol_m4aClient::state_Stream; - resetReadPtr(); - m_result.run(); - } - else if (amt > 0) - { - const bool debug = gOptions.m4aClientDebug(); - checkListenerIsValid(debug); - - if (!m_lastSentMetadata.empty()) - { - logW3C(); - m_lastSentMetadata.clear(); - } - - amt = min(amt, SEND_SIZE); - - int len = (int)amt, - frames = 0; // this will be uvox frames as we pre-process earlier to ensure - // that the audio frames are frame-synced when this is created - bool advert = false; - doM4AFrameSync(m_streamData->streamUvoxDataType(), debug, m_introFileOffset, - (const char*)&m_introFile[0], cur_time, m_streamData->streamBitrate(), - m_streamData->streamSampleRate(), len, frames, advert); - - int rval = doSend(debug, cur_time, autoDumpTime); - if (rval > 0) - { - bandWidth::updateAmount(bandWidth::CLIENT_M4A_SENT, rval); - m_bytesSentForCurrentTitle += rval; - m_totalBytesSent += rval; - m_lastActivityTime = ::time(NULL); - m_metaIntervalCounter += rval; - // we adjust by the pre-M4A size - m_introFileOffset += len; - } - - updateFrameCount(frames, cur_time); - - handleShortSend(autoDumpTime, cur_time, rval); - } -} - -// handle state where we are sending backup files -void protocol_m4aClient::state_SendBackupFile() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - resetCommon(); - - int amt = (int)(m_backupFile.size() - m_backupFileOffset); - - if (streamData::isSourceConnected(m_streamID)) - { - if (m_streamData) - { - m_streamData->releaseStream(); - } - m_streamData = streamData::accessStream(m_streamID); - - // we're done with the backup file - m_backupFile.clear(); - m_backupFile.resize(0); - m_backupFileOffset = 0; - m_backupLoopTries = 0; - m_lastActivityTime = ::time(NULL); - m_state = &protocol_m4aClient::state_Stream; - resetReadPtr(); - m_result.run(); - } - else if (amt == 0) - { - const int backuploop = gOptions.getBackupLoop(m_streamID); - if (!backuploop || (m_backupLoopTries <= backuploop)) - { - // we're done with the backup file. get more data - acquireBackupFile(); - if (!m_backupFile.empty()) - { - ++m_backupLoopTries; - resetReadPtr(); - m_lastActivityTime = ::time(NULL); - m_state = &protocol_m4aClient::state_Stream; - } - } - else if (backuploop && (m_backupLoopTries < backuploop)) - { - m_backupFileOffset = 0; - m_backupFile.clear(); - } - else - { - resetReadPtr(); - m_backupFileOffset = 0; - m_lastActivityTime = ::time(NULL); - m_state = &protocol_m4aClient::state_Stream; - } - - m_result.run(); - } - else if (amt > 0) - { - const bool debug = gOptions.m4aClientDebug(); - checkListenerIsValid(debug); - - time_t cur_time; - const int autoDumpTime = detectAutoDumpTimeout(cur_time, m_lastActivityTime, (m_clientLogString + - "Timeout waiting to send data"), - (!m_ignoreDisconnect && debug), m_streamID); - - if (m_shortSend.empty() && (m_frameCount > calculateFrameLimit(cur_time))) - { - if (calculateDelay((autoDumpTime - (int)(cur_time - m_lastActivityTime)))) - { - // if we're at the limit then we're going to need to sit and spin - // which will need to be a bit short of the required frame rate - // so that we've got a bit of leeway on scheduling delays, etc - return; - } - } - - if (!m_lastSentMetadata.empty()) - { - logW3C(); - m_lastSentMetadata.clear(); - } - - amt = min(amt, SEND_SIZE); - - int len = (int)amt, backup_type = MP3_DATA, - frames = 0; // this will be uvox frames as we pre-process earlier to ensure - // that the audio frames are frame-synced when this is created - if (!m_streamData) - { - utf8 backupFile = gOptions.stream_backupFile(m_streamID); - if (!gOptions.read_stream_backupFile(m_streamID)) - { - backupFile = gOptions.backupFile(); - } - if (!backupFile.empty()) - { - backup_type = ((backupFile.rfind((utf8)".aac") == utf8::npos) ? MP3_DATA : AACP_DATA); - } - } - - bool advert = false; - doM4AFrameSync((m_streamData ? m_streamData->streamUvoxDataType() : backup_type), - debug, m_backupFileOffset, (const char*)&m_backupFile[0], cur_time, - (m_streamData ? m_streamData->streamBitrate() : 0), - (m_streamData ? m_streamData->streamSampleRate() : 0), len, frames, advert); - - int rval = doSend(debug, cur_time, autoDumpTime); - if (rval > 0) - { - bandWidth::updateAmount(bandWidth::CLIENT_M4A_SENT, rval); - m_bytesSentForCurrentTitle += rval; - m_totalBytesSent += rval; - m_lastActivityTime = ::time(NULL); - m_metaIntervalCounter += rval; - // we adjust by the pre-M4A size - m_backupFileOffset += len; - } - - updateFrameCount(frames, cur_time); - - handleShortSend(autoDumpTime, cur_time, rval); - } -} - -// handle state where we are sending advert content -void protocol_m4aClient::state_SendAdverts() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(m_clientLogString + __FUNCTION__); -#endif - - resetCommon(); - - streamData::specialFileData *ad = m_adAccess.getAd(m_streamID, m_streamData->advertGroups, !!m_streamData->m_adTest); - int amt = (ad ? (int)(ad->m_sc1Buffer.size() - m_adAccess.offset) : 0); - - while (true) - { - // DLOG ("amount remaining to be sent " + tos(amt)); - if (amt > 0) - { - break; - } - if (m_adAccess.anotherAd(m_streamID, m_streamData->advertGroups, !!m_streamData->m_adTest)) - { - ad = m_adAccess.getAd(m_streamID, m_streamData->advertGroups, !!m_streamData->m_adTest); - amt = (ad ? (int)(ad->m_sc1Buffer.size() - m_adAccess.offset) : 0); - continue; - } - // no more adverts - m_lastActivityTime = ::time(NULL); - m_state = &protocol_m4aClient::state_Stream; - m_adAccess.stopAdRun(m_streamID, m_streamData->advertGroups, !!m_streamData->m_adTest); - // go to the latest point in the ring buffer. - resetReadPtr(); - m_result.run(); - m_result.timeoutSID(m_streamID); - - ILOG(m_clientLogString + "Transitioning back to stream [Agent: `" + - m_userAgent + "', UID: " + tos(m_unique) + ", GRID: " + tos(m_group) + "]"); - return; - } - - try - { - const bool debug = gOptions.m4aClientDebug(); - checkListenerIsValid(debug); - - time_t cur_time; - const int autoDumpTime = detectAutoDumpTimeout(cur_time, m_lastActivityTime, (m_clientLogString + - "Timeout waiting to send data"), - (!m_ignoreDisconnect && debug), m_streamID); - - if (m_shortSend.empty() && (m_frameCount > calculateFrameLimit(cur_time))) - { - if (calculateDelay((autoDumpTime - (int)(cur_time - m_lastActivityTime)))) - { - // if we're at the limit then we're going to need to sit and spin - // which will need to be a bit short of the required frame rate - // so that we've got a bit of leeway on scheduling delays, etc - return; - } - } - - if (!m_lastSentMetadata.empty()) - { - logW3C(); - m_lastSentMetadata.clear(); - } - - amt = min(amt, SEND_SIZE); - - int len = (int)amt, - frames = 0; // this will be uvox frames as we pre-process earlier to ensure - // that the audio frames are frame-synced when this is created - bool advert = false; - doM4AFrameSync(m_streamData->streamUvoxDataType(), (int)m_adAccess.offset, - debug, (const char*)&ad->m_sc1Buffer[0], cur_time, - m_streamData->streamBitrate(), m_streamData->streamSampleRate(), - len, frames, advert); - - int rval = doSend(debug, cur_time, autoDumpTime); - if (rval > 0) - { - bandWidth::updateAmount(bandWidth::CLIENT_M4A_SENT, rval); - m_bytesSentForCurrentTitle += rval; - m_totalBytesSent += rval; - m_lastActivityTime = ::time(NULL); - m_metaIntervalCounter += rval; - // we adjust by the pre-M4A size - m_adAccess.offset += len; - - m_nextState = &protocol_m4aClient::state_SendText; - } - - updateFrameCount(frames, cur_time); - - handleShortSend(autoDumpTime, cur_time, rval); - } - catch (std::runtime_error) - { - m_adAccess.stopAdRun(m_streamID, m_streamData->advertGroups, !!m_streamData->m_adTest); - throw; - } -} - -void protocol_m4aClient::state_Stream() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(m_clientLogString + __FUNCTION__); -#endif - - resetCommon(); - - const time_t cur_time = ::time(NULL); - const bool debug = gOptions.m4aClientDebug(); - const int autoDumpTime = gOptions.getAutoDumpTime(m_streamID); // don't want this value to change during this call - if ((autoDumpTime > 0) && ((cur_time - m_lastActivityTime) >= autoDumpTime)) - { - throwEx((!m_ignoreDisconnect && debug ? - (m_clientLogString + "Timeout waiting to send data (" + - tos(cur_time) + " " + tos(m_lastActivityTime) + " [" + - tos(cur_time - m_lastActivityTime) + "] )") : (utf8)"")); - } - - if (m_shortSend.empty() && (m_frameCount > calculateFrameLimit(cur_time))) - { - if (calculateDelay((autoDumpTime - (int)(cur_time - m_lastActivityTime)))) - { - // if we're at the limit then we're going to need to sit and spin - // which will need to be a bit short of the required frame rate - // so that we've got a bit of leeway on scheduling delays, etc - return; - } - } - - const streamData::ringBuffer_t rb = (m_streamData ? m_streamData->getSc1RingBuffer() : streamData::ringBuffer_t()); - streamData::ringBufferAccess_t amt = (m_streamData ? (rb.m_writePtr - m_readPtr) : 0); - if ((amt > 0) && (amt > rb.m_data.size())) - { - // the pointers are too far apart. Underrun - resetReadPtr(&amt); - } - - std::vector<__uint8>& rem = getRemainder(); - const streamData::ringBufferAccess_t offset = (m_readPtr & rb.m_ptrMask); - // clamp again so we don't read pass the end of the buffer - // - // if we've got more in remainder than what we're wanting - // to send then we'll prioritise the remainder data first - // before trying to acquire more new data to try to send. - amt = min(amt, min((rb.m_data.size() - offset), (streamData::ringBufferAccess_t)max(0, (SEND_SIZE - rem.size())))); - - bool advert = false; - int remainder = 0, len = (int)amt, - frames = 0; // this will be uvox frames as we pre-process earlier to ensure - // that the audio frames are frame-synced when this is created - if ((len > 0) || !rem.empty() || !m_shortSend.empty()) - { - const std::vector<__uint8>::const_iterator pos = rb.m_data.begin(); - std::vector<__uint8>& tempBuf; - // if we had anything left over then now we - // need to copy it back into the buffer and - // adjust the max data amount to be read in - if (!rem.empty() && ((len + rem.size()) <= (BUF_SIZE * 4))) - { - tempBuf.insert(tempBuf.end(), rem.begin(), rem.end()); - tempBuf.insert(tempBuf.end(), pos + offset, pos + (offset + len)); - len += m_remainderSize; - } - else if (len > 0) - { - tempBuf.insert(tempBuf.end(), pos + offset, pos + (offset + len)); - } - rem.clear(); - - remainder = doM4AFrameSync((m_streamData ? m_streamData->streamUvoxDataType() : MP3_DATA), - debug, 0, cur_time, (m_streamData ? m_streamData->streamBitrate() : 0), - (m_streamData ? m_streamData->streamSampleRate() : 0), - len, frames, advert, true); - } - - // if no data then we need to just go to adverts - // otherwise we need to see what we've got and - // if we can, then transition to adverts or spin - // and wait for the current data to be sent and - // then we should be able to re-process into ads - if (m_output.empty()) - { - // this will close the stream or go to backups as needed - if (handleNoData("M4A", remainder, amt, autoDumpTime, cur_time)) - { - m_state = &protocol_m4aClient::state_SendBackupFile; - } - else - { - if (processAdvertTrigger(advert)) - { - m_state = &protocol_m4aClient::state_SendAdverts; - return; - } - - // at this point, we're in a bit of a weird state - // as we've not been able to generate / retrieve - // anything and if we don't slwo down things then - // we need to delay things to allow it to catchup - if (m_frameCount > calculateFrameLimit(cur_time)) - { - // determine things based on the 'next' second when working out - // the differential as that's how long we want to wait to run - m_result.schedule((int)((__uint64)((cur_time + 1) * 1000) - m_result.m_currentTime)); - } - else - { - // just go with an arbitrary value as we cannot - // be certain when we're going to get data next - // and we don't know the impact on playback etc - m_result.schedule(100); - } - - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - m_result.write(); - } - } - else - { - processTitleW3C(); - - int rval = doSend(debug, cur_time, autoDumpTime); - if (rval > 0) - { - bandWidth::updateAmount(bandWidth::CLIENT_M4A_SENT, rval); - m_bytesSentForCurrentTitle += rval; - m_totalBytesSent += rval; - m_lastActivityTime = ::time(NULL); - m_metaIntervalCounter += rval; - - if (processAdvertTrigger(advert)) - { - m_state = &protocol_m4aClient::state_SendAdverts; - remainder = 0; - } - } - - // as we're keeping a copy of the remainder / non-sent data - // we need to move the readptr on so that it doesn't cause - // the stream to effectively stick on the same point and in - // turn then lead to resetReadPtr() being called (skipping) - m_readPtr += amt; - updateFrameCount(frames, cur_time); - - handleShortSend(autoDumpTime, cur_time, rval); - - // we only keep the remainder if - // there's no advert to provide - m_remainderSize = remainder; - } -} - -void protocol_m4aClient::return_403(void) -{ - protocol_shoutcastClient::return_403(); - m_state = &protocol_m4aClient::state_SendText; - m_nextState = &protocol_m4aClient::state_Close; -} -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_m4aClient.h b/Src/Plugins/DSP/sc_serv3/protocol_m4aClient.h deleted file mode 100644 index 8455754f..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_m4aClient.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once -#if 0 -#ifndef protocol_m4aClient_H_ -#define protocol_m4aClient_H_ - -#include "protocol_shoutcastClient.h" -#include - -class streamData; - -class protocol_m4aClient: public protocol_shoutcastClient -{ -private: - typedef void (protocol_m4aClient::*state_t)(); - state_t m_state; - state_t m_nextState; - - void state_AttachToStream() throw(std::exception); - void state_Close() throw(std::exception); - void state_SendText() throw(std::exception); - void state_InitiateStream() throw(std::exception); - void state_Stream() throw(std::exception); - void state_SendIntroFile() throw(std::exception); - void state_SendIntro() throw(std::exception); - void state_SendBackupFile() throw(std::exception); - void state_SendAdverts() throw(std::exception); - - virtual void timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "protocol_m4aClient"; } - -public: - protocol_m4aClient(const socketOps::tSOCKET s, const streamData::streamID_t streamID, - const uniString::utf8 &hostName, const uniString::utf8 &addr, - const u_short port, const uniString::utf8 &userAgent, - const uniString::utf8 &XFF, const uniString::utf8 &referer) throw(std::exception); - virtual ~protocol_m4aClient() throw(); - - void return_403(void); -}; - -#endif -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_relay.cpp b/Src/Plugins/DSP/sc_serv3/protocol_relay.cpp deleted file mode 100644 index 6db504ec..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_relay.cpp +++ /dev/null @@ -1,544 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include -#include "protocol_relay.h" -#include "protocol_backup.h" -#include "protocol_relay_shoutcast.h" -#include "protocol_relay_uvox.h" -#include "bandwidth.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace stringUtil; -using namespace uniString; - -// g_streamSourceRelayIsActive -// This is a map of sid to int, where the int is a bitmap of flags, the bits being -// 0 - registered, some runnable is working with this. -// 1 - shutdown of relay requested. -// 2 - primary relay in use -// 3 - backup runnable started - -#define LOGNAME "RELAY" -#define DEBUG_LOG(...) do { if (gOptions.relayDebug()) DLOG(__VA_ARGS__); } while (0) - -protocol_relay::protocol_relay(const config::streamConfig &info, const bool retry) throw() - : m_redirectCount(0), m_outBuffer(0), m_outBufferSize(0), m_relayWaitingToReconnect(false), - m_relaySentConnectWait(false), m_retryRelay(retry), m_skip(false), - m_backupStarted(false), m_registered(false), m_relayInfo(info), - m_originalRelayInfo(info), m_retryCount(0), m_relayReconnectStartTime(::time(NULL)), - m_state(&protocol_relay::state_Initial), m_nextState(0) -{ - streamData::setRelayActive (info.m_streamID, -1); // make sure entry exists - - m_srcPort = m_relayInfo.m_relayUrl.port(); - m_srcAddrName = m_relayInfo.m_relayUrl.server(); - m_srcURLpart = m_relayInfo.m_relayUrl.path(); - m_srcLogString = "[RELAY " + m_srcAddrName + ":" + tos(m_srcPort) + - (m_srcURLpart == "/" ? "" : m_srcURLpart) + - " sid=" + tos(m_relayInfo.m_streamID) + "] "; - - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); -} - -protocol_relay::~protocol_relay() throw() -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - socketOps::forgetTCPSocket(m_socket); - if (m_registered) - { - bool noEntry = false; - streamData::setRelayActiveFlags (m_originalRelayInfo.m_streamID, noEntry, 0, 7); - } -} - -void protocol_relay::timeSlice() throw(exception) -{ - if (iskilled()) - { - m_result.done(); - return; - } - - // normal running - try - { - if (m_registered && m_relayWaitingToReconnect && (::time(NULL) < m_relayReconnectStartTime)) - { - // an error occured in the past and we are waiting for the appropriate time interval before we do anything - bool noEntry = false; - int status = streamData::isRelayActive(m_originalRelayInfo.m_streamID, noEntry); - if ((status & 2) == 0) // if no shutdown req - { - m_result.schedule(400); - return; - } - DEBUG_LOG (m_srcLogString + "relay shutdown req", LOGNAME, m_originalRelayInfo.m_streamID); - throwEx(""); - } - (this->*m_state)(); - } - catch(const exception &ex) - { - // close socket and move into waiting state for reconnect - socketOps::forgetTCPSocket(m_socket); - - // but first see if we've hit the retry limit (which can be set as zero to keep on going) - ++m_retryCount; - int retryLimit = gOptions.relayConnectRetries(); - bool noEntry = false; - - DEBUG_LOG(m_srcLogString + __FUNCTION__ + utf8(" m_retryCount:") + tos(m_retryCount) + " retryLimit:" + tos(retryLimit), LOGNAME, m_originalRelayInfo.m_streamID); - int status = streamData::setRelayActiveFlags (m_originalRelayInfo.m_streamID, noEntry, 0, 4); - -#if defined(_DEBUG) || defined(DEBUG) - bool relayActive = status & 4 ? true : false; - - DLOG(m_srcLogString + __FUNCTION__ + " a: " + tos(retryLimit) + - " " + tos(m_retryCount) + " "+tos(relayActive) + " " + - tos(m_retryCount < retryLimit && retryLimit > 0) + " " + - tos(((m_retryCount < retryLimit && retryLimit > 0)) && relayActive),LOGNAME, m_originalRelayInfo.m_streamID); -#endif - - if (noEntry == false && (status & 2) == 0) // is relay still configured - { - if ((status & 8) == 0) - startBackupConnection (""); // kick backup off if present, in case of repeated failure - - utf8 msg = ex.what(); - if (!msg.empty()) - { - ELOG (ex.what(), LOGNAME, m_originalRelayInfo.m_streamID); - } - - if (retryLimit == 0 || (m_retryCount < retryLimit && retryLimit > 0)) - { - - m_relayWaitingToReconnect = true; - m_state = &protocol_relay::state_Initial; - m_relayInfo = m_originalRelayInfo; - m_relayReconnectStartTime = ::time(NULL) + gOptions.relayReconnectTime(); - m_result.schedule (550); - DLOG (m_srcLogString + "reconnect time " + tos ((long)m_relayReconnectStartTime), LOGNAME, m_originalRelayInfo.m_streamID); - return; - } - } - else - { - utf8 ss = m_srcLogString + "Abort trying to "; - if (m_retryCount > 0) - ss += "re"; - ss += "connect to the source relay"; - ILOG (ss, LOGNAME, m_originalRelayInfo.m_streamID); - } - m_result.done(); - } -} - -// parse out relayInfo object -void protocol_relay::state_Initial() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - // if we have a moved stream then now we have the stream id - // then we need to check and block the source as applicable - utf8 movedUrl = gOptions.stream_movedUrl(m_relayInfo.m_streamID); - if (!movedUrl.empty()) - { - ELOG (m_srcLogString + "Relay connection aborted. Stream is configured as having moved.", LOGNAME, m_originalRelayInfo.m_streamID); - m_result.done(); - return; - } - - bool noEntry = false; - if (m_registered == false) - { - int state = streamData::setRelayActiveFlags (m_originalRelayInfo.m_streamID, noEntry, 1); - if (state < 0) - { - ILOG (m_srcLogString + "waiting on other relay termination", LOGNAME, m_originalRelayInfo.m_streamID); - streamData::setRelayActiveFlags (m_originalRelayInfo.m_streamID, noEntry, 2); // request shutdown of other relay - m_result.schedule (100); - return; - } - m_registered = true; - } - int state = streamData::setRelayActiveFlags (m_originalRelayInfo.m_streamID, noEntry, 4); - - if (noEntry || (state & 2) == 2) - { - ILOG (m_srcLogString + "relay shutting down", LOGNAME, m_originalRelayInfo.m_streamID); - m_result.done(); - return; - } - - // if m_retryCount is over 1 then pull the stream relay url from - // the config details as we could be in a re-try or having done - // a config reload and the stream relay url has then sinc changed - // - this primarily aids a config change for a pending relay join - if (m_retryCount > 0) - { - m_relayInfo.m_relayUrl = gOptions.stream_relayURL(m_originalRelayInfo.m_streamID); - } - m_relayWaitingToReconnect = false; - m_srcAddrName = m_relayInfo.m_relayUrl.server(); - m_srcPort = m_relayInfo.m_relayUrl.port(); - m_srcURLpart = m_relayInfo.m_relayUrl.path(); - - m_srcLogString = "[RELAY " + m_srcAddrName + ":" + tos(m_srcPort) + - (m_srcURLpart == "/" ? "" : m_srcURLpart) + - " sid=" + tos(m_relayInfo.m_streamID) + "] "; - - m_state = &protocol_relay::state_ResolveServer; - m_result.run(); -} - - -// resolve server name to numeric address -void protocol_relay::state_ResolveServer() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - assert(m_socket == socketOps::cINVALID_SOCKET); - m_socket = socketOps::createTCPSocketTHROW(); - socketOps::setNonblock(m_socket, true); - m_srcAddrNumeric = socketOps::hostNameToAddress(m_srcAddrName.hideAsString(), m_srcPort); - if (m_srcAddrNumeric.empty()) - { - ELOG (m_srcLogString + "Could not resolve host address", LOGNAME, m_originalRelayInfo.m_streamID); - throwEx(""); - } - - m_state = &protocol_relay::state_Connect; - m_result.run(); -} - -// TCP connect -void protocol_relay::state_Connect() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - assert(m_socket != socketOps::cINVALID_SOCKET); - - if (!m_skip) - { - utf8 ss = m_srcLogString; - if (m_retryCount > 0) - { - ss += "Trying to restore connection to source relay [attempt #"; - ss += tos(m_retryCount+1) + "]"; - } - else - ss += "Connecting to source relay"; - ILOG (ss, LOGNAME, m_originalRelayInfo.m_streamID); - } - - m_skip = false; - socketOps::connectTHROW (m_socket, m_srcAddrNumeric, m_srcPort); - - m_lastActivityTime = ::time(NULL); - m_state = &protocol_relay::state_ConnectWait; - m_result.run(); -} - -// wait for connect to complete -void protocol_relay::state_ConnectWait() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - assert(m_socket != socketOps::cINVALID_SOCKET); - - time_t cur_time; - const int autoDumpSourceTime = detectAutoDumpTimeout (cur_time, m_originalRelayInfo.m_streamID, (m_srcLogString + "Timeout trying to connect")); - - bool noEntry = false, relayActive = ((streamData::isRelayActive(m_originalRelayInfo.m_streamID, noEntry) & 6) == 4); - if (!relayActive && !noEntry) - { - throwEx(""); - } - - string error; - socketOps::nonBlockConnect_t connectResult = socketOps::nonBlockingConnectWait(m_socket, error); - switch (connectResult) - { - case socketOps::NBC_ERROR: - { - ELOG (m_srcLogString + error, LOGNAME, m_originalRelayInfo.m_streamID); - throwEx(""); - break; - } - case socketOps::NBC_INPROGRESS: - { - // try again but wait a bit - m_result.schedule(100); - m_result.timeout((autoDumpSourceTime - (int)(cur_time - m_lastActivityTime))); - break; - } - case socketOps::NBC_CONNECTED: - { - m_lastActivityTime = ::time(NULL); - m_state = &protocol_relay::state_SendGreeting; - m_result.run(); - break; - } - default: - { - ELOG (m_srcLogString + "Unknown non-blocking connect state.", LOGNAME, m_originalRelayInfo.m_streamID); - throwEx(""); - } - } -} - -void protocol_relay::state_SendGreeting() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - m_HTTPHeaders.clear(); - m_HTTPGreetingResponse.clear(); - - string cdn; - if (isCDNSlave(m_relayInfo.m_streamID)) - { - cdn = "cdn-slave:1\r\n"; - } - - m_lineBuffer = "GET " + m_srcURLpart + " " + "HTTP/1.1\r\n" + - "Host:" + stripHTTPprefix(m_srcAddrName) + ":" + tos(m_srcPort) + "\r\n" + - "User-Agent:" + g_userAgent + " Relay\r\n" + - "Ultravox transport type:TCP\r\n" + - "Accept:*/*\r\n" + - "icy-metadata:1\r\n" + - cdn + - "icy-host:" + metrics::metrics_verifyDestIP(gOptions) + "\r\n\r\n"; - - DEBUG_LOG(m_srcLogString + "Sending request [" + eol() + stripWhitespace(m_lineBuffer) + eol() + "]", LOGNAME, m_originalRelayInfo.m_streamID); - m_outBuffer = &(m_lineBuffer[0]); - bandWidth::updateAmount(bandWidth::RELAY_MISC_RECV, (m_outBufferSize = (int)m_lineBuffer.size())); - - m_lastActivityTime = ::time(NULL); - m_state = &protocol_relay::state_Send; - m_nextState = &protocol_relay::state_GetGreetingResponse; - - m_result.write(); - m_result.timeoutSID(m_originalRelayInfo.m_streamID); -} - -// send whatever is in outBuffer -void protocol_relay::state_Send() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - if (sendDataBuffer(m_relayInfo.m_streamID, m_outBuffer, m_outBufferSize, m_srcLogString)) - { - m_state = m_nextState; - m_lineBuffer.clear(); - } -} - -void protocol_relay::state_GetLine() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - if (getHTTPStyleHeaderLine(m_relayInfo.m_streamID, m_lineBuffer, m_srcLogString)) - { - m_state = m_nextState; - } -} - -void protocol_relay::state_GetGreetingResponse() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - m_state = &protocol_relay::state_GetLine; - m_nextState = &protocol_relay::state_AnalyzeGreetingResponse; - - m_lastActivityTime = ::time(NULL); - m_result.read(); - m_result.timeoutSID(m_originalRelayInfo.m_streamID); -} - -// analyze header lines in greeting response -void protocol_relay::state_AnalyzeGreetingResponse() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - m_lastActivityTime = ::time(NULL); - - if ((int)m_HTTPHeaders.size() >= gOptions.maxHeaderLineCount()) - { - throwEx(m_srcLogString + "Max HTTP header lines exceeded"); - } - - m_lineBuffer = stripWhitespace(m_lineBuffer); - if (m_lineBuffer.empty()) - { - m_state = &protocol_relay::state_DetermineProtocol; - m_result.run(); - } - else - { - if (m_HTTPGreetingResponse.empty()) - { - m_HTTPGreetingResponse = m_lineBuffer; - } - else - { - // find the colon that divides header lines into key/value fields - utf8::size_type pos = m_lineBuffer.find(utf8(":")); - if (pos == utf8::npos) - { - throwEx(m_srcLogString + "Connection rejected. Bad HTTP header string [" + m_lineBuffer + "]"); - } - - utf8 key = toLower(stripWhitespace(m_lineBuffer.substr(0, pos))); - utf8 value = stripWhitespace(m_lineBuffer.substr(pos + 1)); - // allow empty values. (for urls and what-not) - if (key.empty()) - { - throwEx(m_srcLogString + "Connection rejected. Bad HTTP header string [" + m_lineBuffer + "]"); - } - m_HTTPHeaders[key] = value; - } - - m_state = &protocol_relay::state_GetLine; - m_nextState = &protocol_relay::state_AnalyzeGreetingResponse; - m_result.read(); - m_result.timeoutSID(m_originalRelayInfo.m_streamID); - m_lineBuffer.clear(); - } -} - -void protocol_relay::state_DetermineProtocol() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - if (m_HTTPGreetingResponse.empty()) - { - throwEx(m_srcLogString + "Empty greeting response"); - } - - // parse into three fields - utf8 s = m_HTTPGreetingResponse; - - utf8::size_type pos = (!s.empty() ? s.find(utf8(" ")) : utf8::npos); - if (pos == utf8::npos) - { - ELOG (m_srcLogString + "Badly formed response line [" + m_HTTPGreetingResponse + "]", LOGNAME, m_originalRelayInfo.m_streamID); - throwEx(""); - } - - s = stripWhitespace(s.substr(pos)); - pos = (!s.empty() ? s.find(utf8(" ")) : utf8::npos); - if (pos == utf8::npos) - { - ELOG (m_srcLogString + "Badly formed response line [" + m_HTTPGreetingResponse + "]", LOGNAME, m_originalRelayInfo.m_streamID); - throwEx(""); - } - - int resultCode = utf8(s.substr(0, pos)).toInt(); - if (resultCode == 200) - { - utf8 diag; - for (httpHeaderMap_t::const_iterator i = m_HTTPHeaders.begin(); i != m_HTTPHeaders.end(); ++i) - { - diag += (*i).first + ": " + (*i).second + eol(); - } - DEBUG_LOG(m_srcLogString + "Received headers [" + eol() + stripWhitespace(diag) + eol() + "]", LOGNAME, m_originalRelayInfo.m_streamID); - - const socketOps::tSOCKET s = m_socket; - - m_result.done(); - - // changed order of this in build 19 so that all uvox2 is reported as misc/ultravox - // and we then base things off the user-agent containing 'Ultravox/2.1' - // we look at content-type to determine the protocol - if ((m_HTTPHeaders["content-type"] == "misc/ultravox") && - (m_HTTPHeaders["server"].find(utf8("Ultravox/2.1")) != utf8::npos)) - { - // uvox 2.1 - threadedRunner::scheduleRunnable(new protocol_relay_uvox(s, m_originalRelayInfo, m_srcAddrName, m_srcAddrNumeric, - m_srcPort, (m_srcURLpart == "/" ? "" : m_srcURLpart), m_HTTPHeaders)); - } - else - { - // shoutcast - threadedRunner::scheduleRunnable(new protocol_relay_shoutcast(s, m_originalRelayInfo, m_srcAddrName, m_srcAddrNumeric, - m_srcPort, (m_srcURLpart == "/" ? "" : m_srcURLpart), m_HTTPHeaders)); - } - m_socket = socketOps::cINVALID_SOCKET; - m_backupStarted = false; // any backup client should terminate automatically - } - else if ((resultCode >= 300) && (resultCode < 400)) - { - utf8 location = m_HTTPHeaders["location"]; - - // do we maybe have a /stream/x url and gotten a /index.html?sid=# redirect? - // if so then we should attempt to access a relay on /stream/x/ (note end / ) - utf8::size_type pos = (!location.empty() ? location.find(utf8("/index.html?sid=")) : utf8::npos); - if (pos != utf8::npos) - { - streamData::streamID_t foundID = atoi((const char *)location.substr(pos + 16).c_str()); - utf8::size_type pos2 = m_relayInfo.m_relayUrl.path().find(utf8("/stream/")); - if (pos2 != utf8::npos) - { - streamData::streamID_t origID = atoi((const char *)m_relayInfo.m_relayUrl.path().substr(pos2 + 8).c_str()); - if (foundID == origID) - { - m_relayInfo.m_relayUrl = m_relayInfo.m_relayUrl.url() + "/"; - gOptions.setOption(utf8("streamrelayurl_"+tos(m_originalRelayInfo.m_streamID)), - m_relayInfo.m_relayUrl.url()); - - m_skip = true; - m_state = &protocol_relay::state_Initial; - socketOps::forgetTCPSocket(m_socket); - m_result.run(); - WLOG(m_srcLogString + "Received an invalid redirect to `" + location + "' - trying " + m_relayInfo.m_relayUrl.url(), LOGNAME, m_originalRelayInfo.m_streamID); - return; - } - } - } - - WLOG(m_srcLogString + "Received redirect to " + location, LOGNAME, m_originalRelayInfo.m_streamID); - if (++m_redirectCount > gOptions.maxHTTPRedirects()) - { - ELOG ("Max redirects exceeded", LOGNAME, m_originalRelayInfo.m_streamID); - throwEx(""); - } - - m_skip = true; - m_relayInfo.m_relayUrl = location; - m_state = &protocol_relay::state_Initial; - socketOps::forgetTCPSocket(m_socket); - m_result.run(); - } - else - { - ELOG ((resultCode >= 400 ? "Source responded with error [" : "Unsupported HTTP response code [") + m_HTTPGreetingResponse + "]"); - throwEx(""); - } -} - -#ifdef INCLUDE_BACKUP_STREAMS -void protocol_relay::startBackupConnection(uniString::utf8 errorMessage) throw(exception) -{ - if (!m_relayInfo.m_backupUrl.url().empty() && m_backupStarted == false) - { - if (errorMessage.empty() == false) - ELOG(m_srcLogString + errorMessage, LOGNAME, m_originalRelayInfo.m_streamID); - // this should pass through the bitrate of the original stream but as we do not - // know what it is then we have to effectively force through to allow the backup - - bool noEntry = false; - streamData::setRelayActiveFlags (m_originalRelayInfo.m_streamID, noEntry, 8); - threadedRunner::scheduleRunnable(new protocol_backup(m_relayInfo, 0, "")); - m_backupStarted = true; - return; - } -} -#else -void protocol_relay::startBackupConnection(uniString::utf8) throw(exception) -{ -} -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_relay.h b/Src/Plugins/DSP/sc_serv3/protocol_relay.h deleted file mode 100644 index ba01c1ee..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_relay.h +++ /dev/null @@ -1,73 +0,0 @@ -#pragma once -#ifndef protocol_relay_H_ -#define protocol_relay_H_ - -#include "threadedRunner.h" - -/* - Runnable object that handles the initial part of a relay connection. - Makes the connection to the source and determines what type of protocol - should be used, then hands off to that particular protocol - (shoutcast or uvox relay) -*/ - -class protocol_relay: public runnable -{ -private: - u_short m_srcPort; // server port - short m_redirectCount; - - uniString::utf8 m_srcAddrName; // server DNS name or value as specified in relayInfo - std::string m_srcAddrNumeric; // resolved numeric addr - uniString::utf8 m_srcURLpart; // server - - uniString::utf8 m_srcLogString; - httpHeaderMap_t m_HTTPHeaders; - uniString::utf8 m_HTTPGreetingResponse; // first line of response - - const uniString::utf8::value_type *m_outBuffer; // for outgoing text lines - int m_outBufferSize; - - bool m_relayWaitingToReconnect; - bool m_relaySentConnectWait; - bool m_retryRelay; - bool m_skip; - bool m_backupStarted; - bool m_registered; // true if runnable is ok to start. new relay have to wait for exisitng one to drop - - uniString::utf8 m_lineBuffer; // in/out lines - - config::streamConfig m_relayInfo; - const config::streamConfig m_originalRelayInfo; // used for reconnects later on - - /// reconnects - int m_retryCount; - time_t m_relayReconnectStartTime; - - typedef void (protocol_relay::*state_t)(); - - state_t m_state; - state_t m_nextState; - - void state_Initial() throw(std::exception); - void state_ResolveServer() throw(std::exception); - void state_Connect() throw(std::exception); - void state_ConnectWait() throw(std::exception); - void state_SendGreeting() throw(std::exception); - void state_GetGreetingResponse() throw(std::exception); - void state_AnalyzeGreetingResponse() throw(std::exception); - void state_DetermineProtocol() throw(std::exception); - void state_Send() throw(std::exception); - void state_GetLine() throw(std::exception); - void startBackupConnection(uniString::utf8 errorMessage) throw(std::exception); - -protected: - virtual void timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "protocol_relay"; } - -public: - protocol_relay(const config::streamConfig &info, const bool retry = false) throw(); - virtual ~protocol_relay() throw(); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_relay_shoutcast.cpp b/Src/Plugins/DSP/sc_serv3/protocol_relay_shoutcast.cpp deleted file mode 100644 index 91c06f79..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_relay_shoutcast.cpp +++ /dev/null @@ -1,455 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include "protocol_relay_shoutcast.h" -#include "protocol_backup.h" -#include "protocol_relay.h" -#include "streamData.h" -#include "bandwidth.h" -#include "MP3Header.h" -#include "ADTSHeader.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define DEBUG_LOG(...) do { if (gOptions.relayShoutcastDebug()) DLOG(__VA_ARGS__); } while (0) -#define LOGNAME "RELAY" - -protocol_relay_shoutcast::protocol_relay_shoutcast(socketOps::tSOCKET s, - const config::streamConfig &originalRelayInfo, const uniString::utf8 &srcAddrName, - const uniString::utf8 &srcAddrNumeric, const int srcPort, - const uniString::utf8 &srcURLpart, httpHeaderMap_t &headers, - const int originalBitrate, const uniString::utf8& originalMimeType, const bool backup) - : runnable(s), m_originalBitrate(originalBitrate), m_originalRelayInfo(originalRelayInfo), - m_metadataInterval(mapGet(headers, "icy-metaint", (short unsigned int)0)), - m_backup(backup), m_denied(false), m_remainderSize(0), - m_remainder(new __uint8[BUF_SIZE * 4]), m_srcAddrName(srcAddrName), - m_srcAddrNumeric(srcAddrNumeric), m_srcURLpart(srcURLpart), m_streamData(0), - m_srcLogString((!backup ? "[RELAY " : "[BACKUP ") + m_srcAddrName + ":" + - tos(srcPort) + m_srcURLpart + " sid=" + - tos(originalRelayInfo.m_streamID) + "] "), - m_bytesSinceMetadata(0), m_metadataSizeByte(-1) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, originalRelayInfo.m_streamID); - bool noEntry = false; - streamData::isRelayActive (m_originalRelayInfo.m_streamID, noEntry); - - // for a backup we need to check that the mimetype matches the original source - // as otherwise there will be issues with the transition between the sources! - utf8 mimeType = fixMimeType(mapGet(headers, "content-type", utf8("audio/mpeg"))); - if (m_backup && !originalMimeType.empty() && (originalMimeType != mimeType)) - { - ELOG(m_srcLogString + "Backup source rejected. The content type does not match the original stream " - "source - detected `" + mimeType + "' instead of `" + originalMimeType + "'.", (char*)m_srcLogString.c_str(), originalRelayInfo.m_streamID); - m_state = &protocol_relay_shoutcast::state_CloseConnection; - return; - } - m_originalMimeType = mimeType; - - // for a backup we need to check that the bitrate matches the original source - // as otherwise there will be issues with the transition between the sources! - const int bitrate = getStreamBitrate(headers); - if (m_backup && (m_originalBitrate > 0) && (m_originalBitrate != bitrate) && (m_originalBitrate/1000 != bitrate)) - { - ELOG(m_srcLogString + "Backup source rejected. The bitrate " - "does not match the original stream source - detected " + - tos(bitrate) + " kbps instead of " + - tos(m_originalBitrate) + " kbps.", (char*)m_srcLogString.c_str(), originalRelayInfo.m_streamID); - m_state = &protocol_relay_shoutcast::state_CloseConnection; - return; - } - m_originalBitrate = bitrate; - - // check that these bitrates are allowed (looking at both max and average values) - int streamMaxBitrate = 0, streamMinBitrate = 0; - const int ret = gOptions.isBitrateDisallowed(originalRelayInfo.m_streamID, bitrate, - streamMaxBitrate, streamMinBitrate); - if (ret) - { - m_denied = true; - utf8 mode = ((streamMaxBitrate == streamMinBitrate) ? "of" : (ret == 2 ? "up to" : "from")); - ELOG(m_srcLogString + (!m_backup ? "Relay" : "Backup") + - " source rejected. Only bitrates " + mode + " " + - tos((ret == 1 ? streamMinBitrate : streamMaxBitrate) / 1000) + " kbps are allowed " - "- detected " + tos(bitrate) + " kbps.", LOGNAME, m_originalRelayInfo.m_streamID); - m_state = &protocol_relay_shoutcast::state_CloseConnection; - return; - } - - bool allowPublicRelay = gOptions.stream_allowPublicRelay(m_originalRelayInfo.m_streamID); - if (!gOptions.read_stream_allowPublicRelay(m_originalRelayInfo.m_streamID)) - { - allowPublicRelay = gOptions.allowPublicRelay(); - } - headers["icy-pub"] = (allowPublicRelay ? "1" : "0"); - - /// data might be encoded in url portion, so decode. - config::streamConfig stream; - const bool found = gOptions.getStreamConfig(stream, m_originalRelayInfo.m_streamID); - m_streamData = streamData::createStream(streamData::streamSetup(m_srcLogString, - m_originalRelayInfo.m_relayUrl.server(), - (found ? stream.m_authHash : ""), "", - m_originalRelayInfo.m_relayUrl.url(), - m_originalRelayInfo.m_backupUrl.url(), - streamData::SHOUTCAST1, - m_originalRelayInfo.m_streamID, - m_originalRelayInfo.m_relayUrl.port(), - m_originalRelayInfo.m_maxStreamUser, - m_originalRelayInfo.m_maxStreamBitrate, - m_originalRelayInfo.m_minStreamBitrate, - m_originalRelayInfo.m_allowPublicRelay, - m_backup, getStreamSamplerate(headers), - mapGet(headers, "icy-vbr", (bool)false), headers)); - if (!m_streamData) - { - throwEx(m_srcLogString + "Could not create " + - (!m_backup ? "relay" : "backup") + " connection."); - } - - // attempt to determine the version of the source based - // on the icy-notice2 line (assuming it is provided etc) - utf8 sourceIdent = mapGet(headers, "icy-notice2", utf8()); - m_streamData->updateSourceIdent(sourceIdent, true); - sourceIdent = mapGet(headers, "server", utf8()); - m_streamData->updateSourceIdent(sourceIdent, true); - - ILOG(m_srcLogString + "Connected to Shoutcast 1 source " + (!m_backup ? "relay" : "backup") + ".", LOGNAME, m_originalRelayInfo.m_streamID); - m_state = &protocol_relay_shoutcast::state_GetStreamData; -} - -void protocol_relay_shoutcast::cleanup() -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - if (m_streamData) - { - int killed = m_streamData->isKill(); - // if this was a kill i.e. when a source re-joins then we need to keep things intact - if (!killed) - { - streamData::streamSourceLost(m_srcLogString, m_streamData, m_originalRelayInfo.m_streamID); - m_streamData = 0; - bool remove_relay = false; - if (gOptions.stream_relayURL(m_originalRelayInfo.m_streamID).empty() && - gOptions.stream_backupURL(m_originalRelayInfo.m_streamID).empty()) - remove_relay = true; - if (remove_relay) - streamData::removeRelayStatus (m_originalRelayInfo.m_streamID); - } - else - { - m_streamData->setKill(false); - } - } - - socketOps::forgetTCPSocket(m_socket); - forgetArray(m_remainder); -} - -protocol_relay_shoutcast::~protocol_relay_shoutcast() throw() -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - ILOG(m_srcLogString + "Disconnected from Shoutcast 1 source " + - (!m_backup ? "relay" : "backup"), (char*)m_srcLogString.c_str(), m_originalRelayInfo.m_streamID); - cleanup(); -} - -void protocol_relay_shoutcast::timeSlice() throw(exception) -{ - const int killed = (m_streamData ? m_streamData->isKill() : 0); - - try - { - if (m_streamData && (m_streamData->isDead() || (!m_backup && killed == 1) || (m_backup && killed == 2))) - { - DLOG(m_srcLogString + "Detected termination of stream", LOGNAME, m_originalRelayInfo.m_streamID); - m_state = &protocol_relay_shoutcast::state_Fail; - } - return (this->*m_state)(); - } - catch (const exception &ex) - { - // on error, we should get ready to retry if applicable - utf8 str = ex.what(); - if (!str.empty()) - { - ELOG(ex.what(), LOGNAME, m_originalRelayInfo.m_streamID); - } - if (m_streamData) - m_streamData->setKill (0); - m_state = &protocol_relay_shoutcast::state_Fail; - m_result.run(); - } -} - -void protocol_relay_shoutcast::state_Fail() throw(std::exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - if (!m_backup) - { - cleanup(); - threadedRunner::scheduleRunnable(new protocol_relay(m_originalRelayInfo)); - } -#ifdef INCLUDE_BACKUP_STREAMS - else - { - threadedRunner::scheduleRunnable(new protocol_backup(m_originalRelayInfo, m_originalBitrate, m_originalMimeType)); - } -#endif - m_result.done(); -} - -void protocol_relay_shoutcast::state_GetMetadata() throw(exception) -{ - time_t cur_time; - const bool debug = gOptions.relayShoutcastDebug(); - const int autoDumpTime = detectAutoDumpTimeout (cur_time, m_originalRelayInfo.m_streamID, (m_srcLogString + "Timeout waiting for stream data")); - - while (m_metadataSizeByte != 0) - { - char buf[BUF_SIZE] = {0}; - // don't read beyond metadata interval - int amt = (m_metadataSizeByte < 0 ? 1 : m_metadataSizeByte); - amt = min(amt, (BUF_SIZE - 1)); - - int rval = 0; - if ((rval = recv (buf, amt, 0x0)) < 1) - { - if (rval == 0) - { - throwEx((debug ? (m_srcLogString + "Remote socket " - "closed while waiting for stream data.") : (utf8)"")); - } - else if (rval < 0) - { - rval = socketOps::errCode(); - if (rval != SOCKETOPS_WOULDBLOCK) - { - throwEx((debug ? (m_srcLogString + "Socket error " - "while waiting for stream data. " + - socketErrString(rval)) : (utf8)"")); - } - - m_result.schedule(); - m_result.read(); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - return; - } - } - bandWidth::updateAmount(bandWidth::RELAY_V1_RECV, rval); - m_lastActivityTime = ::time(NULL); - if (m_metadataSizeByte < 0) - { - m_metadataSizeByte = buf[0] * 16; - m_metadataBuffer.clear(); - } - else - { - m_metadataBuffer.insert(m_metadataBuffer.end(), buf, buf + rval); - m_metadataSizeByte -= rval; - } - } - - // parse and add - // this will pull StreamTitle='' and StreamUrl='' from the string - if (!m_metadataBuffer.empty()) - { - bool song = false, url = false, next = false; - utf8 songStr, urlStr, nextStr; - - // StreamTitle='' - utf8::size_type pos_start = m_metadataBuffer.find(utf8("itle='")); - if (pos_start != utf8::npos) - { - pos_start += 6; - utf8::size_type pos_end = m_metadataBuffer.find(utf8("';")); - if (pos_end != utf8::npos) - { - songStr = m_metadataBuffer.substr(pos_start,pos_end - pos_start); - if (!songStr.empty() && !songStr.isValid()) - { - // use this as a way to try to ensure we've got a utf-8 - // encoded title to improve legacy source title support - songStr = asciiToUtf8(songStr.toANSI(true)); - } - - // advance the buffer as StreamUrl=''; has to follow StreamTitle='' - m_metadataBuffer = m_metadataBuffer.substr(pos_end + 2); - song = true; - } - else - { - ELOG(m_srcLogString + "Bad metadata string [" + m_metadataBuffer + "]", LOGNAME, m_originalRelayInfo.m_streamID); - } - } - - // StreamUrl='' - pos_start = m_metadataBuffer.find(utf8("mUrl='")); - if (pos_start != utf8::npos) - { - pos_start += 6; - utf8::size_type pos_end = m_metadataBuffer.find(utf8("';")); - if (pos_end != utf8::npos) - { - urlStr = m_metadataBuffer.substr(pos_start,pos_end - pos_start); - url = true; - } - else - { - ELOG(m_srcLogString + "Bad metadata string [" + m_metadataBuffer + "]", LOGNAME, m_originalRelayInfo.m_streamID); - } - } - - // StreamNext='' - pos_start = m_metadataBuffer.find(utf8("mNext='")); - if (pos_start != utf8::npos) - { - pos_start += 7; - utf8::size_type pos_end = m_metadataBuffer.find(utf8("';")); - if (pos_end != utf8::npos) - { - nextStr = m_metadataBuffer.substr(pos_start,pos_end - pos_start); - next = true; - } - else - { - ELOG(m_srcLogString + "Bad metadata string [" + m_metadataBuffer + "]", LOGNAME, m_originalRelayInfo.m_streamID); - } - } - - if (!song && !url && !next) - { - ELOG(m_srcLogString + "Bad metadata string [" + m_metadataBuffer + "]", LOGNAME, m_originalRelayInfo.m_streamID); - } - else - { - if (m_streamData->addSc1MetadataAtCurrentPosition(m_srcLogString, songStr, urlStr, nextStr) & 1) - { - ILOG(m_srcLogString + "Title update [" + songStr + "]", LOGNAME, m_originalRelayInfo.m_streamID); - } - } - } - - // it's streaming time - m_metadataSizeByte = -1; - m_metadataBuffer.clear(); - m_bytesSinceMetadata = 0; - m_state = &protocol_relay_shoutcast::state_GetStreamData; - - m_result.run(); -} - -void protocol_relay_shoutcast::state_GetStreamData() throw(exception) -{ - time_t cur_time; - - - try - { - const int autoDumpTime = detectAutoDumpTimeout (cur_time, m_originalRelayInfo.m_streamID, (m_srcLogString + "Timeout waiting for stream data")); - - int bitrate = m_streamData->streamBitrate(); - const int type = m_streamData->streamUvoxDataType(); - while ((!m_metadataInterval) || (m_bytesSinceMetadata < m_metadataInterval)) - { - char buf[BUF_SIZE * 4] = {0}; - // don't read beyond metadata interval otherwise we'll have audio glitching issues :o( - int amt = ((m_metadataInterval > 0) ? m_metadataInterval - m_bytesSinceMetadata : BUF_SIZE); - amt = min(amt, (BUF_SIZE - 1)); - - // if we had anything left over then now we - // need to copy it back into the buffer and - // adjust the max data amount to be read in - if ((m_remainderSize > 0) && ((amt + m_remainderSize) <= (BUF_SIZE * 4))) - { - memcpy(buf, m_remainder, m_remainderSize); - } - else - { - m_remainderSize = 0; - } - - // adjust the position in the buffer based on the prior - // state of the remaining data as part of frame syncing - int rval = 0; - if ((rval = recv (&buf[m_remainderSize], amt, 0x0)) < 1) - { - if (rval < 0) - { - rval = socketOps::errCode(); - if (rval == SOCKETOPS_WOULDBLOCK) - { - m_result.schedule (70); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - return; - } - WLOG (m_srcLogString + "Socket error while waiting for data. " + socketErrString(rval), LOGNAME, m_originalRelayInfo.m_streamID); - } - else - ILOG (m_srcLogString + "Remote socket closed while waiting for data.", LOGNAME, m_originalRelayInfo.m_streamID); - throwEx (""); - } - - // update these details before we mess with anything - // else as we have read things and it's needed to - // ensure that we don't break the metadata detection - bandWidth::updateAmount(bandWidth::RELAY_V1_RECV, rval); - m_bytesSinceMetadata += rval; - - // if we're here then we account for what we already had in the total - // so that we then don't skip the new data read with the original data - rval += m_remainderSize; - m_remainderSize = 0; - amt = rval; - - if (m_streamData->syncToStream(m_remainderSize, m_remainder, amt, bitrate, - type, buf, m_srcLogString)) - { - m_denied = true; - ELOG (m_srcLogString + (!m_backup ? "Relay" : "Backup") + - " source rejected. Unable to sync to the stream. Please " - "check the source is valid and in a supported format.", LOGNAME, m_originalRelayInfo.m_streamID); - throwEx (""); - } - - m_lastActivityTime = ::time(NULL); - } - - if (m_metadataInterval > 0) - { - // it's metadata time! - m_metadataSizeByte = -1; - m_metadataBuffer.clear(); - m_state = &protocol_relay_shoutcast::state_GetMetadata; - } - - m_result.run(); - } - catch (exception &e) - { - // if there was a failure, now see if we have a backup and attempt to run - // before we remove the current handling of the dropped source connection - vector backupInfo = gOptions.getBackupUrl(m_originalRelayInfo.m_streamID); - if (!m_backup && !backupInfo.empty() && !m_denied) - { - m_denied = true; - if (m_streamData) - { - m_streamData->clearCachedMetadata(); - streamData::streamSourceLost(m_srcLogString, m_streamData, m_originalRelayInfo.m_streamID); - m_streamData = 0; - } - } - throw; - } -} - -void protocol_relay_shoutcast::state_CloseConnection() throw(std::exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - m_result.done(); -} diff --git a/Src/Plugins/DSP/sc_serv3/protocol_relay_shoutcast.h b/Src/Plugins/DSP/sc_serv3/protocol_relay_shoutcast.h deleted file mode 100644 index 07872249..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_relay_shoutcast.h +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once -#ifndef protocol_relay_shoutcast_H_ -#define protocol_relay_shoutcast_H_ - -#include "threadedRunner.h" - -class streamData; - -class protocol_relay_shoutcast: public runnable -{ - int m_originalBitrate; // original bitrate for checking - uniString::utf8 m_originalMimeType; // original mimetype for checking - const config::streamConfig m_originalRelayInfo; - - short unsigned int m_metadataInterval; // interval on source - const bool m_backup; // used to change log output depending on relay or backup usage - bool m_denied; // used to prevent source disconnected messages e.g. for failed passwords - - short unsigned int m_remainderSize; - __uint8 *m_remainder; - - const uniString::utf8 m_srcAddrName; - const uniString::utf8 m_srcAddrNumeric; - const uniString::utf8 m_srcURLpart; - - uniString::utf8 m_metadataBuffer; - - streamData *m_streamData; - const uniString::utf8 m_srcLogString; - - typedef void (protocol_relay_shoutcast::*state_t)(); - state_t m_state; - - int m_bytesSinceMetadata; - int m_metadataSizeByte; // metadata length indicator - - void state_GetStreamData() throw(std::exception); - void state_GetMetadata() throw(std::exception); - void state_Fail() throw(std::exception); - void state_CloseConnection() throw(std::exception); - - void cleanup(); - -protected: - virtual void timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "protocol_relay_shoutcast"; } - -public: - protocol_relay_shoutcast(const socketOps::tSOCKET s, const config::streamConfig &originalRelayInfo, - const uniString::utf8 &srcAddrName, const uniString::utf8 &srcAddrNumeric, - const int srcPort, const uniString::utf8 &srcURLpart, - httpHeaderMap_t &httpHeaders, const int originalbitrate = 0, - const uniString::utf8& originalMimeType = "", const bool backup = false); - ~protocol_relay_shoutcast() throw(); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_relay_uvox.cpp b/Src/Plugins/DSP/sc_serv3/protocol_relay_uvox.cpp deleted file mode 100644 index 94dcfcd1..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_relay_uvox.cpp +++ /dev/null @@ -1,693 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include "protocol_relay_uvox.h" -#include "protocol_backup.h" -#include "protocol_relay.h" -#include "streamData.h" -#include "bandwidth.h" -#include "MP3Header.h" -#include "ADTSHeader.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define DEBUG_LOG(...) do { if (gOptions.relayUvoxDebug()) DLOG(__VA_ARGS__); } while (0) -#define LOGNAME "RELAY" - -protocol_relay_uvox::protocol_relay_uvox(const socketOps::tSOCKET s, const config::streamConfig &originalRelayInfo, - const uniString::utf8 &srcAddrName, const uniString::utf8 &srcAddrNumeric, - const int srcPort, const uniString::utf8 &srcURLpart, - const httpHeaderMap_t &httpHeaders, const int originalBitrate, - const uniString::utf8& originalMimeType, const bool backup) throw(runtime_error) - : runnable(s), m_backup(backup), m_denied(false), m_remainderSize(0), - m_remainder(new __uint8[BUF_SIZE * 4]), m_srcAddrName(srcAddrName), - m_srcAddrNumeric(srcAddrNumeric), m_srcURLpart(srcURLpart), - m_srcLogString((!backup ? "[RELAY " : "[BACKUP ") + m_srcAddrName + - ":" + tos(srcPort) + m_srcURLpart + " sid=" + - tos(originalRelayInfo.m_streamID) + "] "), - m_outData(new __uint8[MAX_MESSAGE_SIZE]), m_outBuffer(0), m_outBufferSize(0), - m_originalRelayInfo(originalRelayInfo), m_streamData(0), m_nextState(0) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - // we need to look in the response headers and figure out what's going on - - // mime type. For uvox2 there is none, for shoutcast 2 it must be there - // changed in build 22 to match new specs as there's no part in brackets now - // i.e. should just be 'misc/ultravox if it's a SC2 stream being relayed - - // fixed in build 23 so we set the mime type to the source's details - // which means older clients can connect and keeps relaying to specs - switch (strtol((const char*)mapGet(httpHeaders, "ultravox-class-type", utf8()).c_str(), 0, 16)) - { - case MP3_DATA: - { - m_configData.m_mimeType = "audio/mpeg"; - break; - } - case AAC_LC_DATA: - case AACP_DATA: - { - m_configData.m_mimeType = "audio/aacp"; - break; - } - case OGG_DATA: - { - m_configData.m_mimeType = "audio/ogg"; - break; - } - default: - { - m_configData.m_mimeType = mapGet(httpHeaders, "content-type", utf8("audio/mpeg")); - break; - } - } - - if (m_configData.m_mimeType.empty()) - { - throwEx(m_srcLogString + "No mime-type specified."); - } - - utf8 cdn_authhash; - if (mapGet(httpHeaders, "cdn-master", false)) - { - DEBUG_LOG(m_srcLogString + "CDN master response received by slave", LOGNAME, m_originalRelayInfo.m_streamID); - utf8 authhash = mapGet(httpHeaders, "cdn-token", utf8()); - authhash = XTEA_decipher(authhash.c_str(), authhash.size(), bob().c_str(), bob().size()); - if (yp2::isValidAuthhash(authhash)) - { - cdn_authhash = authhash; - } - else - { - DEBUG_LOG(m_srcLogString + "CDN master response rejected - invalid master authash provided", LOGNAME, m_originalRelayInfo.m_streamID); - } - } - - // for a backup we need to check that the mimetype matches the original source - // as otherwise there will be issues with the transition between the sources! - if (m_backup && !originalMimeType.empty() && (originalMimeType != m_configData.m_mimeType)) - { - ELOG(m_srcLogString + "Backup source rejected. The content type does not match the original stream " - "source - detected `" + m_configData.m_mimeType + "' instead of `" + originalMimeType + "'.", LOGNAME, m_originalRelayInfo.m_streamID); - loadAndSendMsg("NAK:Unsupported mime type", MSG_BROADCAST_SETUP, &protocol_relay_uvox::state_CloseConnection); - return; - } - - utf8 p = mapGet(httpHeaders,"ultravox-max-msg",utf8()); - if (p.empty()) - { - throwEx(m_srcLogString + "Missing Ultravox-Max-Msg header"); - } - - int max_msg = p.toInt(); - if ((max_msg < 256) || (max_msg > MAX_PAYLOAD_SIZE)) - { - throwEx(m_srcLogString + "Bad Ultravox-Max-Msg value " + tos(max_msg)); - } - - p = mapGet(httpHeaders, "ultravox-samplerate", utf8("0")); - int samplerate = p.toInt(); - if (samplerate < 0) - { - throwEx(m_srcLogString + "Bad samplerate specified (" + tos(samplerate) + ")"); - } - - // this is basically a hint that should only appear - // if relaying a MP3 VBR stream from a 2.5+ DNAS... - p = mapGet(httpHeaders, "ultravox-vbr", utf8("0")); - const bool vbr = !!p.toInt(); - - m_configData.m_avgBitrate = 0; - m_configData.m_maxBitrate = 0; - p = mapGet(httpHeaders, "ultravox-avg-bitrate", utf8("0")); - m_configData.m_avgBitrate = p.toInt(); - p = mapGet(httpHeaders, "ultravox-max-bitrate", utf8("0")); - m_configData.m_maxBitrate = p.toInt(); - p = mapGet(httpHeaders, "ultravox-bitrate", utf8("0")); - - int x = p.toInt(); - if (x > 0) - { - m_configData.m_maxBitrate = m_configData.m_avgBitrate = x; - } - - if (m_configData.m_avgBitrate <= 0) - { - throwEx(m_srcLogString + "Bad avg bitrate specified (" + - tos(m_configData.m_avgBitrate) + ")"); - } - - if (m_configData.m_maxBitrate <= 0) - { - throwEx(m_srcLogString + "Bad max bitrate specified (" + - tos(m_configData.m_maxBitrate) + ")"); - } - - // for a backup we need to check that the bitrate matches the original source - // as otherwise there will be issues with the transition between the sources! - int bitrate = max(m_configData.m_avgBitrate, m_configData.m_maxBitrate); - if (m_backup && (originalBitrate > 0) && (originalBitrate != bitrate)) - { - ELOG(m_srcLogString + "Backup source rejected. The bitrate " - "does not match the original stream source - detected " + - tos(bitrate / 1000) + " kbps instead of " + - tos(originalBitrate / 1000) + " kbps."); - loadAndSendMsg("NAK:Bit Rate Error", MSG_BROADCAST_SETUP, &protocol_relay_uvox::state_CloseConnection); - return; - } - - // check that these bitrates are allowed (looking at both max and average values) - int streamMaxBitrate = 0, streamMinBitrate = 0; - const int ret = gOptions.isBitrateDisallowed(originalRelayInfo.m_streamID, bitrate, - streamMaxBitrate, streamMinBitrate); - if (ret) - { - m_denied = true; - utf8 mode = ((streamMaxBitrate == streamMinBitrate) ? "of" : (ret == 2 ? "up to" : "from")); - ELOG(m_srcLogString + (!m_backup ? "Relay" : "Backup") + - " source rejected. Only bitrates " + mode + " " + - tos((ret == 1 ? streamMinBitrate : streamMaxBitrate) / 1000) + " kbps are allowed " - "- detected " + tos(bitrate / 1000) + " kbps."); - loadAndSendMsg("NAK:Bit Rate Error", MSG_BROADCAST_SETUP, &protocol_relay_uvox::state_CloseConnection); - return; - } - - - m_configData.m_minimumBufferSize = m_configData.m_desiredBufferSize = 0; - - m_configData.m_icyName = mapGet(httpHeaders,"ultravox-title", (utf8)""); - m_configData.m_icyGenre = mapGet(httpHeaders,"ultravox-genre", utf8("Misc")); - m_configData.m_icyURL = mapGet(httpHeaders,"ultravox-url", (utf8)""); - m_configData.m_icyPub = m_originalRelayInfo.m_allowPublicRelay; - - config::streamConfig stream; - const bool found = gOptions.getStreamConfig(stream, m_originalRelayInfo.m_streamID); - - m_streamData = streamData::createStream(streamData::streamSetup(m_srcLogString, - m_originalRelayInfo.m_relayUrl.server(), - (!cdn_authhash.empty() ? cdn_authhash : - (found ? stream.m_authHash : "")), "", - m_originalRelayInfo.m_relayUrl.url(), - m_originalRelayInfo.m_backupUrl.url(), - streamData::SHOUTCAST2, - m_originalRelayInfo.m_streamID, - m_originalRelayInfo.m_relayUrl.port(), - m_originalRelayInfo.m_maxStreamUser, - m_originalRelayInfo.m_maxStreamBitrate, - m_originalRelayInfo.m_minStreamBitrate, - m_originalRelayInfo.m_allowPublicRelay, - m_backup, samplerate, vbr, m_configData)); - if (!m_streamData) - { - throwEx(m_srcLogString + "Could not create " + (!m_backup ? - "relay" : "backup") + " connection."); - } - - // attempt to determine the version of the source based - // on the icy-notice2 line (assuming it is provided etc) - utf8 sourceIdent = mapGet(httpHeaders, "icy-notice2", utf8()); - m_streamData->updateSourceIdent(sourceIdent, true); - sourceIdent = mapGet(httpHeaders, "server", utf8()); - m_streamData->updateSourceIdent(sourceIdent, true); - - DEBUG_LOG(m_srcLogString + "Stream configuration [" + eol() + m_configData.toLogString() + eol() + "]"); - ILOG(m_srcLogString + "Connected to Shoutcast 2 source " + (!m_backup ? "relay" : "backup") + "."); - m_state = &protocol_relay_uvox::state_GetStreamData; -} - -void protocol_relay_uvox::cleanup() -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - if (m_streamData) - { - int killed = m_streamData->isKill(); - if (!m_denied) - { - ILOG(m_srcLogString + "Disconnected from Shoutcast 2 source " + - (!m_backup ? "relay" : "backup") + - (!killed ? "." : " - original source connected.")); - } - - // if this was a kill i.e. when a source re-joins then we need to keep things intact - if (!killed) - { - streamData::streamSourceLost(m_srcLogString, m_streamData, m_originalRelayInfo.m_streamID); - m_streamData = 0; - bool remove_relay = false; - if (gOptions.stream_relayURL(m_originalRelayInfo.m_streamID).empty() && - gOptions.stream_backupURL(m_originalRelayInfo.m_streamID).empty()) - remove_relay = true; - if (remove_relay) - streamData::removeRelayStatus (m_originalRelayInfo.m_streamID); - } - else - { - m_streamData->setKill(false); - } - } - - socketOps::forgetTCPSocket(m_socket); - forgetArray(m_outData); - forgetArray(m_remainder); -} - -protocol_relay_uvox::~protocol_relay_uvox() throw() -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - cleanup(); -} - -void protocol_relay_uvox::timeSlice() throw(exception) -{ - const int killed = (m_streamData ? m_streamData->isKill() : 0); - try - { - if (m_streamData && (m_streamData->isDead() || (!m_backup && killed == 1) || (m_backup && killed == 2))) - { - DLOG(m_srcLogString + "Detected termination of stream", LOGNAME, m_originalRelayInfo.m_streamID); - m_state = &protocol_relay_uvox::state_Fail; - } - (this->*m_state)(); - } - catch (const exception &ex) - { - // on error, we should get ready to retry if applicable - utf8 str = ex.what(); - if (!str.empty()) - { - ELOG(ex.what()); - } - if (m_streamData) - m_streamData->setKill (0); - m_state = &protocol_relay_uvox::state_Fail; - m_result.run(); - } -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////// Similar to protocol_uvox2Source from here on in /////////////////////////// - -template -void protocol_relay_uvox::loadAndSendMsg(const T &msg, int type, state_t nextState) throw() -{ - formMessage(msg, type, m_outData, m_outBufferSize); - bandWidth::updateAmount(bandWidth::RELAY_V2_SENT, m_outBufferSize); - m_outBuffer = m_outData; - m_state = &protocol_relay_uvox::state_SendBuffer; - m_nextState = nextState; -} - -// load outbound message into buffer, and establish state to transition to after send -#define SEND_AND_TRANSITION(msg, vtype, state)\ - loadAndSendMsg(msg, vtype, state);\ - m_result.write();\ - m_result.run();\ - return; - -// get next packet, without acknowledgement -#define NEXT_PACKET\ - m_inBuffer.clear();\ - m_nextState = m_state;\ - m_state = &protocol_relay_uvox::state_GetPacket;\ - m_result.read();\ - m_result.schedule();\ - m_result.timeoutSID(m_originalRelayInfo.m_streamID);\ - return; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -void protocol_relay_uvox::state_GetPacket() throw(exception) -{ - time_t cur_time; - - try - { - const int autoDumpTime = detectAutoDumpTimeout (cur_time, m_originalRelayInfo.m_streamID, (m_srcLogString + "Timeout waiting for data")); - - while (true) - { - // calculate optimal read size - char buf[BUF_SIZE] = {0}; - int amt = MAX_MESSAGE_SIZE; - int len = (int)m_inBuffer.size(); - - if (!len) - { - amt = UV2X_HDR_SIZE; - } - else if (len >= UV2X_HDR_SIZE) - { - amt = min(MAX_MESSAGE_SIZE, (int)((ntohs(reinterpret_cast(&(m_inBuffer[0]))->msgLen) + UV2X_OVERHEAD) - len)); - } - else - { - amt = min(MAX_MESSAGE_SIZE, (UV2X_OVERHEAD - len)); - } - - int rval = 0; - if ((rval = recv (buf, amt, 0x0)) < 1) - { - if (rval < 0) - { - rval = socketOps::errCode(); - if (rval == SOCKETOPS_WOULDBLOCK) - { - m_result.schedule (70); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - return; - } - WLOG (m_srcLogString + "Socket error while waiting for data. " + socketErrString(rval), LOGNAME, m_originalRelayInfo.m_streamID); - } - else - ILOG (m_srcLogString + "Remote socket closed while waiting for data.", LOGNAME, m_originalRelayInfo.m_streamID); - throwEx (""); - } - - m_lastActivityTime = ::time(NULL); - m_inBuffer.insert(m_inBuffer.end(), buf, buf + rval); - - len = (int)m_inBuffer.size(); - if ((len > 1) && (len <= UV2X_HDR_SIZE)) - { - // check for sync byte as we cannot be - // certain of good data coming in from - // the connection and so we check it - int found = -1; - for (int i = 0; i < len - 1; i++) - { - // check for sync byte - if ((buf[i] == UVOX2_SYNC_BYTE) && (buf[i + 1] == 0)) - { - found = i; - break; - } - } - - // track what we've received for the bandwidth stats - bandWidth::updateAmount(bandWidth::RELAY_V2_RECV, len); - - if (found != -1) - { - // we need to re-sync and so need to - // clear the buffer and replace it - // according to the re-sync position - if (found > 0) - { - DEBUG_LOG(m_srcLogString + "Shoutcast 2 source relay re-synced to stream [pos: " + tos(found) + "]."); - - m_inBuffer.clear(); - - // we insert in to the start of the buffer - // what appears to be 'good' sync'd data. - m_inBuffer.insert(m_inBuffer.end(), &buf[found], &buf[found] + rval - found); - } - } - else - { - // and then we clear out the buffer which - // is ok to do since we're trying to find - // the frame (as first or next in stream) - m_inBuffer.clear(); - } - - continue; - } - else if (len > MAX_MESSAGE_SIZE) - { - bandWidth::updateAmount(bandWidth::RELAY_V2_RECV, len); - throwEx(m_srcLogString + "UVOX packet is too large" - " [got: " + tos(len) + " bytes, max: " + - tos(MAX_MESSAGE_SIZE) + " bytes]"); - } - else if (len > UV2X_HDR_SIZE) - { - if ((int)(ntohs(reinterpret_cast(&(m_inBuffer[0]))->msgLen) + UV2X_OVERHEAD) == len) - { - // got it - bandWidth::updateAmount(bandWidth::RELAY_V2_RECV, len); - - m_result.run(); - m_state = m_nextState; - return; - } - } - } - } - catch (exception &e) - { - // if there was a failure, now see if we have a backup and attempt to run - // before we remove the current handling of the dropped source connection - vector backupInfo = gOptions.getBackupUrl(m_originalRelayInfo.m_streamID); - if (!m_backup && !backupInfo.empty() && !m_denied) - { - m_denied = true; - if (m_streamData) - { - m_streamData->clearCachedMetadata(); - streamData::streamSourceLost(m_srcLogString, m_streamData, m_originalRelayInfo.m_streamID); - m_streamData = 0; - } - } - throw; - } -} - -void protocol_relay_uvox::state_SendBuffer() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - if (sendDataBuffer(m_originalRelayInfo.m_streamID, m_outBuffer, m_outBufferSize, m_srcLogString)) - { - m_state = m_nextState; - } -} - -// normal streaming state -void protocol_relay_uvox::state_GetStreamData() throw(std::exception) -{ - if (!m_inBuffer.empty()) - { - const uv2xHdr *voxHdr = (const uv2xHdr*)(&(m_inBuffer[0])); - const __uint16 voxMsgType = ntohs(voxHdr->msgType); - - if ((voxMsgType >= 0x7000) && (voxMsgType < 0x9000)) - { - // if we have old uvox, then we don't know our mime-type (since old uvox 2 doesn't - // specify it, though 2.1 does). In the case that mime_type is empty, inspect the packet type and - // set it in the stream - if (m_configData.m_mimeType.empty()) - { - switch (voxMsgType) - { - case MP3_DATA: - { - m_configData.m_mimeType = "audio/mpeg"; - break; - } - case AAC_LC_DATA: - case AACP_DATA: - { - m_configData.m_mimeType = "audio/aacp"; - break; - } - case OGG_DATA: - { - m_configData.m_mimeType = "audio/ogg"; - break; - } - } - - if (!m_configData.m_mimeType.empty()) - { - m_streamData->streamSetMimeType(m_configData.m_mimeType); - } - } - - char buf[BUF_SIZE * 4] = {0}; - __uint16 amt = ntohs(voxHdr->msgLen); - - // if we had anything left over then now we - // need to copy it back into the buffer and - // adjust the max data amount to be read in - if ((m_remainderSize > 0) && ((amt + m_remainderSize) <= (BUF_SIZE * 4))) - { - memcpy(buf, m_remainder, m_remainderSize); - } - else - { - m_remainderSize = 0; - } - - memcpy(&buf[m_remainderSize], (const __uint8 *)((&(m_inBuffer[UV2X_HDR_SIZE]))), amt); - amt += m_remainderSize; - m_remainderSize = 0; - - int br = m_streamData->streamBitrate(); - if (m_streamData->syncToStream (m_remainderSize, m_remainder, amt, br, voxMsgType, buf, m_srcLogString)) - { - m_denied = true; - throwEx(m_srcLogString + (!m_backup ? "Relay" : "Backup") + - " source rejected. Unable to sync to the stream. Please " - "check the source is valid and in a supported format."); - } - } - else if ((voxMsgType >= 0x3000) && (voxMsgType < 0x5000)) - { - DEBUG_LOG(m_srcLogString + "Cacheable metadata received type=0x" + tohex(voxMsgType), LOGNAME, m_originalRelayInfo.m_streamID); - const __uint16 voxPayloadSize = ntohs(voxHdr->msgLen); - if (voxPayloadSize >= UV2X_META_HDR_SIZE) // make sure there's enough data - { - const __uint8 *contents = (const __uint8 *)((&(m_inBuffer[UV2X_HDR_SIZE]))); - const uv2xMetadataHdr *metaHdr = reinterpret_cast(contents); - const __uint16 metadataID = ntohs(metaHdr->id); - const __uint16 metadataSpan = ntohs(metaHdr->span); - const __uint16 metadataIndex = ntohs(metaHdr->index) - 1; - const __uint8* metadataContents = contents + UV2X_META_HDR_SIZE; - const size_t metadataContentsSize = voxPayloadSize - UV2X_META_HDR_SIZE; - - if ((metadataSpan <= MAX_METADATA_FRAGMENTS) && - (metadataSpan > 0) && - (metadataIndex < MAX_METADATA_FRAGMENTS) && - (metadataIndex < metadataSpan)) - { - assemblyTableIndex_t ati = makeAssemblyTableIndex(voxMsgType, metadataID); - metadataEntry_t &me = m_metadataAssemblyTable[ati]; - - if (metadataSpan != me.m_expectedFragments) // span changed, clear the entire thing - { - __uint16 expectedFragments = me.m_expectedFragments; - me.clear(); - DEBUG_LOG(m_srcLogString + "Cacheable metadata reset due to span change [" + tos(metadataSpan) + "," + tos(expectedFragments) + "]", LOGNAME, m_originalRelayInfo.m_streamID); - } - - me.m_expectedFragments = metadataSpan; - if (me.m_fragments[metadataIndex].m_isValid) // duplicate fragment, clear the entire thing - { - me.clear(); - DEBUG_LOG(m_srcLogString + "Cacheable metadata reset due to duplicate fragment", LOGNAME, m_originalRelayInfo.m_streamID); - } - - me.m_fragments[metadataIndex].m_isValid = true; - me.m_fragments[metadataIndex].m_fragment.insert(me.m_fragments[metadataIndex].m_fragment.end(), - metadataContents, metadataContents + metadataContentsSize); - - if ((++me.m_receivedFragments) == me.m_expectedFragments) - { - // assembly, send and clear - vector<__uint8> assembledData; - for (__uint16 x = 0; x < me.m_expectedFragments; ++x) - { - assembledData.insert(assembledData.end(), me.m_fragments[x].m_fragment.begin(), me.m_fragments[x].m_fragment.end()); - } - - // send - m_streamData->addUvoxMetadataAtCurrentPosition(voxMsgType,assembledData); - - if (gOptions.relayUvoxDebug()) - { - if ((voxMsgType >= 0x3000) && (voxMsgType < 0x4000)) - { - ILOG(m_srcLogString + "Got complete metadata message type=0x" + tohex(voxMsgType) + - " [" + tos(assembledData.size()) + " bytes]" + - " id=" + tos(metadataID) + - " span=" + tos(metadataSpan) + - " content=" + eol() + utf8(&(assembledData[0]), assembledData.size()), LOGNAME, m_originalRelayInfo.m_streamID); - } - else - { - ILOG(m_srcLogString + "Got complete metadata message type=0x" + tohex(voxMsgType) + - " [" + tos(assembledData.size()) + " bytes]" + - " id=" + tos(metadataID) + - " span=" + tos(metadataSpan), LOGNAME, m_originalRelayInfo.m_streamID); - } - } - else - { - if ((voxMsgType >= 0x3000) && (voxMsgType < 0x4000)) - { - utf8 currentSong, comingSoon; - std::vector nextSongs; - m_streamData->getStreamNextSongs(m_originalRelayInfo.m_streamID, currentSong, comingSoon, nextSongs); - - if (!currentSong.empty()) - { - if (!comingSoon.empty()) - { - ILOG(m_srcLogString + "Title update [now: \"" + currentSong + "\", next: \"" + comingSoon + "\"]", LOGNAME, m_originalRelayInfo.m_streamID); - } - else - { - ILOG(m_srcLogString + "Title update [" + currentSong + "]", LOGNAME, m_originalRelayInfo.m_streamID); - } - m_streamData->resetAdvertTriggers(currentSong); - } - } - } - - // clear - m_metadataAssemblyTable.erase(ati); - } - } - else - { - ELOG(m_srcLogString + "Badly formed metadata packet type=0x" + tohex(voxMsgType) + " id=" + - tos(metadataID) + " span=" + tos(metadataSpan) + " index=" + tos(metadataIndex + 1), LOGNAME, m_originalRelayInfo.m_streamID); - } - } - else - { - ELOG(m_srcLogString + "Badly formed metadata packet type=0x" + tohex(voxMsgType) + - " content of packet is too small payloadsize=" + tos(voxPayloadSize), LOGNAME, m_originalRelayInfo.m_streamID); - } - } - else if ((voxMsgType >= 0x5000) && (voxMsgType < 0x7000)) - { - // pass thru metadata - DEBUG_LOG(m_srcLogString + "Pass thru metadata"); - m_streamData->writeSc21(m_inBuffer); // like data, but don't write to sc1 buffers - } - else - { - ELOG(m_srcLogString + "Unknown or out of sequence packet " + tos(voxMsgType), LOGNAME, m_originalRelayInfo.m_streamID); - if ((voxMsgType < 0x2000) && (voxMsgType != MSG_FILE_TRANSFER_DATA)) - { - // probably have to NAK it - SEND_AND_TRANSITION("NAK:Unsupported packet type", voxMsgType, &protocol_relay_uvox::state_GetStreamData); - } - } - } - - NEXT_PACKET; -} - -void protocol_relay_uvox::state_Fail() throw(std::exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - if (!m_backup) - { - cleanup(); - threadedRunner::scheduleRunnable(new protocol_relay(m_originalRelayInfo, true)); - } -#ifdef INCLUDE_BACKUP_STREAMS - else - { - threadedRunner::scheduleRunnable(new protocol_backup(m_originalRelayInfo, max(m_configData.m_avgBitrate/1000, - m_configData.m_maxBitrate/1000), m_configData.m_mimeType)); - } -#endif - m_result.done(); -} - -void protocol_relay_uvox::state_CloseConnection() throw(std::exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__, LOGNAME, m_originalRelayInfo.m_streamID); - - m_result.done(); -} diff --git a/Src/Plugins/DSP/sc_serv3/protocol_relay_uvox.h b/Src/Plugins/DSP/sc_serv3/protocol_relay_uvox.h deleted file mode 100644 index 50350e0e..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_relay_uvox.h +++ /dev/null @@ -1,108 +0,0 @@ -#pragma once -#ifndef protocol_relay_uvox_H_ -#define protocol_relay_uvox_H_ - -#include "threadedRunner.h" -#include "streamData.h" -#include "uvox2Common.h" - -class protocol_relay_uvox: public runnable -{ -private: - const bool m_backup; // used to change log output depending on relay or backup usage - bool m_denied; // used to prevent source disconnected messages e.g. for failed passwords - - short unsigned int m_remainderSize; - __uint8 * m_remainder; - - const uniString::utf8 m_srcAddrName; - const uniString::utf8 m_srcAddrNumeric; - const uniString::utf8 m_srcURLpart; - const uniString::utf8 m_srcLogString; - - ///////////// for outgoing data ////////////////////////////// - __uint8 * m_outData; - const __uint8 * m_outBuffer; // for outgoing data lines - int m_outBufferSize; - - const config::streamConfig m_originalRelayInfo; - - ///////////// incoming data //////////////////////////////////// - std::vector<__uint8> m_inBuffer; - //////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////////////// - //// data structures for assembling cached metadata - typedef std::vector<__uint8> metadataFragment_t; - struct metadataFragmentEntry_t - { - metadataFragment_t m_fragment; - bool m_isValid; - - void clear() throw() {m_isValid = false; m_fragment.clear(); } - metadataFragmentEntry_t() throw():m_isValid(false){} - }; - - typedef metadataFragmentEntry_t metadataFragmentCollection_t[MAX_METADATA_FRAGMENTS]; - #pragma pack(push, 1) - struct metadataEntry_t - { - __uint16 m_expectedFragments; - __uint16 m_receivedFragments; - metadataFragmentCollection_t m_fragments; - - void clear() throw() - { - for (int x = 0; x < MAX_METADATA_FRAGMENTS; ++x) - { - m_fragments[x].clear(); - } - m_receivedFragments = 0; - } - metadataEntry_t() throw() : m_expectedFragments(0), m_receivedFragments(0) { } - }; - #pragma pack(pop) - - typedef __uint32 assemblyTableIndex_t; - static assemblyTableIndex_t makeAssemblyTableIndex(__uint16 voxMsgType,__uint16 metadataID) throw() - { - return ((((assemblyTableIndex_t)voxMsgType) << 16) | metadataID); - } - - typedef std::map metadataAssemblyTable_t; - metadataAssemblyTable_t m_metadataAssemblyTable; - ///////////////////////////////////////////////////// - - streamData *m_streamData; - - typedef void (protocol_relay_uvox::*state_t)(); - - void state_GetPacket() throw(std::exception); - void state_SendBuffer() throw(std::exception); - void state_GetStreamData() throw(std::exception); - void state_Fail() throw(std::exception); - void state_CloseConnection() throw(std::exception); - - state_t m_state; - state_t m_nextState; - - streamData::uvoxConfigData_t m_configData; - - void cleanup(); - - template void loadAndSendMsg(const T &msg, int type,state_t nextState) throw(); - -protected: - virtual void timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "protocol_relay_uvox"; } - -public: - protocol_relay_uvox(const socketOps::tSOCKET s, const config::streamConfig &originalRelayInfo, - const uniString::utf8 &srcAddrName, const uniString::utf8 &srcAddrNumeric, - const int srcPort, const uniString::utf8 &srcURLpart, - const httpHeaderMap_t &httpHeaders, const int originalBitrate = 0, - const uniString::utf8& originalMimeType = "", const bool backup = false) throw(std::runtime_error); - ~protocol_relay_uvox() throw(); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_shoutcast1Client.cpp b/Src/Plugins/DSP/sc_serv3/protocol_shoutcast1Client.cpp deleted file mode 100644 index c8621176..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_shoutcast1Client.cpp +++ /dev/null @@ -1,417 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include -#include "protocol_shoutcast1Client.h" -#include "ripList.h" -#include "stats.h" -#include "streamData.h" -#include "w3cLog.h" -#include "global.h" -#include "bandwidth.h" -#include "MP3Header.h" -#include "ADTSHeader.h" -#include "file/fileUtils.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define DEBUG_LOG(...) do { if (gOptions.shoutcast1ClientDebug()) DLOG(__VA_ARGS__); } while (0) -#define AD_DEBUG_LOG(...) do { if (gOptions.adMetricsDebug()) DLOG(__VA_ARGS__); } while (0) - - -protocol_shoutcast1Client::protocol_shoutcast1Client (protocol_HTTPStyle &hs, const streamData::streamID_t streamID, - const uniString::utf8 &hostName, const uniString::utf8 &addr, const uniString::utf8 &XFF) throw (std::exception) - - : protocol_shoutcastClient (hs, streamID, hostName, addr, XFF, streamData::SHOUTCAST1) -{ - setCallback (&protocol_shoutcastClient::state_AttachToStream); -} - -protocol_shoutcast1Client::~protocol_shoutcast1Client() throw() -{ - cleanup("Shoutcast 1", gOptions.shoutcast1ClientDebug()); -} - -////////////////////////////////////////////////////////////////////////////// - -void protocol_shoutcast1Client::timeSlice() throw(exception) -{ - int ret = doTimeSlice(); - if (ret == 1) - { - m_state = &protocol_shoutcastClient::state_Stream; - return; - } - else if (ret == 2) - { - return; - } - - (this->*m_state)(); -} - -void protocol_shoutcast1Client::setCallback (protocol_shoutcastClient::state_t callback, protocol_shoutcastClient::state_t next) -{ - m_state = callback ? callback : m_nextState; - m_nextState = callback ? next : NULL; -} - - -void protocol_shoutcast1Client::state_Close() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - m_result.done(); -} - -// find the appropriate stream and try to attach to it -void protocol_shoutcast1Client::state_AttachToStream() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - int read_bitrate = 0, dataType = 0; - m_streamData = streamData::accessStream(m_streamID); - if (!m_streamData) - { - m_outBuffer = MSG_ICY_HTTP401.c_str(); - bandWidth::updateAmount(bandWidth::CLIENT_V1_SENT, (m_outBufferSize = MSG_ICY_HTTP401_LEN)); - - if (processReject("Shoutcast 1", bandWidth::CLIENT_V1_SENT, MSG_ICY_HTTP401, - MSG_ICY_HTTP401_LEN, &read_bitrate, &dataType)) - { - goto fall_through; - } - - m_state = &protocol_shoutcastClient::state_SendText; - m_nextState = &protocol_shoutcastClient::state_Close; - } - else - { -fall_through: - const utf8 movedUrl = gOptions.stream_movedUrl(m_streamID); - if (movedUrl.empty()) - { - const int add = processAdd("Shoutcast 1", bandWidth::CLIENT_V1_SENT, - MSG_ICY_HTTP401, MSG_ICY_HTTP401_LEN, movedUrl, - (m_streamData ? m_streamData->streamBackupServer() : "")); - if (add != 1) - { - m_state = &protocol_shoutcastClient::state_SendText; - m_nextState = &protocol_shoutcastClient::state_Close; - } - else - { - const bool isPodcast = (!m_streamData && (gOptions.getBackupLoop(m_streamID) == 1)); - m_OKResponse = (m_clientType == streamData::WMP ? MSG_ICY200 : MSG_ICY_HTTP200); - if (!isPodcast) - { - utf8 title = (m_streamData ? m_streamData->streamName() : gOptions.stream_backupTitle(m_streamID)); - if (!m_streamData) - { - if (!gOptions.read_stream_backupTitle(m_streamID)) - { - title = gOptions.backupTitle(); - } - - if (title.empty()) - { - title = gOptions.stream_backupFile(m_streamID); - if (!gOptions.read_stream_backupFile(m_streamID)) - { - title = gOptions.backupFile(); - } - - if (!title.empty()) - { - title = fileUtil::stripSuffix(fileUtil::stripPath(title)); - } - } - } - - m_OKResponse += "icy-name:" + title + "\r\n" - "icy-genre:"; - if (m_streamData) - { - for (int i = 0; i < 5; i++) - { - if (!m_streamData->m_streamInfo.m_streamGenre[i].empty()) - { - m_OKResponse += (i ? ", " : "") + m_streamData->m_streamInfo.m_streamGenre[i]; - } - } - } - else - { - m_OKResponse += "Misc"; - } - - m_OKResponse += "\r\n" - "icy-br:" + tos((m_streamData ? m_streamData->streamBitrate() : read_bitrate)) + "\r\n" + - "icy-sr:" + tos((m_streamData ? m_streamData->streamSampleRate() : 0)) + "\r\n" + - (m_streamData ? (m_streamData->streamIsVBR() ? "icy-vbr:1\r\n" : "") : ""); - } - - if (m_streamData) - { - m_OKResponse += "icy-url:" + m_streamData->streamURL() + "\r\n"; - - if (isUserAgentRelay(toLower(m_userAgent)) && (!m_streamData->allowPublicRelay())) - { - m_OKResponse += "icy-pub:0\r\n"; - } - else - { - m_OKResponse += "icy-pub:" + tos(m_streamData->streamPublic()) + "\r\n"; - } - - m_OKResponse += "content-type:" + m_streamData->streamContentType() + "\r\n"; - } - else - { - utf8 path = getStreamPath(m_streamID); - if (!path.empty() && path.find(utf8("/")) == 0) - { - path = path.substr(1); - } - - m_OKResponse += "Content-Type:" + utf8(dataType == AACP_DATA ? "audio/aacp" : "audio/mpeg") + "\r\n"; - - if (!isPodcast) - { - //m_OKResponse += "icy-url:" + utf8("TODO") + "\r\n"; - - utf8 pub = toLower(gOptions.stream_publicServer(m_streamID)); - if (pub.empty()) - { - pub = toLower(gOptions.publicServer()); - } - if (pub == "always") - { - m_OKResponse += "icy-pub:1\r\n"; - } - else if (pub == "never") - { - m_OKResponse += "icy-pub:0\r\n"; - } - } - else - { - m_OKResponse += "Content-Disposition:attachment;filename=\"" + path + "\"\r\n" - "Content-Length:" + tos(m_backupFile.size()) + "\r\n"; - } - } - - // ignore setting if we've already determined we shouldn't send in-stream metadata - // otherwise for some clients where we force disable just in-case, if it explicitly - // includes a valid "icy-metadata" header, then see if we should override things... - m_OKResponse += "icy-metaint:" + tos(m_metaInterval) + "\r\n"; - - if (gOptions.clacks()) - { - m_OKResponse += "X-Clacks-Overhead:GNU Terry Pratchett\r\n"; - } - m_OKResponse += "\r\n"; - - DEBUG_LOG(m_clientLogString + "Sending [" + eol() + stripWhitespace(m_OKResponse) + eol() + "]"); - m_outBuffer = m_OKResponse.c_str(); - bandWidth::updateAmount(bandWidth::CLIENT_V1_SENT, (m_outBufferSize = (int)m_OKResponse.size())); - m_state = &protocol_shoutcastClient::state_SendText; - if (!m_headRequest) - { - m_nextState = &protocol_shoutcastClient::state_InitiateStream; - } - else - { - m_removeClientFromStats = false; - m_ignoreDisconnect = true; - m_nextState = &protocol_shoutcastClient::state_Close; - } - m_result.write(); - m_result.timeoutSID(m_streamID); - m_result.run(); - - if (!m_userAgent.empty() && toLower(m_userAgent).find(utf8("shoutcast-to-dnas message sender")) == 0) - { - utf8::size_type pos = toLower(m_userAgent).find(utf8("[message:")); - if (pos != utf8::npos) - { - utf8 message = m_userAgent.substr(pos + 9); - pos = message.rfind(utf8("]")); - if (pos != utf8::npos) - { - message = message.substr(0, pos); - } - - if ((message.find(utf8("!doctype")) != utf8::npos) || - (message.find(utf8("") ? "Message cleared." : message)); - if (m_streamData) - { - m_streamData->updateStreamMessage(m_streamID, message); - } - } - m_ignoreDisconnect = true; - } - } - else - { - // setGroup(500); // for testing - // when the client is added, we get back the unique id of the connection - // but we now check for being > 0 as we need to filter out some of the - // YP connections from being counted as valid clients for stats, etc - reportNewListener("Shoutcast 1"); - } - } - } - else - { - // if we get to here then we attempt to redirect the clients to the moved url - // which is useful if the stream has moved hosting or it has been deprecated. - streamMovedOrRejected("Shoutcast 1", bandWidth::CLIENT_V1_SENT, movedUrl, 2); - m_state = &protocol_shoutcastClient::state_SendText; - m_nextState = &protocol_shoutcastClient::state_Close; - } - } -} - -void protocol_shoutcast1Client::state_SendIntro() throw(exception) -{ - state_SendIntroFile(); - if (m_introFile.empty()) - { - acquireIntroFile(); - if (m_introFile.empty()) - { - m_state = &protocol_shoutcastClient::state_Stream; - } - else - { - m_state = &protocol_shoutcastClient::state_SendIntroFile; - } - } -} - -void protocol_shoutcast1Client::state_InitiateStream() throw(exception) -{ - resetReadPtr(); - - // if it's a SHOUTcast Directory test connection then we send just the title (which will - // be a default string if nothing is available) which will still allow the connection to - // work and validate the stream exists whilst only sending the minimum of data nededed. - if (!m_userAgent.empty() && (toLower(m_userAgent) == utf8("shoutcast directory tester"))) - { - // TODO check if artwork needs to also be indicated - const utf8 metadata = fixICYMetadata((m_streamData ? m_streamData->getSc1Metadata(m_readPtr).m_songTitle : "")); - sendICYMetadata((!metadata.empty() ? metadata : "StreamTitle='';")); - m_nextState = &protocol_shoutcastClient::state_Close; - m_ignoreDisconnect = true; - } - else - { - if (!m_streamData || m_introFile.empty()) - { - // send intro file if we have it - acquireIntroFile(); - m_state = (m_introFile.empty() ? &protocol_shoutcastClient::state_Stream : &protocol_shoutcastClient::state_SendIntroFile); - } - else - { - m_state = &protocol_shoutcastClient::state_SendIntro; - } - - setW3CState(); - } - - m_result.run(); -} - -// construct the necessary metadata information and load into outbound buffers. -void protocol_shoutcast1Client::sendICYMetadata(const utf8 &md) throw() -{ - m_ICYMetadata.clear(); - m_ICYMetadata.push_back(1); // placeholder - if (md != m_lastSentMetadata) // don't sent duplicates - { - m_ICYMetadata.insert(m_ICYMetadata.end(),md.begin(),md.end()); - if (!m_lastSentMetadata.empty()) - { - logW3C(); - } - m_lastSentMetadata = md; - } - - unsigned int dlen = (unsigned int)m_ICYMetadata.size(); - if (dlen == 1) - { - dlen = 0; - } - unsigned int l1 = ((dlen + 15) & ~15); - m_ICYMetadata[0] = l1 / 16; - unsigned int send_len = l1 + 1; - m_ICYMetadata.insert(m_ICYMetadata.end(), send_len - m_ICYMetadata.size(), 0); - //assert(m_ICYMetadata.size() == (size_t)((m_ICYMetadata[0] * 16) + 1)); - m_metaIntervalCounter = 0; - - m_outBuffer = &m_ICYMetadata[0]; - bandWidth::updateAmount(bandWidth::CLIENT_V1_SENT, (m_outBufferSize = (int)m_ICYMetadata.size())); - m_nextState = m_state; - m_state = &protocol_shoutcastClient::state_SendText; - m_result.run(); -} - - -int protocol_shoutcast1Client::doSend(const bool debug, const time_t cur_time, const int autoDumpTime, int adjust) throw(std::runtime_error) -{ - // we are going to do a forced short-send if we - // are now needing to be trying to send metadata - int size = (int)m_output.size(); - int rval = 0; - - if ((m_metaIntervalCounter + size) > m_metaInterval) - { - adjust = (size - ((m_metaIntervalCounter + size) - m_metaInterval)); - if (adjust) - { - rval = protocol_shoutcastClient::doSend(debug, cur_time, autoDumpTime, adjust); - // DLOG ("Adjusted send ret " + tos(rval) + " for per-meta " + tos(adjust)); - } - - if (rval == adjust) - { - const utf8 metadata = (!m_streamData ? "StreamTitle='';" : - fixICYMetadata((m_streamData ? - m_streamData->getSc1Metadata(m_readPtr).m_songTitle : ""))); - - sendICYMetadata(metadata); - return rval; - } - size = adjust; - } - else - rval = protocol_shoutcastClient::doSend(debug, cur_time, autoDumpTime); - m_metaIntervalCounter += rval; - if (rval < size) - m_result.schedule(120); - - return rval; -} - - -void protocol_shoutcast1Client::return_403(void) -{ - protocol_shoutcastClient::return_403(); - setCallback (&protocol_shoutcastClient::state_SendText, &protocol_shoutcastClient::state_Close); -} diff --git a/Src/Plugins/DSP/sc_serv3/protocol_shoutcast1Client.h b/Src/Plugins/DSP/sc_serv3/protocol_shoutcast1Client.h deleted file mode 100644 index 970acc7e..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_shoutcast1Client.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once -#ifndef protocol_shoutcast1Client_H_ -#define protocol_shoutcast1Client_H_ - -#include "protocol_shoutcastClient.h" -#include - -class streamData; - -class protocol_shoutcast1Client: public protocol_shoutcastClient -{ -private: - - typedef void (protocol_shoutcast1Client::*state_t)(); - state_t m_state; - state_t m_nextState; - - std::vector<__uint8> m_ICYMetadata; // metadata buffer - - void state_AttachToStream() throw(std::exception); - void state_Close() throw(std::exception); - void state_InitiateStream() throw(std::exception); - void state_SendIntro() throw(std::exception); - - void sendICYMetadata(const uniString::utf8 &md) throw(); - - virtual void timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "protocol_shoutcast1Client"; } - -public: - protocol_shoutcast1Client (protocol_HTTPStyle &hs, const streamData::streamID_t streamID, - const uniString::utf8 &hostName, const uniString::utf8 &addr, const uniString::utf8 &XFF) throw(std::exception); - - virtual ~protocol_shoutcast1Client() throw(); - - virtual void setCallback (protocol_shoutcastClient::state_t callback = NULL, protocol_shoutcastClient::state_t next = NULL); - virtual int doSend(const bool debug, const time_t cur_time, const int autoDumpTime, int adjust = 0) throw(std::runtime_error); - - void return_403(void); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_shoutcast2Client.cpp b/Src/Plugins/DSP/sc_serv3/protocol_shoutcast2Client.cpp deleted file mode 100644 index 745f46c9..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_shoutcast2Client.cpp +++ /dev/null @@ -1,568 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include -#include "protocol_shoutcast2Client.h" -#include "ripList.h" -#include "stats.h" -#include "streamData.h" -#include "w3cLog.h" -#include "metadata.h" -#include "uvox2Common.h" -#include "global.h" -#include "bandwidth.h" -#include "MP3Header.h" -#include "ADTSHeader.h" -#include "file/fileUtils.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define LOGNAME "DST" -#define DEBUG_LOG(...) do { if (gOptions.shoutcast2ClientDebug()) DLOG(__VA_ARGS__); } while(0) -#define AD_DEBUG_LOG(...) do { if (gOptions.adMetricsDebug()) DLOG(__VA_ARGS__); } while(0) - -protocol_shoutcast2Client::protocol_shoutcast2Client (protocol_HTTPStyle &hs, const streamData::streamID_t streamID, - const uniString::utf8 &hostName, const uniString::utf8 &addr,const uniString::utf8 &XFF, const bool cdnSlave) - - : protocol_shoutcastClient (hs, streamID, hostName, addr, XFF, streamData::SHOUTCAST2), m_cdnSlave(cdnSlave) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__, LOGNAME, streamID); - m_state = &protocol_shoutcast2Client::state_AttachToStream; - m_nextState = NULL; -} - -protocol_shoutcast2Client::~protocol_shoutcast2Client() throw() -{ - cleanup("Shoutcast 2", gOptions.shoutcast2ClientDebug(), true); -} - -///////////////////////////////////// W3C Logging ////////////////////////////////////////////// - -// create W3C entry. Entries describe the duration a client has listened to a specific -// title. the entry is generated on a title change, or when the client disconnects -void protocol_shoutcast2Client::logW3C() throw() -{ - if (gOptions.w3cEnable()) - { - vector md; - if (!m_lastMetadata.empty()) - { - // loop through packets and reassemble. Since we put this stuff in there, we don't need to do integrity checks - size_t total_data_size = m_lastMetadata.size(); - for (size_t x = 0; x < total_data_size;) - { - if ((UV2X_OVERHEAD + UV2X_META_HDR_SIZE) > (total_data_size - x)) - { - break; // out of data - } - - const uv2xHdr *voxHdr = (const uv2xHdr*)(&(m_lastMetadata[x])); - const __uint8 *contents = (const __uint8 *)((&(m_lastMetadata[x])) + UV2X_HDR_SIZE); - const __uint8* metadataContents = contents + UV2X_META_HDR_SIZE; - const size_t metadataContentsSize = ntohs(voxHdr->msgLen) - UV2X_META_HDR_SIZE; - - if ((UV2X_OVERHEAD + UV2X_META_HDR_SIZE + metadataContentsSize) > (total_data_size - x)) - { - break; // out of data - } - - md.insert(md.end(), metadataContents,metadataContents + metadataContentsSize); - x += UV2X_OVERHEAD + UV2X_META_HDR_SIZE + metadataContentsSize; - } - } - - utf8 md_s(md.begin(), md.end()); - - // do a sanity check when trying to form the metadata if a uvox 2 connection - // is attempted from an older Winamp client e.g. 5.54 - means a connection - // can be made from the client without it aborting if there's no metadata. - utf8 title; - if (!md_s.empty()) - { - title = metadata::get_song_title_from_3902(md_s); - } - - doLogW3C(title); - } -} - -////////////////////////////////////////////////////////////////////////////// - -void protocol_shoutcast2Client::timeSlice() throw(exception) -{ - int ret = doTimeSlice(true); - if (ret == 1) - { - m_state = &protocol_shoutcastClient::state_Stream; - return; - } - else if (ret == 2) - { - return; - } - - (this->*m_state)(); -} - - -void protocol_shoutcast2Client::setCallback (protocol_shoutcastClient::state_t callback, protocol_shoutcastClient::state_t next) -{ - m_state = callback ? callback : m_nextState; - m_nextState = callback ? next : NULL; -} - - -void protocol_shoutcast2Client::state_Close() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - m_result.done(); -} - -void protocol_shoutcast2Client::state_SendText() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(m_clientLogString + __FUNCTION__); -#endif - - if (sendText()) - { - m_state = m_nextState; - } -} - -// find the appropriate stream and try to attach to it -void protocol_shoutcast2Client::state_AttachToStream() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - int read_bitrate = 0; - m_streamData = streamData::accessStream(m_streamID); - if (!m_streamData) - { - if (processReject("Shoutcast 2", bandWidth::CLIENT_V2_SENT, MSG_HTTP404, - MSG_HTTP404_LEN, &read_bitrate, 0, true)) - { - goto fall_through; - } - - m_state = &protocol_shoutcast2Client::state_SendText; - m_nextState = &protocol_shoutcast2Client::state_Close; - } - else - { -fall_through: - const utf8 movedUrl = gOptions.stream_movedUrl(m_streamID); - if (movedUrl.empty()) - { - // we use this to control the cdn mode so we'll only provide the - // headers needed if it's all enabled and the client asks for it - string cdn; - if (isCDNMaster(m_streamID) && m_cdnSlave) - { - DEBUG_LOG(m_clientLogString + "CDN slave request received by master", LOGNAME, m_streamID); - utf8 authhash = (m_streamData ? m_streamData->streamAuthhash() : ""); - if (yp2::isValidAuthhash(authhash)) - { - utf8 key = XTEA_encipher(authhash.c_str(), authhash.size(), bob().c_str(), bob().size()); - cdn = "cdn-master:1\r\n" - "cdn-token:" + key.hideAsString() + "\r\n"; - m_clientType = ((streamData::source_t)(m_clientType | streamData::SC_CDN_SLAVE)); - } - else - { - DEBUG_LOG(m_clientLogString + "CDN slave request not sent - invalid authhash provided", LOGNAME, m_streamID); - } - } - - const int add = processAdd("FLV", bandWidth::CLIENT_V2_SENT, - MSG_HTTP404, MSG_HTTP404_LEN, movedUrl, - (m_streamData ? m_streamData->streamBackupServer() : "")); - if (add != 1) - { - m_state = &protocol_shoutcast2Client::state_SendText; - m_nextState = &protocol_shoutcast2Client::state_Close; - } - else - { - utf8 pub = "0", genre = ""; - const bool isPodcast = (!m_streamData && (gOptions.getBackupLoop(m_streamID) == 1)); - if (!isPodcast) - { - pub = (m_streamData ? tos(m_streamData->streamPublic()) : "1"); - if (m_streamData) - { - if (isUserAgentRelay(toLower(m_userAgent)) && (!m_streamData->allowPublicRelay())) - { - pub = "0"; - } - - for (int i = 0; i < 5; i++) - { - if (!m_streamData->m_streamInfo.m_streamGenre[i].empty()) - { - genre += (i ? ", " : "") + m_streamData->m_streamInfo.m_streamGenre[i]; - } - } - } - // if running from a backup file then no need to set the states - else - { - pub = toLower(gOptions.stream_publicServer(m_streamID)); - if (pub.empty()) - { - pub = toLower(gOptions.publicServer()); - } - if (pub == "always") - { - pub = "1"; - } - else if (pub == "never") - { - pub = "0"; - } - } - } - else - { - // TODO how do we handle podcasts for 2.x - // as we should somehow swap to 1.x - } - - utf8 title = (m_streamData ? m_streamData->streamName() : gOptions.stream_backupTitle(m_streamID)); - if (!m_streamData) - { - if (!gOptions.read_stream_backupTitle(m_streamID)) - { - title = gOptions.backupTitle(); - } - - if (title.empty()) - { - title = gOptions.stream_backupFile(m_streamID); - if (!gOptions.read_stream_backupFile(m_streamID)) - { - title = gOptions.backupFile(); - } - - if (!title.empty()) - { - title = fileUtil::stripSuffix(fileUtil::stripPath(title)); - } - } - } - - m_OKResponse = MSG_UVOX_HTTP200 + - "icy-pub:" + pub + "\r\n" + cdn + - "Ultravox-SID:" + tos(m_streamID) + "\r\n" + - "Ultravox-Bitrate:" + tos(m_streamData ? m_streamData->streamAvgBitrate() : (read_bitrate * 1000)) + "\r\n" + - "Ultravox-Samplerate:" + tos(m_streamData ? m_streamData->streamSampleRate() : 0) + "\r\n" + - "Ultravox-Title:" + title + "\r\n" + - "Ultravox-Genre:" + genre + "\r\n" + - "Ultravox-URL:" + (m_streamData ? m_streamData->streamURL() : (utf8)""/*"TODO"*/) + "\r\n" + - "Ultravox-Max-Msg:" + tos(MAX_PAYLOAD_SIZE) + "\r\n" + - "Ultravox-Class-Type:" + tohex(m_streamData ? m_streamData->streamUvoxDataType() : MP3_DATA) + "\r\n" + - (m_streamData && m_streamData->streamIsVBR() ? "Ultravox-VBR:1\r\n" : "") + - (gOptions.clacks() ? "X-Clacks-Overhead:GNU Terry Pratchett\r\n\r\n" : "\r\n"); - - DEBUG_LOG(m_clientLogString + "Sending [" + eol() + stripWhitespace(m_OKResponse) + eol() + "]"); - m_outBuffer = m_OKResponse.c_str(); - bandWidth::updateAmount(bandWidth::CLIENT_V2_SENT, (m_outBufferSize = (int)m_OKResponse.size())); - m_state = &protocol_shoutcast2Client::state_SendText; - if (!m_headRequest) - { - m_nextState = &protocol_shoutcast2Client::state_InitiateStream; - } - else - { - m_removeClientFromStats = false; - m_ignoreDisconnect = true; - m_nextState = &protocol_shoutcast2Client::state_Close; - } - m_result.write(); - m_result.timeoutSID(m_streamID); - m_result.run(); - - // when the client is added, we get back the unique id of the connection - // but we now check for being > 0 as we need to filter out some of the - // YP connections from being counted as valid clients for stats, etc - reportNewListener("Shoutcast 2"); - } - } - else - { - // if we get to here then we attempt to redirect the clients to the moved url - // which is useful if the stream has moved hosting or it has been deprecated. - streamMovedOrRejected("Shoutcast 2", bandWidth::CLIENT_V2_SENT, movedUrl, 2); - m_state = &protocol_shoutcast2Client::state_SendText; - m_nextState = &protocol_shoutcast2Client::state_Close; - } - } -} - -void protocol_shoutcast2Client::state_SendCachedMetadata() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - if (sendDataBuffer(m_streamID, m_outBuffer, m_outBufferSize, m_clientLogString)) - { - bool playingAlbumArt = false; - - // send intro file if we have it - acquireIntroFile(true); - - // see if there's any albumart and attempt to send stream and then playing or whatever is present - m_cachedMetadata = (m_streamData ? m_streamData->getSc21StreamAlbumArt(0xFFFFFFFF) : streamData::uvoxMetadata_t()); - if (m_cachedMetadata.empty()) - { - m_cachedMetadata = m_streamData->getSc21PlayingAlbumArt(m_readPtr); - playingAlbumArt = true; - } - - if (m_cachedMetadata.empty()) - { - // send intro file if we have it - acquireIntroFile(true); - m_state = (m_introFile.empty() ? &protocol_shoutcastClient::state_Stream : &protocol_shoutcastClient::state_SendIntroFile); - } - else - { - bandWidth::updateAmount(bandWidth::CLIENT_V2_SENT, (m_outBufferSize = (int)m_cachedMetadata.size())); - m_outBuffer = (uniString::utf8::value_type*)&(m_cachedMetadata[0]); // slam cast so we can reuse variable - m_state = (playingAlbumArt == false ? &protocol_shoutcast2Client::state_SendCachedStreamAlbumArt : &protocol_shoutcast2Client::state_SendCachedPlayingAlbumArt); - } - } -} - -void protocol_shoutcast2Client::state_InitiateStream() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__); - - resetReadPtr(true); - - m_cachedMetadata = (m_streamData ? m_streamData->getSc21Metadata(m_readPtr) : streamData::uvoxMetadata_t()); - - if (m_cachedMetadata.empty()) - { - // send intro file if we have it - acquireIntroFile(true); - m_state = (m_introFile.empty() ? &protocol_shoutcastClient::state_Stream : &protocol_shoutcastClient::state_SendIntro); - } - else - { - bandWidth::updateAmount(bandWidth::CLIENT_V2_SENT, (m_outBufferSize = (int)m_cachedMetadata.size())); - m_outBuffer = (uniString::utf8::value_type*)&(m_cachedMetadata[0]); // slam cast so we can reuse variable - m_state = &protocol_shoutcast2Client::state_SendCachedMetadata; - } - - m_result.run(); -} - -void protocol_shoutcast2Client::state_SendCachedStreamAlbumArt() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__ + "sending stream albumart: " + tos(m_outBufferSize) + - " bytes, mime type: " + tos(m_streamData->streamAlbumArtMime())); - - if (sendDataBuffer(m_streamID, m_outBuffer, m_outBufferSize, m_clientLogString)) - { - // if all went ok then look to send the playing album art if it is present otherwise do intro / stream data - m_cachedMetadata = m_streamData->getSc21PlayingAlbumArt(m_readPtr); - - if (m_cachedMetadata.empty()) - { - // send intro file if we have it - acquireIntroFile(true); - m_state = (m_introFile.empty() ? &protocol_shoutcastClient::state_Stream : &protocol_shoutcastClient::state_SendIntroFile); - } - else - { - bandWidth::updateAmount(bandWidth::CLIENT_V2_SENT, (m_outBufferSize = (int)m_cachedMetadata.size())); - m_outBuffer = (uniString::utf8::value_type*)&(m_cachedMetadata[0]); // slam cast so we can reuse variable - m_state = &protocol_shoutcast2Client::state_SendCachedPlayingAlbumArt; - } - } -} - -void protocol_shoutcast2Client::state_SendCachedPlayingAlbumArt() throw(exception) -{ - DEBUG_LOG(m_clientLogString + __FUNCTION__ + "sending playing albumart: " + tos(m_outBufferSize) + - " bytes, mime type: " + tos(m_streamData->streamPlayingAlbumArtMime())); - - if (sendDataBuffer(m_streamID, m_outBuffer, m_outBufferSize, m_clientLogString)) - { - // send intro file if we have it - acquireIntroFile(true); - m_state = (m_introFile.empty() ? &protocol_shoutcastClient::state_Stream : &protocol_shoutcastClient::state_SendIntroFile); - } -} - - -void protocol_shoutcast2Client::return_403(void) -{ - protocol_shoutcastClient::return_403(); - m_state = &protocol_shoutcast2Client::state_SendText; - m_nextState = &protocol_shoutcast2Client::state_Close; -} - - -const int protocol_shoutcast2Client::doFrameSync(const int type, const bool debug, const int len, - const int offset, const std::vector<__uint8>& inbuf, - const time_t /*cur_time */, const int, const unsigned int, - int &frames, bool &advert, - bool fill_remainder) throw() -{ - bool mp3; - int end = 0; - - if (streamData::isAllowedType(type, mp3)) - { - int last = min (len, (int)(inbuf.size() - offset)); - const unsigned char *buf; - - if (m_remainder.empty () || offset < last) - { - buf = &inbuf [offset]; - // DLOG ("last " + tos(last) + ", off " + tos(offset)); - } - else - { - const std::vector<__uint8>::const_iterator pos = inbuf.begin(); - size_t cc = min (inbuf.size(), (size_t)len); - - cc = min (cc, (size_t)4096); - if (cc > m_remainder.size()) - cc -= m_remainder.size(); - if (cc < 1 || cc > inbuf.size()) - { - ILOG ("sync2, cc is " + tos (cc)); - abort(); - } - m_remainder.insert (m_remainder.end(), inbuf.begin(), inbuf.begin() + cc); - - buf = &m_remainder [0]; - last = min (len, (int)m_remainder.size()); - fill_remainder = false; - // DLOG ("merged remainder, now " + tos (last) + ", added " + tos(cc)); - } - if (last > 8) - { - int last_size = 0; - //double fps_limit = m_fps*2; - - fill_remainder = false; - - for (int i = 0; (i < last-8) && !iskilled();) - { - const uv2xHdr *voxHdr = (const uv2xHdr*)(&(buf[i])); - const int msgLen = ntohs(voxHdr->msgLen); - const int found = ((voxHdr->sync == UVOX2_SYNC_BYTE) && - (msgLen > UV2X_OVERHEAD) && - (msgLen <= MAX_PAYLOAD_SIZE) ? (msgLen + UV2X_OVERHEAD) : 0); - - // need to find frames and that the input is the correct format! - // - // is a bit of a pain for AAC though as we've already done the - // rough bitrate match when the advert / intro / backup was read - // we'll just pass things through as though the bitrate is ok... - if ((found > 0)) // && (found <= len)) - { - if (!frames) - { - end = i; - protocol_shoutcastClient::createFrameRate(mp3, (m_streamData ? m_streamData->streamSampleRate() : 0)); - } - - i += (last_size = found); - // only count valid full-size frames - if (i <= last) - { - //const std::vector<__uint8>::const_iterator pos = inbuf.begin(); - - m_output.insert(m_output.end(), buf+end, buf+end+last_size); - end += last_size; - - // we only want to count audio frames and not metadata - const __uint16 voxMsgType = ntohs(voxHdr->msgType); - if ((voxMsgType >= 0x7000) && (voxMsgType < 0x9000)) - { - ++frames; - } - // DLOG ("frame " + tos(m_frameCount+frames) + " (" + tos(found) + ") last " + tos(last) + " end " + tos(end) + " i " + tos(i)); - } - else - { - // DLOG ("EOB, " + tos (i) + ", " + tos(offset) + ", " + tos(inbuf.size())); - if (m_remainder.empty()) - { - if (i+offset > inbuf.size()) - fill_remainder = true; - } - else if (end + offset < inbuf.size()) - fill_remainder = true; - break; - } - } - else - { - // we now look for the "SCAdvert" marker - // for detecting if we've got an advert. - if (i < (len - 8) && ((buf[i]) == 'S') && ((buf[i+1]) == 'C')) - { - if (!memcmp(&buf[i], "SCAdvert", 8)) - { - if (frames == 0) - { - // DLOG ("Found SCAdvert"); - advert = true; - end += 8; - m_remainder.clear(); - } - break; - } - } - else - { - // if we found something but there is not enough - // data in the read buffer then we'll abort asap - if ((found > 0) && (found > len)) - { - break; - } - - if (m_frameCount && debug) - { - DLOG(m_clientLogString + "Bad frame found at pos: " + - tos(i) + " [" + tos(found) + "]", LOGNAME, m_streamID); - } - } - // otherwise we just need to move on and keep - // looking for what is a valid starting frame - ++i; - } - } - } - else - fill_remainder = true; - if (m_remainder.empty() == false && frames) - m_remainder.clear(); - if (fill_remainder) - { - const int remainder = (last - end); - if (remainder > 0) - m_remainder.insert(m_remainder.end(), buf + end, buf + (end + remainder)); - } - } - return (len - end); -} - - -void protocol_shoutcast2Client::setIntro (vector<__uint8> &buf, int uvoxDataType) -{ - m_introFile.clear(); - if (buf.empty()) - return; - streamData::convertRawToUvox (m_introFile, buf, uvoxDataType, 0, 0); -} diff --git a/Src/Plugins/DSP/sc_serv3/protocol_shoutcast2Client.h b/Src/Plugins/DSP/sc_serv3/protocol_shoutcast2Client.h deleted file mode 100644 index ec89e127..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_shoutcast2Client.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once -#ifndef protocol_shoutcast2Client_H_ -#define protocol_shoutcast2Client_H_ - -#include "protocol_shoutcastClient.h" -#include - -class streamData; - -class protocol_shoutcast2Client: public protocol_shoutcastClient -{ -private: - typedef void (protocol_shoutcast2Client::*state_t)(); - state_t m_state; - state_t m_nextState; - - /// w3c logging - streamData::uvoxMetadata_t m_lastMetadata; // used for w3C tracking - ///////////////////// - - streamData::uvoxMetadata_t m_cachedMetadata; // cached metadata that must be sent at connect time - - const bool m_cdnSlave; // based on the connection header - - void state_AttachToStream() throw(std::exception); - void state_Close() throw(std::exception); - void state_SendText() throw(std::exception); - void state_InitiateStream() throw(std::exception); - void state_SendCachedMetadata() throw(std::exception); - void state_SendCachedStreamAlbumArt() throw(std::exception); - void state_SendCachedPlayingAlbumArt() throw(std::exception); - - void logW3C() throw(); - const int doFrameSync(const int type, const bool debug, const int len, - const int offset, const std::vector<__uint8>& buf, - const time_t cur_time, const int bitrate, - const unsigned int samplerate, int &frames, - bool &advert, const bool fill_remainder = false) throw(); - - virtual void timeSlice() throw(std::exception); - virtual void setCallback (protocol_shoutcastClient::state_t callback, protocol_shoutcastClient::state_t next); - virtual uniString::utf8 name() const throw() { return "protocol_shoutcast2Client"; } - -public: - protocol_shoutcast2Client (protocol_HTTPStyle &hs, const streamData::streamID_t streamID,const uniString::utf8 &hostName, const uniString::utf8 &addr,const uniString::utf8 &XFF, const bool cdnSlave); - virtual ~protocol_shoutcast2Client() throw(); - - virtual void setIntro(vector<__uint8> &v, int uvoxDataType); - - void return_403(void); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_shoutcastClient.cpp b/Src/Plugins/DSP/sc_serv3/protocol_shoutcastClient.cpp deleted file mode 100644 index 97b0427c..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_shoutcastClient.cpp +++ /dev/null @@ -1,1917 +0,0 @@ -#ifdef _WIN32 -#include -#ifndef MSG_DONTWAIT -#define MSG_DONTWAIT 0 -#endif -#endif -#include -#include "protocol_shoutcastClient.h" -#include "ripList.h" -#include "stats.h" -#include "streamData.h" -#include "w3cLog.h" -#include "global.h" -#include "bandwidth.h" -#include "metrics.h" -#include "auth.h" -#include "yp2.h" -#include "FLV.h" -#include "MP3Header.h" -#include "ADTSHeader.h" -#include "file/fileUtils.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define LOGNAME "DST" -#define AD_DEBUG_LOG(...) do { if (gOptions.adMetricsDebug()) DLOG(__VA_ARGS__); } while(0) - -protocol_shoutcastClient::protocol_shoutcastClient (protocol_HTTPStyle &hs, const streamData::streamID_t streamID, - const uniString::utf8 &hostName, const uniString::utf8 &clientAddr, const uniString::utf8 &XFF, const streamData::source_t clientType) - - : runnable (hs), m_streamID(streamID <= 0 || streamID > INT_MAX ? DEFAULT_CLIENT_STREAM_ID : streamID), - m_unique(stats::getNewClientId()), m_adAccess(clientType == streamData::SHOUTCAST2) -{ - m_newListener = m_timerStart = (time_t)0; - m_timerFrames = m_frameLimit = m_frameCount = 0; - m_fps = 0.0; - m_bytesSentForCurrentTitle = m_totalBytesSent = 0; - m_metaIntervalCounter = m_backupLoopTries = m_outBufferSize = 0; - m_backupFileOffset = m_introFileOffset = 0; - m_readPtr = 0; - m_outBuffer = NULL; - m_streamData = NULL; - m_kickNextRound = m_ignoreDisconnect = false; - m_lagOffset = 0; - setGroup (m_unique); - - m_headRequest = (hs.m_httpRequestInfo.m_request == protocol_HTTPStyle::HTTP_HEAD); - m_clientType = streamData::getClientType (clientType, stringUtil::toLower (hs.m_userAgent)); // double toLower work ?? - m_removeClientFromStats = (isUserAgentOfficial (stringUtil::toLower (hs.m_userAgent)) == false); - - if (gOptions.useXFF() && !XFF.empty() && metrics::metrics_verifyDestIP (gOptions, true, XFF).empty() == false) - m_clientAddr = XFF; - else - m_clientAddr = clientAddr; - m_clientLogString = dstAddrLogString (hostName, hs.m_clientPort, XFF, streamID); - - m_clientHostName = hostName; - - m_metaInterval = gOptions.getMetaInterval (streamID); - m_userAgent = hs.m_userAgent; - m_referer = hs.m_referer; - m_XFF = XFF; - m_startTime = m_lastTitleTime = ::time(NULL); -} - - -// setup tracking variables for W3C log -void protocol_shoutcastClient::setW3CState() throw() -{ - m_lastTitleTime = ::time(NULL); - m_bytesSentForCurrentTitle = 0; -} - -int protocol_shoutcastClient::detectAutoDumpTimeout (time_t &cur_time, const size_t streamID, const uniString::utf8 &msg) throw(runtime_error) -{ - const int autoDumpTime = gOptions.getAutoDumpTime(streamID); - cur_time = ::time(NULL); - if ((autoDumpTime > 0) && ((cur_time - m_lastActivityTime) >= autoDumpTime)) - { - if (m_ignoreDisconnect == false) - DLOG (msg, LOGNAME, streamID); - throwEx(""); - } - return autoDumpTime; -} - -////////////////////////////////////////////////////////////////////////////// - -void protocol_shoutcastClient::acquireIntroFile(const bool sc2) throw() -{ - // if we've already loaded something then we won't keep - // trying to re-acquire it for speed and consistency - // whilst this specific client is connected at the time - if (m_streamData && m_introFile.empty()) - { - if (!sc2) - { - m_streamData->getIntroFile().getSc1Data(m_introFile); - } - else - { - m_streamData->getIntroFile().getSc2Data(m_introFile); - } - } - - m_introFileOffset = 0; -} - -int protocol_shoutcastClient::acquireBackupFile(int *dataType, const bool sc2) throw() -{ - int read_bitrate = 0; - // if we've already loaded something then we won't keep - // trying to re-acquire it for speed and consistency - // whilst this specific client is connected at the time - if (m_backupFile.empty()) - { - if (m_streamData) - { - if (!sc2) - { - m_streamData->getBackupFile().getSc1Data(m_backupFile); - } - else - { - m_streamData->getBackupFile().getSc2Data(m_backupFile); - } - - m_streamData->streamSampleRate(); - } - else - { - // for when there is no stream, we'll manually load the - // file and try to do what we can to get it running... - utf8 backupFile = gOptions.stream_backupFile(m_streamID); - if (!gOptions.read_stream_backupFile(m_streamID)) - { - backupFile = gOptions.backupFile(); - } - - if (!backupFile.empty()) - { - const int backuploop = gOptions.getBackupLoop(m_streamID); - if (!backuploop || (m_backupLoopTries <= backuploop)) - { - int streamBitrate = gOptions.stream_maxBitrate(m_streamID); - if (!gOptions.read_stream_maxBitrate(m_streamID) || !streamBitrate) - { - streamBitrate = gOptions.maxBitrate(); - } - if (streamBitrate) - { - streamBitrate /= 1000; - } - - unsigned int read_samplerate = 0; - const int type = ((toLower(backupFile).rfind(utf8(".aac")) == (backupFile.size() - 4)) ? AACP_DATA : MP3_DATA); - streamData::specialFileData loadBackupFile((backuploop == 1 ? "podcast" : "backup")); - read_bitrate = loadBackupFile.loadFromFile(backupFile, streamBitrate, type, read_samplerate, m_clientLogString); - if (!sc2) - { - loadBackupFile.getSc1Data(m_backupFile); - } - else - { - loadBackupFile.getSc2Data(m_backupFile); - } - if (dataType) - { - *dataType = type; - createFrameRate ((type==MP3_DATA), loadBackupFile.m_samplerate); - } - } - else if (backuploop && (m_backupLoopTries < backuploop)) - { - m_backupFile.clear(); - } - } - } - } - - m_backupFileOffset = 0; - - return read_bitrate; -} - -const int protocol_shoutcastClient::doTimeSlice(const bool sc2) throw(exception) -{ - int listenerTime = (int)gOptions.stream_listenerTime(m_streamID); - if (!gOptions.read_stream_listenerTime(m_streamID)) - { - listenerTime = (int)gOptions.listenerTime(); - } - - listenerTime *= 60; // convert to seconds - const bool timesUp = listenerTime && ((::time(NULL) - m_startTime) > listenerTime); - if (m_kickNextRound || timesUp || (m_streamData && m_streamData->isDead() && m_backupFile.empty())) - { - if (timesUp) - { - ILOG(m_clientLogString + "Listener time exceeded.", LOGNAME, m_streamID); - } - else if (m_kickNextRound) - { - ILOG(m_clientLogString + "Kicked [Agent: `" + m_userAgent + "', UID: " + tos(m_unique) + ", GRID: " + tos(getGroup()) + "]", LOGNAME, m_streamID); - } - else - { - const int backuploop = gOptions.getBackupLoop(m_streamID); - if (!backuploop || (m_backupLoopTries <= backuploop)) - { - // we're done with the backup file. get more data - acquireBackupFile(0, sc2); - if (!m_backupFile.empty()) - { - ++m_backupLoopTries; - m_lastActivityTime = ::time(NULL); - return 1; - } - } - else if (backuploop && (m_backupLoopTries < backuploop)) - { - m_backupFileOffset = 0; - m_backupFile.clear(); - } - } - - m_result.done(); - return 2; - } - - return 0; -} - -const bool protocol_shoutcastClient::sendText() throw(exception) -{ - return sendDataBuffer(m_streamID, m_outBuffer, m_outBufferSize, m_clientLogString); -} - -void protocol_shoutcastClient::resetCommon() throw() -{ - if (m_newListener == 0) - { - time_t now = ::time (NULL); - if (m_removeClientFromStats && m_streamData && m_streamData->streamPublic()) - { - if (m_startTime + 3 < now) - { - metrics::metrics_listener_new(*this); - m_streamData->advertGroups.attachGroupQueue (this->m_adAccess); - m_newListener = now; - } - } - else - m_newListener = now; - } - if (m_streamData) - m_adAccess.changedGroup (m_streamData->advertGroups); -} - -// set read pointer to a nice distance from the write pointer. Return that distance -const streamData::ringBufferAccess_t protocol_shoutcastClient::resetReadPtr(std::vector<__uint8>& data, const bool sc2) throw() -{ -#if defined(_DEBUG) || defined(DEBUG) - DLOG(m_clientLogString + __FUNCTION__); -#endif - - // we also reset the remainder handling as - // by this point, it's unlikely that it's - // worth trying to keep up and so we reset - m_remainder.clear(); - - m_lagOffset = 0; - if (m_streamData) - { - m_readPtr = m_streamData->getClientStartPosition(sc2); - streamData::ringBufferAccess_t amt = 0; - return m_streamData->getStreamData(amt, m_readPtr, data, 0, sc2); - } - else - { - m_readPtr = 0; - return 0; - } -} - -void protocol_shoutcastClient::resetReadPtr(const bool sc2) throw() -{ -#if defined(_DEBUG) || defined(DEBUG) - DLOG(m_clientLogString + __FUNCTION__); -#endif - - // we also reset the remainder handling as - // by this point, it's unlikely that it's - // worth trying to keep up and so we reset - m_remainder.clear(); - - if (m_streamData == NULL) - { - m_readPtr = 0; - return; - } - m_lagOffset = 0; - if (m_adAccess.inAdvertMode ()) - { - const streamData::adTrigger *t = m_adAccess.getCurrentTrigger(); - streamData::ringBufferAccess_t ptr; - - if (t) - ptr = sc2 ? t->m_returnPtrSC2 : t->m_returnPtrSC1; - else - { - ptr = sc2 ? m_streamData->advertGroups.m_returnPtrSC2 : m_streamData->advertGroups.m_returnPtrSC1; - if (!ptr) - ptr = (sc2 ? m_streamData->m_sc21_packet_starts : m_streamData->m_sc1_packet_starts).back(); - } - streamData::ringBufferAccess_t lag = ((sc2 ? m_streamData->m_sc21_ring_buffer : m_streamData->m_sc1_ring_buffer).m_writePtr - m_readPtr); - - if (lag < (sc2 ? m_streamData->m_sc21_ring_buffer : m_streamData->m_sc1_ring_buffer).m_data.size()) - m_lagOffset = (sc2 ? m_streamData->m_sc21_ring_buffer : m_streamData->m_sc1_ring_buffer).m_writePtr - m_readPtr; - else - { - ptr = (sc2 ? m_streamData->m_sc21_ring_buffer : m_streamData->m_sc1_ring_buffer).m_writePtr; - m_lagOffset = 0; - } - - m_readPtr = m_streamData->getClientStartPosition (ptr, sc2); - // DLOG ("lag offset is " + tos (m_lagOffset) + " readptr " + tos (m_readPtr)); - } - else if (m_totalBytesSent > 30000) - { - std::deque &starts = (sc2 ? m_streamData->m_sc21_packet_starts : m_streamData->m_sc1_packet_starts); - if (starts.size()) - m_readPtr = m_streamData->getClientStartPosition (starts.back(), sc2); - else - m_readPtr = 0; - } - else - m_readPtr = m_streamData->getClientStartPosition(sc2); -} - - -void protocol_shoutcastClient::resetReadPtr (streamData::ringBufferAccess_t ptr, bool sc2) throw() -{ - m_readPtr = (m_streamData ? m_streamData->getClientStartPosition (ptr, sc2) : 0); - m_lagOffset = 0; -} - - -const __uint64 protocol_shoutcastClient::calculateFrameLimit(const time_t cur_time) -{ - // to allow for a burst on joining the stream for listener pre-buffering - // and stuff, we're trying to give an ~5sec of data before we rate limit - // without such handling then a number of listeners stutter at the start - if (gOptions.rateLimit()) - { - time_t conn; - - if (m_timerStart) - { - conn = (cur_time ? cur_time : ::time(NULL)) - m_timerStart; - float fps = conn > 0 ? ((m_timerFrames) / (float)conn) : 0; - //DLOG ("ad rate values are " + tos (conn) + " TF " + tos((long)m_timerFrames)); - if (fps > m_fps) - { - //DLOG ("rate in calc is " + tos (fps)); - return 0; // cause a stall - } - } - } - // just to make sure something is returned then we'll - // take the current number of frames and adjust by the - // intended rate. much better than returning zero rate - return (__uint64)(m_frameCount + m_fps); -} - -void protocol_shoutcastClient::updateFrameCount(const int frames, const time_t) -{ - if (m_timerStart) - m_timerFrames += frames; - m_frameCount += frames; -} - -const bool protocol_shoutcastClient::calculateDelay(const int autoDumpTime) -{ - bool delayed = false; - const double diff = ((m_frameCount * 1.0) / (max((time_t)1, (m_lastActivityTime - m_startTime))) - m_fps); - if (diff >= 0.0) - { - // if we're at the limit then we're going to need to sit and spin - // which will need to be a bit short of the required frame rate - // so that we've got a bit of leeway on scheduling delays, etc - // determine things based on the 'next' second when working out - // the differential as that's how long we want to wait to run - m_result.schedule((int)(m_result.m_currentTime - (__uint64)(m_lastActivityTime * 1000))); - delayed = true; - } - - m_result.write(); - if (autoDumpTime != -1) - { - m_result.timeout(autoDumpTime); - } - else - { - m_result.timeoutSID(m_streamID); - } - return delayed; -} - - -int protocol_shoutcastClient::doSend(const bool debug, const time_t cur_time, - const int autoDumpTime, int adjust) throw(runtime_error) -{ - int l = (adjust ? adjust : (int)m_output.size()), rval = -1; - if (l == 0) return 0; - if (l > 0) - { - if (!gOptions.forceShortSends()) - { - rval = send ((const char*)&m_output[0], l, 0); - } - else - { - static unsigned int v = 0; - if (((++v) % 7) == 0) - { - char ch = 0; - rval = ::recv(m_socket, &ch, 1, MSG_DONTWAIT | MSG_PEEK); - l = 1; - } - else - { - rval = send ((const char*)&m_output[0], l, 0); - } - } - } - if (rval > 0) - { - m_totalBytesSent += rval; - if (rval < l) - m_result.timeout (0,100); - else - m_result.timeout (0,10); - return rval; - } - - if (rval == 0) - { - if (!m_ignoreDisconnect && debug) - ELOG (m_clientLogString + "Remote socket closed while sending data.", LOGNAME, m_streamID); - throwEx(""); - } - if (rval < 0) - { - rval = socketOps::errCode(); - if (rval != SOCKETOPS_WOULDBLOCK) - { - if (debug && ( -#ifdef _WIN32 - (rval == WSAECONNABORTED) || (rval == WSAECONNRESET) -#else - (rval == ECONNABORTED) || (rval == ECONNRESET) || (rval == EPIPE) -#endif - )) - DLOG (m_clientLogString + "Socket error while waiting to send data. " + socketErrString(rval), LOGNAME, m_streamID); - throwEx(""); - } - - m_result.schedule(); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - - rval = 0; - } - return rval; -} - -void protocol_shoutcastClient::checkListenerIsValid(const bool debug) throw(std::runtime_error) -{ - char ch = 0; - int rval = ::recv(m_socket, &ch, 1, MSG_DONTWAIT | MSG_PEEK); - if (rval == 0) - { - throwEx((!m_ignoreDisconnect && debug ? (m_clientLogString + - "Remote socket closed while sending data.") : (utf8)"")); - } - if (rval < 0) - { - rval = socketOps::errCode(); - if (rval != SOCKETOPS_WOULDBLOCK) - { - throwEx((debug ? ((( - #ifdef _WIN32 - (rval == WSAECONNABORTED) || (rval == WSAECONNRESET) - #else - (rval == ECONNABORTED) || (rval == ECONNRESET) || (rval == EPIPE) - #endif - ) ? (utf8)"" : m_clientLogString + - "Socket error while waiting to send data. " + - socketErrString(rval))) : (utf8)"")); - } - } -} - -const utf8 protocol_shoutcastClient::getContainer() const -{ - return ((m_clientType & streamData::FLV) ? "video/x-flv" : - ((m_clientType & streamData::M4A) ? "audio/mp4" : - ((m_clientType & streamData::SHOUTCAST2) ? "misc/ultravox" : ""))); -} - -void protocol_shoutcastClient::authForStream(streamData *_sd) -{ - streamData *sd = (_sd ? _sd : streamData::accessStream(m_streamID)); - if (sd) - { - if (!sd->radionomyID().empty() && sd->streamAdvertMode()) - { - httpHeaderMap_t vars; - auth::auth_info *info = new auth::auth_info(); - const streamData::streamInfo &stream = sd->getInfo(); - - vars["action"] = "listener_add"; - vars["tstamp"] = tos(::time(NULL)); - vars["host"] = sd->streamPublicIP(); - vars["radionomyid"] = vars["ref"] = sd->radionomyID(); - vars["id"] = tos(m_unique); - vars["ip"] = m_clientAddr; - vars["srvid"] = stream.m_serverID; - if (m_queryParams.empty()) - vars["mount"] = getStreamPath (m_streamID); - else - vars["mount"] = getStreamPath (m_streamID) + "?" + m_queryParams; - - vars["agent"] = m_userAgent; - vars["referer"] = m_referer; - vars["bitrate"] = tos(sd->streamBitrate()); - vars["codec"] = sd->streamContentType(); - vars["contr"] = getContainer(); - info->m_dataType = sd->streamUvoxDataType(); - if (!_sd) - { - sd->releaseStream(); - } - - info->post = encodeVariables(vars); - info->client = this; - info->sid = m_streamID; - - if (_sd) - { - info->delayed_auth = true; - info->group = 0; - } - auth::schedule(info); - return; - } - - if (!_sd) - { - sd->releaseStream(); - } - } - - if (!_sd) - { - // if we need to auth after the listener - // joined the stream due to DNAS / stream - // start-up then we don't want to re-add - threadedRunner::scheduleRunnable(this); - } -} - -void protocol_shoutcastClient::return_403() -{ - m_outBuffer = (const utf8::value_type*)"HTTP/1.1 403 Forbidden\r\n" - "Connection:close\r\n\r\n"; - m_outBufferSize = 44; - m_lastActivityTime = ::time(NULL); -} - -// create W3C entry. Entries describe the duration a client has listened to a specific title. -// the entry is generated on a title change, or when the client disconnects -void protocol_shoutcastClient::doLogW3C(const utf8 &title) throw() -{ - if (gOptions.w3cEnable()) - { - time_t durationOfTitle = (::time(NULL) - m_lastTitleTime); - w3cLog::log(m_streamID, m_clientAddr, m_clientHostName, title, - m_userAgent, m_bytesSentForCurrentTitle, durationOfTitle, - (int)(durationOfTitle ? (8 * m_bytesSentForCurrentTitle) / durationOfTitle : 0)); - - setW3CState(); - } -} - -#if 0 -const bool protocol_shoutcastClient::handleNoData(const utf8 &logString, const int remainder, - const streamData::ringBufferAccess_t amt, - const int autoDumpTime, const time_t cur_time, - const bool sc2) -{ - // nothing in the source - // if the source has gone away, and we have a backup file, send it. - bool sendBackupFile = false, ret = false; - if (!streamData::isSourceConnected(m_streamID)) - { - const int backuploop = gOptions.getBackupLoop(m_streamID); - if (!backuploop || (m_backupLoopTries <= backuploop)) - { - acquireBackupFile(0, sc2); - } - else if (backuploop && (m_backupLoopTries < backuploop)) - { - m_backupFile.clear(); - } - sendBackupFile = !m_backupFile.empty(); - - if (sendBackupFile && backuploop && (m_backupLoopTries > backuploop)) - { - // clear trying to play the backup - sendBackupFile = false; - m_backupFile.clear(); - } - } - else - { - // if we're here then we'll have tried to do something - // but are very likely are not able to due to being at - // the frame rate limit or we're not able to send yet - // but we need to move the readPtr on if anything was - // read was well as then making sure that we maintain - // the remainder otherwise we can gltich on playback. - if (amt > 0) - { - m_readPtr += amt; - } - - if (!remainder) - { - m_remainder.clear(); - } - - // if we're starting and we're not able to correctly - // sync to the stream then this will abort otherwise - // we can potentially sit and spin which isn't good. - if (!m_frameCount && (remainder > 0) && (remainder == (int)amt)) - { - m_ignoreDisconnect = true; - ELOG(m_clientLogString + logString + " client connection closed. Unable to sync to the stream (" + - tos(::time(NULL) - m_startTime).c_str() + " seconds)" + " Agent: `" + m_userAgent + "', UID: " + - tos(m_unique) + ", GRID: " + tos(getGroup()) + " [amt=" + tos(amt) + ", rem=" + tos(remainder) + "]"); - m_result.done(); // state_Close - m_result.write(); - m_result.timeout(autoDumpTime); - } - } - - if (sendBackupFile) - { - // we also reset the remainder handling as - // there is no need to send the remainder. - m_remainder.clear(); - // this is to clear up things with the stream - // as we can otherwise be in a weird state if - // the source then later returns and we have - // a listener still present via backup mode. - if (m_streamData) - { - m_streamData->releaseStream(); - m_streamData = 0; - } - ++m_backupLoopTries; - ret = true; // state_SendBackupFile - m_result.run(); - } - else - { - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - m_result.read(m_limitTrigger.test()); - if (m_streamData) - { - m_streamData->scheduleLimitTrigger(&m_limitTrigger, m_readPtr, sc2); - } - else - { - m_result.done(); // state_Close - m_result.write(); - m_result.timeout(autoDumpTime); - } - } - - return ret; -} -#endif - -void protocol_shoutcastClient::createFrameRate(const bool mp3, const int samplerate) -{ - // now we have some stream data we can create - // a fps for this which we'll assume standard - // rates if not all of the info is available. - // this is mainly for AAC where we assume a - // 44.1kHz samplerate (~43.06 fps) as default - if (!m_fps) - { - m_fps = (mp3 ? 1000.0 / 26 : ((1.0 / (1024.0 / (samplerate > 0 ? samplerate : 44100))))); - } -} - -void protocol_shoutcastClient::setupWorkingBuffer(const std::vector<__uint8>& data, std::vector<__uint8>& tempBuf, int& len) throw() -{ - // if we had anything left over then now we - // need to copy it back into the buffer and - // adjust the max data amount to be read in - if (!m_remainder.empty() && ((len + m_remainder.size()) <= (BUF_SIZE * 4))) - { - tempBuf = m_remainder; - tempBuf.insert(tempBuf.end(), data.begin(), data.end()); - len += (int)m_remainder.size(); - } - else if (len > 0) - { - tempBuf = data; - } - m_remainder.clear(); -} - -#if 0 -const int protocol_shoutcastClient::doUvoxFrameSync(const int type, const bool debug, const int len, - const int offset, const std::vector<__uint8>& buf, - const time_t cur_time, int &frames, bool &advert, - const bool fill_remainder) throw() -{ - bool mp3; - if (streamData::isAllowedType(type, mp3)) - { - if (!m_shortSend.empty()) - { - m_output.insert(m_output.end(), m_shortSend.begin(), m_shortSend.end()); - m_shortSend.clear(); - - if (!fill_remainder) - { - // for intro / backup / advert then it's - // better to just send what was left and - // then look at processing new when this - // is empty else it'll duplicate output. - return 0; - } - } - - int end = 0; - if ((len > 8) && !buf.empty()) - { - int last_size = 0; - for (int i = 0; (i < (len - 8)) && !iskilled();) - { - const uv2xHdr *voxHdr = (const uv2xHdr*)(&(buf[i + offset])); - const int msgLen = ntohs(voxHdr->msgLen); - const int found = ((voxHdr->sync == UVOX2_SYNC_BYTE) && - (msgLen > UV2X_OVERHEAD) && - (msgLen <= MAX_PAYLOAD_SIZE) ? (msgLen + UV2X_OVERHEAD) : 0); - - // need to find frames and that the input is the correct format! - // - // is a bit of a pain for AAC though as we've already done the - // rough bitrate match when the advert / intro / backup was read - // we'll just pass things through as though the bitrate is ok... - if ((found > 0) && (found <= len)) - { - if (!frames) - { - end = (i + offset); - protocol_shoutcastClient::createFrameRate(mp3, (m_streamData ? m_streamData->streamSampleRate() : 0)); - } - - i += (last_size = found); - - // only count valid full-size frames - if (i <= len) - { - if (advert) - { - // skip over the advert trigger - end += 8; - } - - const std::vector<__uint8>::const_iterator pos = buf.begin(); - m_output.insert(m_output.end(), pos + end, pos + (end + last_size)); - end += last_size; - - // we only want to count audio frames and not metadata - const __uint16 voxMsgType = ntohs(voxHdr->msgType); - if ((voxMsgType >= 0x7000) && (voxMsgType < 0x9000)) - { - ++frames; - } - - // we use this to help clamp to the desired frame - // rate as well as not sending anything else asap - if (advert || (gOptions.rateLimit() ? (frames > m_fps) || - ((m_frameCount + frames) > calculateFrameLimit(cur_time)) : 0)) - { - break; - } - } - } - else - { - // we now look for the "SCAdvert" marker - // for detecting if we've got an advert. - if ((i <= len + 8) && ((buf[i + offset]) == 'S') && ((buf[i + offset + 1]) == 'C')) - { - if (!memcmp(&buf[i + offset], "SCAdvert", 8)) - { - advert = true; - i += 8; - } - else - { - ++i; - } - } - else - { - // if we found something but there is not enough - // data in the read buffer then we'll abort asap - if ((found > 0) && (found > len)) - { - break; - } - - if (m_frameCount && debug) - { - DLOG(m_clientLogString + "Bad frame found at pos: " + - tos(i) + " [" + tos(found) + "]"); - } - - // otherwise we just need to move on and keep - // looking for what is a valid starting frame - ++i; - } - } - } - } - - if (fill_remainder && !buf.empty()) - { - const int remainder = (len - end); - if (remainder > 0) - { - const std::vector<__uint8>::const_iterator pos = buf.begin(); - m_remainder.insert(m_remainder.end(), pos + end, pos + (end + remainder)); - } - return remainder; - } - } - return 0; -} -#endif - - -const int protocol_shoutcastClient::doFrameSync(const int type, const bool debug, const int len, - const int offset, const std::vector<__uint8>& inbuf, - const time_t /*cur_time*/, const int bitrate, - const unsigned int samplerate, int &frames, - bool &advert, bool fill_remainder) throw() -{ - bool mp3; - int end = 0; - bool VBR = m_streamData ? m_streamData->streamIsVBR() : false; - - if (streamData::isAllowedType(type, mp3)) - { - int last = min (len, (int)(inbuf.size() - offset)); - const unsigned char *buf; - - if (m_remainder.empty () || offset < last) - { - buf = &inbuf [offset]; - //DLOG ("last " + tos(last) + ", off " + tos(offset)); - } - else - { - // const std::vector<__uint8>::const_iterator pos = inbuf.begin(); - size_t cc = min (inbuf.size(), (size_t)len); - - cc = min (cc, (size_t)4096); - if (cc > m_remainder.size()) - cc -= m_remainder.size(); - if (cc < 1 || cc > inbuf.size()) - { - ILOG ("sync, cc is " + tos(cc)); - abort(); - } - m_remainder.insert (m_remainder.end(), inbuf.begin(), inbuf.begin() + cc); - - buf = &m_remainder [0]; - last = min (len, (int)m_remainder.size()); - fill_remainder = false; - // DLOG ("merged remainder, len " + tos(len) + " now " + tos (last) + ", added " + tos(cc)); - } - - if (last > 8) - { - int last_size = 0; - bool report_frame_settings = m_streamData ? true : false; - - fill_remainder = false; - - for (int i = 0; (i < last-8) && !iskilled();) - { - unsigned int read_samplerate = 0; - int read_bitrate = bitrate; - //const char* f = (const char *)&(buf[(i + offset)]); - const int found = (mp3 ? getMP3FrameInfo ((char*)buf+i, &read_samplerate, &read_bitrate) : - getADTSFrameInfo ((char*)buf+i, &read_samplerate)); - - if (found > len) // do we need more - break; - if (found > 0) - { - bool bitrate_odd = (VBR || (read_bitrate == 0 || read_bitrate == bitrate)) ? false : true; - bool srate_odd = (samplerate == 0 || samplerate == read_samplerate) ? false : true; - - // need to find frames and that the input is the correct format! - // - // is a bit of a pain for AAC though as we've already done the - // rough bitrate match when the advert / intro / backup was read - // we'll just pass things through as though the bitrate is ok... - if (report_frame_settings && (bitrate_odd || srate_odd)) - { - utf8 msg = m_clientLogString + "Frame settings changed, could cause playback problems:"; - if (bitrate_odd) - { - msg += " bitrate " + tos(read_bitrate) + "(" + tos(bitrate) + ")"; - m_streamData->m_streamInfo.m_streamBitrate = read_bitrate; - } - if (srate_odd) - { - msg += " samplerate " + tos(read_samplerate) + "(" + tos(samplerate) + ")"; - } - WLOG (msg, LOGNAME, m_streamID); - protocol_shoutcastClient::createFrameRate(mp3, read_samplerate); - report_frame_settings = false; - } - if (!frames) - { - end = i; - protocol_shoutcastClient::createFrameRate(mp3, read_samplerate); - } - - i += (last_size = found); - - // only count valid full-size frames - if (i <= last) - { - processFrame (type, buf + end, last_size); - ++frames; - end += last_size; - if (m_output.size() > SEND_SIZE) - break; - } - else - { - // DLOG ("EOB, " + tos (i) + ", " + tos(offset) + ", " + tos(inbuf.size())); - if (m_remainder.empty()) - { - if (i+offset > inbuf.size()) - fill_remainder = true; - } - else if (end + offset < inbuf.size()) - fill_remainder = true; - break; - } - continue; - } - // we now look for the "SCAdvert" marker - // for detecting if we've got an advert. - if (i < (len - 8) && ((buf[i]) == 'S') && ((buf[i+1]) == 'C')) - { - if (!memcmp(&buf[i], "SCAdvert", 8)) - { - if (frames == 0) - { - // DLOG ("Found SCAdvert"); - advert = true; - end += 8; - m_remainder.clear(); - } - break; - } - } - if (m_frameCount && debug) - { - DLOG(m_clientLogString + "Bad frame found at pos: " + - tos(i) + " [" + tos(found) + "], " + - tos(read_bitrate) + "(" + tos(bitrate) + "), " + - tos(read_samplerate) + "(" + tos(samplerate) + ")", LOGNAME, m_streamID); - } - // looking for what is a valid starting frame - ++i; - } - } - else - fill_remainder = true; - - if (m_remainder.empty() == false) - { - if (last < m_remainder.size()) - fill_remainder = false; - if (frames) - m_remainder.clear(); - } - if (last < (inbuf.size() - offset)) - fill_remainder = false; - - if (fill_remainder) - { - const int remainder = (last - end); - if (remainder > 0) - m_remainder.insert(m_remainder.end(), buf + end, buf + (end + remainder)); - } - } - return (len - end); -} - - -void protocol_shoutcastClient::processFrame (int, const unsigned char *buf, unsigned int len) -{ - //#define USE_CHUNKED -#ifdef USE_CHUNKED - const utf8 chunked_start (tohex(len) + "\r\n"), chunked_end("\r\n"); - m_output->insert (m_output->end(), chunked_start.begin(), chunked_start.end()); -#endif - //const std::vector<__uint8>::const_iterator pos = buf.begin(); - m_output.insert (m_output.end(), buf, buf + len); -#ifdef USE_CHUNKED - m_output.insert (m_output.end(), chunked_end.begin(), chunked_end.end()); -#endif -} - - -const int protocol_shoutcastClient::addClient() -{ - size_t stream_id = (gOptions.read_stream_ripFile(m_streamID) && !gOptions.stream_ripFile(m_streamID).empty()) ? m_streamID : 0; - - return stats::addClient (m_streamID, m_clientHostName, m_clientAddr, m_userAgent, - g_ripList.find (m_clientAddr, stream_id), m_unique, this); -} - - -void protocol_shoutcastClient::reportNewListener(const utf8 &logString) -{ - if (!logString.empty() && gOptions.logClients()) - { - if (m_removeClientFromStats) - { - // setGroup (500); - // ILOG(m_clientLogString + logString + " client connection accepted. User-Agent: `" + - // m_userAgent + "', UID: " + tos(m_unique) + ", GRID: " + tos(getGroup()), LOGNAME, m_streamID); - utf8 s = m_clientLogString + logString + " client connection accepted. User-Agent: `" + - m_userAgent + "', UID: " + tos(m_unique) + ", GRID: " + tos(getGroup()); - ILOG (s, LOGNAME, m_streamID); - } - else - { - m_ignoreDisconnect = true; - } - } -} - -void protocol_shoutcastClient::reportStopListener() -{ - if (m_removeClientFromStats && m_streamData && m_streamData->streamPublic()) - { - metrics::metrics_listener_drop(*this); - } -} - -const bool protocol_shoutcastClient::processAdvertTrigger(const bool advert) -{ - if (advert && m_streamData) - { - // check if we've got an advert trigger and if the stream is either - // public or it is private but the DNAS is running in any CDN mode. - if ((m_streamData->m_streamInfo.m_streamPublic || - (!gOptions.cdn().empty())) && - // if a CDN slave then we're ok to send the stream but we don't - // want to be sending the adverts to it as those should instead - // be actioned on the slave's ->listener handling and not here. - !isCDNSlave(m_streamID)) - { - // DLOG ("in trigger with g " + tos(m_group)); - if ((getGroup() > 0) || m_streamData->m_adTest) - { - if (m_adAccess.haveAdverts(m_streamID, m_streamData->advertGroups, m_readPtr)) - { - time_t now = ::time(NULL); - ILOG(m_clientLogString + "Transitioning to advert(s) [Agent: `" + - m_userAgent + "', UID: " + tos(m_unique) + ", GRID: " + tos(getGroup()) + "]", LOGNAME, m_streamID); - m_lastActivityTime = now; - stats::updateTriggers(m_streamID, m_unique); - m_adAccess.total_processed = 0; - m_adAccess.start_time = now; - m_remainder.clear(); - m_result.schedule(60); - m_result.timeoutSID(m_streamID); - return true; - } - else - { - AD_DEBUG_LOG("[ADVERT sid=" + tos(m_streamID) + "] Advert trigger detected - no advert(s) available " - "[Agent: `" + m_userAgent + "', UID: " + tos(m_unique) + ", Group: " + tos(getGroup()) + "]", LOGNAME, m_streamID); - } - } - } - } - return false; -} - -const utf8 protocol_shoutcastClient::fixICYMetadata(utf8 metadata) -{ - // we use this to provide a nicer title to clients when the advert update occurs - // for detected relays, we will skip over the filtering so it will be relayed on - if (!metadata.empty() && !(((streamData::source_t)(m_clientType & streamData::RELAY))) && - !metadata.find(utf8("StreamTitle='Advert:")) && !metadata.find(utf8("StreamTitle='Advert!"))) - { - // got a first matching block - metadata = metadata.replace(13, 7, (utf8)""); - - // look for an end block - utf8::size_type pos = metadata.find(utf8("Advert:")); - if (pos != utf8::npos) - { - metadata = metadata.replace(pos, 7, (utf8)""); - } - metadata = stripWhitespace(metadata); - } - return metadata; -} - -// create W3C entry. Entries describe the duration a client has listened to a specific title. -// the entry is generated on a title change, or when the client disconnects -void protocol_shoutcastClient::logW3C() throw() -{ - utf8 title; - if (!m_lastSentMetadata.empty()) - { - utf8::size_type p1 = m_lastSentMetadata.find(utf8("itle='")); - if (p1 != utf8::npos) - { - p1 += 6; - utf8::size_type p2 = m_lastSentMetadata.find(utf8("';"),p1); - if (p2 != utf8::npos) - { - title = m_lastSentMetadata.substr(p1, p2 - p1); - } - } - } - doLogW3C(title); -} - -void protocol_shoutcastClient::processTitleW3C() throw() -{ - if (gOptions.w3cEnable()) // put inside this if block, because this can slow us down a bit - { - if (m_metaIntervalCounter >= m_metaInterval) - { - m_metaIntervalCounter = 0; - const utf8 metadata = fixICYMetadata((m_streamData ? m_streamData->getSc1Metadata(m_readPtr).m_songTitle : "")); - if (m_lastSentMetadata != metadata) - { - logW3C(); - m_lastSentMetadata = metadata; - } - } - } -} - -void protocol_shoutcastClient::streamMovedOrRejected(const utf8 &logString, const bandWidth::usageType_t type, - const utf8 &serverUrl, const int mode) throw() -{ - // if we get to here then we attempt to redirect the clients to the moved url - // which is useful if the stream has moved hosting or it has been deprecated. - if (!mode) - { - m_outBuffer = MSG_HTTP503; - bandWidth::updateAmount(type, (m_outBufferSize = MSG_HTTP503_LEN)); - } - else - { - const utf8::size_type check = (!serverUrl.empty() ? serverUrl.find(utf8("://")) : 0); - if (check == utf8::npos) - { - m_OKResponse = http302("http://" + serverUrl); - } - else - { - m_OKResponse = http302(serverUrl); - } - - m_OKResponse = http302(serverUrl); - m_outBuffer = m_OKResponse.c_str(); - bandWidth::updateAmount(type, (m_outBufferSize = (int)m_OKResponse.size())); - } - m_ignoreDisconnect = true; - - if (gOptions.logClients()) - { - switch (mode) - { - case 0: - { - ELOG(m_clientLogString + logString + " client connection " - "rejected. Max users reached. Agent: `" + m_userAgent + "'", LOGNAME, m_streamID); - break; - } - case 1: - { - WLOG(m_clientLogString + logString + " client connection rejected. Max users " - "reached. Redirecting to " + serverUrl + ". Agent: `" + m_userAgent + "'", LOGNAME, m_streamID); - break; - } - case 2: - { - WLOG(m_clientLogString + logString + " client connection rejected. Stream has " - "moved. Redirecting to " + serverUrl + ". Agent: `" + m_userAgent + "'", LOGNAME, m_streamID); - break; - } - } - } - - m_result.run(); - m_result.write(); - m_result.timeoutSID(m_streamID); -} - -void protocol_shoutcastClient::cleanup(const utf8 &logString, const bool debug, const bool , const bool altLog) throw(exception) -{ - if (debug) - { - DLOG(m_clientLogString + logString + " " + __FUNCTION__, LOGNAME, m_streamID); - } - - try - { - if (gOptions.logClients() && !m_ignoreDisconnect) - { - ILOG(m_clientLogString + logString + " client connection closed (" + - tos(::time(NULL) - m_startTime).c_str() + " seconds)" + " [Bytes: " + - tos(m_totalBytesSent).c_str() + "] Agent: `" + m_userAgent + - "', UID: " + tos(m_unique) + ", GRID: " + tos(getGroup()), LOGNAME, m_streamID); - } - - if (m_removeClientFromStats) - { - stats::removeClient(m_streamID, m_unique); - // create W3C entry. Entries describe the duration a client has listened to a specific title. - // the entry is generated on a title change, or when the client disconnects - if (!altLog) - { - logW3C(); - } - else - { - doLogW3C(); - } - } - - if (m_streamData) - { - releaseAdvert(); - m_streamData->advertGroups.detachGroupQueue (m_adAccess); - - reportStopListener(); - - m_streamData->releaseStream(); - m_streamData = 0; - } - } - catch(const exception &ex) - { - ELOG(ex.what()); - } -} - -const int protocol_shoutcastClient::processAdd(const utf8 &logString, const bandWidth::usageType_t type, - const utf8 &msg, const int msgLen, const utf8 &movedUrl, - const utf8 &serverUrl) throw() -{ - // if we've got a HEAD request then we need to just force things through - const int add = (!m_headRequest ? addClient() : 1); - if (add != 1) - { - if (!add) - { - utf8 backup_server = (m_streamData ? m_streamData->streamBackupServer() : ""); - if (backup_server.empty()) - { - streamMovedOrRejected(logString, type, movedUrl, 0); - } - else - { - streamMovedOrRejected(logString, type, serverUrl, 1); - } - } - else - { - m_outBuffer = msg.c_str(); - bandWidth::updateAmount(type, (m_outBufferSize = msgLen)); - - m_result.write(); - m_result.timeoutSID(m_streamID); - m_ignoreDisconnect = true; - - if (gOptions.logClients()) - { - const bool missing = (add == -1); - ELOG(m_clientLogString + logString + " client connection rejected. " - "Client connection " + (missing ? "missing a" : "from a banned") + - " user-agent" + (missing ? "." : ": `" + m_userAgent + "'"), LOGNAME, m_streamID); - } - } - } - return add; -} - -const bool protocol_shoutcastClient::processReject(const utf8 &logString, const bandWidth::usageType_t type, - const utf8 &msg, const int msgLen, int *read_bitrate, - int *dataType, const bool sc2) throw() -{ - m_outBuffer = msg.c_str(); - bandWidth::updateAmount(type, (m_outBufferSize = msgLen)); - - m_result.write(); - m_result.timeoutSID(m_streamID); - m_ignoreDisconnect = true; - if (gOptions.logClients()) - { - // to prevent some of the stats / logs getting skewed - // then we filter out the SHOUTcast site 'test' users - if (m_removeClientFromStats) - { - const utf8 movedUrl = gOptions.stream_movedUrl(m_streamID); - if (movedUrl.empty()) - { - *read_bitrate = acquireBackupFile(dataType, sc2); - if (!m_backupFile.empty()) - { - m_ignoreDisconnect = false; - return true;//goto fall_through; - } - else - { - ELOG(m_clientLogString + logString + " client connection rejected. " + - (!iskilled() ? "Stream not available as there is no source connected" : - "Server is shutting down") + ". Agent: `" + m_userAgent + "'", LOGNAME, m_streamID); - } - } - else - { - // if we get to here then we attempt to redirect the clients to the moved url - // which is useful if the stream has moved hosting or it has been deprecated. - streamMovedOrRejected(logString, type, movedUrl, 2); - } - } - } - return false; -} - - -void protocol_shoutcastClient::state_SendIntroFile() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - // DLOG(m_clientLogString + __FUNCTION__); -#endif - bool sc2 = (m_clientType & streamData::SHOUTCAST2) ? true : false; - - resetCommon(); - - time_t cur_time; - const bool debug = gOptions.HTTPClientDebug(); - const int autoDumpTime = detectAutoDumpTimeout (cur_time, m_streamID, (m_clientLogString + "Timeout waiting to send data")); - - if (m_timerStart == 0) - { - m_timerStart = cur_time - 10; // prime the rate regulation - m_timerFrames = (__uint64)m_fps * 10; - time_t conn = ::time(NULL) - m_startTime; - if (conn >= 0 && conn < 3) - m_timerStart -= (3 - conn); - } - if (m_frameCount > calculateFrameLimit(cur_time)) - { - m_result.schedule(150); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - //DLOG ("Limited at " + tos(m_frameCount)); - - return; - } - int amt = (int)(m_introFile.size() - m_introFileOffset); - if (amt == 0) - { - // we're done with the intro file - m_introFile.clear(); - m_introFile.resize(0); - m_introFileOffset = 0; - m_lastActivityTime = ::time(NULL); - setCallback (&protocol_shoutcastClient::state_Stream); - resetReadPtr (sc2); - m_result.run(); - } - else if (amt > 0) - { - checkListenerIsValid(debug); - - if (!m_lastSentMetadata.empty()) - { - logW3C(); - m_lastSentMetadata.clear(); - } - - amt = min(amt, SEND_SIZE); - - int len = (int)amt, - frames = 0; // this will be uvox frames as we pre-process earlier to ensure - // that the audio frames are frame-synced when this is created - bool advert = false; - if (m_output.size() < 2000) - { - int rval = doFrameSync(m_streamData->streamUvoxDataType(), debug, - len, m_introFileOffset, m_introFile, - cur_time, m_streamData->streamBitrate(), - m_streamData->streamSampleRate(), frames, advert); - m_introFileOffset += (len - rval); - //DLOG ("offset now " + tos (m_introFileOffset)); - updateFrameCount(frames, cur_time); - } - - int rval = doSend(debug, cur_time, autoDumpTime); - if (rval > 0) - { - bandWidth::updateAmount(bandWidth::CLIENT_HTTP_SENT, rval); - m_bytesSentForCurrentTitle += rval; - m_lastActivityTime = ::time(NULL); - if (rval < m_output.size()) - { - //DLOG ("short send " + tos(rval) + "/" + tos(m_output.size())); - m_output.erase (m_output.begin(), m_output.begin() + rval); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - m_result.write(); - return; - } - m_output.clear(); - } - m_result.schedule(20); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - } -} - - -void protocol_shoutcastClient::state_SendIntro() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - // AD_DEBUG_LOG(m_clientLogString + __FUNCTION__); -#endif - state_SendIntroFile(); - if (m_introFile.empty()) - { - acquireIntroFile(); - if (m_introFile.empty()) - { - setCallback (&protocol_shoutcastClient::state_Stream); - } - else - { - setCallback (&protocol_shoutcastClient::state_SendIntroFile); - } - } -} - - -void protocol_shoutcastClient::state_Stream() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - //DEBUG_LOG(m_clientLogString + __FUNCTION__); -#endif - - resetCommon(); - - const time_t cur_time = ::time(NULL); - const bool debug = gOptions.shoutcast1ClientDebug(); - const int autoDumpTime = gOptions.getAutoDumpTime(m_streamID); // don't want this value to change during this call - int remain = autoDumpTime - (int)(cur_time - m_lastActivityTime); - - if ((autoDumpTime > 0) && ((cur_time - m_lastActivityTime) >= autoDumpTime)) - { - throwEx((!m_ignoreDisconnect && debug ? - (m_clientLogString + "Timeout waiting to send data (" + - tos(cur_time) + " " + tos(m_lastActivityTime) + " [" + - tos(cur_time - m_lastActivityTime) + "] )") : (utf8)"")); - } - - bool advert = false; - bool sc2 = (m_clientType & streamData::SHOUTCAST2) ? true : false; - AOL_namespace::rwLock &lock = (sc2 ? m_streamData->m_sc21StreamLock : m_streamData->m_sc1StreamLock); - - do - { - int samplerate = (m_streamData ? m_streamData->streamSampleRate() : 0); - int bitrate = (m_streamData ? m_streamData->streamBitrate() : 0); - int type = (m_streamData ? m_streamData->streamUvoxDataType() : MP3_DATA); - - m_result.timeout (remain); - if (streamData::isSourceConnected (m_streamID) == false) - { - acquireBackupFile (0, sc2); - //DLOG ("listener detected source drop, backup " + utf8(m_backupFile.size() ? "present" : "not present")); - if (m_backupFile.size()) - { - setCallback (&protocol_shoutcastClient::state_SendBackupFile); - m_timerStart = 0; - m_backupLoopTries = 1; - m_result.run(); - return; - } - if (m_streamData == NULL) - { - m_result.schedule (300); - return; - } - } - - stackRWLock sl (lock, false, false); - if (sl.tryRdLock() == false) - { - m_result.schedule (3); - return; - } - int frames = 0; - - if (m_output.size() < 2000) - { - streamData::ringBufferAccess_t lag = ((sc2 ? m_streamData->m_sc21_ring_buffer : m_streamData->m_sc1_ring_buffer).m_writePtr - m_readPtr); - - if (lag == 0) - { - if (m_frameCount > calculateFrameLimit(cur_time)) - { - m_result.schedule(333); - } - else - { - m_result.schedule(150); - } - return; - } - - const streamData::ringBufferAccess_t offset = (m_readPtr & (sc2 ? m_streamData->m_sc21_ring_buffer : m_streamData->m_sc1_ring_buffer).m_ptrMask); - - if (lag > (sc2 ? m_streamData->m_sc21_ring_buffer : m_streamData->m_sc1_ring_buffer).m_data.size()) - break; // off the queue, lagging too much - - lag -= m_lagOffset; - - size_t remainder = doFrameSync (type, debug, (int)lag, (int)offset, - (sc2 ? m_streamData->m_sc21_ring_buffer : m_streamData->m_sc1_ring_buffer).m_data, - cur_time, bitrate, samplerate, frames, advert, true); - - m_readPtr += (lag-remainder); - updateFrameCount (frames, cur_time); - } - // processTitleW3C(); needs looking into - - // lets jump out if there isn't much to send except in cases where an advert, as we need to - // process the transistion - if (m_output.size() < 1000 && (frames || advert == false)) - { - //DLOG ("not enough to send really"); - m_result.schedule(150); - return; - } - int rval = doSend (debug, cur_time, autoDumpTime); - if (rval > 0) - { - bandWidth::updateAmount(bandWidth::CLIENT_V1_SENT, rval); - m_bytesSentForCurrentTitle += rval; - m_lastActivityTime = ::time(NULL); - - if (rval < m_output.size()) - { - // DLOG ("short send " + tos(rval) + "/" + tos(m_output.size())); - m_output.erase (m_output.begin(), m_output.begin() + rval); - // if we short send and don't need to transition to advert then jump out - if (advert == false) - { - m_result.schedule(80); // back off on sending too much - return; - } - } - else - m_output.clear(); - } - if (processAdvertTrigger(advert)) - { - // DLOG ("advert detected by listener"); - setCallback (&protocol_shoutcastClient::state_SendAdverts); - m_result.schedule(200); - } - else - m_result.schedule(10); - return; - } while (0); - - m_result.schedule(); - resetReadPtr (sc2); -} - - - -// handle state where we are sending backup files -void protocol_shoutcastClient::state_SendBackupFile() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - // DEBUG_LOG(m_clientLogString + __FUNCTION__); -#endif - bool sc2 = (m_clientType & streamData::SHOUTCAST2) ? true : false; - - resetCommon(); - - int amt = (int)(m_backupFile.size() - m_backupFileOffset); - - if (amt == 0) - { - const int backuploop = gOptions.getBackupLoop(m_streamID); - if (!backuploop || (m_backupLoopTries <= backuploop)) - { - // we're done with the backup file. get more data - acquireBackupFile (0, sc2); - if (m_backupFile.empty()) - { - ++m_backupLoopTries; - resetReadPtr (sc2); - m_lastActivityTime = ::time(NULL); - setCallback (&protocol_shoutcastClient::state_Stream); - return; - } - } - else if (backuploop && (m_backupLoopTries < backuploop)) - { - m_backupFileOffset = 0; - m_backupFile.clear(); - } - else - { - resetReadPtr (sc2); - m_backupFileOffset = 0; - m_lastActivityTime = ::time(NULL); - setCallback (&protocol_shoutcastClient::state_Stream); - } - m_result.run(); - } - else if (amt > 0) - { - const bool debug = gOptions.HTTPClientDebug(); - checkListenerIsValid(debug); - - time_t cur_time = ::time(NULL); - const int autoDumpTime = detectAutoDumpTimeout (cur_time, m_streamID, (m_clientLogString + "Timeout waiting to send data")); - - if (m_timerStart == 0) - { - int adj = m_frameCount < 50 ? 3 : 10; - m_timerStart = cur_time - 10; // prime the rate regulation, make it on the slow side to rejoin queue - m_timerFrames = (__uint64)m_fps * adj; - } - if (m_frameCount > calculateFrameLimit(cur_time)) - { - m_result.schedule (333); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - return; - } - - if (!m_lastSentMetadata.empty()) - { - logW3C(); - m_lastSentMetadata.clear(); - } - - amt = min(amt, SEND_SIZE); - int len = (int)amt, backup_type = MP3_DATA, - frames = 0; // this will be uvox frames as we pre-process earlier to ensure - // that the audio frames are frame-synced when this is created - if (!m_streamData) - { - utf8 backupFile = gOptions.stream_backupFile(m_streamID); - if (!gOptions.read_stream_backupFile(m_streamID)) - { - backupFile = gOptions.backupFile(); - } - if (!backupFile.empty()) - { - backup_type = ((backupFile.rfind((utf8)".aac") == utf8::npos) ? MP3_DATA : AACP_DATA); - } - } - - bool advert = false; - if (m_output.size() < 4096) - { - int rval = doFrameSync((m_streamData ? m_streamData->streamUvoxDataType() : backup_type), - debug, len, m_backupFileOffset, m_backupFile, cur_time, - (m_streamData ? m_streamData->streamBitrate() : 0), - (m_streamData ? m_streamData->streamSampleRate() : 0), frames, advert); - m_backupFileOffset += (len - rval); - updateFrameCount (frames, cur_time); - } - int rval = doSend(debug, cur_time, autoDumpTime); - - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - if (rval > 0) - { - bandWidth::updateAmount(bandWidth::CLIENT_HTTP_SENT, rval); - m_bytesSentForCurrentTitle += rval; - m_lastActivityTime = cur_time; - if (rval < m_output.size()) - { - // DLOG ("short send " + tos(rval) + "/" + tos(m_output.size())); - m_output.erase (m_output.begin(), m_output.begin() + rval); - return; - } - m_output.clear(); - // look at moving now that a complete frame is sent - if (streamData::isSourceConnected (m_streamID)) - { - if (m_streamData) - { - m_streamData->releaseStream(); - } - m_streamData = streamData::accessStream(m_streamID); - - if (m_streamData->m_sc1_packet_starts.size() == 0) - { - m_result.schedule (100); // no data from stream, so ignore for now. - return; - } - - // we're done with the backup file - m_backupFile.clear(); - m_backupFile.resize(0); - m_backupFileOffset = 0; - m_backupLoopTries = 0; - setCallback (&protocol_shoutcastClient::state_Stream); - resetReadPtr (sc2); - m_result.run(); - return; - } - m_result.schedule ((rval/512) + 15); - } - else - m_result.schedule(90); - } -} - - - -// handle state where we are sending advert content -void protocol_shoutcastClient::state_SendAdverts() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - //AD_DEBUG_LOG(m_clientLogString + __FUNCTION__); -#endif - - resetCommon(); - - streamData::specialFileData *ad = m_adAccess.getAd(m_streamID, m_streamData->advertGroups, !!m_streamData->m_adTest); - bool sc2 = (m_clientType & streamData::SHOUTCAST2) ? true : false; - - while (true) - { - if (ad) - { - std::vector<__uint8> &adBuffer = (sc2 ? ad->m_sc2Buffer : ad->m_sc1Buffer); - int amt = (ad ? (int)(adBuffer.size() - m_adAccess.offset) : 0); - - if (amt > 0) - break; - } - if (m_adAccess.anotherAd(m_streamID, m_streamData->advertGroups, !!m_streamData->m_adTest)) - { - ad = m_adAccess.getAd (m_streamID, m_streamData->advertGroups, !!m_streamData->m_adTest); - continue; - } - // no more adverts - m_lastActivityTime = ::time(NULL); - if (m_timerStart) - { - // add a small retry here to allow for queue priming after adverts - m_result.schedule (300); - m_result.timeoutSID(m_streamID); - m_timerStart = 0; - //DLOG ("kicking back to retry before transition"); - return; - } - setCallback (&protocol_shoutcastClient::state_Stream); - resetReadPtr (sc2); // this should do a search for a nearest matching frame - releaseAdvert(); - m_result.schedule (); - m_result.timeoutSID(m_streamID); - - ILOG(m_clientLogString + "Transitioning back to stream [Agent: `" + - m_userAgent + "', UID: " + tos(m_unique) + ", GRID: " + tos(getGroup()) + "]", LOGNAME, m_streamID); - return; - } - - try - { - std::vector<__uint8> &adBuffer = (sc2 ? ad->m_sc2Buffer : ad->m_sc1Buffer); - int amt = (ad ? (int)(adBuffer.size() - m_adAccess.offset) : 0); - const bool debug = gOptions.HTTPClientDebug(); - checkListenerIsValid(debug); - - time_t cur_time; - const int autoDumpTime = detectAutoDumpTimeout (cur_time, m_streamID, (m_clientLogString + "Timeout waiting to send data")); - - if (m_timerStart == 0) - { - m_timerStart = cur_time - 8; // prime the rate regulation, make it on the slow side to rejoin queue - m_timerFrames = (__uint64)m_fps * 8; - } - if (m_frameCount > calculateFrameLimit(cur_time)) - { - m_result.schedule(333); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - // DLOG ("throttle in send adverts, count " + tos(m_frameCount)); - return; - } - - if (!m_lastSentMetadata.empty()) - { - logW3C(); - m_lastSentMetadata.clear(); - } - - amt = min(amt, SEND_SIZE); - - int len = (int)amt, - frames = 0; // this will be uvox frames as we pre-process earlier to ensure - // that the audio frames are frame-synced when this is created - bool advert = false; - if (m_output.size() < 4096) - { - int rval = doFrameSync (m_streamData->streamUvoxDataType(), debug, len, - (int)m_adAccess.offset, adBuffer, - cur_time, m_streamData->streamBitrate(), - m_streamData->streamSampleRate(), frames, advert); - int processed = len - rval; - m_adAccess.offset += processed; - m_adAccess.total_processed += processed; - updateFrameCount (frames, cur_time); - } - int rval = doSend(debug, cur_time, autoDumpTime); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - if (rval > 0) - { - bandWidth::updateAmount(bandWidth::CLIENT_HTTP_SENT, rval); - m_bytesSentForCurrentTitle += rval; - m_lastActivityTime = ::time(NULL); - if (rval < m_output.size()) - { - // DLOG ("short send " + tos(rval) + "/" + tos(m_output.size())); - m_output.erase (m_output.begin(), m_output.begin() + rval); - return; - } - m_output.clear(); - } - m_result.write(); - } - catch (std::runtime_error &) - { - releaseAdvert(); - throw; - } -} - - -void protocol_shoutcastClient::state_SendText() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - // AD_DEBUG_LOG (m_clientLogString + __FUNCTION__); -#endif - - if (sendDataBuffer (m_streamID, m_outBuffer, m_outBufferSize, m_clientLogString)) - { - setCallback (); - } -} - -// wrapper for the StopAdRun, as we also need to kick off some listener metrics -void protocol_shoutcastClient::releaseAdvert () -{ - if (m_adAccess.inAdvertMode ()) - { - metrics::adSummary summary; - - summary.sid = m_streamID; - summary.path = getStreamPath (m_streamID); - summary.tstamp = ::time(NULL); - summary.id = m_adAccess.getCurrentTrigger()->m_id; - summary.sd = m_streamData; - metrics_adListener (*this, summary); - - m_adAccess.stopAdRun (m_streamID, m_streamData->advertGroups, false); - } -} diff --git a/Src/Plugins/DSP/sc_serv3/protocol_shoutcastClient.h b/Src/Plugins/DSP/sc_serv3/protocol_shoutcastClient.h deleted file mode 100644 index ab1bcb43..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_shoutcastClient.h +++ /dev/null @@ -1,209 +0,0 @@ -#pragma once -#ifndef protocol_shoutcastClient_H_ -#define protocol_shoutcastClient_H_ - -#include "threadedRunner.h" -#include "streamData.h" -#include "stats.h" -#include "bandwidth.h" -#include "protocol_HTTPStyle.h" - - -#pragma pack(push, 1) -class protocol_shoutcastClient: public runnable, public clientProtocol -{ -public: - friend class protocol_HTTPStyle; - - typedef void (protocol_shoutcastClient::*state_t)(); - protocol_shoutcastClient (protocol_HTTPStyle &hs, const streamData::streamID_t streamID, const uniString::utf8 &hostName, const uniString::utf8 &clientAddr, const uniString::utf8 &XFF, const streamData::source_t clientType); - - protocol_shoutcastClient(const socketOps::tSOCKET socket, const u_short port, - const streamData::source_t clientType, const uniString::utf8 &hostName, - const streamData::streamID_t streamID, const size_t unique, - const uniString::utf8 &userAgent, const uniString::utf8 &referer, - const uniString::utf8 &clientAddr, const uniString::utf8 &XFF, - const bool headRequest); - - virtual ~protocol_shoutcastClient() throw() - { - m_streamData = 0; - socketOps::forgetTCPSocket(m_socket); - } - - virtual void setIntro(vector<__uint8> &v, int uvoxDataType = MP3_DATA) { m_introFile = v; m_introFileOffset = 0; (void)uvoxDataType; } - - virtual void acquireIntroFile(const bool sc2 = false) throw(); - virtual int acquireBackupFile(int *dataType = 0, const bool sc2 = false) throw(); - - void kickNextRound() throw() { m_kickNextRound = true; } - - void setGroup(size_t group) throw() { m_adAccess.setGroup (group); } - const size_t getGroup() const throw() { return m_adAccess.getGroup(); } - - const size_t getUnique() const throw() { return m_unique; } - const streamData::source_t getClientType() const throw() { return m_clientType; } - const time_t getStartTime() const throw() { return m_startTime; } - - const uniString::utf8 getXFF() const throw() { return m_XFF; } - const uniString::utf8 getUserAgent() const throw() { return (!m_userAgent.empty() ? m_userAgent : EMPTY_AGENT); } - const uniString::utf8 getReferer() const throw() { return m_referer; } - - void return_403(); - - const streamData::ringBufferAccess_t resetReadPtr(std::vector<__uint8>& data, const bool sc2 = false) throw(); - void resetReadPtr(const bool sc2 = false) throw(); - void resetReadPtr (streamData::ringBufferAccess_t ptr, bool sc2) throw(); - - const int doTimeSlice(const bool sc2 = false) throw(std::exception); - void resetCommon() throw(); - - const bool sendText() throw(std::exception); - - void setupWorkingBuffer(const std::vector<__uint8>& data, std::vector<__uint8>& tempBuf, int& len) throw(); - - virtual void processFrame (int type, const unsigned char *buf, unsigned int len); - - const int doFLVFrameSync(const int type, const bool debug, const int offset, - const std::vector<__uint8>& buf, const time_t cur_time, - const int bitrate, const unsigned int samplerate, - int &len, int &frames, bool &advert, int ×tamp, - const bool fill_remainder = false) throw(); - - virtual const int doFrameSync(const int type, const bool debug, const int len, - const int offset, const std::vector<__uint8>& buf, - const time_t cur_time, const int bitrate, - const unsigned int samplerate, int &frames, - bool &advert, const bool fill_remainder = false) throw(); - - void createFrameRate(const bool mp3, const int samplerate); - const __uint64 calculateFrameLimit(const time_t cur_time = 0); - void updateFrameCount(const int frames, const time_t cur_time = 0); - const bool calculateDelay(const int autoDumpTime = -1); - virtual int doSend(const bool debug, const time_t cur_time, - const int autoDumpTime, int adjust = 0) throw(std::runtime_error); - void checkListenerIsValid(const bool debug) throw(std::runtime_error); - - void setW3CState() throw(); - const uniString::utf8 getContainer() const; - void authForStream(streamData *_sd = 0); - - const bool handleNoData(const uniString::utf8 &logString, const int remainder, - const streamData::ringBufferAccess_t amt, - const int autoDumpTime, const time_t cur_time, - const bool sc2 = false); - - void streamMovedOrRejected(const uniString::utf8 &logString, const bandWidth::usageType_t type, - const uniString::utf8 &serverUrl, const int mode) throw(); - - const bool processAdvertTrigger(const bool advert); - - const uniString::utf8 fixICYMetadata(uniString::utf8 metadata); - void logW3C() throw(); - void doLogW3C(const uniString::utf8 &title = "") throw(); - void processTitleW3C() throw(); - - const adGroupAccess &getAdAccess () const { return m_adAccess; } - void releaseAdvert(); - - const int processAdd(const uniString::utf8 &logString, const bandWidth::usageType_t type, - const uniString::utf8 &msg, const int msgLen, - const uniString::utf8 &movedUrl, const uniString::utf8 &serverUrl) throw(); - const bool processReject(const uniString::utf8 &logString, const bandWidth::usageType_t type, - const uniString::utf8 &msg, const int msgLen, int *read_bitrate, - int *dataType = 0, const bool sc2 = false) throw(); - - const int addClient(); - void reportNewListener(const uniString::utf8 &logString = ""); - void reportStopListener(); - - void cleanup(const uniString::utf8 &logString, const bool debug, - const bool sc2 = false, const bool altLog = false) throw(exception); - - virtual int detectAutoDumpTimeout (time_t &cur_time, const size_t streamID, const uniString::utf8 &msg) throw(runtime_error); - - virtual void state_AttachToStream() throw(exception) = 0; - virtual void state_Close() throw(std::exception) = 0; - virtual void state_InitiateStream() throw(std::exception) = 0; - virtual void state_SendText() throw(std::exception); - virtual void state_SendAdverts() throw(std::exception); - virtual void state_Stream() throw(std::exception); - virtual void state_SendBackupFile() throw(std::exception); - virtual void state_SendIntroFile() throw(std::exception); - virtual void state_SendIntro() throw(std::exception); - - virtual void setCallback (state_t callback = NULL, state_t next = NULL) = 0; - - friend class auth::authService; - friend void metrics::metrics_listener_new(const protocol_shoutcastClient &client); - friend void metrics::metrics_listener_drop(const protocol_shoutcastClient &client); - friend void stats::catchPreAddClients(const streamData::streamID_t id); - -protected: - uniString::utf8 m_clientHostName; - const streamData::streamID_t m_streamID; // stream ID for this connection - - const size_t m_unique; // clients' unique id - uniString::utf8 m_userAgent; // client's user agent string - uniString::utf8 m_referer; // client's referer string - uniString::utf8 m_queryParams; // client's query parameters - - streamData::source_t m_clientType; // stream client type - - bool m_removeClientFromStats; // do we have to do a stats::removeClient - bool m_kickNextRound; - bool m_headRequest; - bool m_ignoreDisconnect; // used to prevent the 'client connection closed (0 seconds) [Bytes: 0] Agent:' - // message if redirecting or if max limit was reached which keeps logs cleaner - - time_t m_startTime; // when connection started, used to implement listenerTime - time_t m_newListener; // when the new listener metric was sent - time_t m_timerStart; // for time regulated sending - __uint64 m_timerFrames; // amount sent during timer; - - streamData *m_streamData; - - uniString::utf8 m_clientLogString; - uniString::utf8 m_clientAddr; // client's address - uniString::utf8 m_XFF; - uniString::utf8 m_OKResponse; - - uniString::utf8 m_lastSentMetadata; // used for w3C tracking - - std::vector<__uint8> m_introFile; - int m_introFileOffset; - int m_backupFileOffset; - std::vector<__uint8> m_backupFile; - int m_backupLoopTries; - unsigned int m_lagOffset; - - adGroupAccess m_adAccess; - - //// stats for w3c logs - time_t m_lastTitleTime; // time of last title update used for w3c logs - __uint64 m_bytesSentForCurrentTitle; // bytes sent since last title change. used for w3c logs - __uint64 m_totalBytesSent; // total bytes sent whilst the connection is open - /////////////////////////// - - streamData::ringBufferAccess_t m_readPtr; // pointer into ring buffer (main playback) - - const uniString::utf8::value_type *m_outBuffer; // for outgoing text lines - int m_outBufferSize; - - unsigned short m_metaInterval; - unsigned short m_metaIntervalCounter; // counter for metadata updates - - double m_fps; - __uint64 m_frameLimit; // how many frames we're allowed - __uint64 m_frameCount; // how many frames we've provided - - std::vector<__uint8> m_shortSend; // used to keep a copy of the data from short sends - // which will be re-inserted into the output buffer - // before processing more audio data to the output. - std::vector<__uint8> m_remainder; - std::vector<__uint8> m_output; - -}; -#pragma pack(pop) - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_shoutcastSource.cpp b/Src/Plugins/DSP/sc_serv3/protocol_shoutcastSource.cpp deleted file mode 100644 index b8b3ec23..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_shoutcastSource.cpp +++ /dev/null @@ -1,439 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include "protocol_shoutcastSource.h" -#include "protocol_backup.h" -#include "streamData.h" -#include "global.h" -#include "bandwidth.h" -#include "MP3Header.h" -#include "ADTSHeader.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define DEBUG_LOG(...) do { if (gOptions.shoutcastSourceDebug()) DLOG(__VA_ARGS__); } while (0) -#define LOGNAME "SRC" - -protocol_shoutcastSource::protocol_shoutcastSource (microConnection &mc, const uniString::utf8 &password) throw (std::exception) - - : runnable (mc), m_srcPort(mc.m_srcPort), m_srcAddr(mc.m_srcAddress) -{ - m_srcStreamID = DEFAULT_SOURCE_STREAM; - m_denied = false; - m_remainder = new __uint8[BUF_SIZE * 4]; - m_remainderSize = 0; - m_outBuffer = NULL; - m_outBufferSize = 0; - m_streamData = NULL; - - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - // we're looking to see if this is an updated 1.x source - // which is able to indicate the stream # for the stream - // so that we're able to support multiple 1.x sources so - // we need to parse the password and extract the parts - utf8 m_srcPassword = password; - extractPassword(m_srcPassword, m_srcUserID, m_srcStreamID); - - // ensure that only valid stream id's are allowed to connect (1 -> 2147483647) - if (!m_srcStreamID || (m_srcStreamID > INT_MAX)) - { - m_denied = true; - ELOG(m_srcLogString + "Bad Stream ID (" + tos(m_srcStreamID) + "). Stream ID cannot be below 1 or above 2147483647."); - - m_outBuffer = MSG_BADSTREAMID; - bandWidth::updateAmount(bandWidth::SOURCE_V1_SENT, (m_outBufferSize = MSG_BADSTREAMID_LEN)); - m_state = &protocol_shoutcastSource::state_SendBuffer; - m_nextState = &protocol_shoutcastSource::state_CloseConnection; - return; - } - - // update the log message for the read stream number - m_srcLogString = srcAddrLogString (m_srcAddr, m_srcPort, m_srcStreamID); - - // if we have a moved stream then now we have the stream id - // then we need to check and block the source as applicable - utf8 movedUrl = gOptions.stream_movedUrl(m_srcStreamID); - - if (!movedUrl.empty()) - { - m_denied = true; - ELOG(m_srcLogString + "Shoutcast 1 source rejected. Stream is configured as having moved."); - - m_outBuffer = MSG_STREAMMOVED; - bandWidth::updateAmount(bandWidth::SOURCE_V1_SENT, (m_outBufferSize = MSG_STREAMMOVED_LEN)); - m_state = &protocol_shoutcastSource::state_SendBuffer; - m_nextState = &protocol_shoutcastSource::state_CloseConnection; - return; - } - - // as we are a v1 source then we must adhere to the master password - // instead of using a specific per stream password as in v2 streams - // though we also accept connections as sid=1 so check for that too - utf8 srcPassword = gOptions.stream_password(m_srcStreamID); - if (srcPassword.empty()) - { - srcPassword = gOptions.password(); - } - - if (m_srcPassword.empty() || (m_srcPassword != srcPassword)) - { - m_denied = true; - ELOG(m_srcLogString + "Shoutcast 1 source connection denied" + (m_srcUserID.empty() ? "" : " for user (" + m_srcUserID + ")") + - ". " + (m_srcPassword.empty() ? "Empty password not allowed." : "Bad password: " + m_srcPassword), LOGNAME, m_srcStreamID); - m_outBuffer = MSG_INVALIDPASSWORD; - bandWidth::updateAmount(bandWidth::SOURCE_V1_SENT, (m_outBufferSize = MSG_INVALIDPASSWORD_LEN)); - m_state = &protocol_shoutcastSource::state_SendBuffer; - m_nextState = &protocol_shoutcastSource::state_CloseConnection; - } - else - { - // if we've got a source already connected and it's not a backup - // then it's better that we just abort processing now than later - bool isSourceActive = false; - streamData *sd = streamData::accessStream(m_srcStreamID, isSourceActive); - if (sd && (isSourceActive == true) && (sd->isBackupStream(m_srcStreamID) == false)) - { - m_denied = true; - ELOG(m_srcLogString + "Shoutcast 1 source rejected. A source is already connected.", LOGNAME, m_srcStreamID); - m_outBuffer = MSG_STREAMINUSE; - bandWidth::updateAmount(bandWidth::SOURCE_V1_SENT, (m_outBufferSize = MSG_STREAMINUSE_LEN)); - m_state = &protocol_shoutcastSource::state_SendBuffer; - m_nextState = &protocol_shoutcastSource::state_CloseConnection; - } - else - { - ILOG(m_srcLogString + "Shoutcast 1 source connection starting.", LOGNAME, m_srcStreamID); - m_outBuffer = MSG_VALIDPASSWORD; - bandWidth::updateAmount(bandWidth::SOURCE_V1_SENT, (m_outBufferSize = MSG_VALIDPASSWORD_LEN)); - m_state = &protocol_shoutcastSource::state_SendBuffer; - m_nextState = &protocol_shoutcastSource::state_GetHeaders; - } - - if (sd) - { - sd->releaseStream(); - } - } -} - -protocol_shoutcastSource::~protocol_shoutcastSource() throw() -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - if (m_streamData) - { - streamData::streamSourceLost(m_srcLogString, m_streamData, m_srcStreamID); - m_streamData = 0; - } - - socketOps::forgetTCPSocket(m_socket); - forgetArray(m_remainder); - - if (!m_denied) - { - ILOG(m_srcLogString + "Shoutcast 1 source disconnected.", LOGNAME, m_srcStreamID); - } -} - - -void protocol_shoutcastSource::state_AnalyzeHeaders() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - int maxHeaderLineCount = gOptions.maxHeaderLineCount(); - if ((int)m_headers.size() >= maxHeaderLineCount) - { - m_denied = true; - throwEx(m_srcLogString + "Max icy header lines exceeded"); - } - - m_lineBuffer = stripWhitespace(m_lineBuffer); - if (m_lineBuffer.empty()) - { - // adjust icy headers for titleFormat and urlFormat - utf8 titleFormat = gOptions.titleFormat(); - utf8 urlFormat = gOptions.urlFormat(); - if (!titleFormat.empty()) - { - utf8::size_type pos = titleFormat.find(utf8("%s")); - m_headers["icy-name"] = (pos == utf8::npos ? titleFormat : titleFormat.replace(pos,2,m_headers["icy-name"])); - } - - if (!urlFormat.empty()) - { - utf8::size_type pos = urlFormat.find(utf8("%s")); - m_headers["icy-url"] = (pos == utf8::npos ? urlFormat : urlFormat.replace(pos,2,m_headers["icy-url"])); - } - - // dump icy headers to log - if (gOptions.shoutcastSourceDebug()) - { - for (map::const_iterator i = m_headers.begin(); i != m_headers.end(); ++i) - { - DEBUG_LOG(m_srcLogString + "Source client header [" + (*i).first + ":" + (*i).second + "]"); - } - } - - config::streamConfig stream; - const bool found = gOptions.getStreamConfig(stream, m_srcStreamID); - if (!found && gOptions.requireStreamConfigs()) - { - m_denied = true; - throwEx(m_srcLogString + "Shoutcast 1 source rejected. Stream " + - tos(m_srcStreamID) + " must be defined in config file"); - } - - // check that these bitrates are allowed (looking at both max and average values) - const int bitrate = getStreamBitrate(m_headers) * 1000; - int streamMaxBitrate = 0, streamMinBitrate = 0; - const int ret = gOptions.isBitrateDisallowed(m_srcStreamID, bitrate, streamMaxBitrate, streamMinBitrate); - if (ret) - { - m_denied = true; - utf8 mode = ((streamMaxBitrate == streamMinBitrate) ? "of" : (ret == 2 ? "up to" : "from")); - throwEx(m_srcLogString + "Shoutcast 1 source rejected. Only bitrates " + - mode + " " + tos((ret == 1 ? streamMinBitrate : streamMaxBitrate) / 1000) + - " kbps are allowed - detected " + tos(bitrate / 1000) + " kbps."); - } - - m_streamData = streamData::createStream(streamData::streamSetup(m_srcLogString, m_srcAddr, - (found ? stream.m_authHash : ""), m_srcUserID, "", - stream.m_backupUrl.url(), streamData::SHOUTCAST1, - m_srcStreamID, m_srcPort, stream.m_maxStreamUser, - stream.m_maxStreamBitrate, stream.m_minStreamBitrate, - stream.m_allowPublicRelay, false, getStreamSamplerate(m_headers), - mapGet(m_headers, "icy-vbr", (bool)false), m_headers)); - if (!m_streamData) - { - m_denied = true; - ELOG(m_srcLogString + "Shoutcast 1 source rejected. A source is already connected."); - m_outBuffer = MSG_STREAMINUSE; - bandWidth::updateAmount(bandWidth::SOURCE_V1_SENT, (m_outBufferSize = MSG_STREAMINUSE_LEN)); - m_state = &protocol_shoutcastSource::state_SendBuffer; - m_nextState = &protocol_shoutcastSource::state_CloseConnection; - m_result.run(); - return; - } - - utf8 sourceIdent = mapGet(m_headers, "user-agent", utf8()); - m_streamData->updateSourceIdent(sourceIdent); - - m_state = &protocol_shoutcastSource::state_GetStreamData; - m_result.read(); - } - else - { - // find the colon that divides header lines into key/value fields - utf8::size_type pos = m_lineBuffer.find(utf8(":")); - utf8 key = toLower(stripWhitespace(m_lineBuffer.substr(0, pos))); - if (pos == utf8::npos) - { - if (!key.empty() && ((key == "icy-name") || (key == "icy-url"))) - { - // allow through icy-name and icy-url if there is - // a titleformat and urlformat to use respectively - } - else - { - m_denied = true; - throwEx(m_srcLogString + "Shoutcast 1 source connection rejected. " - "Bad icy header string [" + m_lineBuffer + "]"); - } - } - - utf8 value = stripWhitespace(m_lineBuffer.substr(pos+1)); - if (key.empty() || value.empty()) - { - if (!key.empty() && value.empty()) - { - if (key == "icy-genre") - { - value = "Misc"; - } - else if (((key == "icy-name") && !gOptions.titleFormat().empty()) || - ((key == "icy-url") && !gOptions.urlFormat().empty())) - { - // allow through icy-name and icy-url if there is - // a titleformat and urlformat to use respectively - } - else - { - if (key == "icy-url") - { - value = "http://www.shoutcast.com"; - } - else if (!((key == "icy-irc") || (key == "icy-aim") || (key == "icy-icq"))) - { - m_denied = true; - throwEx(m_srcLogString + "Shoutcast 1 source connection rejected. " - "Bad icy header string [" + m_lineBuffer + "]"); - } - } - } - else - { - m_denied = true; - throwEx(m_srcLogString + "Shoutcast 1 source connection rejected. " - "Bad icy header string [" + m_lineBuffer + "]"); - } - } - m_headers[key] = value; - m_nextState = &protocol_shoutcastSource::state_AnalyzeHeaders; - m_state = &protocol_shoutcastSource::state_GetLine; - m_result.read(); - m_lineBuffer.clear(); - } -} - -void protocol_shoutcastSource::timeSlice() throw(std::exception) -{ - try - { - if (m_streamData && m_streamData->isDead()) - { - m_result.done(); - return; - } - (this->*m_state)(); - } - catch(const exception &) - { - if (m_streamData && !m_denied) - { - // if there was a failure, now see if we have a backup and attempt to run - // before we remove the current handling of the dropped source connection - vector backupInfo = gOptions.getBackupUrl(m_srcStreamID); - if (!backupInfo.empty()) - { - streamData::streamInfo info; - streamData::extraInfo extra; - if (streamData::getStreamInfo (m_streamData->ID(), info, extra) && info.m_allowBackupURL) - { - m_denied = true; - m_streamData->clearCachedMetadata(); - streamData::streamSourceLost(m_srcLogString, m_streamData, m_srcStreamID); - m_streamData = 0; - ILOG (m_srcLogString + "Shoutcast 1 source disconnected - trying source backup.", LOGNAME, m_srcStreamID); - threadedRunner::scheduleRunnable(new protocol_backup(backupInfo[0], getStreamBitrate(m_headers), - fixMimeType(m_headers["content-type"]))); - } - else - WLOG ("Stream backup URL not allowed", LOGNAME, m_srcStreamID); - } - } - throw; - } -} - -void protocol_shoutcastSource::state_SendBuffer() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - if (sendDataBuffer(m_srcStreamID, m_outBuffer, m_outBufferSize, m_srcLogString)) - { - m_state = m_nextState; - } -} - -void protocol_shoutcastSource::state_GetLine() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - if (getHTTPStyleHeaderLine(m_srcStreamID, m_lineBuffer, m_srcLogString)) - { - m_state = m_nextState; - } -} - -void protocol_shoutcastSource::state_GetHeaders() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - m_state = &protocol_shoutcastSource::state_GetLine; - m_nextState = &protocol_shoutcastSource::state_AnalyzeHeaders; - m_result.read(); -} - -void protocol_shoutcastSource::state_GetStreamData() throw(exception) -{ -/*#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(m_srcLogString + __FUNCTION__); -#endif*/ - - time_t cur_time; - - const int autoDumpTime = detectAutoDumpTimeout (cur_time, m_srcStreamID, (m_srcLogString + "Timeout waiting for stream data")); - - int bitrate = m_streamData->streamBitrate(); - const int type = m_streamData->streamUvoxDataType(); - while (true) - { - char buf[BUF_SIZE * 4] = {0}; - int amt = (BUF_SIZE - 1); - - // if we had anything left over then now we - // need to copy it back into the buffer and - // adjust the max data amount to be read in - if ((m_remainderSize > 0) && ((amt + m_remainderSize) <= (BUF_SIZE * 4))) - { - memcpy(buf, m_remainder, m_remainderSize); - } - else - { - m_remainderSize = 0; - } - - // adjust the position in the buffer based on the prior - // state of the remaining data as part of frame syncing - int rval = 0; - if ((rval = recv (&buf[m_remainderSize], (BUF_SIZE - 1), 0x0)) < 1) - { - if (rval < 0) - { - rval = socketOps::errCode(); - if (rval == SOCKETOPS_WOULDBLOCK) - { - m_result.schedule(85); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - return; - } - DLOG (m_srcLogString + "Socket error while waiting for data. " + socketErrString(rval), LOGNAME, m_srcStreamID); - } - else - DLOG (m_srcLogString + "Remote socket closed while waiting for data.", LOGNAME, m_srcStreamID); - - throwEx ((utf8)""); - } - - // update these details before we mess with anything - bandWidth::updateAmount(bandWidth::SOURCE_V1_RECV, rval); - - // if we're here then we account for what we already had in the total - // so that we then don't skip the new data read with the original data - rval += m_remainderSize; - m_remainderSize = 0; - amt = rval; - - if (m_streamData->syncToStream(m_remainderSize, m_remainder, amt, - bitrate, type, buf, m_srcLogString)) - { - m_denied = true; - throwEx(m_srcLogString + "Shoutcast 1 source disconnected. " - "Unable to sync to the stream. Please check the " - "source is valid and in a supported format."); - } - - m_lastActivityTime = ::time(NULL); - m_result.schedule(25); - } -} - -void protocol_shoutcastSource::state_CloseConnection() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - m_result.done(); -} diff --git a/Src/Plugins/DSP/sc_serv3/protocol_shoutcastSource.h b/Src/Plugins/DSP/sc_serv3/protocol_shoutcastSource.h deleted file mode 100644 index b9116165..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_shoutcastSource.h +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once -#ifndef protocol_shoutcastSource_H_ -#define protocol_shoutcastSource_H_ - -#include "threadedRunner.h" -#include - -class streamData; - -/* - Runnable object that handles the shoutcast source (broadcaster) - protocol -*/ - -class protocol_shoutcastSource: public runnable -{ -private: - const u_short m_srcPort; - short unsigned int m_remainderSize; - bool m_denied; // used to prevent source disconnected messages e.g. for failed passwords - // is a padding hole around here... - __uint8 * m_remainder; - const uniString::utf8 m_srcAddr; - uniString::utf8 m_srcLogString; - uniString::utf8 m_srcUserID; - int m_srcStreamID; - int m_outBufferSize; - const uniString::utf8::value_type *m_outBuffer; // for outgoing text lines - uniString::utf8 m_lineBuffer; // received header line - httpHeaderMap_t m_headers; // the received source headers - streamData *m_streamData; // associated stream object - - typedef void (protocol_shoutcastSource::*state_t)(); - - state_t m_state; - state_t m_nextState; - - void state_ConfirmPassword() throw(std::exception); - void state_SendBuffer() throw(std::exception); - void state_GetLine() throw(std::exception); - void state_GetHeaders() throw(std::exception); - void state_AnalyzeHeaders() throw(std::exception); - void state_CloseConnection() throw(std::exception); - void state_GetStreamData() throw(std::exception); - -protected: - virtual void timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "protocol_shoutcastSource"; } - -public: - protocol_shoutcastSource (microConnection &mc, const uniString::utf8 &password) throw(std::exception); - - protocol_shoutcastSource(const socketOps::tSOCKET s, const uniString::utf8 &addr, - const u_short port, const uniString::utf8 &password) throw(std::exception); - virtual ~protocol_shoutcastSource() throw(); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/protocol_uvox2Source.cpp b/Src/Plugins/DSP/sc_serv3/protocol_uvox2Source.cpp deleted file mode 100644 index f67d9df4..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_uvox2Source.cpp +++ /dev/null @@ -1,1010 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include "protocol_uvox2Source.h" -#include "protocol_backup.h" -#include "uvox2Common.h" -#include "streamData.h" -#include "global.h" -#include "bandwidth.h" -#include "MP3Header.h" -#include "ADTSHeader.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define DEBUG_LOG(...) do { if (gOptions.uvox2SourceDebug()) DLOG(__VA_ARGS__); } while (0) -#define LOGNAME "SRC" - - -protocol_uvox2Source::protocol_uvox2Source (microConnection &mc, const __uint8 *firstPacket, const int sizeOfFirstPacket) throw(exception) - - : runnable (mc), m_srcPort(mc.m_srcPort), m_srcAddr(mc.m_srcHostName) -{ - m_srcLogString = srcAddrLogString (m_srcAddr, m_srcPort); - m_outData = new __uint8 [MAX_MESSAGE_SIZE]; - m_remainder = new __uint8 [BUF_SIZE * 4]; - m_remainderSize = 0; - m_srcStreamID = DEFAULT_SOURCE_STREAM; - m_outBuffer = NULL; - m_outBufferSize = 0; - m_flushCachedMetadata = false; - m_specialFileBytesExpected = 0; - m_denied = false; - m_streamData = NULL; - m_loop = 0; - m_state = &protocol_uvox2Source::state_SendCrypto; - m_nextState = NULL; - - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - ILOG(m_srcLogString + "Shoutcast 2 source connection starting.", LOGNAME, m_srcStreamID); - - m_configData.m_maxBitrate = 0; - m_configData.m_avgBitrate = 0; - m_configData.m_desiredBufferSize = 0; - m_configData.m_minimumBufferSize = 0; - - if (sizeOfFirstPacket > MAX_MESSAGE_SIZE) - { - m_denied = true; - throw runtime_error(m_srcLogString.hideAsString() + "Initial data packet too large (" + tos(sizeOfFirstPacket) + ")"); - } - - bandWidth::updateAmount(bandWidth::SOURCE_V2_RECV, sizeOfFirstPacket); - m_inBuffer.insert(m_inBuffer.end(), firstPacket, firstPacket + sizeOfFirstPacket); -} - -protocol_uvox2Source::~protocol_uvox2Source() throw() -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - if (m_streamData) - { - streamData::streamSourceLost(m_srcLogString, m_streamData, m_srcStreamID); - m_streamData = 0; - } - - socketOps::forgetTCPSocket(m_socket); - forgetArray(m_outData); - forgetArray(m_remainder); - - if (!m_denied) - { - ILOG(m_srcLogString + "Shoutcast 2 source disconnected.", LOGNAME, m_srcStreamID); - } -} - -void protocol_uvox2Source::timeSlice() throw(std::exception) -{ - try - { - if (m_streamData && m_streamData->isDead()) - { - m_result.done(); - return; - } - (this->*m_state)(); - } - catch(const exception &) - { - // if there was a failure, now see if we have a backup and attempt to run - // before we remove the current handling of the dropped source connection - vector backupInfo = gOptions.getBackupUrl(m_srcStreamID); - if (!backupInfo.empty() && !m_denied) - { - m_denied = true; - if (m_streamData) - { - m_streamData->clearCachedMetadata(); - streamData::streamSourceLost(m_srcLogString, m_streamData, m_srcStreamID); - m_streamData = 0; - } -#ifdef INCLUDE_BACKUP_STREAMS - ILOG(m_srcLogString + "Shoutcast 2 source disconnected - trying source backup.", LOGNAME, m_srcStreamID); - threadedRunner::scheduleRunnable(new protocol_backup(backupInfo[0], - max(m_configData.m_avgBitrate/1000, m_configData.m_maxBitrate/1000), - m_configData.m_mimeType)); -#endif - } - throw; - } -} - -void protocol_uvox2Source::state_CloseConnection() throw(std::exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - m_result.done(); -} - -void protocol_uvox2Source::state_SendBuffer() throw(exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - if (sendDataBuffer(m_srcStreamID, m_outBuffer, m_outBufferSize, m_srcLogString)) - { - m_state = m_nextState; - } -} - -void protocol_uvox2Source::state_GetPacket() throw(exception) -{ - time_t cur_time; - - const int autoDumpTime = detectAutoDumpTimeout (cur_time, m_srcStreamID, (m_srcLogString + "Timeout waiting for data")); - - while (true) - { - // calculate optimal read size - char buf[BUF_SIZE] = {0}; - int amt = MAX_MESSAGE_SIZE; - int len = (int)m_inBuffer.size(); - - if (!len) - { - amt = UV2X_HDR_SIZE; - } - else if (len >= UV2X_HDR_SIZE) - { - amt = min(MAX_MESSAGE_SIZE, (int)((ntohs(reinterpret_cast(&(m_inBuffer[0]))->msgLen) + UV2X_OVERHEAD) - len)); - } - else - { - amt = min(MAX_MESSAGE_SIZE, (UV2X_OVERHEAD - len)); - } - - int rval = 0; - if ((rval = recv (buf, amt, 0x0)) < 1) - { - if (rval < 0) - { - m_loop = 0; - rval = socketOps::errCode(); - if (rval == SOCKETOPS_WOULDBLOCK) - { - m_result.schedule(75); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - return; - } - WLOG (m_srcLogString + "Socket error while waiting for data. " + socketErrString(rval), LOGNAME, m_srcStreamID); - } - else - DLOG (m_srcLogString + "Remote socket closed while waiting for data.", LOGNAME, m_srcStreamID); - - throwEx (""); - } - if (rval < amt) - m_loop = 100000; // force a stop when processed. - - m_lastActivityTime = ::time(NULL); - m_inBuffer.insert(m_inBuffer.end(), buf, buf + rval); - - len = (int)m_inBuffer.size(); - if ((len > 1) && (len <= UV2X_HDR_SIZE)) - { - // check for sync byte as we cannot be - // certain of good data coming in from - // the connection and so we check it - int found = -1; - for (int i = 0; i < len - 1; i++) - { - // check for sync byte - if ((buf[i] == UVOX2_SYNC_BYTE) && (buf[i + 1] == 0)) - { - found = i; - break; - } - } - - // track what we've received for the bandwidth stats - bandWidth::updateAmount(bandWidth::SOURCE_V2_RECV, len); - - if (found != -1) - { - // we need to re-sync and so need to - // clear the buffer and replace it - // according to the re-sync position - if (found > 0) - { - DEBUG_LOG(m_srcLogString + "Shoutcast 2 source re-synced to stream [pos: " + tos(found) + "]."); - - m_inBuffer.clear(); - - // we insert in to the start of the buffer - // what appears to be 'good' sync'd data. - m_inBuffer.insert(m_inBuffer.end(), &buf[found], &buf[found] + rval - found); - } - } - else - { - // and then we clear out the buffer which - // is ok to do since we're trying to find - // the frame (as first or next in stream) - m_inBuffer.clear(); - } - - continue; - } - else if (len > MAX_MESSAGE_SIZE) - { - m_denied = true; - bandWidth::updateAmount(bandWidth::SOURCE_V2_RECV, rval); - throwEx(m_srcLogString + "UVOX packet is too large" - " [got: " + tos(len) + " bytes, max: " + - tos(MAX_MESSAGE_SIZE) + " bytes]"); - } - else if (len > UV2X_HDR_SIZE) - { - if ((int)(ntohs(reinterpret_cast(&(m_inBuffer[0]))->msgLen) + UV2X_OVERHEAD) == len) - { - // got it - bandWidth::updateAmount(bandWidth::SOURCE_V2_RECV, rval); - - m_result.run(); - m_state = m_nextState; - return; - } - } - } -} - -template -void protocol_uvox2Source::loadAndSendMsg(const T &msg, int type, state_t nextState) throw() -{ - formMessage(msg, type, m_outData, m_outBufferSize); - bandWidth::updateAmount(bandWidth::SOURCE_V2_SENT, m_outBufferSize); - m_outBuffer = m_outData; - m_state = &protocol_uvox2Source::state_SendBuffer; - m_nextState = nextState; -} - -// load outbound message into buffer, and establish state to transition to after send -#define SEND_AND_TRANSITION(msg, vtype, state)\ - loadAndSendMsg(msg, vtype, state);\ - m_result.write();\ - m_result.run();\ - return; - -// get a packet and then transition to indicated state -#define GET_AND_TRANSITION(a)\ - m_inBuffer.clear();\ - m_state = &protocol_uvox2Source::state_GetPacket;\ - m_nextState = a;\ - m_result.run();\ - m_result.read();\ - m_result.timeoutSID(m_srcStreamID);\ - return; - -// send a packet then transition to closed state -#define SEND_AND_CLOSE(a, b)\ - SEND_AND_TRANSITION(a, b, &protocol_uvox2Source::state_CloseConnection) - -// get next packet, without acknowledgement -#define NEXT_PACKET\ - m_inBuffer.clear();\ - m_nextState = m_state;\ - m_state = &protocol_uvox2Source::state_GetPacket;\ - m_result.schedule();\ - m_result.timeoutSID(m_srcStreamID);\ - return; - -void protocol_uvox2Source::state_ConfirmPasswordGet() throw(std::exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - GET_AND_TRANSITION(&protocol_uvox2Source::state_ConfirmPassword); -} - -void protocol_uvox2Source::state_SendCrypto() throw(std::exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - // parse the contents of the packet to get user,password,streamid etc. - const uv2xHdr *voxHdr = (const uv2xHdr*)(&(m_inBuffer[0])); - const __uint16 voxMsgType = ntohs(voxHdr->msgType); - - if (voxMsgType != MSG_CIPHER) - { - m_denied = true; - ELOG(m_srcLogString + "Out of sequence uvox packet. Got " + tos(voxMsgType) + " but expected " + tos(MSG_CIPHER), LOGNAME, m_srcStreamID); - SEND_AND_CLOSE("NAK:2.1:Sequence Error", voxMsgType); - } - - const char *contents = (const char *)((&(m_inBuffer[UV2X_HDR_SIZE]))); - if (strcmp(contents,"2.1")) - { - ELOG(m_srcLogString + "Cipher request has bad version (" + contents + ")", LOGNAME, m_srcStreamID); - SEND_AND_TRANSITION("NAK:Version Error", voxMsgType, &protocol_uvox2Source::state_ConfirmPasswordGet); - } - - m_cipherKey = gOptions.stream_uvoxCipherKey(m_srcStreamID); - if (!gOptions.read_stream_uvoxCipherKey(m_srcStreamID) || m_cipherKey.empty()) - { - m_cipherKey = gOptions.uvoxCipherKey(); - } - - SEND_AND_TRANSITION(("ACK:" + m_cipherKey).hideAsString(), voxMsgType, &protocol_uvox2Source::state_ConfirmPasswordGet); -} - -// get stream,userID and password out of MSG_AUTH (0x1001) packet -void protocol_uvox2Source::state_ConfirmPassword() throw(std::exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - // parse the contents of the packet to get user,password,streamid etc. - const uv2xHdr *voxHdr = (const uv2xHdr*)(&(m_inBuffer[0])); - const __uint16 voxMsgType = ntohs(voxHdr->msgType); - - if (voxMsgType != MSG_AUTH) - { - m_denied = true; - ELOG(m_srcLogString + "Out of sequence uvox packet. Got " + tos(voxMsgType) + " but expected " + tos(MSG_AUTH), LOGNAME, m_srcStreamID); - SEND_AND_CLOSE("NAK:2.1:Sequence Error", voxMsgType); - } - - const char *contents = (const char *)((&(m_inBuffer[UV2X_HDR_SIZE]))); - const char *pos = strstr(contents, ":"); - if (!pos) - { - m_denied = true; - ELOG(m_srcLogString + "Bad uvox packet " + tos(voxMsgType) + ". No version field.", LOGNAME, m_srcStreamID); - SEND_AND_CLOSE("NAK:2.1:Parse Error", voxMsgType); - } - - std::string srcVersion = stripWhitespace(string(contents, pos)); - if (srcVersion != "2.1") - { - m_denied = true; - ELOG(m_srcLogString + "Uvox version of type " + srcVersion + " is not accepted. Expecting 2.1", LOGNAME, m_srcStreamID); - SEND_AND_CLOSE("NAK:2.1:Version Error", voxMsgType); - } - - contents = pos+1; - pos = strstr(contents, ":"); - if (!pos) - { - m_denied = true; - ELOG(m_srcLogString + "Bad uvox packet " + tos(voxMsgType) + ". No SID field.", LOGNAME, m_srcStreamID); - SEND_AND_CLOSE("NAK:2.1:Parse Error", voxMsgType); - } - - int sourceStreamID = atoi(string(contents, pos).c_str()); - // ensure that only valid stream id's are allowed to connect (1 -> 2147483647) - if (!sourceStreamID || (sourceStreamID > INT_MAX)) - { - m_denied = true; - ELOG(m_srcLogString + "Bad Stream ID (" + tos(sourceStreamID) + "). Stream ID cannot be below 1 or above 2147483647.", LOGNAME, m_srcStreamID); - SEND_AND_CLOSE("NAK:2.1:Stream ID Error", voxMsgType); - } - - // if we have a moved stream then now we have the stream id - // then we need to check and block the source as applicable - utf8 movedUrl = gOptions.stream_movedUrl(sourceStreamID); - if (!movedUrl.empty()) - { - m_denied = true; - ELOG(m_srcLogString + "Shoutcast 2 source rejected. Stream is configured as having moved.", LOGNAME, m_srcStreamID); - SEND_AND_CLOSE("NAK:2.1:Deny", voxMsgType); - } - - m_srcStreamID = sourceStreamID; - - // if stream configs are required then we have an error if we didn't find one - if (gOptions.requireStreamConfigs()) - { - config::streamConfig stream; - if (!gOptions.getStreamConfig(stream, m_srcStreamID)) - { - m_denied = true; - ELOG(m_srcLogString + "Shoutcast 2 source rejected. Stream " + tos(m_srcStreamID) + " must be defined in config file.", LOGNAME, m_srcStreamID); - SEND_AND_CLOSE("NAK:2.1:Stream ID Error", voxMsgType); - } - } - - contents = pos+1; - pos = strstr(contents, ":"); - if (!pos) - { - m_denied = true; - ELOG(m_srcLogString + "Bad uvox packet " + tos(voxMsgType) + ". No UID field.", LOGNAME, m_srcStreamID); - SEND_AND_CLOSE("NAK:2.1:Parse Error", voxMsgType); - } - m_srcUserID = string(contents, pos); - if (!(m_srcUserID.size() % 16)) - { - m_srcUserID = XTEA_decipher(m_srcUserID.c_str(), m_srcUserID.size(), m_cipherKey.c_str(), m_cipherKey.size()); - } - else - { - m_denied = true; - ELOG(m_srcLogString + "Bad username format. Size of parameters not matching specification.", LOGNAME, m_srcStreamID); - SEND_AND_CLOSE("NAK:2.1:Parse Error", voxMsgType); - } - - contents = pos + 1; - utf8 srcPassword = contents; - - if (!(srcPassword.size() % 16)) - { - srcPassword = XTEA_decipher(srcPassword.c_str(), srcPassword.size(), m_cipherKey.c_str(), m_cipherKey.size()); - } - else - { - m_denied = true; - ELOG(m_srcLogString + "Bad password format. Size of parameters not matching specification.", LOGNAME, m_srcStreamID); - SEND_AND_CLOSE("NAK:2.1:Parse Error", voxMsgType); - } - - // if no stream configuration is specified then we need to fallback - utf8 password = gOptions.stream_password(m_srcStreamID); - if (!gOptions.read_stream_password(m_srcStreamID) || password.empty()) - { - password = gOptions.password(); - } - - // look at the password and check for the multi-1.x style support, - // extracting as needed so we are consistent with all other modes. - // note: we ignore the other parameters and just want 'password'. - utf8 dj_name; // throw-away (equivalent of 'm_srcUserID') - extractPassword(srcPassword, dj_name, sourceStreamID); - - if (srcPassword != password) - { - m_denied = true; - ELOG(m_srcLogString + "Shoutcast 2 source connection denied" + (m_srcUserID.empty() ? "" : " for user (" + m_srcUserID + ")") + - " on stream #" + tos(m_srcStreamID) + ". " + (srcPassword.empty() ? "Empty password not allowed." : "Bad password: " + srcPassword), LOGNAME, m_srcStreamID); - SEND_AND_CLOSE("NAK:2.1:Deny", voxMsgType); - } - - // if we've got a source already connected and it's not a backup - // then it's better that we just abort processing now than later - bool isSourceActive = false; - streamData *sd = streamData::accessStream(m_srcStreamID, isSourceActive); - if (sd && (isSourceActive == true) && (sd->isBackupStream(m_srcStreamID) == false)) - { - sd->releaseStream(); - m_denied = true; - ELOG(m_srcLogString + "Shoutcast 2 source rejected. A source is already connected.", LOGNAME, m_srcStreamID); - SEND_AND_CLOSE("NAK:Stream In Use", voxMsgType); - } - - if (sd) - { - sd->releaseStream(); - } - - m_srcLogString = srcAddrLogString(m_srcAddr, m_srcPort, m_srcStreamID); - DEBUG_LOG(m_srcLogString + "Password accepted. Stream id is " + tos(m_srcStreamID), LOGNAME, m_srcStreamID); - SEND_AND_TRANSITION("ACK:2.1:Allow", voxMsgType, &protocol_uvox2Source::state_StreamConfigurationGet); -} - -// first part of stream configuration state, get the next packet, then process it -void protocol_uvox2Source::state_StreamConfigurationGet() throw(std::exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - GET_AND_TRANSITION(&protocol_uvox2Source::state_StreamConfiguration); -} - -// handle various stream configuration packets -// note: to allow real negotiation, most errors are rejected, but do not cause the connection to be shut -void protocol_uvox2Source::state_StreamConfiguration() throw(std::exception) -{ - DEBUG_LOG(m_srcLogString + __FUNCTION__); - - const uv2xHdr *voxHdr = (const uv2xHdr*)(&(m_inBuffer[0])); - const char *contents = (const char *)((&(m_inBuffer[UV2X_HDR_SIZE]))); - const __uint16 voxMsgType = ntohs(voxHdr->msgType); - - switch (voxMsgType) - { - case MSG_MIME_TYPE: - { - // this is mainly to cope with legacy / incomplete uvox2.x implementations - m_configData.m_mimeType = contents; - DEBUG_LOG(m_srcLogString + "original mime type=" + m_configData.m_mimeType, LOGNAME, m_srcStreamID); - m_configData.m_mimeType = fixMimeType(m_configData.m_mimeType); - DEBUG_LOG(m_srcLogString + "mime type=" + m_configData.m_mimeType, LOGNAME, m_srcStreamID); - break; - } - case MSG_BROADCAST_SETUP: - { - const char *pos = strstr(contents, ":"); - if (!pos) - { - ELOG(m_srcLogString + "Bad uvox packet " + tos(voxMsgType) + ". No avg bitrate field.", LOGNAME, m_srcStreamID); - SEND_AND_TRANSITION("NAK:Parse Error", voxMsgType, &protocol_uvox2Source::state_StreamConfigurationGet); - } - m_configData.m_avgBitrate = atoi(string(contents,pos).c_str()); - contents = pos + 1; - m_configData.m_maxBitrate = atoi(contents); - - // check that these bitrates are allowed (looking at both max and average values) - const int bitrate = max(m_configData.m_avgBitrate, m_configData.m_maxBitrate); - int streamMaxBitrate = 0, streamMinBitrate = 0; - const int ret = gOptions.isBitrateDisallowed(m_srcStreamID, bitrate, streamMaxBitrate, streamMinBitrate); - if (ret) - { - m_denied = true; - utf8 mode = ((streamMaxBitrate == streamMinBitrate) ? "of" : (ret == 2 ? "up to" : "from")); - ELOG(m_srcLogString + "Shoutcast 2 source rejected. Only bitrates " + mode + " " + - tos((ret == 1 ? streamMinBitrate : streamMaxBitrate) / 1000) + - " kbps are allowed - detected " + tos(bitrate / 1000) + " kbps.", LOGNAME, m_srcStreamID); - SEND_AND_CLOSE("NAK:Bit Rate Error", voxMsgType); - } - - DEBUG_LOG(m_srcLogString + "avg bitrate=" + tos(m_configData.m_avgBitrate) + " max bitrate=" + tos(m_configData.m_maxBitrate), LOGNAME, m_srcStreamID); - break; - } - case MSG_NEGOTIATE_BUFFER_SIZE: - { - const char *pos = strstr(contents, ":"); - if (!pos) - { - ELOG(m_srcLogString + "Bad uvox packet " + tos(voxMsgType) + ". No desired buffer size field.", LOGNAME, m_srcStreamID); - SEND_AND_TRANSITION("NAK:Parse Error", voxMsgType, &protocol_uvox2Source::state_StreamConfigurationGet); - } - m_configData.m_desiredBufferSize = atoi(string(contents, pos).c_str()); - contents = pos + 1; - m_configData.m_minimumBufferSize = atoi(contents); - DEBUG_LOG(m_srcLogString + "desired buffer size=" + tos(m_configData.m_desiredBufferSize) + " min buffer size=" + tos(m_configData.m_minimumBufferSize), LOGNAME, m_srcStreamID); - SEND_AND_TRANSITION("ACK:" + tos(m_configData.m_desiredBufferSize), voxMsgType, &protocol_uvox2Source::state_StreamConfigurationGet); - } - case MSG_MAX_PAYLOAD_SIZE: - { - const char *pos = strstr(contents, ":"); - if (!pos) - { - ELOG(m_srcLogString + "Bad uvox packet " + tos(voxMsgType) + ". Parse error.", LOGNAME, m_srcStreamID); - SEND_AND_TRANSITION("NAK:Parse Error", voxMsgType, &protocol_uvox2Source::state_StreamConfigurationGet); - } - int max1 = atoi(string(contents, pos).c_str()); - contents = pos + 1; - int max2 = atoi(contents); - DEBUG_LOG(m_srcLogString + "max payload size 1=" + tos(max1) + " max payload size 2=" + tos(max2), LOGNAME, m_srcStreamID); - int new_max = max(max1, max2); - if ((new_max > MAX_PAYLOAD_SIZE) || (new_max < 256)) - { - ELOG(m_srcLogString + "Bad max payload size of " + tos(new_max), LOGNAME, m_srcStreamID); - SEND_AND_TRANSITION("NAK:Payload Size Error", voxMsgType, &protocol_uvox2Source::state_StreamConfigurationGet); - } - - SEND_AND_TRANSITION("ACK:" + tos(MAX_PAYLOAD_SIZE), voxMsgType, &protocol_uvox2Source::state_StreamConfigurationGet); - } - case MSG_ICYNAME: - { - m_configData.m_icyName = contents; - utf8 titleFormat = gOptions.titleFormat(); - if (!titleFormat.empty()) - { - utf8::size_type pos = titleFormat.find(utf8("%s")); - m_configData.m_icyName = (pos == utf8::npos ? titleFormat : titleFormat.replace(pos, 2, m_configData.m_icyName)); - } - DEBUG_LOG(m_srcLogString + "icy-name=" + m_configData.m_icyName, LOGNAME, m_srcStreamID); - break; - } - case MSG_ICYGENRE: - { - m_configData.m_icyGenre = contents; - DEBUG_LOG(m_srcLogString + "icy-genre=" + m_configData.m_icyGenre, LOGNAME, m_srcStreamID); - break; - } - case MSG_ICYURL: - { - m_configData.m_icyURL = contents; - if (m_configData.m_icyURL.empty()) - { - m_configData.m_icyURL = "http://www.shoutcast.com"; - } - utf8 urlFormat = gOptions.urlFormat(); - if (!urlFormat.empty()) - { - utf8::size_type pos = urlFormat.find(utf8("%s")); - m_configData.m_icyURL = (pos == utf8::npos ? urlFormat : urlFormat.replace(pos,2,m_configData.m_icyURL)); - } - DEBUG_LOG(m_srcLogString + "icy-url=" + m_configData.m_icyURL, LOGNAME, m_srcStreamID); - break; - } - case MSG_ICYPUB: - { - m_configData.m_icyPub = atoi(contents); - DEBUG_LOG(m_srcLogString + "icy-pub=" + tos(m_configData.m_icyPub), LOGNAME, m_srcStreamID); - break; - } - case MSG_STANDBY: - { - DEBUG_LOG(m_srcLogString + "Standby", LOGNAME, m_srcStreamID); - if (m_streamData) - { - SEND_AND_CLOSE("NAK:Sequence Error", voxMsgType); - } - else - { - try - { - // build the correct path for the stream clients - config::streamConfig stream; - const bool found = gOptions.getStreamConfig(stream, m_srcStreamID); - m_streamData = streamData::createStream(streamData::streamSetup(m_srcLogString, m_srcAddr, - (found ? stream.m_authHash : ""), m_srcUserID, "", - (found ? stream.m_backupUrl.url() : ""), - streamData::SHOUTCAST2, m_srcStreamID, m_srcPort, - (found ? stream.m_maxStreamUser : 0), - (found ? stream.m_maxStreamBitrate : 0), - (found ? stream.m_minStreamBitrate : 0), - (found ? stream.m_allowPublicRelay : true), - false, 0, false, m_configData)); - } - catch(const exception &ex) - { - ELOG(m_srcLogString + ex.what(), LOGNAME, m_srcStreamID); - SEND_AND_TRANSITION(string("NAK:") + ex.what(), voxMsgType, &protocol_uvox2Source::state_StreamConfigurationGet); - } - - if (!m_streamData) - { - m_denied = true; - ELOG(m_srcLogString + "Shoutcast 2 source rejected. A source is already connected.", LOGNAME, m_srcStreamID); - SEND_AND_CLOSE("NAK:Stream In Use", voxMsgType); - } - else - { - if (m_flushCachedMetadata) - { - m_streamData->clearCachedMetadata(); - m_metadataAssemblyTable.clear(); - } - m_flushCachedMetadata = false; - } - } - DEBUG_LOG(m_srcLogString + "Stream configuration complete. [" + eol() + m_configData.toLogString() + eol() + "]", LOGNAME, m_srcStreamID); - SEND_AND_TRANSITION("ACK:Data transfer mode", voxMsgType, &protocol_uvox2Source::state_StreamDataGet); - } - case MSG_FLUSH_CACHED_METADATA: - { - DEBUG_LOG(m_srcLogString + "Flush cached metadata", LOGNAME, m_srcStreamID); - m_metadataAssemblyTable.clear(); - m_flushCachedMetadata = true; - break; - } - case MSG_TERMINATE: - { - DEBUG_LOG(m_srcLogString + "Terminate", LOGNAME, m_srcStreamID); - throwEx (""); - break; - } - case MSG_LISTENER_AUTHENTICATION: // not supported, just ACK it - { - WLOG(m_srcLogString + "Listener Auth - not supported", LOGNAME, m_srcStreamID); - break; - } - default: // out of sequence - { - ELOG(m_srcLogString + "Unknown or out of sequence packet " + tos(voxMsgType), LOGNAME, m_srcStreamID); - SEND_AND_TRANSITION("NAK:Sequence Error", voxMsgType, &protocol_uvox2Source::state_StreamConfigurationGet); - } - } - - SEND_AND_TRANSITION("ACK", voxMsgType, &protocol_uvox2Source::state_StreamConfigurationGet); -} - -// this is needed to allow the source to process the -// response before starting to send the stream data -void protocol_uvox2Source::state_StreamDataGet() throw(std::exception) -{ - GET_AND_TRANSITION(&protocol_uvox2Source::state_GetStreamData); -} - -// normal streaming state -void protocol_uvox2Source::state_GetStreamData() throw(std::exception) -{ - if (!m_inBuffer.empty()) - { - const uv2xHdr *voxHdr = (const uv2xHdr*)(&(m_inBuffer[0])); - const __uint16 voxMsgType = ntohs(voxHdr->msgType); - - if ((voxMsgType >= 0x7000) && (voxMsgType < 0x9000)) - { - // if we have old uvox, then we don't know our mime-type (since old uvox 2 doesn't - // specify it, though 2.1 does). In the case that mime_type is empty, inspect the packet type and - // set it in the stream - if (m_configData.m_mimeType.empty()) - { - switch (voxMsgType) - { - case MP3_DATA: - { - m_configData.m_mimeType = "audio/mpeg"; - break; - } - case AAC_LC_DATA: - case AACP_DATA: - { - m_configData.m_mimeType = "audio/aacp"; - break; - } - case OGG_DATA: - { - m_configData.m_mimeType = "audio/ogg"; - break; - } - } - - if (!m_configData.m_mimeType.empty()) - { - m_streamData->streamSetMimeType(m_configData.m_mimeType); - } - } - - __uint16 amt = ntohs(voxHdr->msgLen); - vector <__uint8> tempbuf; - const char *buf; - - // if we had anything left over then now we - // need to copy it back into the buffer - if (m_remainderSize > 0 && m_remainder) - { - tempbuf.insert (tempbuf.end(), m_remainder, m_remainder+m_remainderSize); - tempbuf.insert (tempbuf.end(), m_inBuffer.begin() + UV2X_HDR_SIZE, m_inBuffer.begin()+UV2X_HDR_SIZE+amt); - amt = (__uint16)tempbuf.size(); - buf = (char *)&tempbuf[0]; - } - else - { - // buf.insert (buf.end(), m_inBuffer.begin() + UV2X_HDR_SIZE, m_inBuffer.begin()+UV2X_HDR_SIZE+amt); - buf = (char*)&m_inBuffer [UV2X_HDR_SIZE]; - } - - m_remainderSize = 0; - - int br = m_streamData->streamBitrate(); - if (m_streamData->syncToStream (m_remainderSize, m_remainder, amt, br, - m_streamData->streamUvoxDataType(), buf, - m_srcLogString)) - { - m_denied = true; - throwEx(m_srcLogString + "Shoutcast 2 source disconnected. " - "Unable to sync to the stream. Please check the " - "source is valid and in a supported format."); - } - if (++m_loop < 20) - { - // force several small uvox packets to read/processed for now - m_inBuffer.clear(); - m_nextState = m_state; - m_state = &protocol_uvox2Source::state_GetPacket; - m_result.run(); - return; - } - m_loop = 0; - } - else if ((voxMsgType >= 0x3000) && (voxMsgType < 0x5000)) - { - DEBUG_LOG(m_srcLogString + "Cacheable metadata received type=0x" + tohex(voxMsgType), LOGNAME, m_srcStreamID); - const __uint16 voxPayloadSize = ntohs(voxHdr->msgLen); - if (voxPayloadSize >= UV2X_META_HDR_SIZE) // make sure there's enough data - { - const __uint8 *contents = (const __uint8 *)((&(m_inBuffer[UV2X_HDR_SIZE]))); - const uv2xMetadataHdr *metaHdr = reinterpret_cast(contents); - const __uint16 metadataID = ntohs(metaHdr->id); - const __uint16 metadataSpan = ntohs(metaHdr->span); - const __uint16 metadataIndex = ntohs(metaHdr->index) - 1; - const __uint8* metadataContents = contents + UV2X_META_HDR_SIZE; - const size_t metadataContentsSize = voxPayloadSize - UV2X_META_HDR_SIZE; - - if ((metadataSpan <= MAX_METADATA_FRAGMENTS) && - (metadataSpan > 0) && - (metadataIndex < MAX_METADATA_FRAGMENTS) && - (metadataIndex < metadataSpan)) - { - assemblyTableIndex_t ati = makeAssemblyTableIndex(voxMsgType, m_srcStreamID); - metadataEntry_t &me = m_metadataAssemblyTable[voxMsgType][ati]; - - if (metadataSpan != me.m_expectedFragments) // span changed, clear the entire thing - { - __uint16 expectedFragments = me.m_expectedFragments; - me.clear(); - DEBUG_LOG(m_srcLogString + "Cacheable metadata reset due to span change [" + tos(metadataSpan) + "," + tos(expectedFragments) + "]", LOGNAME, m_srcStreamID); - } - - me.m_expectedFragments = metadataSpan; - if (me.m_fragments[metadataIndex].m_isValid) // duplicate fragment, clear the entire thing - { - me.clear(); - DEBUG_LOG(m_srcLogString + "Cacheable metadata reset due to duplicate fragment", LOGNAME, m_srcStreamID); - } - - me.m_fragments[metadataIndex].m_isValid = true; - me.m_fragments[metadataIndex].m_fragment.insert(me.m_fragments[metadataIndex].m_fragment.end(), - metadataContents, metadataContents + metadataContentsSize); - - if ((++me.m_receivedFragments) == me.m_expectedFragments) - { - // assembly, send and clear - vector<__uint8> assembledData; - for (__uint16 x = 0; x < me.m_expectedFragments; ++x) - { - assembledData.insert(assembledData.end(), me.m_fragments[x].m_fragment.begin(), me.m_fragments[x].m_fragment.end()); - } - - // send - m_streamData->addUvoxMetadataAtCurrentPosition(voxMsgType,assembledData); - - if (gOptions.uvox2SourceDebug()) - { - if ((voxMsgType >= 0x3000) && (voxMsgType < 0x4000)) - { - ILOG(m_srcLogString + "Got complete metadata message type=0x" + tohex(voxMsgType) + - " [" + tos(assembledData.size()) + " bytes]" + - " id=" + tos(metadataID) + - " span=" + tos(metadataSpan) + - " content=" + eol() + utf8(&(assembledData[0]), assembledData.size()), LOGNAME, m_srcStreamID); - } - else - { - ILOG(m_srcLogString + "Got complete metadata message type=0x" + tohex(voxMsgType) + - " [" + tos(assembledData.size()) + " bytes]" + - " id=" + tos(metadataID) + - " span=" + tos(metadataSpan), LOGNAME, m_srcStreamID); - } - } - else - { - if ((voxMsgType >= 0x3000) && (voxMsgType < 0x4000)) - { - utf8 currentSong, comingSoon; - std::vector nextSongs; - m_streamData->getStreamNextSongs(m_srcStreamID, currentSong, comingSoon, nextSongs); - - if (!currentSong.empty()) - { - if (!comingSoon.empty()) - { - ILOG(m_srcLogString + "Title update [now: \"" + currentSong + "\", next: \"" + comingSoon + "\"]", LOGNAME, m_srcStreamID); - } - else - { - ILOG(m_srcLogString + "Title update [" + currentSong + "]", LOGNAME, m_srcStreamID); - } - m_streamData->resetAdvertTriggers(currentSong); - } - } - else - { - utf8 mimeType[] = { - "image/jpeg", - "image/png", - "image/bmp", - "image/gif" - }; - - __uint16 ArtType = voxMsgType & 0x0F00; - if (!assembledData.size()) - { - ILOG(m_srcLogString + ((ArtType & MSG_METADATA_PLAYING_ART) ? "Playing" : "Stream") + " artwork cleared", LOGNAME, m_srcStreamID); - m_streamData->clearCachedArtwork(((ArtType & MSG_METADATA_PLAYING_ART) ? 1 : 0)); - } - else - { - ILOG(m_srcLogString + ((ArtType & MSG_METADATA_PLAYING_ART) ? "Playing" : "Stream") + - " artwork update [mime=" + mimeType[(voxMsgType & 0x00FF)] + ", " + tos(assembledData.size()) + " bytes]", LOGNAME, m_srcStreamID); - } - } - } - - // clear - m_metadataAssemblyTable[voxMsgType].erase(ati); - } - } - else - { - ELOG(m_srcLogString + "Badly formed metadata packet type=0x" + tohex(voxMsgType) + " id=" + - tos(metadataID) + " span=" + tos(metadataSpan) + " index=" + tos(metadataIndex + 1), LOGNAME, m_srcStreamID); - } - } - else - { - ELOG(m_srcLogString + "Badly formed metadata packet type=0x" + tohex(voxMsgType) + - " content of packet is too small payloadsize=" + tos(voxPayloadSize), LOGNAME, m_srcStreamID); - } - } - else if ((voxMsgType >= 0x5000) && (voxMsgType < 0x7000)) - { - // pass thru metadata - DEBUG_LOG(m_srcLogString + "Pass thru metadata", LOGNAME, m_srcStreamID); - m_streamData->writeSc21(m_inBuffer); // like data, but don't write to sc1 buffers - } - else if (voxMsgType == MSG_FILE_TRANSFER_BEGIN) - { - const __uint8 *contents = (const __uint8 *)((&(m_inBuffer[UV2X_HDR_SIZE]))); - const __uint8 *pos = (const __uint8*)strstr((const char *)contents, ":"); - if (!pos) - { - ELOG(m_srcLogString + "Bad uvox packet " + tos(voxMsgType) + ". Parse error.", LOGNAME, m_srcStreamID); - SEND_AND_TRANSITION("NAK:Parse Error", voxMsgType, &protocol_uvox2Source::state_StreamDataGet); - } - m_specialFileType = toLower(string(contents, pos)); - if ((m_specialFileType != "intro") && (m_specialFileType != "backup")) - { - ELOG(m_srcLogString + "Bad uvox packet " + tos(voxMsgType) + " Special file type (" + m_specialFileType + ") is not supported", LOGNAME, m_srcStreamID); - SEND_AND_TRANSITION("NAK:Type Error", voxMsgType, &protocol_uvox2Source::state_StreamDataGet); - } - - contents = pos + 1; - m_specialFileBytesExpected = atoi((const char *)contents); - if (m_specialFileBytesExpected > gOptions.maxSpecialFileSize()) - { - ELOG(m_srcLogString + "Bad special file size " + tos(m_specialFileBytesExpected) + ". Parse error.", LOGNAME, m_srcStreamID); - m_specialFileBytesExpected = 0; - SEND_AND_TRANSITION("NAK:Size Error",voxMsgType,&protocol_uvox2Source::state_StreamDataGet); - } - - m_specialFileBytes.clear(); - if (m_specialFileBytesExpected == 0) - { - ILOG(m_srcLogString + "Clearing " + m_specialFileType + " file.", LOGNAME, m_srcStreamID); - streamData::specialFileData &fd = (m_specialFileType == "intro" ? m_streamData->getIntroFile() : m_streamData->getBackupFile()); - fd.replaceData(m_specialFileBytes, m_streamData->streamUvoxDataType(), - m_streamData->streamBitrate(), m_streamData->streamSampleRate()); - } - else - { - ILOG(m_srcLogString + "Beginning " + m_specialFileType + " file transfer of size " + tos(m_specialFileBytesExpected) + " bytes.", LOGNAME, m_srcStreamID); - } - SEND_AND_TRANSITION("ACK", voxMsgType, &protocol_uvox2Source::state_StreamDataGet); - } - else if (voxMsgType == MSG_FILE_TRANSFER_DATA) - { - // do not NAK or ACK this packet - if (m_specialFileBytesExpected > 0) - { - int amt = ntohs(voxHdr->msgLen); - if (amt > m_specialFileBytesExpected) - { - WLOG(m_srcLogString + "Received too many bytes during special file transfer for " + m_specialFileType + ". Data will be truncated", LOGNAME, m_srcStreamID); - amt = m_specialFileBytesExpected; - } - - const __uint8 *contents = (const __uint8 *)((&(m_inBuffer[UV2X_HDR_SIZE]))); - m_specialFileBytes.insert(m_specialFileBytes.end(), contents, contents + amt); - m_specialFileBytesExpected -= amt; - if (m_specialFileBytesExpected == 0) - { - streamData::specialFileData &fd = (m_specialFileType == "intro" ? m_streamData->getIntroFile() : m_streamData->getBackupFile()); - fd.replaceData(m_specialFileBytes, m_streamData->streamUvoxDataType(), - m_streamData->streamBitrate(), m_streamData->streamSampleRate()); - m_specialFileBytes.clear(); - string fileType = m_specialFileType; - fileType[0] -= ('a' - 'A'); - ILOG(m_srcLogString + fileType + " file transfer complete.", LOGNAME, m_srcStreamID); - } - } - } - else if (voxMsgType == MSG_FLUSH_CACHED_METADATA) - { - ILOG(m_srcLogString + "Flush cached metadata", LOGNAME, m_srcStreamID); - m_streamData->clearCachedMetadata(); - m_metadataAssemblyTable.clear(); - SEND_AND_TRANSITION("ACK", voxMsgType, &protocol_uvox2Source::state_StreamDataGet); - } - else if (voxMsgType == MSG_TERMINATE) - { - ILOG(m_srcLogString + "Terminate", LOGNAME, m_srcStreamID); - throwEx (""); - } - else - { - ELOG(m_srcLogString + "Unknown or out of sequence packet " + tos(voxMsgType), LOGNAME, m_srcStreamID); - if ((voxMsgType < 0x2000) && (voxMsgType != MSG_FILE_TRANSFER_DATA)) - { - // probably have to NAK it - SEND_AND_TRANSITION("NAK:Unsupported packet type", voxMsgType, &protocol_uvox2Source::state_StreamDataGet); - } - } - } - - NEXT_PACKET; -} diff --git a/Src/Plugins/DSP/sc_serv3/protocol_uvox2Source.h b/Src/Plugins/DSP/sc_serv3/protocol_uvox2Source.h deleted file mode 100644 index 1bd7343c..00000000 --- a/Src/Plugins/DSP/sc_serv3/protocol_uvox2Source.h +++ /dev/null @@ -1,129 +0,0 @@ -#pragma once -#ifndef protocol_uvox2Source_H_ -#define protocol_uvox2Source_H_ - -#include "threadedRunner.h" -#include "streamData.h" -#include "uvox2Common.h" -#include - -class streamData; - -/* - Runnable object that handles the uvox 2 and 2.1 source (broadcaster) - protocol -*/ - -class protocol_uvox2Source: public runnable -{ -private: - int m_srcStreamID; - const u_short m_srcPort; - - bool m_flushCachedMetadata; // flush cached metadata when source connects - bool m_denied; // used to prevent source disconnected messages e.g. for failed passwords - - const uniString::utf8 m_srcAddr; - uniString::utf8 m_srcLogString; - - ///////////// for outgoing data ////////////////////////////// - __uint8 *m_outData; - const __uint8 *m_outBuffer; // for outgoing data lines - int m_outBufferSize; - /////////////////////////////////////////////////////////////// - - /////////// temporary storage buffer for special file transfers (uvox 0x1050) ///////////////// - int m_specialFileBytesExpected; - std::vector<__uint8> m_specialFileBytes; - std::string m_specialFileType; - - ///////////// incoming data //////////////////////////////////// - std::vector<__uint8> m_inBuffer; - //////////////////////////////////////////////////////////// - - streamData *m_streamData; // associated stream object - - ///// source information - uniString::utf8 m_srcUserID; - uniString::utf8 m_cipherKey; // for uvox 2.1 - streamData::uvoxConfigData_t m_configData; - - /////////////////////////////////////////////////////////////////////// - //// data structures for assembling cached metadata - typedef std::vector<__uint8> metadataFragment_t; - struct metadataFragmentEntry_t - { - metadataFragment_t m_fragment; - bool m_isValid; - - void clear() throw() - { - m_isValid = false; - m_fragment.clear(); - } - metadataFragmentEntry_t() throw() : m_isValid(false) {} - }; - - typedef metadataFragmentEntry_t metadataFragmentCollection_t[MAX_METADATA_FRAGMENTS]; - struct metadataEntry_t - { - metadataFragmentCollection_t m_fragments; - __uint16 m_expectedFragments; - __uint16 m_receivedFragments; - - void clear() throw() - { - for (int x = 0; x < MAX_METADATA_FRAGMENTS; ++x) - { - m_fragments[x].clear(); - } - m_receivedFragments = 0; - } - metadataEntry_t() throw() : m_expectedFragments(0), m_receivedFragments(0) {} - }; - - typedef __uint32 assemblyTableIndex_t; - static assemblyTableIndex_t makeAssemblyTableIndex(__uint16 voxMsgType,__uint16 metadataID) throw() - { - return ((((assemblyTableIndex_t)voxMsgType) << 16) | metadataID); - } - - typedef std::map metadataAssemblyTable_t; - std::map<__uint16,metadataAssemblyTable_t> m_metadataAssemblyTable; - ///////////////////////////////////////////////////// - - typedef void (protocol_uvox2Source::*state_t)(); - - state_t m_state; - state_t m_nextState; - - __uint8 *m_remainder; - short unsigned int m_remainderSize; - int m_loop; // hack until the read handler can process more than 1 packet at a time - - void state_SendBuffer() throw(std::exception); - void state_ConfirmPasswordGet() throw(std::exception); - void state_ConfirmPassword() throw(std::exception); - void state_SendCrypto() throw(std::exception); - void state_CloseConnection() throw(std::exception); - void state_StreamConfiguration() throw(std::exception); - void state_StreamConfigurationGet() throw(std::exception); - void state_GetPacket() throw(std::exception); - void state_StreamDataGet() throw(std::exception); - void state_GetStreamData() throw(std::exception); - - template void loadAndSendMsg(const T &msg,int type,state_t nextState) throw(); - -protected: - virtual void timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "protocol_uvox2Source"; } - -public: - protocol_uvox2Source (microConnection &mc, const __uint8 *firstPacket, const int sizeOfFirstPacket) throw(exception); - - protocol_uvox2Source(const socketOps::tSOCKET s, const uniString::utf8 &addr, const u_short port, - const __uint8 *firstPacket, const int sizeOfFirstPacket) throw(std::exception); - virtual ~protocol_uvox2Source() throw(); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/readme.txt b/Src/Plugins/DSP/sc_serv3/readme.txt deleted file mode 100644 index e7daea4d..00000000 --- a/Src/Plugins/DSP/sc_serv3/readme.txt +++ /dev/null @@ -1,89 +0,0 @@ -Building sc_serv2 ------------------ - -The build dependencies for sc_serv2 are expat and zlib and these already have a pre-built -library stored in the 'libs' folder. Otherwise everything else is built from the contents -of the sc_serv3 folder so the libs only need to be updated rarely. - -It is assumed in all cases that there is a valid gcc + g++ tool chain in place along with -all standard libraries for building tools on the platform being used. - - -Win32 / Win64 -------------- - -The MSVC 2008 project builds straight from here with it using the pre-built libraries. - -As from DNAS v2.6, additional libcurl, libssl & libcrypto .lib files are required. -External zip files can be downloaded from the Nullsoft github repo: -https://github.com/Radionomy/Nullsoft/blob/master/Shoutcast/sc_serv3/deps/win32.7z -https://github.com/Radionomy/Nullsoft/blob/master/Shoutcast/sc_serv3/deps/win64.7z - -Extract locally to Shoutcast\sc_serv3\deps - - -BSD / Mac OS X / Linux ----------------------- - -The following is only needed if there is an update of the dependency library current -setup requires building expat before you can build sc_serv2 itself (not ideal but as it -is usually a build once event on the dependencies then it isn't too much of an issue...). - -EXPAT ------ - -In most cases just running ./unix_build_expat in the aolxml folder will build it. - - -ZLIB ----- - -./configure --static && make - -May also need to set (or applicable): - - export CC="/usr/bin/gcc44" - -in order to get it using the desired version of GCC on the system used to build this. - - ------------ - -Once all of the dependencies have been built then you just need to do "(g)make release" -to get a build. The make stage accepts the following modes: - - clean - release - fire - debug - - -Building on Centos 7 (on x64) ------------------------------ -Packages to install to enable compilation - sudo yum install gcc-c++ - sudo yum install openssl-devel - sudo yum install libstdc++-static - - curl http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/libcurl-devel-7.61.1-22.el8.x86_64.rpm > libcurl-devel.rpm - sudo rpm install libcur-devel.rpm - -If the directory deps/x86_64/lib does not exists create it - mkdir -p deps/x86_64/lib -Copy the static dependencies to this directory - cp libs/Aol_XML/Linux_x86_64/libexpat.a deps/x86_64/lib/ - cp libs/zlib/Linux_x86_64/libz.a deps/x86_64/lib/ - -Notes ------ - -Building assumes that both the C and C++ compilers are correctly setup on the machine. -When doing the linux build on ubuntu 10.10 the g++ compiler was not available leading to -"error trying to exec 'cc1plus' execvp" errors during building. The fix is: - - sudo apt-get install g++ - -When doing the linux build on Centos 5.5 the g++ compiler was not available leading to -"gcc: error trying to exec 'cc1plus': execvp: No such file or directory". The fix is: - - yum install gcc-c++ diff --git a/Src/Plugins/DSP/sc_serv3/resource.h b/Src/Plugins/DSP/sc_serv3/resource.h deleted file mode 100644 index e16fd8f7..00000000 --- a/Src/Plugins/DSP/sc_serv3/resource.h +++ /dev/null @@ -1,16 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by sc_serv.rc -// -#define IDI_ICY 101 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/Src/Plugins/DSP/sc_serv3/ripList.cpp b/Src/Plugins/DSP/sc_serv3/ripList.cpp deleted file mode 100644 index b7e9348f..00000000 --- a/Src/Plugins/DSP/sc_serv3/ripList.cpp +++ /dev/null @@ -1,391 +0,0 @@ -#ifdef _WIN32 -#include -#else -#include -#include -#include -#endif - -#include -#include -#include "ripList.h" -#include "global.h" -#include "stl/stringUtils.h" -#include "macros.h" -#include "webNet/socketOps.h" -#include "file/fileUtils.h" -#include "services/stdServiceImpl.h" -#include - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -#define LOGNAME "[RIP] " - -#ifdef _WIN32 -typedef unsigned long in_addr_t; -#endif - -ripList g_ripList; - -class ripList::impl -{ -private: - struct ripEntrySave - { - FILE *f; - size_t stream_ID; - }; - - struct ripEntry: public rip_t - { - in_addr_t m_ip; // ip as binary type. Old style, but that's how the old sc_serv did it and we'll - // continue to do it that way until we're ready to break the old software - - void save(ripEntrySave entrySave) throw(exception) - { - if (m_stream_ID == entrySave.stream_ID) - { - utf8 s(m_numericIP + eol()); - if (fwrite(s.c_str(),1,s.size(),entrySave.f) != s.size()) - { - throwEx(LOGNAME "I/O error writing " + (!entrySave.stream_ID ? "global" : "sid=" + tos(entrySave.stream_ID)) + " rip file"); - } - } - } - - bool validIP() throw() - { - return ((m_ip != INADDR_NONE) && (m_ip != 0)); - } - - static in_addr_t stringToIP(const utf8 &sIP, utf8 &hostIP) - { - // default is to assume a raw IP address in the list - in_addr_t ip = inet_addr((const char *)sIP.c_str()); - if (ip == INADDR_NONE) - { - // though if that fails then attempt to - // get an IP address from a hostname... - string sHost; - try - { - sHost = socketOps::hostNameToAddress(sIP.hideAsString()); - } - catch(...) - { - } - if (!sHost.empty()) - { - ip = inet_addr((const char *)sHost.c_str()); - if (ip != INADDR_NONE) - { - hostIP = sHost; - } - } - } - return ip; - } - - ripEntry(const utf8 &numericIP, const size_t stream_ID) throw() : rip_t(numericIP, stream_ID), m_ip(stringToIP(numericIP, m_hostIP)) {} - ripEntry() throw() : m_ip(0) {} - }; - - AOL_namespace::mutex m_lock; - list m_list; - -public: - bool load(const uniFile::filenameType &fn, size_t stream_ID) throw(exception) - { - if (fn.empty()) - { - throwEx(LOGNAME "No " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " rip file"); - } - else if (gOptions.microServerDebug()) - { - DLOG(LOGNAME "Attempting to read rip file: " + fileUtil::getFullFilePath(fn)); - } - - stackLock sml(m_lock); - - FILE *f = uniFile::fopen(fn,"rb"); - if (!f) return false; - - bool updating = (!m_list.empty()); - m_list.clear(); - - try - { - int l = 0; - int count = 0; - while (true) - { - char buffer[4096] = {0}; - - if (!fgets(buffer, sizeof(buffer), f)) break; // get a line - - ++l; // increment line counter - - utf8 s; - - // skip utf-8 BOM - if ((strlen(buffer) > 2) && - (((unsigned char*)buffer)[0] == 0xef) && - (((unsigned char*)buffer)[1] == 0xbb) && - (((unsigned char*)buffer)[2] == 0xbf)) - { - s = &(buffer[3]); - } - else - { - s = buffer; - } - - ripEntry e(stripWhitespace(s),stream_ID); - - if (!e.validIP()) - { - WLOG(LOGNAME "Line " + tos(l) + " of " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " rip list has been ignored (bad IP)"); - } - else - { - if (this->find(e.m_numericIP,e.m_stream_ID,false) == false) - { - m_list.push_back(e); - ++count; - } - } - } - if (!updating) - { - if (count > 0) - { - ILOG(LOGNAME "Reserved " + tos(count) + " IP" + (count != 1 ? "'s" : "") + - " from " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " rip file"); - } - else if (gOptions.microServerDebug()) - { - DLOG(LOGNAME "No IPs read from " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " rip file"); - } - } - else - { - ILOG(LOGNAME "Reloaded " + tos(count) + " Reserved IP" + (count != 1 ? "'s" : "") + - " from " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + " rip file"); - } - } - catch(...) - { - if (f) ::fclose(f); - throw; - } - if (f) ::fclose(f); - return true; - } - - void save(const uniFile::filenameType &fn,size_t stream_ID) throw(exception) - { - stackLock sml(m_lock); - - FILE *f = uniFile::fopen(fn,"wb"); - if (!f) - { - throwEx(LOGNAME "Could not open " + (!stream_ID ? "global" : "sid=" + tos(stream_ID)) + - " rip file `" + fn + "' for writing (" + errMessage().hideAsString() + ")"); - } - try - { - ripEntrySave entrySave; - entrySave.f = f; - entrySave.stream_ID = stream_ID; - for_each(m_list.begin(),m_list.end(),bind2nd(mem_fun_ref(&ripEntry::save),entrySave)); - } - catch(...) - { - if (f) ::fclose(f); - throw; - } - if (f) ::fclose(f); - - if (!uniFile::fileSize(fn)) - { - uniFile::unlink(fn); - } - } - - bool add(const utf8 &ipAddr, const size_t stream_ID, const bool soft) throw(exception) - { - // skip loopback addresses as we treat them specially anyway - if ((ipAddr.find(utf8("127.")) == utf8::npos)) - { - ripEntry e(ipAddr, stream_ID); - if (!e.validIP()) - { - if (!soft) - { - throwEx(LOGNAME "Invalid IP specified - `" + ipAddr + "'"); - } - else - { - return false; - } - } - - stackLock sml(m_lock); - m_list.push_back(e); - return true; - } - return false; - } - - // true if removed - bool remove(const utf8 &ipAddr, const size_t stream_ID, const bool allStream, const bool fallback = false, const bool use_lock = true) - { - if (use_lock) - { - stackLock sml(m_lock); - } - - for (list::iterator i = m_list.begin(); i != m_list.end(); ++i) - { - if ( - (allStream || ((!allStream && ((*i).m_numericIP == ipAddr)) || ((*i).m_hostIP == ipAddr))) && - ((*i).m_stream_ID == stream_ID)) - { - m_list.erase(i); - return true; - } - } - - // attempt to see if we've got a hostname which has not been detected from the loading mapping - if (!fallback) - { - string sHost; - try - { - sHost = socketOps::hostNameToAddress(ipAddr.hideAsString()); - } - catch(...) - { - } - if (!sHost.empty()) - { - return remove(sHost, stream_ID, allStream, true, false); - } - } - - return false; - } - - // true if found - bool find(const utf8 &ipAddr, const size_t stream_ID, const bool use_lock = true) throw() - { - if (use_lock) - { - stackLock sml(m_lock); - } - - if (!m_list.empty()) - { - for (list::const_iterator i = m_list.begin(); i != m_list.end(); ++i) - { - if (((*i).m_stream_ID == stream_ID) && - ((ipAddr == (*i).m_numericIP) || (ipAddr == (*i).m_hostIP))) - { - return true; - } - } - } - - return false; - } - - void get(std::vector &rl, size_t stream_ID) throw() - { - stackLock sml(m_lock); - - for (list::const_iterator i = m_list.begin(); i != m_list.end(); ++i) - { - if ((*i).m_stream_ID == stream_ID) - { - rl.push_back(*i); - } - } - } -}; - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -ripList::ripList() : m_impl(0) -{ - m_impl = new ripList::impl; -} - -ripList::~ripList() throw() -{ - forget(m_impl); -} - -bool ripList::load(const uniFile::filenameType &fn, size_t stream_ID) throw() -{ - assert(m_impl); - - bool result(false); - - try - { - result = m_impl->load(fn,stream_ID); - } - catch(const exception &ex) - { - ELOG(ex.what()); - } - return result; -} - -bool ripList::save(const uniFile::filenameType &fn, size_t stream_ID) throw() -{ - assert(m_impl); - - bool result(false); - - try - { - m_impl->save(fn,stream_ID); - result = true; - } - catch(const exception &ex) - { - ELOG(ex.what()); - } - return result; -} - -// throws if parameters are invalid -bool ripList::add(const utf8 &ipAddr, const size_t stream_ID, const bool soft) throw(exception) -{ - assert(m_impl); - return m_impl->add(ipAddr, stream_ID, soft); -} - -// true if removed -bool ripList::remove(const utf8 &ipAddr, const size_t stream_ID, const bool allStream) throw() -{ - assert(m_impl); - return m_impl->remove(ipAddr, stream_ID, allStream); -} - -// true if found -bool ripList::find(const utf8 &ipAddr, const size_t stream_ID) throw() -{ - assert(m_impl); - return m_impl->find(ipAddr, stream_ID); -} - -void ripList::get(vector &bl, const size_t stream_ID) throw() -{ - assert(m_impl); - m_impl->get(bl, stream_ID); -} diff --git a/Src/Plugins/DSP/sc_serv3/ripList.h b/Src/Plugins/DSP/sc_serv3/ripList.h deleted file mode 100644 index 9ae418a2..00000000 --- a/Src/Plugins/DSP/sc_serv3/ripList.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once -#ifndef ripList_H_ -#define ripList_H_ - -#include "unicode/uniFile.h" - -// class that manages lists of reserved IPs -// these are remote addresses that must always be allowed in no matter what. - -class ripList -{ -private: - class impl; - impl *m_impl; - -public: - struct rip_t - { - uniString::utf8 m_numericIP; - uniString::utf8 m_hostIP; // used to hold the converted IP from a hostname - size_t m_stream_ID; // used to differentiate - - rip_t(const uniString::utf8 &numericIP, const size_t stream_ID) throw() : m_numericIP(numericIP), m_stream_ID(stream_ID) {} - rip_t() throw() : m_stream_ID(0) {} - }; - - // throws if parameters are invalid - bool add(const uniString::utf8 &ipAddr, const size_t stream_ID, const bool soft) throw(std::exception); - // true if removed - bool remove(const uniString::utf8 &ipAddr, const size_t stream_ID, const bool allStream) throw(); - // true if found - bool find(const uniString::utf8 &ipAddr, const size_t stream_ID) throw(); - - bool load(const uniFile::filenameType &fn, const size_t stream_ID) throw(); - bool save(const uniFile::filenameType &fn, const size_t stream_ID) throw(); - - ripList(); - ~ripList() throw(); - - // for web administration reference - void get(std::vector &rl, size_t stream_ID) throw(); -}; - -extern ripList g_ripList; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/sc_serv.rc b/Src/Plugins/DSP/sc_serv3/sc_serv.rc deleted file mode 100644 index 080ed630..00000000 --- a/Src/Plugins/DSP/sc_serv3/sc_serv.rc +++ /dev/null @@ -1,112 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 777,21,01,2023 - PRODUCTVERSION 2,6,1,777 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "Radionomy SA" - VALUE "FileDescription", "Shoutcast DNAS v2.6.1" - VALUE "FileVersion", "777, 21, 01, 2022" - VALUE "InternalName", "sc_serv.exe" - VALUE "LegalCopyright", "Copyright © 2014-2023 Radionomy SA" - VALUE "LegalTrademarks", "Shoutcast is a trademark of Radionomy SA" - VALUE "OriginalFilename", "sc_serv.exe" - VALUE "ProductName", "Shoutcast DNAS v2.6.1" - VALUE "ProductVersion", "2, 6, 1, 777" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_ICY ICON "icy.ico" -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/Src/Plugins/DSP/sc_serv3/sc_serv.vcxproj b/Src/Plugins/DSP/sc_serv3/sc_serv.vcxproj deleted file mode 100644 index 4d3d1187..00000000 --- a/Src/Plugins/DSP/sc_serv3/sc_serv.vcxproj +++ /dev/null @@ -1,393 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - 17.0 - {5A93B2EA-61E0-4079-A002-06B4EA498853} - sc_serv - Win32Proj - 10.0.19041.0 - - - - Application - v142 - Unicode - true - - - Application - v142 - Unicode - false - - - Application - v142 - Unicode - true - - - Application - v142 - Unicode - false - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>17.0.32505.173 - - - $(PlatformShortName)_$(Configuration)\ - $(PlatformShortName)_$(Configuration)\ - false - false - $(IncludePath) - $(LibraryPath) - - - $(PlatformShortName)_$(Configuration)\ - $(PlatformShortName)_$(Configuration)\ - false - false - - - $(PlatformShortName)_$(Configuration)\ - $(PlatformShortName)_$(Configuration)\ - false - false - $(IncludePath) - $(LibraryPath) - - - $(PlatformShortName)_$(Configuration)\ - $(PlatformShortName)_$(Configuration)\ - false - false - - - false - true - - - false - - - Debug - x86-windows-static - - - - - false - x86-windows-static - - - - - false - x86-windows-static - Debug - - - - - false - x86-windows-static - - - - Disabled - .;nmrCommon;GeoIP\libGeoIP;..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\include;.\deps\win32\include;%(AdditionalIncludeDirectories) - _WINDOWS;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0601;WINVER=0x0601;XML_STATIC;_DEBUG;WIN32;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - 4290;4996;4512;4505;4244;4127;4100;4057;%(DisableSpecificWarnings) - true - $(IntDir)$(TargetName).pdb - - - crypt32.lib;version.lib;ws2_32.lib;shlwapi.lib;wldap32.lib;%(AdditionalDependencies) - true - true - Console - true - MachineX86 - %(AdditionalLibraryDirectories) - $(IntDir)$(TargetName).pdb - false - - - - - Disabled - nmrCommon;deps\win64\include;GeoIP\libGeoIP;libcurl\include;pthread-win32;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0500;WINVER=0x0500;ZLIB_WINAPI;CURL_STATICLIB;XML_STATIC;PTW32_STATIC_LIB;%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - 4290;4996;%(DisableSpecificWarnings) - true - $(IntDir)$(TargetName).pdb - - - crypt32.lib;version.lib;ws2_32.lib;shlwapi.lib;wldap32.lib;expat.lib;%(AdditionalDependencies) - LinkVerboseLib - $(ProjectDir)..\..\..\external_dependencies\expat\$(PlatformShortName)_$(Configuration);%(AdditionalLibraryDirectories) - true - true - Console - true - MachineX64 - false - $(IntDir)$(TargetName).pdb - - - - - MinSpace - Size - .;nmrCommon;GeoIP\libGeoIP;..\..\..\external_dependencies\vcpkg\$(PlatformShortName)-windows-static\include;.\deps\win32\include;%(AdditionalIncludeDirectories) - _WINDOWS;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0601;WINVER=0x0601;XML_STATIC;NDEBUG;WIN32;%(PreprocessorDefinitions) - true - true - Level3 - None - 4290;4996;4512;4505;4244;4127;4100;4057;%(DisableSpecificWarnings) - true - $(IntDir)$(TargetName).pdb - MultiThreaded - - - crypt32.lib;version.lib;ws2_32.lib;shlwapi.lib;wldap32.lib;%(AdditionalDependencies) - %(AdditionalLibraryDirectories) - false - Console - true - true - true - MachineX86 - $(IntDir)$(TargetName).pdb - false - true - UseLinkTimeCodeGeneration - - - - - MinSpace - Size - nmrCommon;GeoIP\libGeoIP;deps\win64\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WIN32_WINNT=0x0500;WINVER=0x0500;ZLIB_WINAPI;CURL_STATICLIB;XML_STATIC;PTW32_STATIC_LIB;%(PreprocessorDefinitions) - true - true - Level3 - None - 4290;4996;%(DisableSpecificWarnings) - true - $(IntDir)$(TargetName).pdb - MultiThreaded - - - false - - - crypt32.lib;version.lib;ws2_32.lib;shlwapi.lib;wldap32.lib;expat.lib;%(AdditionalDependencies) - NotSet - $(ProjectDir)..\..\..\external_dependencies\expat\$(PlatformShortName)_$(Configuration);%(AdditionalLibraryDirectories) - false - false - Console - true - true - true - MachineX64 - false - $(IntDir)$(TargetName).pdb - UseLinkTimeCodeGeneration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - mc %(Filename)%(Extension) - - %(Filename).rc;%(Outputs) - mc %(Filename)%(Extension) - - %(Filename).rc;%(Outputs) - - - - - - - - - - \ No newline at end of file diff --git a/Src/Plugins/DSP/sc_serv3/sc_serv.vcxproj.filters b/Src/Plugins/DSP/sc_serv3/sc_serv.vcxproj.filters deleted file mode 100644 index 96d430dd..00000000 --- a/Src/Plugins/DSP/sc_serv3/sc_serv.vcxproj.filters +++ /dev/null @@ -1,478 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - {c34a54ac-e9e7-4c8a-b9f9-9cc7758d3d21} - - - {3f82ce9b-8dc8-424a-bdde-8c342e7feb9b} - - - {fb22ca6f-a754-4d98-b944-dd2661f51e25} - - - {22dcd7de-78a0-42dc-aaee-5e0e04ac5b77} - - - {1988542f-b8aa-4c7c-8fb6-12b0e2526d28} - - - {58a554bb-7523-4c5d-9241-bd5415e2c419} - - - {91c2a3ab-9a23-4d9e-bcd6-5b0d3e510903} - - - {9ee51758-e92b-4ad9-aee0-ed69e46618d3} - - - {1ddb836e-12e8-49a1-b8c2-909481bb2c6d} - - - {737011da-050f-44ad-b3b6-5d567f7e4637} - - - {5ee15fe3-52cc-4159-923c-e836529f487a} - - - {67d8861d-7f54-4184-80dd-c9678138388c} - *.h - - - {6e00589b-88ef-4ea1-8f8b-51596a345943} - - - {a656032e-a732-4832-b3a3-0bcea8f6d791} - - - {07a48b1f-8e08-4e90-93b4-71653561b78a} - - - {d27744f0-c242-402c-95be-646dc831abea} - - - {60d7f6d7-1b1e-464a-894b-52daa21450eb} - - - {95b2a92c-2e41-4f7c-810d-a04ae787d388} - - - {8b2c078c-2c94-41bc-9132-db30125dc6d2} - - - {a969a98a-24a4-4466-95a2-829958825065} - - - {bdb6b5dd-09ef-4fd9-83b9-7ca8b40a7695} - - - {1358113b-a1a5-45ec-8c3a-69915899e621} - - - {46611830-1bd8-417e-9843-14aa9c2e3a92} - - - {d9918193-0071-4850-8917-f7ad4516fc3b} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - nmrCommon\services - - - nmrCommon\services - - - nmrCommon\services - - - nmrCommon\services - - - nmrCommon\threading - - - nmrCommon\unicode - - - nmrCommon\unicode - - - nmrCommon\win32 - - - nmrCommon\file - - - webNet - - - webNet - - - aolxml - - - aolxml - - - flashPolicyServer - - - listener_clients - - - listener_clients - - - listener_clients - - - listener_clients - - - listener_clients - - - listener_clients - - - yp - - - geoip - - - geoip - - - geoip - - - geoip - - - updater - - - metrics - - - auth - - - aac - - - mp3 - - - flv - - - source_clients - - - source_clients - - - source_clients - - - source_clients - - - source_clients - - - source_clients - - - source_clients - - - web_ui - - - web_ui - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - nmrCommon\services - - - nmrCommon\services - - - nmrCommon\services - - - nmrCommon\services - - - nmrCommon\threading - - - nmrCommon\threading - - - nmrCommon\unicode - - - nmrCommon\unicode - - - nmrCommon\win32 - - - nmrCommon\stl - - - nmrCommon\stl - - - nmrCommon\stl - - - nmrCommon\file - - - webNet - - - webNet - - - aolxml - - - flashPolicyServer - - - listener_clients\Header Files - - - listener_clients\Header Files - - - listener_clients\Header Files - - - listener_clients\Header Files - - - listener_clients\Header Files - - - listener_clients\Header Files - - - yp - - - geoip - - - geoip - - - geoip - - - geoip - - - geoip - - - metrics - - - auth - - - aac - - - mp3 - - - flv - - - source_clients\Header Files - - - source_clients\Header Files - - - source_clients\Header Files - - - source_clients\Header Files - - - source_clients\Header Files - - - source_clients\Header Files - - - source_clients\Header Files - - - web_ui\Header Files - - - web_ui\Header Files - - - - - Resource Files - - - - - Resource Files - - - Resource Files - - - - - Resource Files - - - updater - - - \ No newline at end of file diff --git a/Src/Plugins/DSP/sc_serv3/stats.cpp b/Src/Plugins/DSP/sc_serv3/stats.cpp deleted file mode 100644 index bfdeda21..00000000 --- a/Src/Plugins/DSP/sc_serv3/stats.cpp +++ /dev/null @@ -1,862 +0,0 @@ -#ifdef _WIN32 -#include -#endif - -#include "protocol_shoutcastClient.h" -#include "stats.h" -#include "agentList.h" -#include "services/stdServiceImpl.h" -#include - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -static AOL_namespace::mutex g_statLock; - -#define DEBUG_LOG(...) do { if (gOptions.statsDebug()) DLOG(__VA_ARGS__); } while (0) - -#define LOGNAME "[STATS] " - -const utf8 EMPTY_AGENT("**EMPTY**"); - -struct statTableEntry_t -{ - size_t m_peakListeners; - size_t m_totalStreamHits; - typedef map clientEntry_t; - clientEntry_t m_clientData; - - statTableEntry_t() : m_peakListeners(0), m_totalStreamHits(0) {} -}; - -typedef map streamStatTable_t; - -static streamStatTable_t g_streamStatTable; -static size_t g_totalClients; -static size_t g_uniqueClientId; - -const size_t stats::getNewClientId() -{ - return ++g_uniqueClientId; -} - -static bool _kickNonRipClientFromStream(const streamData::streamID_t id) throw() -{ - bool kicked = false; - - // first try our stream - streamStatTable_t::iterator ti = g_streamStatTable.find(id); - if (ti != g_streamStatTable.end()) - { - statTableEntry_t &ste = (*ti).second; - if (!ste.m_clientData.empty()) - { - statTableEntry_t::clientEntry_t &ce = ste.m_clientData; - - for (statTableEntry_t::clientEntry_t::iterator ci = ce.begin(); (ci != ce.end()) && (!kicked); ++ci) - { - if ((!(*ci).second->m_kicked) && (!(*ci).second->m_ripClient)) - { - (*ci).second->m_kicked = true; - if ((*ci).second->m_client) - { - (*ci).second->m_client->kickNextRound(); - } - kicked = true; - } - } - } - } - - return kicked; -} - -static bool _kickRandomNonRipClient(const streamData::streamID_t id, const bool anyStream) throw() -{ - bool kicked = _kickNonRipClientFromStream(id); - if ((!kicked) && anyStream) - { - for (streamStatTable_t::const_iterator i = g_streamStatTable.begin(); (i != g_streamStatTable.end()) && (!kicked); ++i) - { - kicked = _kickNonRipClientFromStream((*i).first); - } - } - - return kicked; -} - -const int stats::addClient(const streamData::streamID_t id, const utf8 &hostName, - const utf8 &ipAddr, const utf8 &userAgent, const bool ripClient, - const size_t clientUnique, protocol_shoutcastClient *client) -{ - if (id > 0) - { - stackLock sml(g_statLock); - - // to prevent some of the stats / logs getting skewed - // then we filter out the SHOUTcast site 'test' users - if (isUserAgentOfficial(toLower(userAgent))) - { - return 1; - } - - statTableEntry_t &ste = g_streamStatTable[id]; - ++ste.m_totalStreamHits; - - if (ste.m_clientData.find(clientUnique) == ste.m_clientData.end()) - { - // seen this crop up a bit and seem dodgy so rejecting (may change based on usage feedback) - if (userAgent.empty() && gOptions.blockEmptyUserAgent()) - { - return -1; - } - - // this will check against a blocked 'user agent' list - // so we can give stations a means to block bad clients - // e.g. Winamp/5.0 or Bass/2.x or something like that - if (!userAgent.empty() && g_agentList.find(userAgent, ((gOptions.read_stream_agentFile(id) && !gOptions.stream_agentFile(id).empty()) ? id : 0))) - { - return -2; - } - - streamData::streamInfo info; - streamData::extraInfo extra; - streamData::getStreamInfo(id, info, extra); - const int _maxUser = gOptions.maxUser(), - maxUsers = ((info.m_streamMaxUser > 0) && (info.m_streamMaxUser < _maxUser) ? info.m_streamMaxUser : _maxUser); - - const size_t num_clients = ste.m_clientData.size(); - const bool over = ((maxUsers && ((int)num_clients >= maxUsers)) || - (_maxUser && ((int)g_totalClients >= _maxUser))); - if (over && !ripClient) - { - return 0; // too many, and we are not allowed to boot anyone - } - - if (over && ripClient) // too many, and we are allowed to try to boot someone... - { - // if total reserved is already at the listener limit then nothing else to do - if (getTotalRipClients(id) < num_clients) - { - // we only allow the new listener to join as long as we can kick someone - if (!_kickRandomNonRipClient(id, true)) - { - return 0; - } - } - else - { - return 0; - } - } - - ste.m_clientData[clientUnique] = new stats::clientData_t(hostName, ipAddr, ripClient, client); - ste.m_peakListeners = max(ste.m_clientData.size(), ste.m_peakListeners); - ++g_totalClients; - - DEBUG_LOG(LOGNAME "System wide listener total now " + tos(g_totalClients)); - - return 1; - } - } - return 0; -} - - -// hacky, to maintain a count in here, should be one in sd -long stats::getUserCount (const streamData::streamID_t id) -{ - long c = 0; - if (id > 0) - { - stackLock sml(g_statLock); - statTableEntry_t &ste = g_streamStatTable[id]; - c = ste.m_clientData.size(); - } - return c; -} - - -void stats::removeClient(const streamData::streamID_t id, const size_t clientUnique) -{ - if ((id > 0) && (g_totalClients > 0)) - { - stackLock sml(g_statLock); - - streamStatTable_t::iterator ti = g_streamStatTable.find(id); - if (ti != g_streamStatTable.end()) - { - statTableEntry_t &ste = (*ti).second; - if (!ste.m_clientData.empty()) - { - statTableEntry_t::clientEntry_t::iterator i = ste.m_clientData.find(clientUnique); - if (i != ste.m_clientData.end()) - { - delete i->second; - ste.m_clientData.erase(clientUnique); - - g_totalClients -= 1; - DEBUG_LOG(LOGNAME "System wide listener total now " + tos(g_totalClients)); - } - } - } - } -} - -// get stats. Some values, like newSessions and newConnects set a flag so that clients are only counted once. -// This is fine for touch reporting, but sometimes we want to fetch this information and, since we are not touching YP, -// do not want to set the flags indicating that things have been counted. The "resetAccumulators" flag controls this. -// Set to true for touch, false otherwise -void stats::getStats(streamData::streamID_t id, statsData_t &data, bool resetAccumulators) throw() -{ - if (id > 0) - { - stackLock sml(g_statLock); - - streamStatTable_t::iterator ti = g_streamStatTable.find(id); - if (ti != g_streamStatTable.end()) - { - statTableEntry_t &ste = (*ti).second; - - data.peakListeners = ste.m_peakListeners; - data.totalStreamHits = ste.m_totalStreamHits; - - if (!ste.m_clientData.empty()) - { - set ipTable; - - time_t t = ::time(NULL); - data.connectedListeners = ste.m_clientData.size(); - __uint64 total_listen_time = 0; - for (statTableEntry_t::clientEntry_t::iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked) - { - if (ipTable.find((*i).second->m_ipAddr) == ipTable.end()) - { - ++data.uniqueListeners; - } - ipTable.insert((*i).second->m_ipAddr); - } - - total_listen_time += (t - (*i).second->m_client->getStartTime()); - if (!(*i).second->m_connectCounted) - { - if (resetAccumulators) - { - (*i).second->m_connectCounted = true; - } - ++data.newConnects; - } - - if ((!(*i).second->m_fiveMinuteCumeCounted) && ((t - (*i).second->m_client->getStartTime()) > (5 * 60))) - { - if (resetAccumulators) - { - (*i).second->m_fiveMinuteCumeCounted = true; - } - ++data.newSessions; - } - } - - data.avgUserListenTime = (data.connectedListeners ? (int)(total_listen_time / data.connectedListeners) : 0); - } - } - } -} - -void stats::getFinalStats() throw() -{ - stackLock sml(g_statLock); - - size_t totalPeak = 0; - utf8 msg; - - if (!g_streamStatTable.empty()) - { - for (streamStatTable_t::const_iterator ti = g_streamStatTable.begin(); ti != g_streamStatTable.end(); ++ti) - { - size_t peakListeners = (*ti).second.m_peakListeners; - totalPeak += peakListeners; - msg += (msg.size() > 0 ? ",#" : "#") + tos((*ti).first) + ":" + tos(peakListeners); - } - } - - if (totalPeak > 0) - { - msg += (!g_streamStatTable.empty() ? "," : (utf8)"") + "Total: " + tos(totalPeak); - ILOG(LOGNAME "Peak numbers: " + msg); - } -} - -const streamData::streamIDs_t stats::getActiveStreamIds() throw() -{ - stackLock sml(g_statLock); - - streamData::streamIDs_t activeIds; - - for (streamStatTable_t::const_iterator ti = g_streamStatTable.begin(); ti != g_streamStatTable.end(); ++ti) - { - // we check this to make sure that we're only - // adding 'active' details and skip inactive - const statTableEntry_t &ste = (*ti).second; - if (!ste.m_clientData.empty()) - { - if (activeIds.find((*ti).first) == activeIds.end()) - { - activeIds.insert((*ti).first); - } - } - } - - return activeIds; -} - -const size_t stats::getTotalUniqueListeners() throw() -{ - stackLock sml(g_statLock); - - size_t uniqueListeners = 0; - - set ipTable; - - for (streamStatTable_t::const_iterator ti = g_streamStatTable.begin(); ti != g_streamStatTable.end(); ++ti) - { - const statTableEntry_t &ste = (*ti).second; - if (!ste.m_clientData.empty()) - { - for (statTableEntry_t::clientEntry_t::const_iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked) - { - if (ipTable.find((*i).second->m_ipAddr) == ipTable.end()) - { - ++uniqueListeners; - } - ipTable.insert((*i).second->m_ipAddr); - } - } - } - } - - return uniqueListeners; -} - -const size_t stats::getTotalRipClients(streamData::streamID_t id) throw() -{ - size_t uniqueListeners = 0; - - if (id > 0) - { - streamStatTable_t::const_iterator ti = g_streamStatTable.find(id); - if (ti != g_streamStatTable.end()) - { - const statTableEntry_t &ste = (*ti).second; - if (!ste.m_clientData.empty()) - { - for (statTableEntry_t::clientEntry_t::const_iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked && (*i).second->m_ripClient) - { - ++uniqueListeners; - } - } - } - } - } - - return uniqueListeners; -} - -void stats::updateRipClients(const streamData::streamID_t id, const uniString::utf8& ripAddr, const bool mode) -{ - stackLock sml(g_statLock); - - if (id) - { - streamStatTable_t::iterator ti = g_streamStatTable.find(id); - if (ti != g_streamStatTable.end()) - { - statTableEntry_t &ste = (*ti).second; - if (!ste.m_clientData.empty()) - { - for (statTableEntry_t::clientEntry_t::iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked && ((*i).second->m_ipAddr == ripAddr)) - { - (*i).second->m_ripClient = mode; - } - } - } - } - } - else - { - for (streamStatTable_t::iterator i = g_streamStatTable.begin(); i != g_streamStatTable.end(); ++i) - { - statTableEntry_t &ste = (*i).second; - if (!ste.m_clientData.empty()) - { - for (statTableEntry_t::clientEntry_t::iterator c = ste.m_clientData.begin(); c != ste.m_clientData.end(); ++c) - { - if (!(*c).second->m_kicked && ((*c).second->m_ipAddr == ripAddr)) - { - (*c).second->m_ripClient = mode; - } - } - } - } - } -} - -void stats::resetStats(const streamData::streamID_t id) throw() -{ - if (id > 0) - { - stackLock sml(g_statLock); - - streamStatTable_t::iterator ti = g_streamStatTable.find(id); - if (ti != g_streamStatTable.end()) - { - statTableEntry_t &ste = (*ti).second; - // reset peak and stream hits to current client connection level - ste.m_totalStreamHits = ste.m_peakListeners = ste.m_clientData.size(); - } - } -} - -void stats::updatePeak(const streamData::streamID_t id, const size_t peakListeners) throw() -{ - if (id > 0) - { - stackLock sml(g_statLock); - - streamStatTable_t::iterator ti = g_streamStatTable.find(id); - statTableEntry_t &ste = ((ti != g_streamStatTable.end()) ? (*ti).second : g_streamStatTable[id]); - ste.m_peakListeners = max(peakListeners, ste.m_peakListeners); - } -} - -void stats::updateTriggers(const streamData::streamID_t id, const size_t unique) throw() -{ - if (id > 0) - { - stackLock sml(g_statLock); - - streamStatTable_t::iterator ti = g_streamStatTable.find(id); - if (ti != g_streamStatTable.end()) - { - statTableEntry_t &ste = (*ti).second; - if (!ste.m_clientData.empty()) - { - for (statTableEntry_t::clientEntry_t::iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked && ((*i).first == unique)) - { - ++(*i).second->m_triggers; - break; - } - } - } - } - } -} - -static bool sortCurrentClientDataByTime(const stats::currentClientData_t* a, const stats::currentClientData_t* b) -{ - return (a->m_startTime < b->m_startTime); -} - -// get all client data blocks for stream -void stats::getClientDataForStream(const streamData::streamID_t id, currentClientList_t &client_data) throw() -{ - stackLock sml(g_statLock); - - if (id > 0) - { - streamStatTable_t::const_iterator ti = g_streamStatTable.find(id); - if (ti != g_streamStatTable.end()) - { - const statTableEntry_t &ste = (*ti).second; - if (!ste.m_clientData.empty()) - { - for (statTableEntry_t::clientEntry_t::const_iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked) - { - currentClientData_t* client = new currentClientData_t((*i).second->m_hostName, (*i).second->m_ipAddr, - (*i).second->m_client->getXFF(), (*i).second->m_client->getUserAgent(), - (*i).second->m_client->getReferer(), (*i).second->m_triggers, - (*i).second->m_client->getUnique(), (*i).second->m_client->getStartTime(), - (*i).second->m_client->getGroup(), (*i).second->m_client->getClientType(), - (*i).second->m_fiveMinuteCumeCounted, (*i).second->m_connectCounted, - (*i).second->m_ripClient, (*i).second->m_kicked); - client_data.push_back(client); - } - } - } - } - } - else - { - for (streamStatTable_t::const_iterator i = g_streamStatTable.begin(); i != g_streamStatTable.end(); ++i) - { - const statTableEntry_t &ste = (*i).second; - if (!ste.m_clientData.empty()) - { - for (statTableEntry_t::clientEntry_t::const_iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked) - { - currentClientData_t* client = new currentClientData_t((*i).second->m_hostName, (*i).second->m_ipAddr, - (*i).second->m_client->getXFF(), (*i).second->m_client->getUserAgent(), - (*i).second->m_client->getReferer(), (*i).second->m_triggers, - (*i).second->m_client->getUnique(), (*i).second->m_client->getStartTime(), - (*i).second->m_client->getGroup(), (*i).second->m_client->getClientType(), - (*i).second->m_fiveMinuteCumeCounted, (*i).second->m_connectCounted, - (*i).second->m_ripClient, (*i).second->m_kicked); - client_data.push_back(client); - } - } - } - } - } - - std::sort(client_data.begin(), client_data.end(), sortCurrentClientDataByTime); -} - -void stats::getClientDataForKicking(const streamData::streamID_t id, kickClientList_t &kick_data) throw() -{ - stackLock sml(g_statLock); - - if (id > 0) - { - streamStatTable_t::const_iterator ti = g_streamStatTable.find(id); - if (ti != g_streamStatTable.end()) - { - const statTableEntry_t &ste = (*ti).second; - if (!ste.m_clientData.empty()) - { - for (statTableEntry_t::clientEntry_t::const_iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked) - { - kickClientData_t* client = new kickClientData_t((*i).second->m_client->getUserAgent(), - (*i).second->m_client->getUnique(), - (*i).second->m_kicked); - kick_data.push_back(client); - } - } - } - } - } - else - { - for (streamStatTable_t::const_iterator i = g_streamStatTable.begin(); i != g_streamStatTable.end(); ++i) - { - const statTableEntry_t &ste = (*i).second; - if (!ste.m_clientData.empty()) - { - for (statTableEntry_t::clientEntry_t::const_iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked) - { - kickClientData_t* client = new kickClientData_t((*i).second->m_client->getUserAgent(), - (*i).second->m_client->getUnique(), - (*i).second->m_kicked); - kick_data.push_back(client); - } - } - } - } - } -} - -void stats::catchPreAddClients(const streamData::streamID_t id) -{ - if (id > 0) - { - stackLock sml(g_statLock); - - // make sure the client still exists before calling it - streamStatTable_t::iterator ti = g_streamStatTable.find(id); - if (ti != g_streamStatTable.end()) - { - statTableEntry_t &ste = (*ti).second; - if (!ste.m_clientData.empty()) - { - for (statTableEntry_t::clientEntry_t::iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - // if we find an active listener which has m_group = -1 then - // we need to get the listener to do a listener_add request. - if (!(*i).second->m_kicked && - (*i).second->m_client->m_removeClientFromStats && - ((*i).second->m_client->getGroup() == -1)) - { - // we only want to do this once - // so we'll set it to group = 0 - // and it'll not be done again. - (*i).second->m_client->setGroup(0); - - DEBUG_LOG((*i).second->m_client->m_clientLogString + "Re-authenticating listener for adverts / metrics."); - - // using this to force an attept to check but only for non - // 'local' listener connections which won't get a group id - if ((isRemoteAddress((*i).second->m_client->m_clientAddr) || - isRemoteAddress((*i).second->m_client->m_XFF))) - { - (*i).second->m_client->authForStream((*i).second->m_client->m_streamData); - } - (*i).second->m_client->reportNewListener(); - } - } - } - } - } -} - -// set flag in client so it will bail on next round. This is safe since the client object -// cannot delete itself until calling stats::removeClient() which is protected by the g_statLock -void stats::kickClient(const streamData::streamID_t id, const size_t unique) throw() -{ - if (id > 0) - { - stackLock sml(g_statLock); - - // make sure the client still exists before calling it - streamStatTable_t::iterator ti = g_streamStatTable.find(id); - if (ti != g_streamStatTable.end()) - { - statTableEntry_t &ste = (*ti).second; - if (!ste.m_clientData.empty()) - { - for (statTableEntry_t::clientEntry_t::iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked && ((*i).first == unique)) - { - (*i).second->m_kicked = true; - if ((*i).second->m_client) - { - (*i).second->m_client->kickNextRound(); - } - break; - } - } - } - } - } -} - -void stats::kickClient(const streamData::streamID_t id, const uniString::utf8& ipAddr) throw() -{ - if (id > 0) - { - stackLock sml(g_statLock); - - // make sure the client still exists before calling it - streamStatTable_t::iterator ti = g_streamStatTable.find(id); - if (ti != g_streamStatTable.end()) - { - statTableEntry_t &ste = (*ti).second; - if (!ste.m_clientData.empty()) - { - for (statTableEntry_t::clientEntry_t::iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked && ((*i).second->m_ipAddr == ipAddr)) - { - (*i).second->m_kicked = true; - if ((*i).second->m_client) - { - (*i).second->m_client->kickNextRound(); - } - } - } - } - } - } -} - -const bool stats::kickAllClients(const streamData::streamID_t id, const bool allStreams) throw() -{ - bool kicked = false; - if ((id > 0) && !allStreams) - { - stackLock sml(g_statLock); - - // make sure the client still exists before calling it - streamStatTable_t::iterator ti = g_streamStatTable.find(id); - if (ti != g_streamStatTable.end()) - { - statTableEntry_t &ste = (*ti).second; - if (!ste.m_clientData.empty()) - { - for (statTableEntry_t::clientEntry_t::iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked) - { - (*i).second->m_kicked = true; - if ((*i).second->m_client) - { - (*i).second->m_client->kickNextRound(); - kicked = true; - } - } - } - } - } - } - else if (!id && allStreams) - { - stackLock sml(g_statLock); - - for (streamStatTable_t::iterator ti = g_streamStatTable.begin(); ti != g_streamStatTable.end(); ++ti) - { - statTableEntry_t &ste = (*ti).second; - if (!ste.m_clientData.empty()) - { - for (statTableEntry_t::clientEntry_t::iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked) - { - (*i).second->m_kicked = true; - if ((*i).second->m_client) - { - (*i).second->m_client->kickNextRound(); - kicked = true; - } - } - } - } - } - } - - return kicked; -} - -static bool sortClientDataByTime(const stats::clientData_t &a, const stats::clientData_t &b) -{ - return (a.m_client->getStartTime() < b.m_client->getStartTime()); -} - -const bool stats::kickDuplicateClients(const streamData::streamID_t id) throw() -{ - bool kicked = false; - if (id > 0) - { - stackLock sml(g_statLock); - - // we first spin through all of the connected listeners and work out - // which listener addresses have more than one connection against it - streamStatTable_t::const_iterator ti = g_streamStatTable.find(id); - if (ti != g_streamStatTable.end()) - { - map ipTable; - - const statTableEntry_t &ste = (*ti).second; - if (!ste.m_clientData.empty()) - { - for (statTableEntry_t::clientEntry_t::const_iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked) - { - if (ipTable.find((*i).second->m_ipAddr) == ipTable.end()) - { - ipTable[(*i).second->m_ipAddr] = 1; - } - else - { - ++ipTable[(*i).second->m_ipAddr]; - } - } - } - } - - if (!ipTable.empty()) - { - for (map::const_iterator ip = ipTable.begin(); ip != ipTable.end(); ++ip) - { - // we now only look at addresses with multiple clients - // being reported for the address which has been noted - if (ip->second > 1) - { - map agentTable; - - for (statTableEntry_t::clientEntry_t::const_iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked && (ip->first == (*i).second->m_ipAddr)) - { - const utf8 userAgent = (*i).second->m_client->getUserAgent(); - if (agentTable.find(userAgent) == agentTable.end()) - { - agentTable[userAgent] = 1; - } - else - { - ++agentTable[userAgent]; - } - } - } - - if (!agentTable.empty()) - { - std::vector data; - for (map::const_iterator ai = agentTable.begin(); ai != agentTable.end(); ++ai) - { - // this should now just leave us with duplicate - // user-agents connected from the same address - if (ai->second > 1) - { - // now we need to process through and get the - // details needed so we can finally kick them - for (statTableEntry_t::clientEntry_t::const_iterator i = ste.m_clientData.begin(); i != ste.m_clientData.end(); ++i) - { - if (!(*i).second->m_kicked && - (ip->first == (*i).second->m_ipAddr) && - (ai->first == (*i).second->m_client->getUserAgent())) - { - data.push_back(*(*i).second); - } - } - } - } - - // now we've got data, we sort by data and then - // process through the final set of data & kick - if (!data.empty()) - { - std::sort(data.begin(), data.end(), sortClientDataByTime); - // remove the newest and kick the remainder - data.pop_back(); - - for (vector::iterator i = data.begin(); i != data.end(); ++i) - { - if (!(*i).m_kicked) - { - (*i).m_kicked = true; - if ((*i).m_client) - { - (*i).m_client->kickNextRound(); - kicked = true; - } - } - } - } - } - } - } - } - } - } - return kicked; -} - -const bool stats::kickRandomNonRipClient(const streamData::streamID_t id, const bool anyStream) throw() -{ - if (id > 0) - { - stackLock sml(g_statLock); - return _kickRandomNonRipClient(id, anyStream); - } - return false; -} diff --git a/Src/Plugins/DSP/sc_serv3/stats.h b/Src/Plugins/DSP/sc_serv3/stats.h deleted file mode 100644 index d902b112..00000000 --- a/Src/Plugins/DSP/sc_serv3/stats.h +++ /dev/null @@ -1,173 +0,0 @@ -#pragma once -#ifndef stats_H_ -#define stats_H_ - -#include "streamData.h" - -extern uniString::utf8 niceURL(uniString::utf8 srcAddr); - -extern const uniString::utf8 EMPTY_AGENT; - -namespace stats -{ - struct clientData_t - { - uniString::utf8 m_hostName; // holds the hostname (usually only available with namelookups=1) - uniString::utf8 m_ipAddr; - size_t m_triggers; // number of valid advert triggers done for the client - protocol_shoutcastClient* m_client; // reference to the client (mainly for kicking) - bool m_fiveMinuteCumeCounted; // already reported against 5 minute session (cm) - bool m_connectCounted; // already reported against new connects (ht) - bool m_ripClient; // client cannot be autobooted - bool m_kicked; // was ordered to be kicked and will go away soon - - clientData_t(const uniString::utf8 &hostName, const uniString::utf8 &ipAddr, - const bool ripClient, protocol_shoutcastClient* client) throw() - : m_hostName(niceURL(hostName)), m_ipAddr(niceURL(ipAddr)), - m_triggers(0), m_client(client), m_fiveMinuteCumeCounted(false), - m_connectCounted(false), m_ripClient(ripClient), m_kicked(false) {} - }; - - const size_t getNewClientId(); - - // return false if reach maxUsers for that stream or all streams. If ripClient == true, then this client MUST be added, even - // if it means we have to boot someone - const int addClient(const streamData::streamID_t id, const uniString::utf8& hostName, - const uniString::utf8 &ipAddr, const uniString::utf8 &userAgent, - const bool ripClient, const size_t clientUnique, - protocol_shoutcastClient *client); - void removeClient(const streamData::streamID_t id, const size_t clientUnique); - - struct statsData_t - { - size_t connectedListeners; // li - time_t avgUserListenTime; // alt - size_t newSessions; // cm - size_t newConnects; // ht - size_t peakListeners; - size_t uniqueListeners; - size_t totalStreamHits; // total hits against stream since start - - statsData_t() throw() : connectedListeners(0), avgUserListenTime(0), - newSessions(0), newConnects(0), peakListeners(0), - uniqueListeners(0), totalStreamHits(0) {} - }; - - // get stats. Some values, like newSessions and newConnects set a flag so that clients are only counted once. - // This is fine for touch reporting, but sometimes we want to fetch this information and, since we are not touching YP, - // do not want to set the flags indicating that things have been counted. The "resetAccumulators" flag controls this. - // Set to true for touch, false otherwise - void getStats(const streamData::streamID_t id, statsData_t &data, bool resetAccumulators = false) throw(); - - // provides log message when the DNAS is stopped of stream 'peak' values - void getFinalStats() throw(); - - // works out the total number of unique listeners even if connected to different streams - const size_t getTotalUniqueListeners() throw(); - - // works out the active stream ids so we can also catch listeners - // on non-configured streams but are being provided the backup - const streamData::streamIDs_t getActiveStreamIds() throw(); - - // get the current number of listeners on the specified stream - long getUserCount (const streamData::streamID_t id); - - // wsorks out the total number of reserved listeners on the specified stream - const size_t getTotalRipClients(const streamData::streamID_t id) throw(); - - // updates the appropriate clients (by stream) against any changes to the reserved list - void updateRipClients(const streamData::streamID_t id, const uniString::utf8& ripAddr, const bool mode); - - // only resets peakListeners and totalStreamHits currently with peakListeners set to current listeners if there are any - void resetStats(const streamData::streamID_t id) throw(); - - // used only during a YP 'add' to help restore the previous peak level (if applicable) - void updatePeak(const streamData::streamID_t id, const size_t peakListeners) throw(); - - void updateTriggers(const streamData::streamID_t id, const size_t unique) throw(); - - struct currentClientData_t - { - const uniString::utf8 m_hostName; // holds the hostname (usually only available with namelookups=1) - const uniString::utf8 m_ipAddr; - const uniString::utf8 m_XFF; - const uniString::utf8 m_userAgent; - const uniString::utf8 m_referer; - - const size_t m_triggers; // number of valid advert triggers done for the client - const size_t m_unique; // clients' unique id - - const time_t m_startTime; // when connection started, used to implement listenerTime - - const int m_group; // advert group id - const streamData::source_t m_clientType; // stream client type - - const bool m_fiveMinuteCumeCounted; // already reported against 5 minute session (cm) - const bool m_connectCounted; // already reported against new connects (ht) - const bool m_ripClient; // client cannot be autobooted - const bool m_kicked; // was ordered to be kicked and will go away soon - - currentClientData_t(const uniString::utf8 &hostName, const uniString::utf8 &ipAddr, - const uniString::utf8 &XFF, const uniString::utf8 &userAgent, - const uniString::utf8 &referer, const size_t triggers, - const size_t unique, const time_t startTime, - const int group, const streamData::source_t clientType, - const bool fiveMinuteCumeCounted, const bool connectCounted, - const bool ripClient, const bool kicked) throw() - : m_hostName(niceURL(hostName)), m_ipAddr(niceURL(ipAddr)), m_XFF(XFF), - m_userAgent(userAgent), m_referer(referer), m_triggers(triggers), - m_unique(unique), m_startTime(startTime), m_group(group), - m_clientType(clientType), m_fiveMinuteCumeCounted(fiveMinuteCumeCounted), - m_connectCounted(connectCounted), m_ripClient(ripClient), m_kicked(kicked) {} - }; - - typedef std::vector currentClientList_t; - void getClientDataForStream(const streamData::streamID_t id, currentClientList_t &client_data) throw(); - - - struct kickClientData_t - { - const uniString::utf8 m_userAgent; - const size_t m_unique; // clients' unique id - const bool m_kicked; // was ordered to be kicked and will go away soon - - kickClientData_t(const uniString::utf8 &userAgent, const size_t unique, const bool kicked) throw() - : m_userAgent(userAgent), m_unique(unique), m_kicked(kicked) {} - }; - - typedef std::vector kickClientList_t; - void getClientDataForKicking(const streamData::streamID_t id, kickClientList_t &kick_data) throw(); - - void catchPreAddClients(const streamData::streamID_t id); - - // kick client if it's still around - void kickClient(const streamData::streamID_t id, const size_t unique) throw(); - void kickClient(const streamData::streamID_t id, const uniString::utf8& ipAddr) throw(); - - // kick all clients currently connected - const bool kickAllClients(const streamData::streamID_t id, const bool allStreams = false) throw(); - - // kick all duplicate clients currently connected - // based on the older first and by the user-agent - const bool kickDuplicateClients(const streamData::streamID_t id) throw(); - - // kick a random nonRip client. return true if successful. If anyStream, then we can boot - // someone from another stream if we have to - const bool kickRandomNonRipClient(const streamData::streamID_t id, const bool anyStream = true) throw(); - - struct uniqueClientData_t - { - time_t m_connectTime; // longest connection time of group - uniString::utf8 m_hostName; // holds the hostname (usually only available with namelookups=1) - uniString::utf8 m_ipAddr; - uniString::utf8 m_XFF; - uniString::utf8 m_userAgent; // either holds a raw or processed list of user agents - uniString::utf8 m_unique; // unique id of the client - size_t m_total; // total number of clients on this - bool m_ripAddr; // if the address is reserved or not - - uniqueClientData_t() throw() : m_connectTime(0), m_total(0), m_ripAddr(false) {} - }; -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/streamData.cpp b/Src/Plugins/DSP/sc_serv3/streamData.cpp deleted file mode 100644 index 6a78b00f..00000000 --- a/Src/Plugins/DSP/sc_serv3/streamData.cpp +++ /dev/null @@ -1,5666 +0,0 @@ -#ifdef _WIN32 -#include -#include -#define strncasecmp _strnicmp -#endif -#include -#include -#include -#include -#include -#include "streamData.h" -#include "metadata.h" -#include "stats.h" -#include "aolxml/aolxml.h" -#include "stl/stringUtils.h" -#include "stl/stlx.h" -#include "global.h" -#include "protocol_shoutcastClient.h" -#include "bandwidth.h" -#include "uvox2Common.h" -#include "base64.h" -#include "file/fileUtils.h" -#include "ADTSHeader.h" -#include "MP3Header.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace stringUtil; -using namespace uniString; - -#define DEBUG_LOG(...) do { if (gOptions.streamDataDebug()) DLOG(__VA_ARGS__); } while(0) -#define AD_DEBUG_LOG(...) do { if (gOptions.adMetricsDebug()) DLOG(__VA_ARGS__); } while(0) -#define ADLOGNAME "ADVERT" -#define LOGNAME "STREAMDATA" - -/////////// statics /// - -AOL_namespace::mutex streamData::g_streamMapLock; -set streamData::g_streams; // all the streams, including those that are "dying" -map streamData::g_streamMap; -map streamData::g_streamUptime; -map streamData::g_streamReferenceCounts; -map streamData::g_streamSourceIsConnected; // is the source connected -AOL_namespace::mutex streamData::g_sourceRelayMapLock; -map streamData::g_streamSourceRelayIsActive; // is the source relay active e.g. connected or trying to connect or needs to die? -AOL_namespace::mutex streamData::g_streamSongHistoryMapLock; -map streamData::g_streamSongHistoryMap; -static AOL_namespace::mutex g_streamMessageMapLock; -static std::map g_streamMessageMap; - -// global pool related -AOL_namespace::mutex streamData::adGroups::adContentLock; -list streamData::adGroups::adContentPending; -time_t streamData::adGroups::m_nextDownloadRun; -streamData::adGroups::gpool streamData::adGroups::adData; - -#ifdef LICENCE_FREE - -int streamData::streamInfo::m_allowSSL_global = 1; -int streamData::streamInfo::m_allowAllFormats_global = 1; -int streamData::streamInfo::m_allowBackupURL_global = 1; -int streamData::streamInfo::m_allowMaxBitrate_global = 0; - -#else -// default free version settings if no licence check response -// -int streamData::streamInfo::m_allowSSL_global = 1; -int streamData::streamInfo::m_allowAllFormats_global = 1; -int streamData::streamInfo::m_allowMaxBitrate_global = 0; -int streamData::streamInfo::m_allowBackupURL_global = 1; -#endif - - -// just make sure we drop the collected adverts, helps track memory leakage -streamData::adGroups::gpool::~gpool() -{ - for (; begin() != end(); ) - { - delete begin()->second; - erase (begin()); - } -} - -#if defined(_DEBUG) || defined(DEBUG) -map streamData::g_streamSaving; -#endif - -static size_t handle_returned_header(void *ptr, size_t size, size_t nmemb, void *stream); -static size_t handle_returned_data(void *ptr, size_t size, size_t nmemb, void *stream); -int xferinfo(void *p, curl_off_t /*dltotal*/, curl_off_t /*dlnow*/, curl_off_t /*ultotal*/, curl_off_t /*ulnow*/); - -class streamData::adGroups::adGroupsRetriever -{ -public: - stringstream ss; - CURL *m_curl; - utf8 post; - streamData::streamID_t m_sid; - char* m_curl_error; - int cleanup; - int loaded; - string last_uuid; - - adGroupsRetriever(const utf8 &url, const streamData::streamID_t sid) : m_curl(0), m_sid(sid), cleanup(0), loaded(0) - { - m_curl_error = new char[CURL_ERROR_SIZE]; - memset(m_curl_error, 0, CURL_ERROR_SIZE); - - streamData *sd = streamData::accessStream(sid); - if (sd) - { - if (!sd->radionomyID().empty() && sd->streamAdvertMode()) - { - m_curl = webClient::setupCurlDefaults(m_curl, ADLOGNAME, (url + "/?radionomyid=" + sd->radionomyID()), 0, 30L, sid); - if (m_curl) - { - const streamData::streamInfo &stream = sd->getInfo(); - - curl_easy_setopt(m_curl, CURLOPT_HEADERFUNCTION, handle_returned_header); - curl_easy_setopt(m_curl, CURLOPT_HEADERDATA, this); - curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, handle_returned_data); - curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, &ss); - curl_easy_setopt(m_curl, CURLOPT_ERRORBUFFER, &(m_curl_error[0])); - - // use progress/xfer functions to trap for the server kill case - curl_easy_setopt(m_curl, CURLOPT_NOPROGRESS, 0L); - curl_easy_setopt(m_curl, CURLOPT_XFERINFOFUNCTION, xferinfo); - curl_easy_setopt(m_curl, CURLOPT_XFERINFODATA, (long)sid); - -#ifdef CURLOPT_PASSWDFUNCTION - curl_easy_setopt (m_curl, CURLOPT_PASSWDFUNCTION, my_getpass); -#endif - - httpHeaderMap_t vars; - vars["tstamp"] = tos(::time(NULL)); - vars["host"] = sd->streamPublicIP(); - vars["path"] = getStreamPath(sid); - vars["radionomyid"] = vars["ref"] = sd->radionomyID(); - vars["srvid"] = stream.m_serverID; - vars["bitrate"] = tos(sd->streamBitrate()); - vars["codec"] = sd->streamContentType(); - vars["server"] = "Shoutcast v" + gOptions.getVersionBuildStrings(); - vars["port"] = tos(g_portForClients); - - post = encodeVariables(vars); - curl_easy_setopt(m_curl, CURLOPT_POSTFIELDSIZE, post.size()); - curl_easy_setopt(m_curl, CURLOPT_COPYPOSTFIELDS, post.c_str()); - last_uuid = sd->advertGroups.lastUUID; - if (last_uuid == "") - AD_DEBUG_LOG ("sending no UUID", ADLOGNAME, sid); - else - AD_DEBUG_LOG ("sending UUID " + tos(last_uuid), ADLOGNAME, sid); - cleanup = 0; - loaded = 1; - } - else - WLOG ("Unable to create link for map", LOGNAME, sid); - } - // some clients may have already connected to the stream before - // it had been publically listed, so for those we need to force - // an update of the stream's information so we have the new lot - else if (sd->m_streamInfo.m_streamPublic || !gOptions.cdn().empty()) - { - int addFailIgnore = 0, errorCode = 0; - if (sd->YP2_addSuccessful(addFailIgnore, errorCode)) - { - loaded = 2; - } - } - sd->releaseStream(); - } - } - - ~adGroupsRetriever() - { - if (m_curl) - { - // incase we're mid-processig then we don't - // want to do this otherwise things go boom - // instead we allow it to remain and it'll - // be cleaned up once the abort is actioned - if (loaded && cleanup) - { - curl_easy_cleanup(m_curl); - } - m_curl = 0; - } - - forgetArray(m_curl_error); - - loaded = cleanup = 0; - } -}; - - -static size_t handle_returned_header(void *ptr, size_t size, size_t nmemb, void *stream) -{ - int amount = (int)(size * nmemb); - size_t remain = amount; - const char *p = (const char*)ptr, *eol = (const char*)memchr (p, '\r', amount); - class streamData::adGroups::adGroupsRetriever *feed = (streamData::adGroups::adGroupsRetriever*)stream; - - if (eol == NULL) - return 0; - - remain = eol - p; - if (remain > 13 && strncasecmp (p, "bluebox-uuid:", 13) == 0) - { - p += 13; - size_t skip = strspn (p, " \t"); - remain -= (13 + skip); - p += skip; - feed->last_uuid = string (p, remain); - DEBUG_LOG ("identified uuid as :" + tos (feed->last_uuid) + ":", ADLOGNAME); - } - bandWidth::updateAmount(bandWidth::ADVERTS, amount); - return amount; -} - -static size_t handle_returned_data(void *ptr, size_t size, size_t nmemb, void *stream) -{ - stringstream *ss = (stringstream*)stream; - size_t length = size * nmemb; - if (ss) - { - ss->write((const char*)ptr, length); - } - - bandWidth::updateAmount(bandWidth::ADVERTS, length); - return length; -} - -int xferinfo(void *p, curl_off_t /*dltotal*/, curl_off_t /*dlnow*/, curl_off_t /*ultotal*/, curl_off_t /*ulnow*/) -{ - long sid = (long)p; - const int killed = iskilled(); - - if (killed || (sid >= 0 && !streamData::isSourceConnected((size_t)sid))) - { - WLOG("[ADVERT sid=" + tos(sid) + "] Aborting data transfer due to the " + - (killed ? "server shutting down." : "stream source disconnecting."), ADLOGNAME, sid); - return -1; - } - return 0; -} - -// assumes the g_streamMapLock is set. Creates a stream based on the config data, installs it into -// the necessary tables and returns the result -streamData* streamData::_createNewStream(const streamSetup& setup) throw(exception) -{ - if (setup.m_sid > 0) - { - streamData *result = new streamData(setup); - if (result) - { - g_streamMap[setup.m_sid] = result; - g_streams.insert(result); - g_streamUptime[setup.m_sid] = ::time(NULL); - g_streamReferenceCounts[result] = 1; - g_streamSourceIsConnected[result] = true; - DEBUG_LOG(setup.m_logString + "Creating new stream for ID " + tos(setup.m_sid), LOGNAME, setup.m_sid); - return result; - } - else - { - DEBUG_LOG(setup.m_logString + "Failed to create new stream for ID " + tos(setup.m_sid)); - } - } - return 0; -} - -/* - Create a type 1 (old shoutcast) stream. A number of things can happen here - 1) Sources are disabled - return NULL - 2) Stream does not exist - create a new one - 3) If the stream exists and a source is connected, return NULL - 4) If the stream exists, but the source is not connected, then check the stream configuration. - a) Compatible, return the streamData - b) Incompatible, boot clients, move stream to dead pool, create a new one -*/ -streamData* streamData::createStream(const streamSetup& setup) throw(exception) -{ - streamData *result = 0; - - if (setup.m_sid > 0) - { - stackLock sml(g_streamMapLock); - - // does the stream exist - map::const_iterator i = g_streamMap.find(setup.m_sid); - - if (i == g_streamMap.end()) - { - // case 2) The stream does not exist - result = _createNewStream(setup); - } - else // cases 3 and 4 - { - streamData *sd = (*i).second; - // data structure integrity - assert(g_streamSourceIsConnected.find(sd) != g_streamSourceIsConnected.end()); - assert(g_streams.find(sd) != g_streams.end()); - assert(g_streamReferenceCounts.find(sd) != g_streamReferenceCounts.end()); - assert(g_streamReferenceCounts[sd] > 0); - - if (!g_streamSourceIsConnected[sd]) - { - // case 4 - stream exists and source is not connected - if (sd->isSourceCompatible(setup)) - { - // case 4a - streams exists and is compatible - sd->sourceReconnect(setup); - g_streamSourceIsConnected[sd] = true; - ++g_streamReferenceCounts[sd]; - result = sd; - } - else - { - if (!setup.m_backupURL.empty() && !sd->isBackupStream(setup.m_sid)) - { - sd->sourceReconnect(setup); - g_streamSourceIsConnected[sd] = true; - ++g_streamReferenceCounts[sd]; - result = sd; - } - // case 4b - source is incompatible. Move current stream to the dead pool and create a new one - else - { - DEBUG_LOG(setup.m_logString + "Source has changed. Moving old stream " + - tos(setup.m_sid) + " to dead pool and creating a new one.", LOGNAME, setup.m_sid); - // if you call die on a stream you MUST remove it from the g_streamMap - _moveStreamToDeadPool(setup.m_sid); - result = _createNewStream(setup); - } - } - } - // else, case 3 - source is connected. Do nothing and return default intializer of result (NULL) - else - { - // if we have a backup running and a non-backup trying - // to connect then we should allow it to connect to it - if (!setup.m_backup && sd->isBackupStream(setup.m_sid)) - { - // case 4xxx - source is incompatible. Move current stream to the dead pool and create a new one - sd->setKill((sd->isBackupStream(setup.m_sid) ? 2 : 1)); - sd->sourceReconnect(setup); - g_streamSourceIsConnected[sd] = true; - ++g_streamReferenceCounts[sd]; - result = sd; - } - // otherwise block the source connection from joining - // as we should not override an existing true source. - } - } - } - if (result) - result->m_startTime = ::time(NULL); - return result; -} - -////////////////////////////////////////////////////////////////////////////////////////////////// -// putting a stream, conceptually, into the dead pool requires a specific order of operations -// to avoid structure corruption. This order is different depending on the reference point -// so these calls cover the scenarios -void streamData::_moveStreamToDeadPool(streamData *sd) throw() -{ - if (sd) - { - g_streamMap.erase(sd->ID()); // do this before calling die, since die() clears objects stream ID() - g_streamUptime.erase(sd->ID()); - sd->die(); - } -} - -void streamData::removeRelayStatus(streamID_t ID) -{ - #if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(__FUNCTION__, LOGNAME, ID); - #endif - stackLock sml(g_sourceRelayMapLock); - - map::iterator r = g_streamSourceRelayIsActive.find(ID); - if (r != g_streamSourceRelayIsActive.end()) - { - g_streamSourceRelayIsActive.erase(r); - } -} - - -void streamData::_moveStreamToDeadPool(map::iterator i) throw() -{ - // if you call die on a stream you MUST remove it from the g_streamMap - (*i).second->die(); - - g_streamUptime.erase((*i).second->m_ID); - g_streamMap.erase(i); -} - -bool streamData::isAllowedType(const int type) -{ - bool mp3; - return isAllowedType(type, mp3); -} - -bool streamData::isAllowedType(const int type, bool& mp3) -{ - mp3 = (type == MP3_DATA); - return (mp3 || (type == AACP_DATA) || (type == AAC_LC_DATA)); -} - -void streamData::_moveStreamToDeadPool(streamData::streamID_t id) throw() -{ - if (id > 0) - { - map::iterator i = g_streamMap.find(id); - if (i != g_streamMap.end()) - { - _moveStreamToDeadPool(i); - } - } -} - -////////////////////////////////////////////////////////////////////////////////////////////// - -// you must hold the g_streamMapLock before calling this. increases the reference count -// on stream with indicated ID. returns stream object -streamData* streamData::_increaseReferenceCount(streamID_t id) -{ - streamData *result = 0; - - if (id > 0) - { - map::const_iterator i = g_streamMap.find(id); - - if (i != g_streamMap.end()) - { - assert((*i).second); - map::iterator ic = g_streamReferenceCounts.find((*i).second); - assert(ic != g_streamReferenceCounts.end()); - assert((*ic).second); - ++(*ic).second; - result = (*i).second; - } - } - return result; -} - -// you must hold the g_streamMapLock before calling this. Decreases the reference count -// on the stream. Returns stream object if reference count has not reached zero -void streamData::_reduceReferenceCount(const utf8& logString, streamData *sd, const streamID_t id) -{ - if (sd && (id > 0)) - { - map::iterator ic = g_streamReferenceCounts.find(sd); - - // integrity checks - assert(ic != g_streamReferenceCounts.end()); - assert(g_streams.find(sd) != g_streams.end()); - assert(g_streamSourceIsConnected.find(sd) != g_streamSourceIsConnected.end()); - - /////////////////// - if (ic != g_streamReferenceCounts.end()) - { - if (--(*ic).second <= 0) - { - // clean it up - if (id) - { - g_streamMap.erase(id); - g_streamUptime.erase(id); - } - - g_streamReferenceCounts.erase(ic); - g_streamSourceIsConnected.erase(sd); - g_streams.erase(sd); - delete sd; - sd = NULL; - - if (id) - { - DEBUG_LOG (logString + "Cleaning up stream as no references remain", LOGNAME, id); - } - } - else - { - DEBUG_LOG (logString + "Stream still has " + tos((*ic).second) + " reference" + ((*ic).second > 1 ? "s" : ""), LOGNAME, id); - } - } - } -} - -void streamData::streamSourceLost(const utf8& logString, streamData *sd, const streamID_t id) -{ - if (sd && (id > 0)) - { - stackLock sml(g_streamMapLock); - - assert(g_streamSourceIsConnected[sd]); - g_streamSourceIsConnected[sd] = false; - _reduceReferenceCount(logString, sd, id); - - // if we are auto dumping our users, then move - // the stream to the dead pool immediately - bool autoDumpUsers = gOptions.stream_autoDumpUsers(id); - if (!gOptions.read_stream_autoDumpUsers(id)) - { - autoDumpUsers = gOptions.autoDumpUsers(); - } - - if (autoDumpUsers) - { - _moveStreamToDeadPool(id); - } - } - - // if there are still listeners but no sources - // then (without this) the listeners will halt - // this will force things to keep things alive - threadedRunner::wakeup(); -} - -void streamData::streamClientLost(const utf8& logString, streamData *sd, const streamID_t id) -{ - if (sd && (id > 0)) - { - stackLock sml(g_streamMapLock); - - _reduceReferenceCount(logString, sd, id); - } -} - -void streamData::streamUpdate(const streamID_t id, const uniString::utf8 &authHash, - const int streamMaxUser, const int streamMaxBitrate, - const int streamMinBitrate) throw() -{ - if (id > 0) - { - stackLock sml(g_streamMapLock); - - bool authChanged = (m_streamInfo.m_authHash != authHash); - if (authChanged && !m_streamInfo.m_authHash.empty()) - { - YP2_remove(); - } - - m_streamInfo.m_authHash = authHash; - m_streamInfo.m_streamMaxBitrate = streamMaxBitrate; - m_streamInfo.m_streamMinBitrate = streamMinBitrate; - m_streamInfo.m_streamMaxUser = streamMaxUser; - - if (authChanged && !authHash.empty()) - { - YP2_add(); - } - } -} - -void streamData::updateSourceIdent(uniString::utf8& sourceIdent, const bool relay) throw() -{ - // attempt to determine the version of the source connected - if (!sourceIdent.empty()) - { - utf8::size_type pos = sourceIdent.find(utf8("
")); - if (pos != utf8::npos) - { - sourceIdent = sourceIdent.substr(0, pos); - } - pos = sourceIdent.find(utf8("Ultravox/2.1 ")); - if (pos != utf8::npos && pos == 0) - { - sourceIdent = sourceIdent.substr(13); - } - - if (!sourceIdent.empty() && ((!relay && m_streamInfo.m_sourceType != SHOUTCAST2) || relay)) - { - if (m_streamInfo.m_sourceIdent.empty() || - (m_streamInfo.m_sourceIdent == utf8("Legacy / Unknown"))) - { - m_streamInfo.m_sourceIdent = sourceIdent; - } - } - } -} - -// Client wants access to the stream. returns null if stream does not exist -// this one is only called by protocol_admincgi in order to allow metadata updates -// from sc_trans. Actual client connects should use the accessStream(streamID_t,bool) -// call, to allow consideration for whether the stream is is actually connected, or -// to allow rejection if yp2 has not returned stream information yet. -streamData* streamData::accessStream(streamID_t id) throw() -{ - #if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(__FUNCTION__, LOGNAME, id); - #endif - - if (id > 0) - { - try - { - if (g_streamMapLock.timedLock(3000)) - { - streamData *sd = _increaseReferenceCount(id); - g_streamMapLock.unlock(); - return sd; - } - } - catch (const exception &ex) - { - WLOG(utf8("Failed to acquire lock(1): ") + ex.what(), LOGNAME, id); - } - } - return 0; -} - -streamData* streamData::accessStream(streamID_t id, bool &isSourceActive) throw() -{ - #if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(utf8(__FUNCTION__) + "(2)", LOGNAME, id); - #endif - - if (id > 0) - { - try - { - if (g_streamMapLock.timedLock(3000)) - { - streamData *sd = _increaseReferenceCount(id); - if (sd) - { - assert(g_streamSourceIsConnected.find(sd) != g_streamSourceIsConnected.end()); - isSourceActive = g_streamSourceIsConnected[sd]; - } - g_streamMapLock.unlock(); - return sd; - } - } - catch (const exception &ex) - { - WLOG(utf8("Failed to acquire lock(2): ") + ex.what(), LOGNAME, id); - } - } - - isSourceActive = false; - return 0; -} - -void streamData::releaseStream() -{ - #if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(__FUNCTION__, LOGNAME, this->ID()); - #endif - - stackLock sml(g_streamMapLock); - - _reduceReferenceCount(utf8(), this, this->ID()); -} -////////// - -bool streamData::isSourceConnected(streamData::streamID_t id) throw() -{ - if ((id > 0) && g_streamMapLock.timedLock(3000)) - { - map::const_iterator i = g_streamMap.find(id); - if (i == g_streamMap.end()) - { - g_streamMapLock.unlock(); - return false; - } - - const bool connected = g_streamSourceIsConnected[(*i).second]; - g_streamMapLock.unlock(); - return connected; - } - return false; -} - -// is a relay source active either from trying to connect or connected -// (which also includes backup sources to prevent multiple spawning) -int streamData::isRelayActive(streamData::streamID_t id, bool &noEntry) throw() -{ - if (id > 0) - { - stackLock sml(g_sourceRelayMapLock); - - map::const_iterator i = g_streamSourceRelayIsActive.find(id); - if (i == g_streamSourceRelayIsActive.end()) - { - noEntry = true; - #if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG("[STREAMDATA sid=" + tos(id) + "] isRelayActive: " + tos(id) + " ~0", LOGNAME, id); - #endif - return 0; - } - - try - { - // only signal active if 1 since 2 is used to signal being stopped - #if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG("[STREAMDATA sid=" + tos(id) + "] isRelayActive: " + tos(id) + " " + tos((id == (*i).first) ? (*i).second : 0), LOGNAME, id); - #endif - return ((id == (*i).first) ? (*i).second : 0); - } - catch(...) - { - } - } - return 0; -} - -int streamData::setRelayActiveFlags (streamData::streamID_t id, bool &noEntry, int flags, int mask) -{ - int state = 0; - string msg; - - if (id <= 0 || (mask == 0 && flags <= 0)) - return -1; - do - { - stackLock sml(g_sourceRelayMapLock); - - if (flags < 0) - { - map::iterator r = g_streamSourceRelayIsActive.find (id); - if (r != g_streamSourceRelayIsActive.end()) - { - state = (*r).second; - flags = state & mask; - msg = " is " + tos (state) + ", flags " + tos(flags) + "/" + tos(mask); - break; // it exists, so skip the setting (flags is nonsensical) and just possible log it - } - g_streamSourceRelayIsActive[id] = 0; // create entry in map with 0 value; - noEntry = true; - return 0; - } - int &v = g_streamSourceRelayIsActive[id]; - - if (mask == 0) - mask = flags; - flags &= mask; // only focus on the requested bits. - if ((v & mask) == flags) - { - state = v; - break; // already set as this, so return -1 - } - msg = " was " + tos (v) + ", flags " + tos(flags) + "/" + tos(mask); - v = (v & ~mask) | (flags & mask); - state = v; - flags = ~state; // invalidate the last test as we have done the change. - - } while (0); - -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG("[STREAMDATA sid=" + tos(id) + "] RelayActiveFlags: " + tos(id) + " " + tos(state) + msg, LOGNAME, id); -#endif - noEntry = false; - if ((state & mask) == flags) - return -1; - return state; -} - -void streamData::setRelayActive(streamData::streamID_t id, int state) throw() -{ - int p; - do - { - if (id <= 0) - return; - - stackLock sml(g_sourceRelayMapLock); - - if (state < 0) - { - map::iterator r = g_streamSourceRelayIsActive.find (id); - if (r != g_streamSourceRelayIsActive.end()) - { - p = state = (*r).second; - break; // it exists, so skip setting it and just report it - } - state = 0; // create entry in map with 0 value; - } - p = g_streamSourceRelayIsActive[id] = state; - } while (0); - -#if defined(_DEBUG) || defined(DEBUG) - string msg = " was " + tos (p); - DEBUG_LOG("[STREAMDATA sid=" + tos(id) + "] setRelayActive: " + tos(id) + " " + tos(state) + msg, LOGNAME, id); -#endif -} - -/////////// are used in main() to facilitate an orderly shutdown that sends the -/////////// necessary remsrv to YP -// send die signal to all streams -void streamData::killAllSources() throw() -{ - stackLock sml(g_streamMapLock); - - // if you call die on a stream you must remove it from the g_streamMap - for_each(g_streams.begin(),g_streams.end(),mem_fun(&streamData::die)); - g_streamMap.clear(); -} - -// total of all streamData objects, including those that are dying -size_t streamData::totalStreams() throw() -{ - if (g_streamMapLock.timedLock(3000)) - { - const size_t total = g_streams.size(); - g_streamMapLock.unlock(); - return total; - } - - return 0; -} - -size_t streamData::totalActiveStreams(size_t &lastSID) throw() -{ - size_t total = 0; - if (totalStreams() > 0) - { - size_t inc = 0; - size_t sid = 0; - do - { - streamInfo info; - extraInfo extra; - sid = enumStreams(inc); - if (getStreamInfo(sid, info, extra)) - { - ++total; - lastSID = sid; - } - ++inc; - } - while (sid); - } - return total; -} - -// enumerate the available number of streams actually present -size_t streamData::enumStreams(const size_t index) throw() -{ - stackLock sml(g_streamMapLock); - - if (index < g_streamMap.size()) - { - map::const_iterator i = g_streamMap.begin(); - size_t inc = 0; - while (inc < index) - { - ++inc; - ++i; - } - return (*i).second->ID(); - } - return 0; -} - -// enumerate the available number of streams to get the stream ids -streamData::streamIDs_t streamData::getStreamIds(const int mode) throw() -{ - streamIDs_t streamIds; - if (totalStreams() > 0) - { - size_t inc = 0; - size_t sid = 0; - do - { - sid = streamData::enumStreams(inc); - ++inc; - if (sid) - { - streamIds.insert(sid); - } - } - while (sid); - } - - if (mode) - { - // now we check through for any known but inactive relays - // and then get them included for being kicked as well - vector relayList(gOptions.getRelayList()); - if (!relayList.empty()) - { - for (vector::const_iterator i = relayList.begin(); i != relayList.end(); ++i) - { - streamIds.insert((*i).m_streamID); - } - } - - if (mode == 2) - { - // this will now do a final check for any listeners which are on - // an un-confiured stream but are being provided a 'backupfile'. - streamData::streamIDs_t activeIds = stats::getActiveStreamIds(); - if (!activeIds.empty()) - { - for (streamData::streamIDs_t::const_iterator i = activeIds.begin(); i != activeIds.end(); ++i) - { - streamIds.insert((*i)); - } - } - } - } - - return streamIds; -} - -void streamData::killStreamSource(const streamID_t id) throw() -{ - if (id > 0) - { - // handle relays / backups a bit differently from normal streams - // since if it's not been able to connect or is backup mode then - // the normal 'isSourceConnected' will not be able to kill it. - if ((!gOptions.stream_relayURL(id).empty() && gOptions.stream_movedUrl(id).empty()) || - streamData::isRelayStream(id) || streamData::isBackupStream(id)) - { - bool noEntry = false, active = ((streamData::isRelayActive(id, noEntry) & 12)); - if (active) - { - ILOG(gOptions.logSectionName() + "Kicking source for stream #" + tos(id) + ".", LOGNAME, id); - - // kick source off system - streamData::killSource(id); - } - } - else if (streamData::isSourceConnected(id)) - { - ILOG(gOptions.logSectionName() + "Kicking source for stream #" + tos(id) + ".", LOGNAME, id); - - // kick source off system - streamData::killSource(id); - } - } -} - -// used by web interface to dump a specific source -void streamData::killSource(const streamID_t id, streamData *sd) throw() -{ - if ((id > 0) && g_streamMapLock.timedLock(3000)) - { - if (sd) - { - g_streamSourceIsConnected[sd] = false; - _reduceReferenceCount(utf8(), sd, sd->ID()); - } - - // force flag a source relay kick if this is called - bool noEntry = false; - if ((isRelayActive(id, noEntry) & 12)) - { - setRelayActiveFlags (id, noEntry, 2); - } - _moveStreamToDeadPool(id); - - g_streamMapLock.unlock(); - } -} - -// you must remove this streamData object from the g_streamMap immediately before or after calling -// this, otherwise you'll corrupt the static structures. -// Reason: die will cause the streamData to be removed from g_streams, but since die() causes ID() to return zero, -// it will not get removed from g_streamMap -void streamData::die() throw() -{ - if (!m_dead) - { - stackLock sml(m_stateLock); - _YP2_remove(); - m_dead = 1; - } -} - -///////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////// -utf8 streamData::getStreamContentType(const streamID_t id) throw() -{ - if (id > 0) - { - stackLock sml(g_streamMapLock); - - map::const_iterator i = g_streamMap.find(id); - return (i == g_streamMap.end() ? (utf8)"" : (*i).second->streamContentType()); - } - return ""; -} - -const bool streamData::updateSourceSampleRate(unsigned int& samplerate, const unsigned int read_samplerate) throw() -{ - // we do some extra checking so we make sure we're got - // consecutive frames that are at the same samplerate - // otherwise we can end up with the checking spinning - //DLOG ("samp " + tos(samplerate) + " read " + tos(read_samplerate) + " last" + tos(m_lastStreamSampleRate)); - if (read_samplerate > 0) - { - if ((m_lastStreamSampleRate == 0) || - (m_lastStreamSampleRate == read_samplerate)) - { - // we've got something that matches - m_streamInfo.m_streamSampleRate = samplerate = read_samplerate; - m_lastStreamSampleRate = read_samplerate; - return true; - } - } - return false; -} - -bool streamData::isRelayStream(const streamID_t id) throw() -{ - bool result = false; - if (id > 0) - { - stackLock sml(g_streamMapLock); - - map::const_iterator i = g_streamMap.find(id); - if (i != g_streamMap.end()) - { - assert(g_streams.find((*i).second) != g_streams.end()); - result = !(*i).second->m_streamInfo.m_relayURL.empty(); - } - } - return result; -} - -bool streamData::isBackupStream(const streamID_t id) throw() -{ - bool result = false; - if (id > 0) - { - map::const_iterator i = g_streamMap.find(id); - if (i != g_streamMap.end()) - { - assert(g_streams.find((*i).second) != g_streams.end()); - // check if there is a backup specified and also if we've been set as being a running backup - result = (!(*i).second->m_streamInfo.m_backupURL.empty() && (*i).second->m_streamInfo.m_backup); - } - } - return result; -} - -bool streamData::getStreamInfo(const streamID_t id, streamInfo &info, extraInfo &extra) throw() -{ - if (id > 0) - { - extra.ypConnected = 0; - - stackLock sml(g_streamMapLock); - map::const_iterator i = g_streamMap.find(id); - if (i == g_streamMap.end()) - { - extra.ypErrorCode = 200; - extra.isConnected = false; - extra.isRelay = false; - extra.isBackup = false; - } - else - { - assert(g_streams.find((*i).second) != g_streams.end()); - assert(g_streamSourceIsConnected.find((*i).second) != g_streamSourceIsConnected.end()); - - info = (*i).second->m_streamInfo; - extra.isConnected = g_streamSourceIsConnected[(*i).second]; - extra.isRelay = !(*i).second->m_streamInfo.m_relayURL.empty(); - extra.isBackup = (!(*i).second->m_streamInfo.m_backupURL.empty() && (*i).second->m_streamInfo.m_backup); - - extra.ypErrorCode = info.m_ypResponseCode; - extra.ypConnected = ((*i).second->m_streamInfo.m_streamPublic && (info.m_ypResponseCode == 200)); - - } - } - else - { - extra.ypConnected = 0; - extra.ypErrorCode = 200; - extra.isConnected = false; - extra.isRelay = false; - extra.isBackup = false; - } - - return extra.isConnected; -} - -void streamData::getStreamSongHistory(const streamID_t id, streamHistory_t& songHistory) throw() -{ - if (id > 0) - { - stackLock sml(g_streamSongHistoryMapLock); - map::const_iterator i = g_streamSongHistoryMap.find(id); - if (i != g_streamSongHistoryMap.end()) - { - songHistory = (*i).second; - } - } -} - -bool streamData::getStreamNextSongs(const streamID_t id, uniString::utf8& currentSong, - uniString::utf8& comingSoon, - vector& nextSongs) throw() -{ - bool isConnected = false; - if (id > 0) - { - stackLock sml(g_streamMapLock); - map::const_iterator i = g_streamMap.find(id); - if (i != g_streamMap.end()) - { - assert(g_streams.find((*i).second) != g_streams.end()); - assert(g_streamSourceIsConnected.find((*i).second) != g_streamSourceIsConnected.end()); - isConnected = g_streamSourceIsConnected[(*i).second]; - currentSong = (*i).second->m_streamInfo.m_currentSong; - comingSoon = (*i).second->m_streamInfo.m_comingSoon; - nextSongs = (*i).second->m_streamInfo.m_nextSongs; - } - } - return isConnected; -} - -utf8 streamData::getContentType(const streamData::streamInfo &info) throw() -{ - utf8 content; - if (info.m_uvoxDataType == MP3_DATA) - { - content = "MP3"; - } - else if (info.m_uvoxDataType == AACP_DATA || info.m_uvoxDataType == AAC_LC_DATA) - { - content = "HE-AAC"; - } - else if (info.m_uvoxDataType == OGG_DATA) - { - content = "OGG Vorbis"; - } - else - { - content = aolxml::escapeXML(!info.m_contentType.empty() ? info.m_contentType : "unknown"); - if (content == "video/nsv") - { - content = "NSV"; - } - } - return content; -} - -//////////////////////////////////////////////////////////////////////////////////////////////// -/*********************************************************************************************/ -//////////////////////////////////////////////////////////////////////////////////////////////// - -// file names for intro and backup files can have %d in them which should be replace by the bitrate -static uniFile::filenameType parseSpecialName(const uniFile::filenameType &rootName, const size_t bitrate) throw() -{ - uniFile::filenameType result = rootName; - if (!result.empty()) - { - uniFile::filenameType::size_type pos = result.find(uniFile::filenameType("%d")); - if (pos != uniFile::filenameType::npos) - { - result.replace(pos,2,uniFile::filenameType(tos(bitrate))); - } - } - return result; -} - - -int streamData::convertRawToUvox (vector<__uint8> &sc2buffer, const vector<__uint8> &buf, - const int uvoxDataType, const int bitrate, const unsigned int samplerate) throw() -{ - __uint64 frameCount = 0; - int last_size = 0, end = 0; - const int len = (int)buf.size(); - const bool mp3 = (uvoxDataType == MP3_DATA); - - for (int i = 0; (i < (len - 8)) && !iskilled();) - { - unsigned int read_samplerate = 0; - __uint8 asc_header[2] = {0}; - int read_bitrate = 0; - const int found = (mp3 ? getMP3FrameInfo((const char*)&(buf[i]), &read_samplerate, &read_bitrate) : - getADTSFrameInfo((const char*)&(buf[i]), &read_samplerate, asc_header)); - - // need to find frames and that the input is the correct format! - // - // is a bit of a pain for AAC though as we've already done the - // rough bitrate match when the advert / intro / backup was read - // we'll just pass things through as though the bitrate is ok... - if ((found > 0) && (mp3 && bitrate ? (read_bitrate == bitrate) : 1) && - (!mp3 || !samplerate || (samplerate == read_samplerate))) - { - if (!frameCount) - { - end = i; - } - - i += (last_size = found); - - // only count valid full-size frames - if (i <= len) - { - formMessage(&buf[end], last_size, uvoxDataType, sc2buffer); - end += last_size; - ++frameCount; - } - else - { - break; - } - } - else - { - ++i; - } - } - return frameCount; -} - - -// take raw file data and build sc1 and sc2 data buffers -void streamData::specialFileData::updateUvoxData (const int uvoxDataType, - const int bitrate, const unsigned int samplerate) throw() -{ - const vector<__uint8> &buf = m_sc1Buffer; - - m_sc2Buffer.clear(); - if (buf.size() > 0) // can't take subscript of data[0] if siz==0 - { - int frames = convertRawToUvox (m_sc2Buffer, buf, uvoxDataType, bitrate, samplerate); - if (frames) - m_samplerate = samplerate; - m_missing = (frames ? false : true); - m_lastUsed = ::time(NULL); - } -} - -// replace data with collection of uvox packets with given data type -void streamData::specialFileData::replaceData(const vector<__uint8> &data, const int uvoxDataType, - const int bitrate, const unsigned int samplerate) throw() -{ - stackLock sml(m_lock); - - m_sc1Buffer = data; - - updateUvoxData (uvoxDataType, bitrate, samplerate); -} - - -void streamData::specialFileData::release (specialFileData *f) -{ - AD_DEBUG_LOG ("[STREAMDATA] content release " + f->m_description + ", count was " + tos (f->m_refcount)); - if (f->m_refcount > 1) - { - --f->m_refcount; - f->m_lastUsed = ::time (NULL); - return; - } - delete f; -} - - -int streamData::specialFileData::verifyData (const utf8 &logString) -{ - // attempt to strip out any tags from the file - // to increase client connection reliability - - size_t siz = m_sc1Buffer.size(); - // check for ID3v2.x tag - if (siz > 3 && - (m_sc1Buffer[0] == 'I') && - (m_sc1Buffer[1] == 'D') && - (m_sc1Buffer[2] == '3')) - { - int id3len = make28BitValue(&m_sc1Buffer[6]) + 10; - m_sc1Buffer.erase (m_sc1Buffer.begin(), m_sc1Buffer.begin()+id3len); - siz = m_sc1Buffer.size(); - } - - // check for ID3v1.x tag - if (siz > 128 && - (m_sc1Buffer[siz-128] == 'T') && - (m_sc1Buffer[siz-127] == 'A') && - (m_sc1Buffer[siz-126] == 'G')) - { - m_sc1Buffer.resize(siz -= 128); - } - - // check for Lyrics3 tag - if (siz > 20 && - (m_sc1Buffer[siz-9] == 'L') && - (m_sc1Buffer[siz-8] == 'Y') && - (m_sc1Buffer[siz-7] == 'R') && - (m_sc1Buffer[siz-6] == 'I') && - (m_sc1Buffer[siz-5] == 'C') && - (m_sc1Buffer[siz-4] == 'S') && - (m_sc1Buffer[siz-3] == '2') && - (m_sc1Buffer[siz-2] == '0') && - (m_sc1Buffer[siz-1] == '0')) - { - size_t length = 9; - while (length < siz - 10) - { - if ((m_sc1Buffer[siz-length] == 'L') && - (m_sc1Buffer[siz-length+1] == 'Y') && - (m_sc1Buffer[siz-length+2] == 'R') && - (m_sc1Buffer[siz-length+3] == 'I') && - (m_sc1Buffer[siz-length+4] == 'C') && - (m_sc1Buffer[siz-length+5] == 'S') && - (m_sc1Buffer[siz-length+6] == 'B') && - (m_sc1Buffer[siz-length+7] == 'E') && - (m_sc1Buffer[siz-length+8] == 'G') && - (m_sc1Buffer[siz-length+9] == 'I') && - (m_sc1Buffer[siz-length+10] == 'N')) - { - m_sc1Buffer.resize(siz -= length); - break; - } - ++length; - } - } - - // check for Ape tag - if (siz > 8) - { - size_t pos = 0; - while (pos < siz - 8) - { - if (siz > 32 && - (m_sc1Buffer[pos] == 'A') && - (m_sc1Buffer[pos+1] == 'P') && - (m_sc1Buffer[pos+2] == 'E') && - (m_sc1Buffer[pos+3] == 'T') && - (m_sc1Buffer[pos+4] == 'A') && - (m_sc1Buffer[pos+5] == 'G') && - (m_sc1Buffer[pos+6] == 'E') && - (m_sc1Buffer[pos+7] == 'X')) - { - struct HeaderData - { - __uint32 version; - __uint32 size; - __uint32 items; - __uint32 flags; - }; - HeaderData *header = (HeaderData*)&(m_sc1Buffer[pos+8]); - int size = header->size; - int flags = header->flags; - - enum - { - FLAG_HEADER_HAS_HEADER = (1 << 31), - FLAG_HEADER_NO_FOOTER = (1 << 30), - FLAG_HEADER_IS_HEADER = (1 << 29) - }; - - if (!!(flags & FLAG_HEADER_IS_HEADER) && !(flags & FLAG_HEADER_NO_FOOTER)) - { - size += 32; - } - if (!(flags & FLAG_HEADER_IS_HEADER) && !!(flags & FLAG_HEADER_HAS_HEADER)) - { - size += 32; - } - m_sc1Buffer.resize(siz -= size); - break; - } - ++pos; - } - } - int len = (int)m_sc1Buffer.size(); - if (len > 4) - { - parserInfo *parser = NULL; - unsigned syncFrames = 0; - - getFrameInfo (parser, syncFrames, (unsigned char*)&(m_sc1Buffer[0]), len, 0); - if (parser) - { - utf8 msg = logString; - - if (parser->m_reduce) - m_sc1Buffer.resize (len - parser->m_reduce); - msg += " Loaded "; - msg += m_description; - msg += ", "; - msg += tos(m_sc1Buffer.size()); - msg += " bytes, "; - msg += parser->m_description; - if (parser->m_duration < 1) - { - msg += " (frames "; - msg += tos(parser->m_frameCount); - msg += ")"; - } - m_bitrate = parser->m_bitrate; - m_samplerate = parser->m_samplerate; - m_duration = parser->m_duration; - DEBUG_LOG (msg, LOGNAME); - updateUvoxData (parser->getUvoxType(), parser->m_bitrate, parser->m_samplerate); - delete parser; - return 0; - } - if (m_description.empty() == false) - WLOG (logString + " Trouble parsing " + m_description); - - } - m_sc1Buffer.clear(); - return -1; -} - - -int streamData::cleanFileData(uniFile::filenameType fn, vector<__uint8> &buffer, size_t siz, - const int bitrate, const unsigned int samplerate, - const int /*uvoxDataType*/, const utf8& logString, - const utf8& /*description*/, unsigned int &read_samplerate) -{ - // attempt to strip out any tags from the file - // to increase client connection reliability - - // check for ID3v2.x tag - if (siz > 3 && - (buffer[0] == 'I') && - (buffer[1] == 'D') && - (buffer[2] == '3')) - { - int id3len = make28BitValue(&buffer[6]) + 10; - buffer.erase (buffer.begin(), buffer.begin()+id3len); - siz = buffer.size(); - } - - // check for ID3v1.x tag - if (siz > 128 && - (buffer[siz-128] == 'T') && - (buffer[siz-127] == 'A') && - (buffer[siz-126] == 'G')) - { - buffer.resize(siz -= 128); - } - - // check for Lyrics3 tag - if (siz > 20 && - (buffer[siz-9] == 'L') && - (buffer[siz-8] == 'Y') && - (buffer[siz-7] == 'R') && - (buffer[siz-6] == 'I') && - (buffer[siz-5] == 'C') && - (buffer[siz-4] == 'S') && - (buffer[siz-3] == '2') && - (buffer[siz-2] == '0') && - (buffer[siz-1] == '0')) - { - size_t length = 9; - while (length < siz - 10) - { - if ((buffer[siz-length] == 'L') && - (buffer[siz-length+1] == 'Y') && - (buffer[siz-length+2] == 'R') && - (buffer[siz-length+3] == 'I') && - (buffer[siz-length+4] == 'C') && - (buffer[siz-length+5] == 'S') && - (buffer[siz-length+6] == 'B') && - (buffer[siz-length+7] == 'E') && - (buffer[siz-length+8] == 'G') && - (buffer[siz-length+9] == 'I') && - (buffer[siz-length+10] == 'N')) - { - buffer.resize(siz -= length); - break; - } - ++length; - } - } - - // check for Ape tag - if (siz > 8) - { - size_t pos = 0; - while (pos < siz - 8) - { - if (siz > 32 && - (buffer[pos] == 'A') && - (buffer[pos+1] == 'P') && - (buffer[pos+2] == 'E') && - (buffer[pos+3] == 'T') && - (buffer[pos+4] == 'A') && - (buffer[pos+5] == 'G') && - (buffer[pos+6] == 'E') && - (buffer[pos+7] == 'X')) - { - struct HeaderData - { - __uint32 version; - __uint32 size; - __uint32 items; - __uint32 flags; - }; - HeaderData *header = (HeaderData*)&(buffer[pos+8]); - int size = header->size; - int flags = header->flags; - - enum - { - FLAG_HEADER_HAS_HEADER = (1 << 31), - FLAG_HEADER_NO_FOOTER = (1 << 30), - FLAG_HEADER_IS_HEADER = (1 << 29) - }; - - if (!!(flags & FLAG_HEADER_IS_HEADER) && !(flags & FLAG_HEADER_NO_FOOTER)) - { - size += 32; - } - if (!(flags & FLAG_HEADER_IS_HEADER) && !!(flags & FLAG_HEADER_HAS_HEADER)) - { - size += 32; - } - buffer.resize(siz -= size); - break; - } - ++pos; - } - } - - int read_bitrate = 0; - do - { - int len = (int)buffer.size();//, start = 0, end = 0; - if (len > 4) - { - parserInfo *parser = NULL; - unsigned syncFrames = 0; - getFrameInfo (parser, syncFrames, (unsigned char*)&(buffer[0]), len, 0); - if (parser) - { - read_bitrate = parser->m_bitrate; - read_samplerate = parser->m_samplerate; - int ok = true; - utf8 msg = logString; - - if (((read_bitrate == bitrate) || !bitrate) && - ((read_samplerate == samplerate) || !samplerate)) - msg += " Loaded "; - else - { - msg += " Mismatched "; - ok = false; - } - msg += fn; - msg += ", "; - msg += tos(buffer.size()); - msg += " bytes, "; - msg += parser->m_description; - if (parser->m_duration < 1) - { - msg += " (frames "; - msg += tos(parser->m_frameCount); - msg += ")"; - } - delete parser; - if (ok) - { - DEBUG_LOG (msg, LOGNAME); - break; - } - WLOG (msg, LOGNAME); - } - else if (fn.empty() == false) - WLOG (logString + " Trouble parsing " + fn); - } - buffer.clear(); - - } while (0); - - return read_bitrate; -} - -int streamData::specialFileData::loadFromFile(const uniFile::filenameType &name, const int bitrate, - const int /*uvoxDataType*/, const unsigned int samplerate, - const utf8& logString) throw() -{ - stackLock sml(m_lock); - - m_sc1Buffer.clear(); - m_sc2Buffer.clear(); - vector<__uint8> &buffer = m_sc1Buffer; - int read_bitrate = 0; - - uniFile::filenameType fn = parseSpecialName(name, bitrate); - if (!fn.empty()) - { - // KH, fopen etc can take some time if you are dealing with many files at once, in icecast - // I used the lower level open/seek/tell calls in the end. library allocates buffers. - // - FILE *f = uniFile::fopen(fn,"rb"); - if (f) - { - if (!::fseek(f, 0, SEEK_END)) - { - int maxSpecialFileSize = gOptions.maxSpecialFileSize(); - size_t siz = ::ftell(f); - if ((siz > 0) && ((int)siz <= maxSpecialFileSize)) - { - ::fseek(f, 0, SEEK_SET); - buffer.resize (siz); - if (::fread(&(buffer[0]), 1, siz, f) != siz) - { - ELOG(logString + " Error reading " + m_description + " file `" + fn + "'"); - } - else - { - unsigned int read_samplerate = 0; - size_t original_size = buffer.size(); - - verifyData (""); - read_bitrate = m_bitrate; - read_samplerate = m_samplerate; - if (buffer.size() > 0) - { - ILOG(logString + " Loaded " + m_description + " file `" + fn + "' (" + tos(original_size) + " bytes" + - (original_size != buffer.size() ? " - processed down to " + tos(buffer.size()) + " bytes" : "") + ")"); - } - else - { - WLOG(logString + "Skipped " + m_description + " file `" + fn + - "' as it is incompatible with the current stream format. Expected " + - tos(bitrate) + " kbps, got " + (read_bitrate > 0 ? tos(read_bitrate) : "unknown") + - " kbps. Expected " + sampleRateStr(samplerate) + ", got " + sampleRateStr(read_samplerate) + "."); - } - } - } - else - { - ELOG(logString + m_description + " " + fn + " has bad size (" + tos(siz) + ")."); - } - } - else - { - ELOG(logString + "Could not seek to end of " + m_description + " file `" + fn + "'"); - } - ::fclose(f); - } - else - { - ELOG(logString + "Could not open " + m_description + " file `" + - fn + "' (" + errMessage().hideAsString() + ")"); - } - } - return read_bitrate; -} - -void streamData::_setupBuffers(const utf8& logString, const bool re_init) throw() -{ - // load intro and backup files - size_t stream_ID = ID(); - utf8 introFile = gOptions.stream_introFile(stream_ID); - if (!gOptions.read_stream_introFile(stream_ID)) - { - introFile = gOptions.introFile(); - } - - m_introFile.loadFromFile(introFile, m_streamInfo.m_streamBitrate, - m_streamInfo.m_uvoxDataType, - m_streamInfo.m_streamSampleRate, logString); - - - utf8 backupFile = gOptions.stream_backupFile(stream_ID); - if (!gOptions.read_stream_backupFile(stream_ID)) - { - backupFile = gOptions.backupFile(); - } - - m_backupFile.loadFromFile(backupFile, m_streamInfo.m_streamBitrate, - m_streamInfo.m_uvoxDataType, - m_streamInfo.m_streamSampleRate, logString); - -#if 0 - utf8 adTestFile = gOptions.stream_adTestFile(stream_ID); - if (!gOptions.read_stream_adTestFile(stream_ID)) - { - adTestFile = gOptions.adTestFile(); - } - - m_adTestFile.loadFromFile(adTestFile, m_streamInfo.m_streamBitrate, - m_streamInfo.m_uvoxDataType, - m_streamInfo.m_streamSampleRate, logString); - - utf8 adTestFile2 = gOptions.stream_adTestFile2(stream_ID); - if (!gOptions.read_stream_adTestFile2(stream_ID)) - { - adTestFile2 = gOptions.adTestFile2(); - } - - m_adTestFile2.loadFromFile(adTestFile2, m_streamInfo.m_streamBitrate, - m_streamInfo.m_uvoxDataType, - m_streamInfo.m_streamSampleRate, logString); - - utf8 adTestFile3 = gOptions.stream_adTestFile3(stream_ID); - if (!gOptions.read_stream_adTestFile3(stream_ID)) - { - adTestFile3 = gOptions.adTestFile3(); - } - - m_adTestFile3.loadFromFile(adTestFile3, m_streamInfo.m_streamBitrate, - m_streamInfo.m_uvoxDataType, - m_streamInfo.m_streamSampleRate, logString); - - utf8 adTestFile4 = gOptions.stream_adTestFile4(stream_ID); - if (!gOptions.read_stream_adTestFile4(stream_ID)) - { - adTestFile4 = gOptions.adTestFile4(); - } - - m_adTestFile4.loadFromFile(adTestFile4, m_streamInfo.m_streamBitrate, - m_streamInfo.m_uvoxDataType, - m_streamInfo.m_streamSampleRate, logString); -#endif - ///////////////////////////////////////////// - - // determine configuration of ring buffer - size_t requestedSize = gOptions.fixedBufferSize(); - - if ((gOptions.bufferType() == 1) && (m_streamInfo.m_streamBitrate > 0)) - { - DEBUG_LOG(logString + "Calculating buffer size from time (" + - tos(m_streamInfo.m_streamBitrate) + " kbps for " + - tos(gOptions.adaptiveBufferSize()) + "s)", LOGNAME, stream_ID); - requestedSize = (size_t)((gOptions.adaptiveBufferSize() * m_streamInfo.m_streamBitrate * 1024) / 8); - } - - size_t bufferHardLimit = gOptions.bufferHardLimit(); - requestedSize = min(requestedSize, bufferHardLimit); - - DEBUG_LOG(logString + "Requested fixed size of " + tos(requestedSize), LOGNAME, stream_ID); - // make sure it's a power of two - size_t powerOfTwo = 1; - while (true) - { - size_t n = powerOfTwo * 2; - if (n >= requestedSize) - { - requestedSize = n; - break; - } - else - { - powerOfTwo = n; - } - } - - if (re_init) - { - DEBUG_LOG(logString + "Re-initialising buffers", LOGNAME, stream_ID); - m_sc1_ring_buffer.m_writePtr = m_sc21_ring_buffer.m_writePtr = 0; - } - - DEBUG_LOG(logString + "Using buffer size of " + tos(requestedSize), LOGNAME, stream_ID); - m_sc1_ring_buffer.m_data.resize(requestedSize); - m_sc21_ring_buffer.m_data.resize(requestedSize); - m_sc1_ring_buffer.m_writePtr = m_sc21_ring_buffer.m_writePtr = 0; - m_sc1_ring_buffer.m_ptrMask = m_sc21_ring_buffer.m_ptrMask = (requestedSize - 1); -} - -uniString::utf8 streamData::getYPStreamTitle() throw() -{ - // in order to determine if we should update the title in YP, we should - // get the title based on where a client would be if he/she connected right now - const sc1MetadataAndExtensionInfo md = getSc1Metadata(0xFFFFFFFF); - if (!md.m_songTitle.empty()) - { - const utf8::size_type pos1 = md.m_songTitle.find(utf8("StreamTitle='")), - pos2 = (pos1 == utf8::npos ? utf8::npos : md.m_songTitle.find(utf8("';"),pos1+13)); - - utf8 metadata = stripWhitespace((pos1 == utf8::npos) || (pos2 == utf8::npos) ? (utf8)"" : md.m_songTitle.substr(pos1+13,pos2-pos1-13)); - // we use this to provide a nicer title to the YP when the advert update occurs - int remove_size = 7; - utf8::size_type pos = metadata.find(utf8("Advert:")); - if (pos != 0) - { - pos = metadata.find(utf8("Advert!")); - } - - if (!metadata.empty() && (pos == 0)) - { - // got a first matching block - metadata = metadata.replace(0, remove_size, (utf8)""); - - // look for an end block - pos = metadata.find(utf8("Advert!")); - if (pos == utf8::npos) - { - remove_size = 7; - pos = metadata.find(utf8("Advert:")); - } - else - { - remove_size = 12; - } - - if (pos != utf8::npos) - { - metadata = metadata.replace(pos, remove_size, (utf8)""); - } - - metadata = stripWhitespace(metadata); - } - - return metadata; - } - return (utf8)""; -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////// YP2 Messaging /////////////////////////////////////////////////////////////////////////////// -void streamData::_YP2_add() throw() // yp2 -{ - // only allow formats that we support - if (isAllowedType(m_streamInfo.m_uvoxDataType) && - (m_streamInfo.m_avgBitrate > 0) && - (m_streamInfo.m_streamSampleRate > 0)) - { - if ((!m_dead) && m_ID && m_streamInfo.m_streamPublic) - { -#if 0 - // in order to determine if we should update the title in YP, we should - // get the title based on where a client would be if he/she connected right now - const sc1MetadataAndExtensionInfo md = getSc1Metadata(0xFFFFFFFF); - const utf8 songTitle = getYPStreamTitle(); - - yp2::ypInfo info(m_yp2SessionKey, m_ID, m_streamInfo.m_authHash, - m_streamInfo.m_vbr, m_streamInfo.m_streamPublic, - !m_sc21AlbumArtData[0].empty(), !m_sc21AlbumArtData[1].empty()); - - info.bitrate = m_streamInfo.m_avgBitrate; - info.samplerate = m_streamInfo.m_streamSampleRate; - info.peakClientConnections = m_streamInfo.m_streamPeakUser; - info.maxClientConnections = ((m_streamInfo.m_streamMaxUser > 0) && - (m_streamInfo.m_streamMaxUser < gOptions.maxUser()) ? - m_streamInfo.m_streamMaxUser : gOptions.maxUser()); - info.mimeType = m_streamInfo.m_contentType; - info.relayURL = m_streamInfo.m_relayURL; - info.songMetadataForYP2 = (!md.m_songMetadataForYP2.empty() ? stripWhitespace(md.m_songMetadataForYP2) : - (!songTitle.empty() ? "" + aolxml::escapeXML(songTitle) + "" : "")); - info.sourceIdent = m_streamInfo.m_sourceIdent; - info.sourceUser = m_streamInfo.m_streamUser; - - m_yp2SessionKey = yp2::add(info, m_creating); -#endif - if (m_yp2SessionKey != yp2::INVALID_SESSION_KEY) - { - m_lastTouchTitle.clear(); - } - - if (!m_maxYPInterval) - { - m_maxYPInterval = gOptions.ypReportInterval(); - } - } - } -} - -void streamData::YP2_add() throw() // yp2 -{ - stackLock sml(m_stateLock); - - _YP2_add(); -} - -// check status and update stream info -void streamData::YP2_updateInfo(const yp2::stationInfo &info) throw() -{ - stackLock sml(m_stateLock); - int maxbitrate = info.m_allowMaxBitrate > 0 ? info.m_allowMaxBitrate : m_streamInfo.m_allowMaxBitrate_global; - int allformats = info.m_allowAllFormats < 0 ? m_streamInfo.m_allowAllFormats_global : info.m_allowAllFormats; - - m_streamInfo.m_streamName = info.m_streamTitle; - m_streamInfo.m_radionomyID = info.m_radionomyID; -#if 0 - for (int i = 0; i < 5; i++) - { - m_streamInfo.m_streamGenre[i] = info.m_streamGenre[i]; - } - m_streamInfo.m_streamURL = info.m_broadcasterURL; - m_streamInfo.m_backupServer = info.m_backupServer; - m_streamInfo.m_backupServersList = info.m_backupServersList; - m_streamInfo.m_publicIP = info.m_publicIP; -#endif - if (m_streamInfo.m_ypResponseCode == 0) - metrics::metrics_stream_up (m_ID, m_streamInfo.m_radionomyID, info.m_serverID, gOptions.publicIP(), getStartTime()); - - m_streamInfo.m_advertMode = info.m_advertMode; - m_streamInfo.m_ypResponseCode = info.m_responseCode; - - // use global default if per-stream settings not provided - m_streamInfo.m_allowSSL = info.m_allowSSL < 0 ? m_streamInfo.m_allowSSL_global : info.m_allowSSL; - m_streamInfo.m_allowAllFormats = allformats; - m_streamInfo.m_allowMaxBitrate = maxbitrate; - m_streamInfo.m_allowBackupURL = info.m_allowBackupURL < 0 ? m_streamInfo.m_allowBackupURL_global : info.m_allowBackupURL; - m_streamInfo.m_stationID = info.m_stationID; - m_streamInfo.m_serverID = info.m_serverID; - advertGroups.setType (info.m_advertType); - - if (gOptions.adMetricsDebug()) - { - string s = "using licence attribs, bitrate "; - if (m_streamInfo.m_allowMaxBitrate) - s += tos (m_streamInfo.m_allowMaxBitrate); - else - s += "unrestricted"; - s += ", fmts "; - s += tos (m_streamInfo.m_allowAllFormats); - s += ", ssl "; - s += tos (m_streamInfo.m_allowSSL); - s += ", backup "; - s += tos (m_streamInfo.m_allowBackupURL); - s += ", ad "; - s += tos (m_streamInfo.m_advertMode); - if (m_streamInfo.m_advertMode == 1) - { - s += ", ad mode "; - s += info.m_advertType.hideAsString(); - if (advertGroups.m_type == ADVERT_MAP_PAUSE) // maybe magic as well - { - size_t min_buf = m_streamInfo.m_streamBitrate * 1000 * 300 / 8; // 5 minutes - size_t powerOfTwo = 1; - while (true) - { - size_t n = powerOfTwo * 2; - if (n >= min_buf) - { - min_buf = n; - break; - } - else - { - powerOfTwo = n; - } - } - - if (min_buf > m_sc1_ring_buffer.m_data.size()) - { - m_sc1_ring_buffer.m_data.resize (min_buf); - m_sc21_ring_buffer.m_data.resize(min_buf); - m_sc1_ring_buffer.m_ptrMask = m_sc21_ring_buffer.m_ptrMask = (min_buf - 1); - s += ", resized buffer to "; - s += tos (min_buf); - } - } - } - DLOG (s, LOGNAME, m_ID); - } -} - -bool streamData::YP2_addSuccessful(int &addFailIgnore, int &errorCode) throw() -{ - stackLock sml(m_stateLock); - - yp2::addState_t result = yp2::addStatus(m_yp2SessionKey, addFailIgnore, errorCode); - return (!addFailIgnore ? (result == yp2::ADD_SUCCEEDED) : true); -} - -void streamData::_YP2_remove() throw() -{ - if ((!m_dead) && m_ID && m_streamInfo.m_streamPublic) - { -#if 0 - yp2::ypInfo info(m_yp2SessionKey, m_ID, m_streamInfo.m_authHash, - m_streamInfo.m_vbr, m_streamInfo.m_streamPublic); - - info.streamStartTime = m_startTime; - info.peakClientConnections = m_streamInfo.m_streamPeakUser; - info.maxClientConnections = ((m_streamInfo.m_streamMaxUser > 0) && - (m_streamInfo.m_streamMaxUser < gOptions.maxUser()) ? - m_streamInfo.m_streamMaxUser : gOptions.maxUser()); - - yp2::remove(info); -#endif - pushMetricsYP(); - metrics::metrics_stream_down (m_ID, m_streamInfo.m_radionomyID, - m_streamInfo.m_serverID, gOptions.publicIP(), m_startTime); - } -} - -void streamData::YP2_remove() throw() -{ - stackLock sml(m_stateLock); - - _YP2_remove(); -} - -#if 0 -inline void streamData::YP2_update() throw() -{ - m_stateLock.lock(); - - time_t t = ::time(NULL), elapsed = (t - m_lastYPTime); - if (((m_streamInfo.m_streamPublic || !gOptions.cdn().empty()) && (!m_dead) && m_ID && - // make sure we're looking at min and max intervals to ensure we send updates - // even when playing long mixes otherwise we can potentially drop off the YP. - // - // 2.4.8 we now have a fixed min-interval but if there's been no YP add yet - // then we have a 2sec minimum which is a bit more response whilst allowing - // for failed sources / relay connections to do things so we don't YP spam - (elapsed >= (m_yp2SessionKey ? 10 : 2) || elapsed >= m_maxYPInterval))) - { - // make sure we're added - if (m_yp2SessionKey == 0) - { - _YP2_add(); - } - - if (m_yp2SessionKey) - { - // in order to determine if we should update the title in YP, we should - // get the title based on where a client would be if he/she connected right now - m_stateLock.unlock(); - const uniString::utf8 songTitle = getYPStreamTitle(); - - // its touch time - if ((songTitle != m_lastTouchTitle) || (elapsed >= m_maxYPInterval)) - { - yp2::ypInfo info(m_yp2SessionKey, m_ID, m_streamInfo.m_authHash, - m_streamInfo.m_vbr, m_streamInfo.m_streamPublic, - !m_sc21AlbumArtData[0].empty(), !m_sc21AlbumArtData[1].empty()); - - stats::statsData_t data; - stats::getStats(m_ID, data, true); - - info.numListeners = data.connectedListeners; // li - info.avgUserListenTime = data.avgUserListenTime; // alt - info.numberOfClientsConnectedMoreThanFiveMinutes = data.newSessions; // cm - info.numberOfClientConnectsSinceLastUpdate = data.newConnects; // ht - info.numUniqueListeners = data.uniqueListeners; - - const ringBufferAccess_t startPos = getClientStartPosition(); - const sc1MetadataAndExtensionInfo md = getSc1Metadata((!startPos ? 0xFFFFFFFF : startPos)); - - //info.peakClientConnections = m_streamInfo.m_streamPeakUser; - info.maxClientConnections = ((m_streamInfo.m_streamMaxUser > 0) && - (m_streamInfo.m_streamMaxUser < gOptions.maxUser()) ? - m_streamInfo.m_streamMaxUser : gOptions.maxUser()); - info.songMetadataForYP2 = (!md.m_songMetadataForYP2.empty() ? stripWhitespace(md.m_songMetadataForYP2) : - "" + aolxml::escapeXML(songTitle) + ""); - info.sourceIdent = m_streamInfo.m_sourceIdent; - info.sourceUser = m_streamInfo.m_streamUser; - info.bitrate = m_streamInfo.m_avgBitrate; - info.samplerate = m_streamInfo.m_streamSampleRate; - info.mimeType = m_streamInfo.m_contentType; - info.relayURL = m_streamInfo.m_relayURL; - - m_stateLock.lock(); - yp2::updateResult ur = yp2::update(info); - - m_maxYPInterval = ur.m_maxYPInterval; - if (ur.m_requestQueued) - { - m_lastYPTime = t; - m_lastTouchTitle = songTitle; - } - m_stateLock.unlock(); - } - return; - } - } - m_stateLock.unlock(); -} -#endif - -int streamData::YP_SrvID(const streamID_t id) throw() -{ - if (id > 0) - { - map::const_iterator i = g_streamMap.find(id); - if (i == g_streamMap.end()) - { - return 0; - } - return yp2::getSrvID((*i).second->m_yp2SessionKey); - } - return 0; -} - -int streamData::YP_StnID(const streamID_t id) throw() -{ - if (id > 0) - { - map::const_iterator i = g_streamMap.find(id); - if (i == g_streamMap.end()) - { - return 0; - } - return yp2::getStnID((*i).second->m_yp2SessionKey); - } - return 0; -} - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -streamData::streamData(const streamSetup& setup) throw() - : m_ID(setup.m_sid), m_nextYPPush(::time(NULL)+10), - m_maxYPInterval(gOptions.ypReportInterval()), - m_yp2SessionKey(111), m_creating(0), - m_kill(0), m_dead(0), m_adTest(0), m_insertAdvert(false), - m_lastStreamSampleRate(setup.m_sampleRate), - m_lastStreamBitrate(0), m_syncFrameCount(0), - m_introFile("intro"), m_backupFile("backup"), - m_adTestFile("test advert"), m_adTestFile2("test advert"), - m_adTestFile3("test advert"), m_adTestFile4("test advert"), - advertGroups(this), m_parser(NULL) -{ - sourceReconnect(setup); - _setupBuffers(srcAddrLogString(setup.m_srcAddr, setup.m_srcPort, setup.m_sid)); -} - -streamData::~streamData() throw() -{ - DEBUG_LOG("[STREAMDATA sid=" + tos(m_ID) + "] " + __FUNCTION__, LOGNAME, m_ID); - - //YP2_remove(); - - m_sc1_ring_buffer.m_writePtr = m_sc21_ring_buffer.m_writePtr = 0; - delete m_parser; -} - -// sc1 style. Return false if stream is already connected -void streamData::sourceReconnect(const streamSetup& setup) throw() -{ - stackLock sml(m_stateLock); - - const bool uvox = (setup.m_sourceType == SHOUTCAST2), - native = (setup.m_sourceType != HTTP); - - m_streamInfo.m_backup = setup.m_backup; - m_streamInfo.m_streamUser = setup.m_streamUser; - m_streamInfo.m_allowPublicRelay = setup.m_allowPublicRelay; - m_streamInfo.m_streamMaxBitrate = setup.m_maxStreamBitrate; - m_streamInfo.m_streamMinBitrate = setup.m_minStreamBitrate; - m_streamInfo.m_streamMaxUser = setup.m_maxStreamUser; - m_streamInfo.m_streamSampleRate = setup.m_sampleRate; - m_streamInfo.m_authHash = setup.m_authHash; - m_streamInfo.m_vbr = setup.m_vbr; - - m_streamInfo.m_srcAddr = setup.m_srcAddr; - m_streamInfo.m_srcPort = setup.m_srcPort; - - m_streamInfo.m_relayURL = setup.m_relayURL; - m_streamInfo.m_backupURL = setup.m_backupURL; - - if (!uvox) - { - m_streamInfo.m_streamName = mapGet(setup.m_headers, (native ? "icy-name" : "ice-name"), (utf8)""); - m_streamInfo.m_streamGenre[0] = mapGet(setup.m_headers, (native ? "icy-genre" : "ice-genre"), utf8("Misc")); - } - else - { - m_streamInfo.m_streamName = setup.m_config.m_icyName; - m_streamInfo.m_streamGenre[0] = setup.m_config.m_icyGenre; - } - - for (int i = 1; i < 5; i++) - { - m_streamInfo.m_streamGenre[i].clear(); - } - - if (!uvox) - { - m_streamInfo.m_streamBitrate = getStreamBitrate(setup.m_headers); - m_streamInfo.m_streamSampleRate = getStreamSamplerate(setup.m_headers); - m_streamInfo.m_streamURL = mapGet(setup.m_headers, (native ? "icy-url" : "ice-url"), (utf8)"http://www.shoutcast.com"); - // sanity handling to map things to something which the YP2 will definitely like - m_streamInfo.m_contentType = fixMimeType(mapGet(setup.m_headers, "content-type", utf8("audio/mpeg"))); - m_streamInfo.m_streamPublic = mapGet(setup.m_headers, (native ? "icy-pub" : "ice-pub"), false); - } - else - { - m_streamInfo.m_streamBitrate = (setup.m_config.m_avgBitrate / 1000); - m_streamInfo.m_streamURL = setup.m_config.m_icyURL; - m_streamInfo.m_contentType = setup.m_config.m_mimeType; - m_streamInfo.m_streamPublic = (setup.m_config.m_icyPub ? true : false); - } - - // see if there's a per-stream option else revert to master - utf8 pub = toLower(gOptions.stream_publicServer(setup.m_sid)); - if (pub.empty()) - { - pub = toLower(gOptions.publicServer()); - } - if (pub == "always") - { - m_streamInfo.m_streamPublic = true; - } - else if (pub == "never") - { - m_streamInfo.m_streamPublic = false; - } - - m_streamInfo.m_sourceType = setup.m_sourceType; - - if (!uvox) - { - m_streamInfo.m_avgBitrate = m_streamInfo.m_minBitrate = - m_streamInfo.m_maxBitrate = (m_streamInfo.m_streamBitrate * 1000); - } - else - { - m_streamInfo.m_avgBitrate = setup.m_config.m_avgBitrate; - m_streamInfo.m_minBitrate = m_streamInfo.m_maxBitrate = setup.m_config.m_maxBitrate; - } - - if ((m_streamInfo.m_contentType == "audio/ogg" || m_streamInfo.m_contentType == "application/ogg")) - { - m_streamInfo.m_uvoxDataType = OGG_DATA; - m_streamInfo.m_vbr = true; - } - else if ((m_streamInfo.m_contentType == "audio/aac") || (m_streamInfo.m_contentType == "audio/aacp")) - { - m_streamInfo.m_uvoxDataType = AACP_DATA; - } - else - { - m_streamInfo.m_uvoxDataType = MP3_DATA; - } - - // uvox codes for intro and backup files will be wrong if contentType is empty. This is only a problem - // if we are using vanilla uvox 2 which does not send a mime type (uvox 2.1 does, however) - if (m_streamInfo.m_contentType.empty()) - { - WLOG("Content type of stream " + tos(m_ID) + " is empty. Intro and backup files may not work.", LOGNAME, m_ID); - } - - g_streamUptime[m_ID] = ::time(NULL); - delete m_parser; - m_parser = NULL; -} - - -MP3_FrameInfo *streamData::detectMP3 (unsigned int &failureThresh, const unsigned char *buf, unsigned int buflen, unsigned chk) -{ - unsigned loop = chk ? chk : 10000, remain = buflen, frames = 0; - MP3_FrameInfo info, *parser = NULL; - const unsigned char *p = buf; - __uint64 samples = 0; - - if (buflen < 3000) // get sufficient data to check, saves failing part way through - return NULL; - int len = getMP3FrameInfo (p, buflen, info); - // check a few frames to see about consistency - while (len > 0) - { - //DLOG ("loop is " + tos(loop)); - len = info.verifyFrame (p, remain); - if (len <= 0 || len > remain) - break; - samples += info.m_samples; - frames++; - p += len; - remain -= len; - loop--; - // DLOG("Detecting frames, loop " + tos(loop) + ", remain " + tos(remain)); - } - if (samples > 1000) - { - failureThresh += 100; - parser = new MP3_FrameInfo (buf, buflen); - parser->m_inUse = true; - parser->m_description += info.getVersionName(); - parser->m_description += " layer "; - parser->m_description += info.getLayerName(); - parser->m_description += (info.m_mono ? " mono" : " stereo"); - if (chk == 0 && loop && samples && info.m_samplerate) - { - parser->m_frameCount = frames; - parser->m_duration = ((float)samples / info.m_samplerate); - parser->m_description += " duration "; - parser->m_description += tos (parser->m_duration); - parser->m_description += "s"; - } - if (remain && chk == 0 && loop) - { - parser->m_description += ", reduced size by "; - parser->m_description += tos (remain); - parser->m_reduce = remain; - } - } - return parser; -} - -static unsigned long getMSB4 (unsigned long v) -{ - unsigned long m = v; - int c = 0; - - for (; m > 15; c++, m >>= 1) - ; - DEBUG_LOG ("bitrate estimate mark " + tos(m)); - if (m == 0xF) // binary 1111 is not a normal bit pattern, adjust to 1000 - m = 0x10; - if (m == 0xB) // binary 1011 is not a normal bit pattern, adjust to 1100 - m = 0xC; - return c ? m << c : m; -} - -AAC_FrameInfo *streamData::detectAAC (unsigned int &failureThresh, const unsigned char *buf, unsigned int buflen, unsigned chk) -{ - unsigned int loop = chk ? chk : 10000, remain = buflen; - int bytes = 0; - float fcount = 0; - AAC_FrameInfo info, *parser = NULL; - const unsigned char *p = buf; - - if (buflen < 8000) // get sufficient data to check, saves failing part way through - return 0; - int len = getAACFrameInfo (p, buflen, info); - - // check a few frames to see about consistency - while (len > 0) - { - len = info.verifyFrame (p, remain); - if (len == 0 || len > remain) // short - break; - if (len < 0) // failed to match - break; - p += len; - remain -= len; - bytes += (len - 7); // drop the adts frame header - fcount += info.m_blocks; - loop--; - // DLOG("Detecting frames, loop " + tos(loop) + ", remain " + tos(remain)); - } - if (bytes > 1000) - { - parser = new AAC_FrameInfo (buf, buflen); - failureThresh += 100; - parser->m_inUse = true; - info.m_description += stringUtil::tos (info.m_samplerate); - info.m_description += "hz"; - - // increase the average a small amount, just to help rounding, we do tuncate later - int r = (int)((bytes * 1.028 / fcount) * (parser->m_samplerate / 1000.0)) * 8; - - parser->m_bitrate = getMSB4 ((r/1024)); - parser->m_frameCount = fcount; - - parser->m_description += info.getVersionName(); - parser->m_description += ", "; - parser->m_description += info.getAOT(); - parser->m_description += " ("; - parser->m_description += stringUtil::tos (info.m_aot); - parser->m_description += "), "; - parser->m_description += stringUtil::tos (info.m_samplerate); - parser->m_description += "hz, estimated "; - parser->m_description += tos (parser->m_bitrate); - parser->m_description += " kbps"; - if (remain && chk == 0 && loop) - { - parser->m_description += ", reduced size by "; - parser->m_description += tos (remain); - parser->m_reduce = remain; - } - } - return parser; -} - - -int streamData::getFrameInfo (parserInfo *&parser, unsigned &failureThresh, const unsigned char *buf, unsigned int len, unsigned chk) -{ - int ret = 0, loop = 100; - do - { - loop--; - if (parser && parser->m_inUse) - { - ret = parser->verifyFrame (buf, len); - if (ret >= 0) - break; - delete parser; - parser = NULL; - } - if (len < 3000) - return 0; - parser = detectMP3 (failureThresh, buf, len, chk); - if (parser) - continue; - parser = detectAAC (failureThresh, buf, len, chk); - if (parser) - continue; - return len < 12000 ? 0 : -1; - } while (loop); - - // maybe ID3 check? - if (failureThresh > 0) - --failureThresh; - return ret; -} - - -const bool streamData::syncToStream(short unsigned int& remainderSize, __uint8 *remainder, - int amt, int& bitrate, const int type, const char *buf, - const utf8& logString) -{ - unsigned int samplerate = m_streamInfo.m_streamSampleRate; - bool mp3; - if (streamData::isAllowedType(type, mp3)) - { - int end = 0; - - //DLOG ("process block of " + tos (amt)); - for (int i = 0; (i < (amt - 8)) && !iskilled();) - { - unsigned int read_samplerate = 0; - int read_bitrate = 0; - const unsigned char* f = (const unsigned char *)&(buf[i]); - int remain = amt - i; - int restart = m_parser == NULL ? 1 : 0; - - int found = getFrameInfo (m_parser, m_syncFrameCount, f, remain); - - if (found > remain || found == 0) - { - end = i; - // DLOG ("Need more data for " + tos(found) + " , remaining " + tos(remain)); - break; - } - // DLOG ("frame size return " + tos (found)); - - if (m_parser) - { - if (restart) - { - utf8 msg = logString; - - msg += "stream detected "; - msg += m_parser->m_description; - ILOG (msg, LOGNAME, ID()); - } - read_samplerate = m_parser->m_samplerate; - read_bitrate = m_parser->m_bitrate; - } - - // DLOG ("FME: frame size is " + tos (found)); - if (found > 0) - { - if (m_streamInfo.m_streamSampleRate == 0 && read_samplerate) - { - m_streamInfo.m_streamSampleRate = (samplerate = read_samplerate); - } - if (m_streamInfo.m_streamBitrate == 0) - { - // update everything as we'll have no bitrate if we're calling this... - if (read_bitrate == 0 && bitrate > 0) - m_streamInfo.m_streamBitrate = bitrate; - else - m_streamInfo.m_streamBitrate = (bitrate = read_bitrate); - m_streamInfo.m_avgBitrate = m_streamInfo.m_minBitrate = - m_streamInfo.m_maxBitrate = (bitrate * 1000); - - DEBUG_LOG ("No bitrate info provided, assuming stream settings at " + tos(bitrate) + "k", LOGNAME, ID()); - - // we need to kick things back into shape at this point... - _setupBuffers(logString, true); - - _YP2_add(); - } - if (read_bitrate && m_streamInfo.m_streamBitrate && m_streamInfo.m_vbr == false) - { - if (m_lastStreamBitrate) - { - if (m_lastStreamBitrate != read_bitrate) - { - m_streamInfo.m_vbr = true; - DEBUG_LOG ("Detected bitrate change (vBR) from " + tos (m_streamInfo.m_streamBitrate) + " to " + tos (read_bitrate), LOGNAME, ID()); - } - else - { - if (read_bitrate != m_streamInfo.m_streamBitrate) - { - utf8 msg = "expected bitrate of "; - msg += tos (m_streamInfo.m_streamBitrate); - msg += "k, actually found "; - msg += tos(read_bitrate); - msg += "k, will assume that"; - ILOG (msg, LOGNAME, ID()); - m_streamInfo.m_streamBitrate = read_bitrate; - } - } - } - else - m_lastStreamBitrate = read_bitrate; - } -#if defined(_DEBUG) || defined(DEBUG) - writeSc1((const __uint8 *)&buf[end], found, ID()); -#else - writeSc1((const __uint8 *)&buf[end], found); -#endif - end += found; - i += found; - } - else - { - m_syncFrameCount += 50; - if (m_syncFrameCount > 700) // threshold before dropping stream - return true; - - // otherwise we just need to move on and keep - // looking for what is a valid starting frame - const void *p = memchr (f+1, 255, remain-1); - if (p) - { - i = (int)((unsigned char*)p - (unsigned char*)buf); - DEBUG_LOG ("FMK: found marker, searching from " + tos(i) + " in len " + tos(amt) + ", sync " + tos(m_syncFrameCount), LOGNAME, ID()); - } - else - { - end = i = amt; - DEBUG_LOG ("FMK: skipping to end " + tos (i), LOGNAME, ID()); - } - } - } - - amt = (amt - end); - // DLOG ("EOB: remainder " + tos (remainderSize) + ", end " + tos(end) + ", amt " + tos(amt)); - if ((amt > 0)) // && (samplerate > 0)) - { - memcpy(&(remainder[remainderSize]), &buf[end], amt); - remainderSize += amt; - } - } - - return false; -} - -utf8 streamData::getHTML5Player(const size_t sid) throw() -{ - return ""; -} - -utf8 streamData::getStreamMessage(const size_t sid) throw() -{ - stackLock sml(g_streamMessageMapLock); - - map::const_iterator i = g_streamMessageMap.find(sid); - if (i != g_streamMessageMap.end()) - { - return (*i).second; - } - return ""; -} - -void streamData::updateStreamMessage(const size_t sid, const uniString::utf8& message) throw() -{ - stackLock sml(g_streamMessageMapLock); - - if (message.empty() || (message == "")) - { - map::iterator i = g_streamMessageMap.find(sid); - if (i != g_streamMessageMap.end()) - { - (*i).second.clear(); - } - } - else - { - g_streamMessageMap[sid] = message; - } -} - -const bool streamData::isSourceCompatible(const streamSetup& setup) const throw() -{ - stackLock sml(m_stateLock); - - if (setup.m_sourceType == SHOUTCAST2) - { - if (m_streamInfo.m_contentType != setup.m_config.m_mimeType) - { - return false; - } - - if (m_streamInfo.m_avgBitrate != setup.m_config.m_avgBitrate) - { - return false; - } - if (m_streamInfo.m_maxBitrate != setup.m_config.m_maxBitrate) - { - return false; - } - if (m_streamInfo.m_minBitrate != setup.m_config.m_maxBitrate) - { - return false; - } - return true; - } - else - { - if (m_streamInfo.m_sourceType == SHOUTCAST2) - { - return false; - } - if (m_streamInfo.m_contentType != mapGet(setup.m_headers, "content-type", utf8("audio/mpeg"))) - { - return false; - } - if (!m_streamInfo.m_streamBitrate || (m_streamInfo.m_streamBitrate != getStreamBitrate(setup.m_headers))) - { - return false; - } - return true; - } -} - -// write data into a ring buffer. if packet_starts is provided, then add an entry to it (and also clean it up as necessary) -static void writeToRingBuffer(const __uint8 *data, int amt, AOL_namespace::rwLock &bufferLock, - streamData::ringBuffer_t &buffer, - deque *packet_starts = 0) throw() -{ - stackRWLock sl (bufferLock, false); - if (packet_starts) - { - - const streamData::ringBufferAccess_t ptr = buffer.m_writePtr, - bottom = (ptr - buffer.m_data.size()); // warning this could wrap - - // add new entry - packet_starts->push_back(buffer.m_writePtr); - - // cleanup old ones - int remove_count = 0; - for (deque < streamData::ringBufferAccess_t>::const_iterator i = packet_starts->begin(); i != packet_starts->end(); ++i) - { - streamData::ringBufferAccess_t v = (*i); - // edge case, ptr has rolled over, therefore bottom > ptr - if (bottom > ptr) - { - if ((v < bottom) && (v > ptr)) - { - ++remove_count; - } - else - { - break; - } - } - else - { - // normal case - if ((v < bottom) || (v > ptr)) // note: (v > ptr) probably not necessary, but can't hurt - { - ++remove_count; - } - else - { - break; - } - } - } - while ((remove_count--) > 0) - { - packet_starts->pop_front(); - } - } - - size_t remain = amt; - - while (remain > 0) - { - // get masked ring offset - const streamData::ringBufferAccess_t o = (buffer.m_writePtr & buffer.m_ptrMask); - // don't write beyond end of buffer - const size_t amt_to_write = min (remain, (buffer.m_data.size() - o)); - - memcpy(&(buffer.m_data[o]), data, amt_to_write); - // advance pointers - data += amt_to_write; - remain -= amt_to_write; - buffer.m_writePtr += amt_to_write; - } -} - -// data is shoutcast1 format WITH NO METADATA. Insert into the two ring buffers -#if defined(_DEBUG) || defined(DEBUG) -void streamData::writeSc1(const __uint8 *data, const int amt, const streamID_t) -#else -void streamData::writeSc1(const __uint8 *data, const int amt) -#endif -{ - time_t now = ::time(NULL); - if (m_insertAdvert) - { - adTrigger *t = advertGroups.triggers.empty() ? NULL : advertGroups.triggers.front(); - if (t && t->m_playedAt == (time_t)0) - { - writeToRingBuffer((const __uint8*)"SCAdvert", 8, m_sc1StreamLock, m_sc1_ring_buffer); - writeToRingBuffer((const __uint8*)"SCAdvert", 8, m_sc21StreamLock, m_sc21_ring_buffer); - t->m_startPosSC1 = m_sc1_ring_buffer.m_writePtr; - t->m_startPosSC2 = m_sc21_ring_buffer.m_writePtr; - t->m_returnPtrSC1 = m_sc1_ring_buffer.m_writePtr; - t->m_returnPtrSC2 = m_sc21_ring_buffer.m_writePtr; - t->m_type = advertGroups.m_type; - - if (t->m_type == ADVERT_MAP_FIXED || t->m_type == ADVERT_MAP_FLEX) // overlay - { - t->m_returnPtrSC1 += advertGroups.overlaySize (t); - t->m_returnPtrSC2 += advertGroups.overlaySize (t, true); - DLOG ("overlay of ads, returning to " + tos(t->m_returnPtrSC1), LOGNAME, m_ID); - } - else - { - DLOG ("insert of ads, returning to " + tos(t->m_returnPtrSC1), LOGNAME, m_ID); - } - t->m_playedAt = time(NULL); - t->m_duration = m_duration; - - metrics::adSummary summary; - summary.id = t->m_id; - summary.sid = ID(); - summary.path = getStreamPath (ID()); - summary.tstamp = now; - summary.count = stats::getUserCount (ID()); - summary.sd = this; - - metrics::metrics_advert_started (summary); - } - m_insertAdvert = false; - } - - long uptime = now - streamData::getStreamUptime(ID()); - if ((uptime & 7) == 7) // check for some things every 8 seconds - { - advertGroups.purge (m_sc1_ring_buffer); - - if (m_streamInfo.m_allowAllFormats == 0 && m_parser && m_parser->getUvoxType() != MP3_DATA) - { - WLOG ("Format is not MP3, where only MP3 is allowed", "Licence", ID()); - throwEx(""); - } - if (m_streamInfo.m_allowMaxBitrate && m_streamInfo.m_avgBitrate) - { - int avg = m_streamInfo.m_avgBitrate/1000; - if (avg > (m_streamInfo.m_allowMaxBitrate + 5)) - { - string msg = "Dropping as bitrate needs to be " + tos (m_streamInfo.m_allowMaxBitrate) + "k or less, currently " + tos (avg) +"k"; - WLOG (msg, "Licence", ID()); - throwEx(""); - } - } - } - - // sc1 - if (amt > 0) - { - int len = amt; - // put into the sc1 buffer - writeToRingBuffer(data, len, m_sc1StreamLock, m_sc1_ring_buffer, &m_sc1_packet_starts); -#if 0 - // TODO would be nice to have this as a more formal thing for debugging and / or backup - if (!g_streamSaving[id]) - { - g_streamSaving[id] = uniFile::fopen("D:\\Dev\\git_radionomy\\SHOUTcast\\sc_serv3\\test_" + tos(id) + (m_streamInfo.m_uvoxDataType == MP3_DATA ? ".mp3" : ".aac"), "wb"); - } - if (g_streamSaving[id]) - { - fwrite(data, 1, amt, g_streamSaving[id]); - } - stackLock sml(m_sc1LimitTriggerLock); - for_each(m_sc1LimitTriggers.begin(), m_sc1LimitTriggers.end(), mem_fun(&pipeDrivenSignal::set)); -#endif - } - // sc1 - - // sc21 - m_sc21MetadataLock.lock(); - uvoxMetadata_t md = m_sc21MetadataToPutInline; - m_sc21MetadataToPutInline.clear(); - m_sc21MetadataLock.unlock(); - - // const bool trigger = ((amt > 0) || (!md.empty())); - - if (!md.empty()) - { - writeToRingBuffer((const __uint8*)&md[0], (int)md.size(), m_sc21StreamLock, m_sc21_ring_buffer); - } - - int len = amt; - while (len > 0) - { - __uint8 uvoxBuffer[MAX_MESSAGE_SIZE] = {0}; - int left_over = formMessage(data, len, m_streamInfo.m_uvoxDataType, uvoxBuffer); - writeToRingBuffer((const __uint8*)uvoxBuffer, len - left_over + UV2X_OVERHEAD, - m_sc21StreamLock, m_sc21_ring_buffer, &m_sc21_packet_starts); - data += (len - left_over); - len = left_over; - } -#if 0 - if (trigger) - { - stackLock sml(m_sc21LimitTriggerLock); - for_each(m_sc21LimitTriggers.begin(), m_sc21LimitTriggers.end(), - mem_fun(&pipeDrivenSignal::set)); - } - // sc21 - YP2_update(); -#endif - checkForAdverts(); - pushMetricsYP (false); -} - -void streamData::writeSc21(const vector<__uint8> &data) throw() -{ - if (data.empty()) - { - return; - } - - m_sc21MetadataLock.lock(); - uvoxMetadata_t md = m_sc21MetadataToPutInline; - m_sc21MetadataToPutInline.clear(); - m_sc21MetadataLock.unlock(); - - if (!md.empty()) - { - writeToRingBuffer((const __uint8*)&md[0], (int)md.size(), - m_sc21StreamLock, m_sc21_ring_buffer); - } - - writeToRingBuffer(&(data[0]), (int)data.size(), m_sc21StreamLock, - m_sc21_ring_buffer, &m_sc21_packet_starts); -#if 0 - stackLock sml(m_sc21LimitTriggerLock); - for_each(m_sc21LimitTriggers.begin(), m_sc21LimitTriggers.end(), - mem_fun(&pipeDrivenSignal::set)); -#endif -} - -static streamData::ringBufferAccess_t _getClientStartPosition (const streamData::ringBuffer_t &/*buffer*/, - deque &packet_starts, - AOL_namespace::rwLock &streamLock, - streamData::ringBufferAccess_t ptr = 0) throw() -{ - stackRWLock sl (streamLock); - - const deque::size_type packet_count = packet_starts.size(); - if (packet_count < 6) - { - return 0; - } - - streamData::ringBufferAccess_t avail_range = (packet_starts.back() - packet_starts.front()); - - if (ptr == 0) - { - streamData::ringBufferAccess_t avg = avail_range / packet_count; - size_t pkts = avg ? (256000/avg) : 0; // target about 250k burst - if (pkts) - { - if (pkts + 6 > packet_count) - pkts = packet_count - 6; - return packet_starts [packet_count - pkts]; - } - return packet_starts.front(); - } - deque::reverse_iterator r = packet_starts.rbegin(), t = r; - if (*r < ptr && (ptr - *r) > 60000) - ILOG ("[ADVERT] Expected transition point still to come, returning early", ADLOGNAME); - for (; r != packet_starts.rend(); ++r) - { - if (*r < ptr) - break; - t = r; - } - // DLOG("start pos, returning " + tos ((long)*t)); - return *t; -} - -const streamData::ringBufferAccess_t streamData::getClientStartPosition(const bool sc2) throw() -{ - return _getClientStartPosition((!sc2 ? m_sc1_ring_buffer : m_sc21_ring_buffer), - (!sc2 ? m_sc1_packet_starts : m_sc21_packet_starts), - (!sc2 ? m_sc1StreamLock : m_sc21StreamLock)); -} - - -streamData::ringBufferAccess_t streamData::getClientStartPosition (ringBufferAccess_t ptr, bool sc2) throw() -{ - return _getClientStartPosition((!sc2 ? m_sc1_ring_buffer : m_sc21_ring_buffer), - (!sc2 ? m_sc1_packet_starts : m_sc21_packet_starts), - (!sc2 ? m_sc1StreamLock : m_sc21StreamLock), ptr); -} - - -const int streamData::getStreamData(streamData::ringBufferAccess_t& amt, const streamData::ringBufferAccess_t& readPtr, - vector<__uint8>& data, const size_t remSize, const bool sc2) throw() /* for readers only */ -{ - stackRWLock sl ((!sc2 ? m_sc1StreamLock : m_sc21StreamLock)); - - const streamData::ringBuffer_t& buffer = (!sc2 ? m_sc1_ring_buffer : m_sc21_ring_buffer); - - amt = (buffer.m_writePtr - readPtr); - if ((amt > 0) && (amt > buffer.m_data.size())) - { - // the pointers are too far apart - underrun - // make the listener handler process a reset - return -1; - } - - const streamData::ringBufferAccess_t offset = (readPtr & buffer.m_ptrMask); - // clamp again so we don't read pass the end of the buffer - // - // if we've got more in remainder than what we're wanting - // to send then we'll prioritise the remainder data first - // before trying to acquire more new data to try to send. - amt = min(amt, min((buffer.m_data.size() - offset), - (streamData::ringBufferAccess_t)max(0, (SEND_SIZE - (int)remSize)))); - - int len = (int)amt; - if (len > 0) - { - const vector<__uint8>::const_iterator pos = buffer.m_data.begin(); - data.insert(data.end(), pos + offset, pos + (offset + len)); - } - - return len; -} - -#if 0 -void streamData::abandonLimitTrigger(pipeDrivenSignal *t, const bool sc2) throw() -{ - if (!sc2) - { - stackLock sml(m_sc1LimitTriggerLock); - m_sc1LimitTriggers.erase(t); - } - else - { - stackLock sml(m_sc21LimitTriggerLock); - m_sc21LimitTriggers.erase(t); - } -} - -void streamData::_scheduleLimitTrigger(pipeDrivenSignal *t, const ringBufferAccess_t readPtr, - AOL_namespace::mutex &streamLock, const ringBuffer_t &ringBuffer, - AOL_namespace::mutex &triggerSetLock, - set*> &triggerSet) throw() -{ - bool add_to_set = true; - - streamLock.lock(); - if (ringBuffer.m_writePtr > readPtr) - { - t->set(); - add_to_set = false; - } - streamLock.unlock(); - - stackLock sml(triggerSetLock); - if (add_to_set) - { - triggerSet.insert(t); - } - else - { - triggerSet.erase(t); - } -} - -void streamData::scheduleLimitTrigger(pipeDrivenSignal *t, - const ringBufferAccess_t readPtr, const bool sc2) throw() -{ - _scheduleLimitTrigger(t, readPtr, (!sc2 ? m_sc1StreamLock : m_sc21StreamLock), - (!sc2 ? m_sc1_ring_buffer : m_sc21_ring_buffer), - (!sc2 ? m_sc1LimitTriggerLock : m_sc21LimitTriggerLock), - (!sc2 ? m_sc1LimitTriggers : m_sc21LimitTriggers)); -} -#endif - -// find the metadata entry that is <= to ptr. -template -typename T::value_type::second_type _getMetadata(const T &metadataTable, AOL_namespace::mutex &metadataLock, - const streamData::ringBufferAccess_t ptr) throw() -{ - stackLock sml(metadataLock); - - typename T::value_type::second_type result; - - if (metadataTable.empty()) - { - return result; - } - streamData::ringBufferAccess_t old_entry = metadataTable.front().first; // "oldest" entry - streamData::ringBufferAccess_t new_entry = metadataTable.back().first; // "newest" entry - - if (old_entry <= new_entry) - { - // normal case. older entries have lower pointers than later ones - for (typename T::const_iterator i = metadataTable.begin(); i != metadataTable.end(); ++i) - { - if ((*i).first <= ptr) - { - result = (*i).second; - } - else - { - break; - } - } - } - else - { - // wrap case - typename T::const_iterator i = metadataTable.begin(); - - if (ptr >= old_entry) // "upper half" - { - for (; i != metadataTable.end(); ++i) - { - if (((*i).first <= ptr) && ((*i).first >= old_entry)) - { - result = (*i).second; - } - else - { - break; - } - } - } - else if (ptr > new_entry) // in "gap" - { - result = metadataTable.back().second; - } - else // lower half - { - for (; i != metadataTable.end(); ++i) // skip entries in "upper half" - { - if ((*i).first < old_entry) - { - break; - } - } - for (; i != metadataTable.end(); ++i) - { - if ((*i).first <= ptr) - { - result = (*i).second; - } - else - { - break; - } - } - } - } - return result; -} - -streamData::sc1MetadataAndExtensionInfo streamData::getSc1Metadata(ringBufferAccess_t ptr) throw() -{ - return _getMetadata(m_sc1MetadataTable, m_sc1MetadataLock, ptr); -} - -streamData::uvoxMetadata_t streamData::getSc21Metadata(ringBufferAccess_t ptr) throw() -{ - return _getMetadata(m_sc21MetadataTable, m_sc21MetadataLock, ptr); -} - -streamData::uvoxMetadata_t streamData::getSc21StreamAlbumArt(ringBufferAccess_t ptr) throw() -{ - return _getMetadata(m_sc21StreamAlbumArtTable, m_sc21StreamAlbumArtLock, ptr); -} - -streamData::uvoxMetadata_t streamData::getSc21PlayingAlbumArt(ringBufferAccess_t ptr) throw() -{ - return _getMetadata(m_sc21PlayingAlbumArtTable, m_sc21PlayingAlbumArtLock, ptr); -} - -// remove stale metadata entries by looking for those that are beyond the bottom of the ring buffer. -// HOWEVER, always keep the bottom one so that clients who enter will have some metadata to work with -template -static void _cleanupMetadataEntries(METATABLE &metadataTable, - const streamData::ringBufferAccess_t ptr, - const streamData::ringBufferAccess_t siz) -{ - streamData::ringBufferAccess_t bottom = ptr - siz; // warning this could wrap - int remove_count = -1; // always leave bottom entry - for (typename METATABLE::const_iterator i = metadataTable.begin(); i != metadataTable.end(); ++i) - { - streamData::ringBufferAccess_t v = (*i).first; - // edge case, ptr has rolled over, therefore bottom > ptr - if (bottom > ptr) - { - if ((v < bottom) && (v > ptr)) - { - ++remove_count; - } - else - { - break; - } - } - else - { - // normal case - if ((v < bottom) || (v > ptr)) // note: (v > ptr) probably not necessary, but can't hurt - { - ++remove_count; - } - else - { - break; - } - } - } - - while ((remove_count--) > 0) - { - metadataTable.pop_front(); - } -} - -template -static void _addMetadata(AOL_namespace::rwLock &streamLock, const streamData::ringBuffer_t &ringBuffer, - AOL_namespace::mutex &metadataLock, METADATA &metadataTable, const MT &md) throw() -{ - // get current position and size of ring buffer - streamLock.lock(); - const streamData::ringBufferAccess_t ptr = ringBuffer.m_writePtr, - siz = ringBuffer.m_data.size(); - streamLock.unlock(); - - // put entry in table - metadataLock.lock(); - metadataTable.push_back(make_pair(ptr, md)); - - // remove any stale entries - _cleanupMetadataEntries(metadataTable, ptr, siz); - metadataLock.unlock(); -} - -bool streamData::validateTitle(uniString::utf8 &m_updinfoSong) throw() -{ - bool allowed = true; - - m_updinfoSong = stripWhitespace(m_updinfoSong); - if (!m_updinfoSong.empty()) - { - // work on lowercase comparison as well as doing a check to see if - // after removing white space + punctuation we have a valid title. - uniString::utf8 m_checkUpdinfoSong = toLower(m_updinfoSong); - - // exclude weird title updates from being accepted - // as no point in giving junk to the user later on - if (m_checkUpdinfoSong.find((utf8)"!doctype") != utf8::npos || - m_checkUpdinfoSong.find((utf8)" &data) throw() -{ - // convert uvox metadata to sc21, sc2 and sc1 - utf8 sc21_metadata_s; - vector<__uint8> sc21_albumart_data; - bool albumart = false; - - sc1MetadataAndExtensionInfo sc1_metadata_and_extension_info; - - if (voxMsgType == MSG_METADATA_XML_NEW) // new shoutcast 2 - { - sc21_metadata_s.insert(sc21_metadata_s.end(), data.begin(), data.end()); - utf8 meta(sc21_metadata_s.begin(), sc21_metadata_s.end()); - - // attempt to get the encoder from the metadata i.e. used to identify the source - try - { - m_streamInfo.m_comingSoon.clear(); - m_streamInfo.m_nextSongs.clear(); - m_streamInfo.m_sourceIdent = metadata::get_XX_from_3902("TENC", meta, m_streamInfo.m_sourceIdent); - m_streamInfo.m_nextSongs = metadata::get_nextsongs_from_3902(meta, m_streamInfo.m_nextSongs); - - // these allow for updating of information from a source when a DJ - // is connected e.g. to sc_trans but is not setup to be listed or - // is just sending through a DJ name update for admin tracking, etc - m_streamInfo.m_streamUser = metadata::get_XX_from_3902("DJ", meta, m_streamInfo.m_streamUser); - - int addFailIgnore = 0, errorCode = 0; - if (!m_streamInfo.m_streamPublic || YP2_addSuccessful(addFailIgnore, errorCode)) - { - if (!m_streamInfo.m_streamPublic || addFailIgnore) - { - // only update the stream name from metadata if public or pending a YP update - m_streamInfo.m_streamName = metadata::get_XX_from_3902("TRSN", meta, m_streamInfo.m_streamName); - } - } - } - catch (const exception &ex) - { - ELOG(ex.what()); - // abort nicely if there was an error - return 0; - } - - // attempt to get the next song from the extended information from the metadata - utf8 m_checkComingSoon = metadata::get_XX_from_3902("extension/soon", meta, m_streamInfo.m_comingSoon); - if (!m_checkComingSoon.empty()) - { - if (validateTitle(m_checkComingSoon)) - { - m_streamInfo.m_comingSoon = m_checkComingSoon; - } - else - { - if (!(m_checkComingSoon.find((utf8)"nextsong") != utf8::npos && m_checkComingSoon.find((utf8)"sctrans2next") != utf8::npos)) - { - WLOG("[ADMINCGI sid=" + tos(ID()) + "] Coming soon title rejected - value not allowed: " + m_checkComingSoon, LOGNAME, ID()); - } - m_streamInfo.m_comingSoon.clear(); - } - } - else - { - if (!m_streamInfo.m_comingSoon.empty()) - { - m_streamInfo.m_comingSoon.clear(); - WLOG("[ADMINCGI sid=" + tos(ID()) + "] Coming soon title cleared", LOGNAME, ID()); - } - } - - // clip out any extension data - utf8::size_type pos1 = sc21_metadata_s.find(utf8("")), // 11 chars - pos2 = sc21_metadata_s.find(utf8("")); // 12 chars - if ((pos1 != utf8::npos) && (pos2 != utf8::npos)) - { - // got it, clip it out - sc1_metadata_and_extension_info.m_songMetadataForYP2 = - #ifdef XML_DEBUG - "\t" + - #endif - stripWhitespace(sc21_metadata_s.substr(pos1 + 11, pos2 + 12 - pos1 - 11 - 12)); - } - - try - { - utf8 m_checkSongTitle = metadata::convert_3902_to_shoutcast1(sc21_metadata_s, ID()); - if (sc1_metadata_and_extension_info.m_songTitle != m_checkSongTitle) - { - sc1_metadata_and_extension_info.m_songTitle = m_checkSongTitle; - } - } - catch (const exception &ex) - { - ELOG(string("3902 => Shoutcast 1 metadata conversion error. ") + ex.what() + " 3902=" + eol() + sc21_metadata_s, LOGNAME, ID()); - } - - // if we get a title update, if we've not added then do so as we - // changed adding to the YP to wait a while in 2.1+ so that titles - // can be obtained to ensure the listing is showing all information - // - // 2.4.8 disable this as it's causing quick add / removes to the YP - // which is ok if the stream is ok, but if there's issues, it's not - // and that's then also causing lots of METRICS_RESET_URL messages. - /*if (m_yp2SessionKey == 0) - { - _YP2_add(); - }*/ - } - // handling albumart as required for station and stream artwork - else - { - __uint16 aaMsgType = (voxMsgType & 0xF000); - if (aaMsgType & MSG_METADATA_ALBUMART) - { - sc21_albumart_data.insert(sc21_albumart_data.end(), data.begin(), data.end()); - albumart = true; - } - } - - int ret = 0; - // filter things so we're only doing what is needed at the time - if (albumart == false) - { - uvoxMetadata_t sc21_metadata; - - // ultravox 2.1 style xml - try - { - createMetadataPackets(&sc21_metadata_s[0], (int)sc21_metadata_s.size(), MSG_METADATA_XML_NEW, sc21_metadata); - } - catch (const exception &ex) - { - ELOG(ex.what(), LOGNAME, ID()); - } - - if (!sc1_metadata_and_extension_info.m_songTitle.empty()) - { - _addMetadata(m_sc1StreamLock, m_sc1_ring_buffer, m_sc1MetadataLock, m_sc1MetadataTable, sc1_metadata_and_extension_info); - } - if (!sc21_metadata.empty()) - { - _addMetadata(m_sc21StreamLock, m_sc21_ring_buffer, m_sc21MetadataLock, m_sc21MetadataTable, sc21_metadata); - - m_sc21MetadataLock.lock(); - m_sc21MetadataToPutInline = sc21_metadata; - m_sc21MetadataLock.unlock(); - } - - // maintain history - g_streamSongHistoryMapLock.lock(); - - // attempting to use the pre-filled title information based on forum request so - // that 'artist - album - title' from sc_trans appears in the history (not client) - utf8 metadata(sc21_metadata_s.begin(), sc21_metadata_s.end()); - const vector m_nextSong = metadata::get_nextsongs_from_3902(metadata, m_streamInfo.m_nextSongs, true); - const vector::const_iterator nextSong = m_nextSong.begin(); - - utf8 m_checkSongHistory = (((nextSong != m_nextSong.end()) && !(*nextSong).empty()) ? - (*nextSong) : metadata::get_song_title_from_3902(metadata)); - if (validateTitle(m_checkSongHistory)) - { - map::iterator i = g_streamSongHistoryMap.find(ID()); - if (i != g_streamSongHistoryMap.end()) - { - if ((*i).second.empty() || ((*i).second.front().m_title != m_checkSongHistory)) - { - (*i).second.push_front(songHistoryInfo(m_checkSongHistory, metadata)); - } - } - else - { - g_streamSongHistoryMap[ID()].push_front(songHistoryInfo(m_checkSongHistory, metadata)); - } - } - - // do conversions as needed to cope with funky v1 titles from relays for example - map::iterator i = g_streamSongHistoryMap.find(ID()); - if (i != g_streamSongHistoryMap.end()) - { - if (!(*i).second.empty()) - { - utf8 m_checkCurrentSong = metadata::toFixedString((*i).second.front().m_title); - if (validateTitle(m_checkCurrentSong)) - { - if (m_streamInfo.m_currentSong != m_checkCurrentSong) - { - m_streamInfo.m_currentSong = m_checkCurrentSong; - } - } - } - - while ((*i).second.size() > gOptions.getSongHistorySize(ID())) - { - (*i).second.pop_back(); - } - } - g_streamSongHistoryMapLock.unlock(); - - resetAdvertTriggers(m_streamInfo.m_currentSong); - } - else - { - uvoxMetadata_t sc21_albumart; - - // ultravox 2.1 style albumart - try - { - if (!sc21_albumart_data.empty()) - { - createMetadataPackets(&sc21_albumart_data[0], (int)sc21_albumart_data.size(), voxMsgType, sc21_albumart); - } - else - { - // indicates we need to clear the cached data - } - } - catch (const exception &ex) - { - ELOG(ex.what(), LOGNAME, ID()); - } - - // store a copy of the raw image file and mime type - // so it's easier to display on the admin pages, etc - __uint16 ArtType = voxMsgType & 0x0F00; - if (ArtType & MSG_METADATA_PLAYING_ART) - { - m_sc21AlbumArtData[1] = sc21_albumart_data; - m_sc21AlbumArtMime[1] = (voxMsgType & 0x00FF); - } - else - { - m_sc21AlbumArtData[0] = sc21_albumart_data; - m_sc21AlbumArtMime[0] = (voxMsgType & 0x00FF); - } - - if (!sc21_albumart.empty()) - { - // uvox metadata must also be injected into the stream itself - if (ArtType & MSG_METADATA_PLAYING_ART) - { - m_sc21PlayingAlbumArtLock.lock(); - m_sc21PlayingAlbumArtToPutInline = sc21_albumart; - m_sc21PlayingAlbumArtLock.unlock(); - - _addMetadata(m_sc21StreamLock, - m_sc21_ring_buffer, - m_sc21PlayingAlbumArtLock, - m_sc21PlayingAlbumArtTable, - sc21_albumart); - - ret = addSc1MetadataAtCurrentPosition("", m_streamInfo.m_currentSong, - "DNAS/playingart?sid=" + tos(ID()), - m_streamInfo.m_comingSoon); - - // due to how things work, it's easier to do it all this way and - // then directly insert as if it's pass-through but keep a copy - writeToRingBuffer((const __uint8*)&sc21_albumart[0], - (int)sc21_albumart.size(), - m_sc21StreamLock, m_sc21_ring_buffer); - } - else - { - m_sc21StreamAlbumArtLock.lock(); - m_sc21StreamAlbumArtToPutInline = sc21_albumart; - m_sc21StreamAlbumArtLock.unlock(); - - _addMetadata(m_sc21StreamLock, - m_sc21_ring_buffer, - m_sc21StreamAlbumArtLock, - m_sc21StreamAlbumArtTable, - sc21_albumart); - - // if we've got playing artwork then we should skip updating this as it's preferred for the client - // to provide playing artwork first and then the stream branding so it shows playing on joining - if (m_sc21AlbumArtData[1].empty()) - { - ret = addSc1MetadataAtCurrentPosition("", m_streamInfo.m_currentSong, - "DNAS/streamart?sid=" + tos(ID()), - m_streamInfo.m_comingSoon); - } - } - } - else - { - // TODO make sure this is specified if a custom streamart is provided and nothing from the stream - ret = addSc1MetadataAtCurrentPosition("", m_streamInfo.m_currentSong, - (!m_sc21AlbumArtData[0].empty() ? "DNAS/streamart?sid=" + tos(ID()) : ""), - m_streamInfo.m_comingSoon); - } - } - return ret; -} - -void streamData::updateSongHistorySize() throw() -{ - // maintain history - stackLock sml(g_streamSongHistoryMapLock); - - map::iterator i = g_streamSongHistoryMap.find(ID()); - if (i != g_streamSongHistoryMap.end()) - { - while ((*i).second.size() > gOptions.getSongHistorySize(ID())) - { - (*i).second.pop_back(); - } - } -} - -void streamData::updateStreamUser(const uniString::utf8& streamUser) -{ - m_streamInfo.m_streamUser = streamUser; -} - -void streamData::resetStreamAuthhash() -{ - m_streamInfo.m_authHash.clear(); - _YP2_add(); -} - -void streamData::resetAdvertTriggers(const uniString::utf8& m_updinfoSong) -{ - if (m_updinfoSong.empty()) - return; - - unsigned d = 120; // default - const char *p = (const char *)&m_updinfoSong[0]; - char s[2] = ""; - int matched = sscanf (p, "Advert%1[!:-]", s); - - if (matched == 1) - { - if (s[0] == '-') - { - char pattern[6]; - matched = ::sscanf (p+7, "%4[0-9]%1[!:]", pattern, s); - if (matched == 2) - { - d = atoi (pattern); - if (d < 1 || d > 999) - d = 120; - } - else - p = NULL; - } - if (p) p = strchr (p+6, s[0]); - if (p) - { - p++; - //::memmove (tag, p, strlen (p)+1); ?? - AD_DEBUG_LOG("[ADVERT sid=" + tos(ID()) + "] " + "Advert trigger detected.", LOGNAME, ID()); - m_insertAdvert = true; - } - } - m_duration = d; - pushMetricsYP(); -} - -int streamData::addSc1MetadataAtCurrentPosition(const utf8 &logString, const utf8 &sc1_metadata_raw, - const utf8 &sc1_url_raw, const utf8 &sc1_next_raw) throw() -{ - const utf8 m_oldCurrentSong = m_streamInfo.m_currentSong; - const utf8 m_oldCurrentURL = m_streamInfo.m_currentURL; - const utf8 m_oldComingSoon = m_streamInfo.m_comingSoon; - - // maintain history - m_stateLock.lock(); - - m_streamInfo.m_currentSong = sc1_metadata_raw; - m_streamInfo.m_comingSoon = sc1_next_raw; - - if (!sc1_url_raw.empty()) - { - m_streamInfo.m_currentURL = sc1_url_raw; - } - else - { - // this allows us to force artwork through for all of the clients when - // it's not provided by the connected source on the first title update - if (m_sc21AlbumArtData[0].empty() && (!gOptions.m_artworkBody[m_ID].empty() || !gOptions.m_artworkBody[0].empty())) - { - vector<__uint8> sc21_albumart_data; - if (!gOptions.m_artworkBody[m_ID].empty()) - { - sc21_albumart_data.insert(sc21_albumart_data.end(), gOptions.m_artworkBody[m_ID].begin(), gOptions.m_artworkBody[m_ID].end()); - } - else - { - sc21_albumart_data.insert(sc21_albumart_data.end(), gOptions.m_artworkBody[0].begin(), gOptions.m_artworkBody[0].end()); - } - - int voxMsgType = 0x4000; - uvoxMetadata_t sc21_albumart; - if (!sc21_albumart_data.empty()) - { - // try to find the correct mime-type to give the clients a hint - utf8::size_type pos = gOptions.artworkFile().rfind((utf8)"."); - if (pos != utf8::npos) - { - utf8 ext = gOptions.artworkFile().substr(pos + 1, gOptions.artworkFile().size()); - if ((ext == "jpeg") || (ext == "jpg")) - { - voxMsgType = 0x4000; - } - else if (ext == "png") - { - voxMsgType = 0x4001; - } - else if (ext == "bmp") - { - voxMsgType = 0x4002; - } - else if (ext == "gif") - { - voxMsgType = 0x4003; - } - } - - createMetadataPackets(&sc21_albumart_data[0], (int)sc21_albumart_data.size(), voxMsgType, sc21_albumart); - } - - m_sc21AlbumArtData[0] = sc21_albumart_data; - m_sc21AlbumArtMime[0] = (voxMsgType & 0x00FF); - - m_sc21StreamAlbumArtLock.lock(); - m_sc21StreamAlbumArtToPutInline = sc21_albumart; - m_sc21StreamAlbumArtLock.unlock(); - - _addMetadata(m_sc21StreamLock, - m_sc21_ring_buffer, - m_sc21StreamAlbumArtLock, - m_sc21StreamAlbumArtTable, - sc21_albumart); - - m_streamInfo.m_currentURL = "DNAS/streamart?sid=" + tos(ID()); - } - else - { - m_streamInfo.m_currentURL.clear(); - } - } - - // changed in 2.4 so it will allow repeated 'Advert:xx' - // update through since it's needed for advert triggers - // changed in 2.4.8+ so we can provide a 'test' case - bool sameTitle = (m_oldCurrentSong == m_streamInfo.m_currentSong), - sameUrl = (m_oldCurrentURL == m_streamInfo.m_currentURL), - sameNext = (m_oldComingSoon == m_streamInfo.m_comingSoon); - if ((sameTitle && sameUrl && sameNext && - ((m_streamInfo.m_currentSong.find ((utf8)"Advert:") != 0) && - (m_streamInfo.m_currentSong.find ((utf8)"Test Advert:") != 0)))) - { - // if the same then we might as well skip as it won't add anything - // other than filling the song history list with deemed duplicates - m_stateLock.unlock(); - return 0; - } - - DEBUG_LOG(logString + "title: " + tos(sameTitle) + " - url: " + tos(sameUrl) + " - next: " + tos(sameNext), LOGNAME, ID()); - - // convert sc1 metadata to sc21 metadata - utf8 sc21_metadata_s = metadata::toXML_fromFilename(m_streamInfo.m_currentSong, m_streamInfo.m_currentURL, "%N"); - - g_streamSongHistoryMapLock.lock(); - map::iterator i = g_streamSongHistoryMap.find(ID()); - if (i != g_streamSongHistoryMap.end()) - { - (*i).second.push_front(songHistoryInfo(m_streamInfo.m_currentSong, sc21_metadata_s)); - - while ((*i).second.size() > gOptions.getSongHistorySize(ID())) - { - (*i).second.pop_back(); - } - } - else - { - g_streamSongHistoryMap[ID()].push_front(songHistoryInfo(m_streamInfo.m_currentSong, sc21_metadata_s));; - } - g_streamSongHistoryMapLock.unlock(); - - resetAdvertTriggers(m_streamInfo.m_currentSong); - - m_stateLock.unlock(); - - sc1MetadataAndExtensionInfo sc1_metadata_and_extension_info; - sc1_metadata_and_extension_info.m_songTitle = "StreamTitle='" + m_streamInfo.m_currentSong + "';"; - - if (!m_streamInfo.m_comingSoon.empty()) - { - // added in 2.5 (dunno if any client will use it or not) - sc1_metadata_and_extension_info.m_songTitle += "StreamNext='" + m_streamInfo.m_comingSoon + "';"; - } - - if (!m_streamInfo.m_currentURL.empty()) - { - sc1_metadata_and_extension_info.m_songTitle += "StreamUrl='" + m_streamInfo.m_currentURL + "';"; - } - else - { - if (!m_sc21AlbumArtData[1].empty()) - { - m_streamInfo.m_currentURL = "DNAS/playingart?sid=" + tos(ID()); - sc1_metadata_and_extension_info.m_songTitle += "StreamUrl='" + m_streamInfo.m_currentURL + "';"; - } - else - { - // **** TODO **** - - // this allows us to force artwork through for all of the clients when - // it's not provided by the connected source on the first title update - if (m_sc21AlbumArtData[0].empty() && !gOptions.m_artworkBody[0].empty()) - { - m_sc21AlbumArtData[0] = vector<__uint8>(&gOptions.m_artworkBody[0][0], &gOptions.m_artworkBody[0][gOptions.m_artworkBody[0].size()]); - // TODO - //m_sc21AlbumArtMime[0] = (voxMsgType & 0x00FF); - } - - if (!m_sc21AlbumArtData[0].empty()) - { - m_streamInfo.m_currentURL = "DNAS/streamart?sid=" + tos(ID()); - sc1_metadata_and_extension_info.m_songTitle += "StreamUrl='" + m_streamInfo.m_currentURL + "';"; - } - } - } - - uvoxMetadata_t sc21_metadata; - try - { - createMetadataPackets(&sc21_metadata_s[0], (int)sc21_metadata_s.size(), MSG_METADATA_XML_NEW, sc21_metadata); - } - catch(const exception &ex) - { - ELOG(ex.what(), LOGNAME, ID()); - } - - if (!sc1_metadata_and_extension_info.m_songTitle.empty()) - { - _addMetadata(m_sc1StreamLock, m_sc1_ring_buffer, m_sc1MetadataLock, m_sc1MetadataTable, sc1_metadata_and_extension_info); - } - - if (!sc21_metadata.empty()) - { - _addMetadata(m_sc21StreamLock, m_sc21_ring_buffer, m_sc21MetadataLock, m_sc21MetadataTable, sc21_metadata); - } - - // uvox metadata must also be injected into the stream itself - if (!sc21_metadata.empty()) - { - m_sc21MetadataLock.lock(); - m_sc21MetadataToPutInline = sc21_metadata; - m_sc21MetadataLock.unlock(); - } - - return (!sameTitle ? 1 : 0) | (!sameUrl ? 2 : 0) | (!sameNext ? 4 : 0); -} - - -void streamData::pushMetricsYP (bool force) -{ - if (m_dead || m_ID <= 0 || m_streamInfo.m_streamPublic == false) - return; - time_t now = ::time(NULL); - if (force == false && m_nextYPPush > now) - return; - - if (m_parser) - { - metrics::metaInfo meta; - - meta.m_sid = m_ID; - meta.m_audience = -1; - meta.m_private = m_streamInfo.m_streamPublic ? false : true; - meta.m_maxListeners = (m_streamInfo.m_streamMaxUser > 0) ? m_streamInfo.m_streamMaxUser : gOptions.maxUser(); - meta.m_song = m_streamInfo.m_currentSong; - meta.m_format = m_streamInfo.m_contentType; - meta.m_bitrate = m_streamInfo.m_streamBitrate; - meta.m_samplerate = m_streamInfo.m_streamSampleRate; - meta.m_agent = m_streamInfo.m_sourceIdent; - meta.m_publicIP = m_streamInfo.m_publicIP; - meta.m_sourceIP = m_streamInfo.m_srcAddr; - meta.m_version = m_parser->getVersionName(); - metrics::updateMeta (meta); - m_nextYPPush = now + 600; // make it at most 10 mins. - } - else - m_nextYPPush = now + 20; // no data currently retry again in 20 seconds -} - - -void streamData::clearCachedMetadata() throw() -{ - m_sc1MetadataLock.lock(); - m_sc1MetadataTable.clear(); - m_sc1MetadataLock.unlock(); - - m_sc21MetadataLock.lock(); - m_sc21MetadataTable.clear(); - m_sc21MetadataToPutInline.clear(); - m_sc21MetadataLock.unlock(); - - m_sc21StreamAlbumArtLock.lock(); - m_sc21StreamAlbumArtTable.clear(); - m_sc21StreamAlbumArtToPutInline.clear(); - m_sc21StreamAlbumArtLock.unlock(); - - m_sc21PlayingAlbumArtLock.lock(); - m_sc21PlayingAlbumArtTable.clear(); - m_sc21PlayingAlbumArtToPutInline.clear(); - m_sc21PlayingAlbumArtLock.unlock(); - - m_sc21AlbumArtData[0].clear(); - m_sc21AlbumArtData[1].clear(); - - m_sc21AlbumArtMime[0] = 0; - m_sc21AlbumArtMime[1] = 0; -} - -void streamData::clearCachedArtwork(const size_t index) throw() -{ - if (!index) - { - m_sc21StreamAlbumArtLock.lock(); - m_sc21StreamAlbumArtTable.clear(); - m_sc21StreamAlbumArtToPutInline.clear(); - m_sc21StreamAlbumArtLock.unlock(); - } - else - { - m_sc21PlayingAlbumArtLock.lock(); - m_sc21PlayingAlbumArtTable.clear(); - m_sc21PlayingAlbumArtToPutInline.clear(); - m_sc21PlayingAlbumArtLock.unlock(); - } - - m_sc21AlbumArtData[index].clear(); - m_sc21AlbumArtMime[index] = 0; - - addSc1MetadataAtCurrentPosition("", m_streamInfo.m_currentSong, - (!m_sc21AlbumArtData[1].empty() ? "DNAS/playingart?sid=" + tos(ID()) : - !m_sc21AlbumArtData[0].empty() ? "DNAS/streamart?sid=" + tos(ID()) : ""), - m_streamInfo.m_comingSoon); -} - -streamData::streamID_t streamData::getStreamIdFromPath(const uniString::utf8 &url, bool& htmlPage) throw() -{ - // look for an exact match against / which is sid=1 since if - // we've gotten to here then it's unlikely to be non-client. - if ((url == utf8("/")) || (url == utf8("/;")) || url.empty()) - { - return DEFAULT_CLIENT_STREAM_ID; - } - - streamData::streamID_t sid = DEFAULT_CLIENT_STREAM_ID; - config::streams_t streams; - gOptions.getStreamConfigs(streams); - - if (!streams.empty()) - { - for (config::streams_t::const_iterator i = streams.begin(); i != streams.end(); ++i) - { - // look for an exact match against the streampath - if ((*i).second.m_urlPath == url) - { - sid = (*i).first; - break; - } - else - { - // otheriwse look for a streampath with additional paramters on it - // and then attempt to match things back - // e.g. /bob;stream.mp3 or /bob/;stream.mp3 - // note: /bob/bob checking doesn't want to work... - if ((url.find((utf8)";") != utf8::npos) || (url.find((utf8)"/;") != utf8::npos)/* || - (url.find(utf8("/")) != utf8::npos && url.find(utf8("/")) != 0)*/) - { - utf8 param_free = url.substr(0, (*i).second.m_urlPath.size()); - if (!param_free.empty() && (*i).second.m_urlPath == param_free) - { - // we need to treat '/stream' as a special - // case and skip it and action it later on - if (!(param_free == "/stream")) - { - sid = (*i).first; - break; - } - } - } - } - - // otherwise look for the streampath and common values - // which are appended to the end of the path e.g. /; - if (!(*i).second.m_urlPath.empty()) - { - utf8 stream("/stream"); - utf8::size_type pos = url.find((*i).second.m_urlPath), - pos2 = url.find(stream); - - if ((pos != utf8::npos) && (pos == 0) && - // this helps to check for setting /stream as a streampath and it - // causing all streams to be provided as if that stream instead - // of the actually requested / expected stream since it's special - ((pos2 == 0) && ((*i).second.m_urlPath != stream))) - { - utf8 params = url.substr(pos + (*i).second.m_urlPath.size()); - if (!params.empty()) - { - if ((params.find(utf8(";")) == 0) || (params.find(utf8("/")) == 0) || (params.find(utf8("/;")) == 0)) - { - sid = (*i).first; - break; - } - } - } - } - - // and if that fails then we instead base it on /stream/x/ - utf8::size_type pos = url.find((utf8)"/stream/"); - if (pos != utf8::npos) - { - utf8 stream_id = url.substr(8); - // look for the raw stream url and if it's not exact then treat as a stream request - if (!stream_id.empty() && - (stream_id.find((utf8)"/") == utf8::npos) && - (stream_id.find((utf8)";") == utf8::npos)) - { - htmlPage = true; - } - sid = atoi((const char *)stream_id.c_str()); - } - } - } - else - { - // and if that fails then we instead base it on /stream/x/ - utf8::size_type pos = url.find((utf8)"/stream/"); - if (pos != utf8::npos) - { - utf8 stream_id = url.substr(8); - // look for the raw stream url and if it's not exact then treat as a stream request - if (!stream_id.empty() && - (stream_id.find((utf8)"/") == utf8::npos) && - (stream_id.find((utf8)";") == utf8::npos)) - { - htmlPage = true; - } - sid = atoi((const char *)stream_id.c_str()); - } - } - - return sid; -} - -//streamData::streamID_t streamData::getStreamUptime(streamID_t id) throw() -time_t streamData::getStreamUptime(streamID_t ID) throw() -{ - stackLock sml(g_streamMapLock); - - return g_streamUptime[ID]; -} - -streamData::source_t streamData::getClientType(streamData::source_t clientType, const uniString::utf8& userAgent) -{ - if (!userAgent.empty()) - { - if (isUserAgentRelay(userAgent)) - { - clientType = ((streamData::source_t)(clientType | streamData::RELAY)); - } - if ((userAgent.find((utf8)"winampmpeg/") == 0) || (userAgent.find((utf8)"wafa/") == 0)) - { - // this is a specical case and is unlikely to be any 'real' 5.09 - if (userAgent.find(utf8("winampmpeg/5.09")) == utf8::npos) - { - clientType = ((streamData::source_t)(clientType | streamData::WINAMP)); - } - else - { - clientType = ((streamData::source_t)(clientType | streamData::RADIONOMY)); - } - } - if (userAgent.find((utf8)"curl/7.") == 0) - { - clientType = ((streamData::source_t)(clientType | streamData::CURL_TOOL)); - } - if (userAgent.find((utf8)"sc_iradio/1.") == 0) - { - clientType = ((streamData::source_t)(clientType | streamData::SC_IRADIO)); - } - if (userAgent.find((utf8)"icecast ") == 0) - { - clientType = ((streamData::source_t)(clientType | streamData::ICECAST | streamData::RELAY)); - } - if (userAgent.find((utf8)"foobar2000/") == 0) - { - clientType = ((streamData::source_t)(clientType | streamData::FB2K)); - } - if ((userAgent.find((utf8)"vlc/") == 0) || - (userAgent.find((utf8)" libvlc/") != utf8::npos)) - { - clientType = ((streamData::source_t)(clientType | streamData::VLC)); - } - if ((userAgent.find((utf8)"windows-media-player/") == 0) || - (userAgent.find((utf8)"nsplayer/") == 0)) - { - clientType = ((streamData::source_t)(clientType | streamData::WMP)); - } - if (userAgent.find((utf8)"roku/dvp") == 0) - { - clientType = ((streamData::source_t)(clientType | streamData::ROKU)); - } - if (userAgent.find((utf8)"wiimc/") == 0) - { - clientType = ((streamData::source_t)(clientType | streamData::WIIMC)); - } - if (userAgent.find((utf8)"audiostation/") == 0) - { - clientType = ((streamData::source_t)(clientType | streamData::SYNOLOGY)); - } - if (userAgent.find((utf8)"itunes/") == 0) - { - clientType = ((streamData::source_t)(clientType | streamData::ITUNES)); - } - if ((userAgent.find((utf8)"mplayer/") == 0) || - (userAgent.find((utf8)"mplayer ") == 0)) - { - clientType = ((streamData::source_t)(clientType | streamData::MPLAYER)); - } - if (userAgent.find((utf8)"applecoremedia/1.") == 0) - { - clientType = ((streamData::source_t)(clientType | streamData::APPLE)); - } - if (userAgent.find((utf8)"psp-internetradioplayer/") == 0) - { - clientType = ((streamData::source_t)(clientType | streamData::PS)); - } - if (userAgent.find((utf8)"radio toolbox/") == 0) - { - clientType = ((streamData::source_t)(clientType | streamData::RADIO_TOOLBOX)); - } - - // rough stream ripper identification - if ((userAgent.find((utf8)"rma/1.0 (compatible; realmedia)") == 0) || - (userAgent.find((utf8)"nullsoft winamp3 version 3.0 (compatible)") == 0)) - { - clientType = ((streamData::source_t)(clientType | streamData::WARNING)); - } - - // rough browser identification - if (userAgent.find((utf8)"mozilla/5.0") == 0) - { - if (userAgent.find((utf8)"trident/") != utf8::npos) // IE - { - clientType = ((streamData::source_t)(clientType | streamData::IE)); - } - else if (userAgent.find((utf8)"chrome/") != utf8::npos) - { - clientType = ((streamData::source_t)(clientType | streamData::CHROME)); - } - else if (userAgent.find((utf8)"safari/") != utf8::npos) - { - clientType = ((streamData::source_t)(clientType | streamData::SAFARI)); - } - else if (userAgent.find((utf8)"firefox/") != utf8::npos) - { - clientType = ((streamData::source_t)(clientType | streamData::FIREFOX)); - } - } - } - return clientType; -} - -streamData::source_t streamData::getClientTypeCompat(streamData::source_t clientType, const uniString::utf8& userAgent) -{ - if (!userAgent.empty()) - { - if ((userAgent.find((utf8)"windows-media-player/") == 0) || - (userAgent.find((utf8)"nsplayer/") == 0)) - { - clientType = ((streamData::source_t)(clientType | streamData::WMP)); - } - if (userAgent.find((utf8)"roku/dvp") == 0) - { - clientType = ((streamData::source_t)(clientType | streamData::ROKU)); - } - } - return clientType; -} - -// Advert related code. -typedef pair idGroup; - -void streamData::adEntry::flush(metrics::adSummary &summary) -{ - if (ad && (summary.sendRest || upper)) - { - summary.count = (int)upper; - summary.name = ad->m_description.c_str(); - summary.failed = ad->m_failed; - summary.missing = ad->m_missing; - - metrics::metrics_advert_stats(summary); - summary.sendRest = true; - } - upper = 0; -} - - -streamData::adEntry::adEntry (specialFileData *d) -{ - upper = 0; - ad = d; - if (d) - { - ++d->m_refcount; - d->m_lastUsed = ::time (NULL); - AD_DEBUG_LOG ("[STREAMDATA] content new, " + d->m_description + " now has " + tos (d->m_refcount)); - } -} - - -streamData::adEntry::adEntry (const adEntry &e) -{ - upper = 0; - ad = e.ad; - ++(e.ad->m_refcount); - e.ad->m_lastUsed = ::time (NULL); - AD_DEBUG_LOG ("[STREAMDATA] content copy, " + e.ad->m_description + " now has " + tos (e.ad->m_refcount)); -} - - -streamData::adGroup::adGroup (adGroup &prev, adTrigger &trig) -{ - m_totalSizeSC1 = m_totalSizeSC2 = 0; - m_trigger = &trig; - - std::deque ::iterator it = prev.ads.begin(); - for (; it != prev.ads.end(); ++it) - { - specialFileData *f = it->ad; - ads.push_back (adEntry (f)); - } -} - - -void streamData::adGroup::appendAdvert(streamData::specialFileData &s) -{ - ads.push_back (adEntry (&s)); - m_totalSizeSC1 += s.m_sc1Buffer.size(); - m_totalSizeSC2 += s.m_sc2Buffer.size(); -} - -void streamData::adGroup::flushCounts(metrics::adSummary &summary) -{ - summary.sendRest = false; - summary.tstamp = m_trigger->m_playedAt; - for (std::deque::iterator it = ads.begin(); it != ads.end(); ++it) - { - it->flush(summary); - } -} - -streamData::adGroups::adGroups (streamData *sd) -{ - m_sd = sd; - refcount = 0; - m_recheck = 0; - nextUpdate = ::time(NULL); - m_nextDownloadRun = nextUpdate + 40; - m_type = ADVERT_MAP_FIXED; - skippedAds = 0; - retriever = NULL; -} - - -streamData::adGroups::~adGroups() -{ - while (triggers.empty() == false) // pop each on the triggers list and run release on it - { - adTrigger *trig = *triggers.begin(); - triggers.pop_front(); - releaseTrigger (trig); - } - if (retriever) - { - delete retriever; - retriever = NULL; - } -} - - -void streamData::adGroups::setType (const uniString::utf8 &s) -{ - if (s == "flex") - m_type = ADVERT_MAP_FLEX; - else if (s == "pause") - m_type = ADVERT_MAP_PAUSE; - else - m_type = ADVERT_MAP_FIXED; -} - - -#if 0 -streamData::adGroup *streamData::adGroups::insertAdTestFile(const streamData::streamID_t sid, streamData *sd) -{ - streamData::adGroup *ret = NULL; - for (int i = 0; i < 4; i++) - { - specialFileData *f = new specialFileData("test advert"); - if (f) - { - vector<__uint8> v; - sd->getAdTestFile(i).getSc1Data(v); - if (!v.empty()) - { - const int uvoxDataType = sd->streamUvoxDataType(); - unsigned int read_samplerate = sd->streamSampleRate(), samplerate = read_samplerate; - // if the bitrate is not known, setting -1 will reject things - // as we cannot be sure well insert ok if using '0' otherwise - const int read_bitrate = cleanFileData("", v, v.size(), sd->streamBitrate(), samplerate, uvoxDataType, - "[ADVERT sid=" + tos(sid) + "] ", "advert", read_samplerate); - - if (!v.empty()) - { - f->replaceData(v, uvoxDataType, read_bitrate, read_samplerate); - AD_DEBUG_LOG("[ADVERT sid=" + tos(sid) + "] Adding to group TEST"); - ret = addToGroup(-2, f); - } - else - { - delete f; - WLOG("[ADVERT sid=" + tos(sid) + "] Skipping test advert - " - "does not match the current stream format. Got " + - tos(read_bitrate) + " kbps, " + sampleRateStr(samplerate) + - " (stream) vs " + tos(sd ? sd->streamBitrate() : -1) + - " kbps, " + sampleRateStr(read_samplerate) + " (test advert)"); - } - } - } - } - - return ret; -} -#endif - -bool streamData::adGroups::attachGroupQueue (adGroupAccess &ac) -{ - if (ac.m_groupQueue == NULL && ac.inAdvertMode() == false) - { - stackLock sml(m_lock); - - adGroupMap_t::iterator it = mapping.find (ac.group); - adGroupQueue *q; - - if (it == mapping.end()) - { - q = new adGroupQueue(); - mapping [ac.group] = q; - } - else - q = (*it).second; - q->listeners++; - ac.m_groupQueue = q; - return true; - } - return false; -} - - -void streamData::adGroups::detachGroupQueue (adGroupAccess &ac) -{ - if (ac.m_groupQueue) - { - stackLock sml(m_lock); - - adGroupQueue *q = ac.m_groupQueue; - adGroup *run = ac.cached_ref; - - q->listeners--; - AD_DEBUG_LOG ("drop from group " + tos(ac.group) + " referenced, listeners now " + tos(q->listeners), ADLOGNAME, m_sd->ID()); - if (run) - { - // admetrics - releaseTrigger (run->m_trigger); - } - ac.m_groupQueue = NULL; - ac.cached_ref = NULL; - } - else - AD_DEBUG_LOG ("no group queue referenced from listener", ADLOGNAME, m_sd->ID()); -} - -streamData::adGroup *streamData::adGroups::findGroup(adGroupAccess &ac, ringBufferAccess_t pos) -{ - adGroupQueue *q = ac.m_groupQueue; - list ::iterator it = q->queue.begin(); - - for (; it != q->queue.end(); ++it) - { - adGroup *g = *it; - if (g->m_trigger == NULL) return NULL; // should not happen - ringBufferAccess_t tpos = g->m_trigger->getStartPos (ac.m_sc2); - - if (pos == tpos) // found it - return g; - if (pos > tpos) // past it, jump out - break; - } - return NULL; -} - -#if 0 -streamData::adGroup *streamData::adGroups::findGroup(const streamData::streamID_t sid, const int id) -{ - // PSA = -1, TEST = -2 - if (mapping && ((id > 0) || (id == -2))) - { - map::iterator search = mapping->find(id); - if (search == mapping->end()) - { - // if there's no test group, we now - streamData::adGroup *ret = NULL; - if (id == -2) - { - streamData *sd = streamData::accessStream(sid); - if (sd) - { - ret = insertAdTestFile(sid, sd); - sd->releaseStream(); - } - } - return ret; - } - return &search->second; - } - // if there's no mapping, we need to create one for the test case - else if (!mapping && (id == -2)) - { - streamData::adGroup *ret = NULL; - mapping = new map; - if (mapping) - { - streamData *sd = streamData::accessStream(sid); - if (sd) - { - ret = insertAdTestFile(sid, sd); - sd->releaseStream(); - } - } - return ret; - } - return NULL; -} -#endif - -void streamData::adGroups::purge (ringBuffer_t &buffer) -{ - if ((m_recheck & 31) == 0) - { - // drop reference when off the ring buffer, loop in case there are a few to purge - while (triggers.empty() == false) - { - adTrigger *t = triggers.back(); - if (t== NULL) - DLOG ("purge trigger NULL"); - if (t && (t->m_playedAt || triggers.size() > 1)) - { - size_t sz = buffer.m_data.size(); - //DLOG ("trig " + t->m_id + ", played " + tos((long)t->m_playedAt) + ", ret " + tos((long)t->m_returnPtrSC1) + ", wptr " + tos((long)(buffer.m_writePtr)) + ", sz " + tos(sz)); - if (buffer.m_writePtr < sz) // for early cases of stream start - break; - if (t->m_returnPtrSC1 < (buffer.m_writePtr - sz)) - { - AD_DEBUG_LOG ("trigger " + t->m_id + " reference off the ring buffer", ADLOGNAME, m_sd->ID()); - triggers.remove (t); - releaseTrigger (t); - continue; - } - } - break; - } - } - if ((m_recheck & 255) == 0) - { - // DLOG("rechecking for group purge"); - purgeGroups(); - } - ++m_recheck; -} - - -void streamData::adGroups::createNewTrigger (const string &reqID) -{ - string id; - if (reqID == "") - { - stringstream s; - s << tos(time_now_ms()); - id = s.str(); - } - else - id = reqID; - - adTrigger *trig = new adTrigger (id, m_sd->ID()); - triggers.push_front (trig); -} - - -size_t streamData::adGroups::overlaySize (adTrigger *trigger, bool sc2) -{ - int gn = 0; - - if (trigger == NULL) abort(); - if (sc2) // assume sc2 is done after sc1 - return trigger->m_maxSizeSC2; - - adGroupMap_t::iterator it = mapping.begin(); - for (gn = 0; gn < 8 && it != mapping.end(); ++gn, ++it) // check so many group queues for filled adverts - { - adGroupQueue *q = it->second; - - for (list::iterator it = q->queue.begin(); it != q->queue.end(); ++it) - { - adGroup *g = *it; - if (g->m_trigger == trigger) - { - if (trigger->m_playedAt == 0) - { - g->recalculateTotalSize(); - } - break; - } - } - } - if (trigger->m_maxSizeSC1) - ILOG ("Trigger " + tos(trigger->m_id) + " size is " + tos(trigger->m_maxSizeSC1) + "/" + tos(trigger->m_maxSizeSC2), ADLOGNAME, m_sd->ID()); - return trigger->m_maxSizeSC1; -} - - -streamData::adGroup *streamData::adGroups::addToGroup (const string &id, const int grp, specialFileData *f) -{ - - if ((f == NULL) || !grp) - { - return NULL; - } - std::map::iterator it = mapping.find (grp); - adGroupQueue *q; - if (it == mapping.end()) - { - AD_DEBUG_LOG ("new queue " + tos(grp) + " on " + id, ADLOGNAME, m_sd->ID()); - mapping [grp] = q = new adGroupQueue(); - } - else - q = it->second; - adTrigger *cur = NULL; //, *prev = NULL; - cur = triggers.empty() ? NULL : triggers.front(); - - if (cur == NULL || cur->m_id != id) - { - //prev = cur; - createNewTrigger (id); - if (cur && cur->m_playedAt == 0) - { - triggers.remove (cur); - releaseTrigger (cur); - return addToGroup (id, grp, f); - } - } - else - if (cur->m_playedAt) - { - AD_DEBUG_LOG ("Trigger " + id + " has already started, skipping", ADLOGNAME, m_sd->ID()); - return NULL; - } - - cur = triggers.front(); - - adGroup *g = q->queue.empty() ? NULL : q->queue.front(); - - if (g && g->m_trigger != cur) - g = NULL; - if (g == NULL || g->m_trigger->m_playedAt) - { - g = new adGroup; - g->m_trigger = cur; - q->queue.push_front (g); - } - g->appendAdvert(*f); - - if (cur->m_maxSizeSC1 < g->m_totalSizeSC1) - cur->m_maxSizeSC1 = g->m_totalSizeSC1; - if (cur->m_maxSizeSC2 < g->m_totalSizeSC2) - cur->m_maxSizeSC2 = g->m_totalSizeSC2; - - return NULL; -} - -#if 0 -void streamData::adGroups::queueNewSet(const streamID_t sid, adGroups *qGroups) -{ - stackLock sml(m_lock); - if (qGroups) - { - if (queuedGroups) - { - AD_DEBUG_LOG("[ADVERT sid=" + tos(sid) + "] Replacing queued advert set"); - delete queuedGroups; - } - queuedGroups = qGroups; - if (queuedGroups->mapping && queuedGroups->adData) - { - const size_t group_size = queuedGroups->mapping->size(), - adverts_size = queuedGroups->adData->size(); - ILOG("[ADVERT sid=" + tos(sid) + "] Updated adverts: queued " + - tos(group_size) + " group" + (group_size != 1 ? "s" : "") + ", " + - tos(adverts_size) + " advert" + (adverts_size != 1 ? "s" : "") + ", " + - tos((queuedGroups->skippedAds > 0 ? queuedGroups->skippedAds : 0)) + - " advert file" + (queuedGroups->skippedAds != 1 ? "s" : "") + " skipped," - " next update in " + tos(queuedGroups->nextUpdate - ::time(NULL)) + " seconds."); - } - } -} -#endif - -#if 0 -void streamData::adGroups::flushGroupCounts(const streamData::streamID_t sid) -{ - if (mapping.empty() == false) - { - streamData *sd = streamData::accessStream (sid); - if (sd == NULL) - return; - - if (sd->radionomyID().empty() && sd->streamAdvertMode()) - { - metrics::adSummary summary; - - summary.sid = sid; - summary.path = getStreamPath(sid); - summary.tstamp = playedAt; - summary.sd = sd; - - for (adGroupMap_t::iterator it = mapping.begin(); it != mapping.end(); ++it) - { - summary.group = (*it).first; - (*it).second->flushStats (summary); - } - } - sd->releaseStream(); - } -} -#endif - -#if 0 -// if the increase is set to false then we require the sid -void streamData::adGroups::join(const bool increase, const streamData::streamID_t sid, const bool testing) -{ - stackLock sml(m_lock); - if (increase) - { - if ((refcount == 0) && (playedAt == 0)) - { - AD_DEBUG_LOG("[ADVERT sid=" + tos(sid) + "] Starting " + (testing ? "test " : "") + "advert run"); - playedAt = ::time(NULL); - } - ++refcount; - } - else - { - --refcount; - if (refcount == 0) - { - AD_DEBUG_LOG("[ADVERT sid=" + tos(sid) + "] End of " + (testing ? "test " : "") + "advert run"); - if (!testing) - { - flushGroupCounts(sid); - nextUpdate = 1; // force new download of adverts - } - playedAt = 0; - } - } -} -#endif - -streamData::adTrigger::~adTrigger () -{ - AD_DEBUG_LOG ("Trigger destroyed, " + m_id, ADLOGNAME, m_sid); -} - - -void streamData::adGroups::releaseTrigger (adTrigger *trigger) -{ - if (trigger == NULL) return; - - AD_DEBUG_LOG ("trigger " + trigger->m_id + " had count " + tos(trigger->m_inUse), ADLOGNAME, trigger->m_sid); - if (trigger->m_inUse > 1) - { - --trigger->m_inUse; - return; - } - if (trigger->m_playedAt) - flushStats (trigger); - - adGroupMap_t::iterator it = mapping.begin(); - unsigned int num = 0; - - while (it != mapping.end()) - { - size_t grp_num = it->first; - adGroupQueue *q = it->second; - - ++it; - if (q->queue.empty()) - continue; - - adGroup *g = q->queue.back(); - if (g->m_trigger == trigger) // should be true - { - q->queue.pop_back(); - AD_DEBUG_LOG ("deleting from group " + tos(grp_num) + " matching trigger " + tos(trigger->m_id), ADLOGNAME, trigger->m_sid); - delete g; - ++num; - } - else - AD_DEBUG_LOG ("trigger unexpected " + tos(g->m_trigger->m_id), ADLOGNAME, trigger->m_sid); - } - ILOG ("trigger " + tos(trigger->m_id) + " dropped with " + tos(num) + " populated groups", ADLOGNAME, trigger->m_sid); - delete trigger; -} - - -void streamData::adGroups::purgeGroups() -{ - adGroupMap_t::iterator it = mapping.begin(); - - while (it != mapping.end()) - { - size_t grp_num = it->first; - adGroupQueue *q = it->second; - - if (q->listeners == 0) - { - adGroupMap_t::iterator to_go = it; - adGroupQueue *q = to_go->second; - ++it; - AD_DEBUG_LOG ("Purging group " + tos (grp_num), ADLOGNAME, m_sd->ID()); - mapping.erase (to_go); - delete q; - continue; - } - // DLOG ("[ADVERT] purge group " + tos(grp_num) + "still has " + tos (q->listeners)); - ++it; - } -} - - -streamData::adGroupQueue::~adGroupQueue() -{ - list::iterator it = queue.begin(); - - AD_DEBUG_LOG ("[ADVERT] queue destroyed, blocks remaining " + tos(queue.size())); - for (; it != queue.end(); ++it) - { - AD_DEBUG_LOG ("[ADVERT] Deleting group"); - delete *it; - } -} - - -void streamData::adGroupQueue::flushStats (metrics::adSummary &summary, adTrigger *trigger) -{ - for (list::iterator it = queue.begin(); it != queue.end(); ++it) - { - adGroup *g = *it; - if (g->m_trigger == trigger && g->m_trigger->m_inUse <= 1) - { - summary.id = g->m_trigger->m_id; - g->flushCounts (summary); - break; - } - } -} - - -int streamData::adGroup::recalculateTotalSize () -{ - std::deque ::iterator it = ads.begin(); - int missing = 0; - - m_totalSizeSC1 = 0; - m_totalSizeSC2 = 0; - for (;it != ads.end(); ++it) - { - adEntry &e = *it; - if (e.ad == NULL || e.ad->m_missing) - { - ++missing; - continue; - } - m_totalSizeSC1 += e.ad->m_sc1Buffer.size(); - m_totalSizeSC2 += e.ad->m_sc2Buffer.size(); - } - if (m_trigger) - { - bool updated = false; - if (m_trigger->m_maxSizeSC1 < m_totalSizeSC1) - { - m_trigger->m_maxSizeSC1 = m_totalSizeSC1; - updated = true; - } - if (m_trigger->m_maxSizeSC2 < m_totalSizeSC2) - { - m_trigger->m_maxSizeSC2 = m_totalSizeSC2; - updated = true; - } - if (updated) - AD_DEBUG_LOG ("Group size is " + tos(m_totalSizeSC1) + "/" + tos(m_totalSizeSC2), ADLOGNAME, m_trigger->m_sid); - } - return missing; -} - - -void streamData::adGroups::flushStats (adTrigger *trigger) -{ - adGroupMap_t::iterator it = mapping.begin(); - metrics::adSummary summary; - - summary.sid = m_sd->ID(); - summary.path = getStreamPath(summary.sid); - summary.sd = m_sd; - - //DLOG ("FLUSHing stats for metrics"); - for (; it != mapping.end(); ++it) - { - adGroupQueue *q = it->second; - - summary.group = (*it).first; - q->flushStats (summary, trigger); - } -} - - -streamData::adGroup *adGroupAccess::getGroup(streamData::streamID_t, streamData::adGroups &, const bool) -{ - if (cached_ref) - return cached_ref; // avoids the traversal of map - if (m_groupQueue == NULL) - return NULL; - - return cached_ref; -} - - -bool adGroupAccess::foundNextAdvert (const streamData::streamID_t sid, streamData::adGroups &/*groups*/, streamData::adGroup &g) -{ - do - { - if (idx >= (int)g.ads.size()) - break; - streamData::adEntry *e = &g.ads[idx]; - if (e == NULL || e->ad == NULL) - { - AD_DEBUG_LOG("Listener on group " + (group == -2 ? "TEST" : tos(group)) + - ", idx " + tos(idx) + ", content missing", ADLOGNAME, sid); - idx++; - continue; - } - utf8 msg = "Listener (grp "; - msg += tos (group); - msg += ", idx "; - msg += tos (idx); - msg += ", ad dura "; - msg += tos(e->ad->m_duration); - msg += ", rem "; - msg += tos(m_duration); - msg += ")"; - AD_DEBUG_LOG (msg, LOGNAME, sid); - - unsigned ad_dur = (unsigned)(e->ad->m_duration+0.5); - if (g.m_trigger->m_type == ADVERT_MAP_FIXED && ad_dur > m_duration) - { - idx++; - continue; - } - if (g.m_trigger->m_type == ADVERT_MAP_FLEX) - m_duration -= ad_dur; - ++g.ads [idx].upper; - return true; - } while (1); - return false; -} - - -bool adGroupAccess::anotherAd(const streamData::streamID_t sid, streamData::adGroups &groups, const bool testing) -{ - streamData::adGroup *g = getGroup(sid, groups, testing); - if ((g == NULL) || g->ads.empty()) - { - cached_ref = NULL; - return false; - } - - offset = 0; - int total = (int)g->ads.size(); - - ++idx; - if (idx < total) - { - stackLock sml(groups.m_lock); - if (foundNextAdvert (sid, groups, *g)) - { - return true; - } - } - return false; -} - -const bool adGroupAccess::inAdvertMode() const -{ - return (cached_ref) ? true : false; -} - -void adGroupAccess::setGroup (size_t id) -{ - group = id; - m_grpChanged = true; -} - -void adGroupAccess::changedGroup (streamData::adGroups &groups) -{ - if (m_grpChanged == false || inAdvertMode()) - return; - - if (m_groupQueue) - groups.detachGroupQueue (*this); - groups.attachGroupQueue (*this); - m_grpChanged = false; -} - - -bool adGroupAccess::haveAdverts(const streamData::streamID_t sid, streamData::adGroups &groups, streamData::ringBufferAccess_t pos) -{ - if (m_groupQueue == NULL) - return false; - - streamData::adGroup *g = groups.findGroup (*this, pos), *prev = cached_ref; - - if ((g == NULL) || (g->ads.size() == 0)) - { - return false; - } - idx = 0; - - cached_ref = g; - stackLock sml(groups.m_lock); - ++g->m_trigger->m_inUse; - m_duration = g->m_trigger->m_duration; - if (m_duration == 0) - m_duration = 3600; - if (prev) - groups.releaseTrigger (prev->m_trigger); - if (foundNextAdvert (sid, groups, *g)) - return true; - return false; -} - -streamData::specialFileData *adGroupAccess::getAd(const streamData::streamID_t sid, streamData::adGroups &groups, const bool testing) -{ - streamData::adGroup *g = getGroup(sid, groups, testing); - do - { - if (g == NULL) break; - if (idx < 0 || idx >= (int)g->ads.size()) break; - - streamData::adEntry *e = &g->ads[idx]; - return e->ad; - } while (1); - return NULL; -} - -void adGroupAccess::stopAdRun(const streamData::streamID_t, streamData::adGroups &groups, const bool) -{ - if (cached_ref) - { - if (cached_ref->m_trigger) - groups.releaseTrigger (cached_ref->m_trigger); - cached_ref = NULL; - } -} - -// routine to catch whatever conditions will trigger an advert -// -void streamData::checkForAdverts() -{ - // only fire if it's a public stream and the stream has been added to the YP - // otherwise we're not going to have the radionomyid from the authhash info. - if (!iskilled() && (m_streamInfo.m_streamPublic) && - (!m_dead) && m_ID && m_streamInfo.m_advertMode && - (m_streamInfo.m_avgBitrate > 0) && (m_streamInfo.m_streamSampleRate > 0)) - { - advertGroups.checkForNewAdverts(targetSpotUrl(), ID()); - } -} - -void streamData::adGroups::checkForNewAdverts(const uniString::utf8& url, const streamData::streamID_t sid) -{ - time_t now = ::time (NULL); - bool start_map_retrieval = false; - do - { - stackLock sml (adContentLock); - if (m_nextDownloadRun && m_nextDownloadRun <= now) - { - m_nextDownloadRun = 0; - SimpleThread (streamData::adGroups::runAdDownload, NULL); - } - - // in this case, we should just skip until things - // have been processed. when processed then we - // can step through and that will allow updates. - if (nextUpdate == 0) - { - if (retriever && retriever->cleanup) - break; - return; - } - else if (nextUpdate <= now) - { - nextUpdate = 0; // disable while this starts up - start_map_retrieval = true; - break; - } - return; - } while (0); - - if (start_map_retrieval) - { - loadGroups(url, sid); - return; - } - AD_DEBUG_LOG("Cleanup advert map thread", ADLOGNAME, sid); - delete retriever; - retriever = NULL; -} - -uniString::utf8 streamData::getAdvertGroup() -{ - if (m_streamInfo.m_advertMode) - { - utf8 groups = "Ad setup is correct, but no adverts / groups are currently assigned to this stream."; - // only fire if it's a public stream and the stream has been added to the YP - // otherwise we're not going to have the radionomyid from the authhash info. - if ((m_streamInfo.m_streamPublic) && (!m_dead) && m_ID && m_streamInfo.m_advertMode) - { - groups = advertGroups.getAdvertGroup(); - } - else - { - if (m_dead) - { - return "Ads cannot be provided without an active stream source."; - } - else - { - return "Stream is not configured properly for ads.

" - "Check that the authhash for this stream is correct, " - "and contact support if the condition persists."; - } - } - return groups; - } - - // otherwise, we have to assume that we've - // been able to get something or it's just - // not configured and so need to register. - return "This stream is not configured for adverts.

" + - utf8(m_streamInfo.m_radionomyID.empty() ? "Please register your stream for the DNAS+ service" : - "Please upgrade your stream to the DNAS+ service") + - " to enable advert support."; -} - -bool streamData::knownAdvertGroup(const streamData::streamID_t &sid, const int group) -{ - if (sid > 0) - { - map::const_iterator i = g_streamMap.find(sid); - if (i == g_streamMap.end()) - { - return false; - } - adGroups &gps = (*i).second->advertGroups; - stackLock sml (gps.m_lock); - return ((*i).second->advertGroups.findQueue (group) != NULL); - - } - return false; -} - - -streamData::adGroupQueue *streamData::adGroups::findQueue (int grp) -{ - std::map::iterator it = mapping.find (grp); - adGroupQueue *q = NULL; - if (it != mapping.end()) - q = it->second; - return q; -} - - -utf8 streamData::adGroups::getAdvertGroup() -{ - stackLock sml(m_lock); - - utf8 groups; - unsigned count = 0; - for (adGroupMap_t::const_iterator it = mapping.begin(); it != mapping.end(); ++it, ++count) - { - groups += (count ? ", " : "The following advert groups are currently in use:

") + tos((*it).first); - } - - if (count) - { - groups += ""; - } - else - groups += "Ad setup is correct, but no adverts / groups are currently assigned to this stream."; - - if (skippedAds > 0) - { - groups += "

There are adverts retrieved which do not match the current stream format.
" - "These will not be played to avoid breaking stream playback."; - } - return groups; -} - - -struct ad_dload_info -{ - stringstream ss; - int respcode; - int type; - size_t length; - - ad_dload_info() { respcode = 0; length = 0; type = 0; } -}; - - -static size_t handle_ad_dload_header (void *ptr, size_t size, size_t nmemb, void *stream) -{ - ad_dload_info *info = (ad_dload_info*)stream; - size_t length = size * nmemb; - char *s = (char*)ptr; - - do - { - if (length == 0) break; - - s [length] = 0; - - if (length > 12 && strncmp (s, "HTTP", 4) == 0) - { - unsigned int resp = 0; - char eol[5] = ""; - if (sscanf (s, "%*8s %u %4[^\r]", &resp, eol) == 2 && strcmp (eol, "OK") == 0 && resp > 99 && resp < 600) - info->respcode = resp; - break; - } - if (length > 12 && strncasecmp (s, "content-type:", 13) == 0) - { - char content[40]; - if (sscanf (s+14, " %40[^\r ]", content) == 1) - { - if (strcmp (content, "audio/aac") == 0) - info->type = AAC_LC_DATA; - else if (strcmp (content, "audio/aacp") == 0) - info->type = AACP_DATA; - else if (strcmp (content, "audio/mpeg") == 0) - info->type = MP3_DATA; - else if (strcmp (content, "application/octet-stream") == 0) - { - AD_DEBUG_LOG("[ADVERT] ad download has default mime, assuming aac"); - info->type = AACP_DATA; - } - else - { - WLOG ("[ADVERT] ad download has unexpected mime " + utf8(content)); - return 0; - } - break; - } - } - } while (0); - return length; -} - - -static size_t handle_ad_dload_body (void *ptr, size_t size, size_t nmemb, void *stream) -{ - ad_dload_info *info = (ad_dload_info*)stream; - size_t length = size * nmemb; - if (info->ss) - { - info->ss.write ((const char*)ptr, length); - info->length += length; - } - - bandWidth::updateAmount (bandWidth::ADVERTS, length); - return length; -} - - -THREAD_FUNC streamData::adGroups::runAdDownload (void* /*arg*/) -{ - int purged = 0, retry = 0, added = 0, count = 0; - CURL *curl = NULL; - ad_dload_info info; - char curl_error [CURL_ERROR_SIZE]; - - curl = webClient::setupCurlDefaults (curl, "[ADVERT] ", "", 4, 20L); - if (curl == NULL) - { - // set retry time - m_nextDownloadRun = ::time(NULL) + 25; - return NULL; - } - curl_easy_setopt (curl, CURLOPT_HEADERFUNCTION, handle_ad_dload_header); - curl_easy_setopt (curl, CURLOPT_HEADERDATA, &info); - curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, handle_ad_dload_body); - curl_easy_setopt (curl, CURLOPT_WRITEDATA, &info); - curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, &(curl_error[0])); - - // use progress/xfer functions to trap for the server kill case - curl_easy_setopt (curl, CURLOPT_NOPROGRESS, 0L); - curl_easy_setopt (curl, CURLOPT_XFERINFOFUNCTION, xferinfo); - curl_easy_setopt (curl, CURLOPT_XFERINFODATA, (long)-1); - -#ifdef CURLOPT_PASSWDFUNCTION - curl_easy_setopt (curl, CURLOPT_PASSWDFUNCTION, my_getpass); -#endif - // limit to 200 in one run and assume 6 retries is not a good sign and likely to stall things - while (count < 200 && retry < 6) - { - specialFileData *f; - if (1) - { - // grab the oldest - stackLock sml (adContentLock); - if (iskilled() || adContentPending.empty()) - break; - list::iterator it = adContentPending.begin(); - f = *it; - adContentPending.pop_front(); - } - ++count; - if (f->m_url == "") - { - ILOG ("[Advert] download requested but no url specified " + f->m_description); - specialFileData::release (f); - continue; - } - // clear old data - memset (curl_error, 0, CURL_ERROR_SIZE); - info.respcode = 0; - info.length = 0; - info.type = 0; - info.ss.str (string()); - - curl_easy_setopt (curl, CURLOPT_URL, f->m_url.c_str()); - int ret = curl_easy_perform (curl); - if (ret != CURLE_OK) - { - // assume a timeout, add to the end for checking later - if (f->m_retried < 2) - { - ++f->m_retried; - ILOG("[ADVERT] failed to get " + f->m_description + ", will retry"); - ++retry; - stackLock sml (adContentLock); - adContentPending.push_back (f); - continue; - } - ILOG ("[ADVERT] retried " + f->m_description + " several times, skipping"); - } - else if (info.respcode == 200 && info.length && info.type) - { - // ok, we have something that initially looks like something - vector<__uint8> &v = f->m_sc1Buffer; - v.reserve (info.ss.tellp()); - std::copy (std::istreambuf_iterator( info.ss ), std::istreambuf_iterator(), std::back_inserter(v)); - - //unsigned int read_samplerate = 0; - - f->verifyData("[ADVERT]"); - - // now we either have nothing left or something valid - if (v.size() > 0) - { - string e = " (" + tos (info.length); - if (info.length != v.size()) - e += " bytes, processed down to " + tos(v.size()); - - added++; - specialFileData::release (f); // from content pending not pool - ILOG("[ADVERT] Loaded advert " + f->m_description + e + " bytes), referenced " + tos(f->getRefcount())); - continue; - } - ILOG ("[ADVERT] no useful data returned for " + f->m_description + " so flag for removal"); - } else { - ELOG("[ADVERT] failed to get " + f->m_description + ", resp " + tos(info.respcode) + ", len " + tos(info.length) + ", type " + tos (info.type)); - } - f->m_failed = true; - // missing content, need to remove from pool - ++purged; - specialFileData::release (f); // from content pending - stackLock sml (adContentLock); - adData.erase (f->m_description); // drop entry from pool - specialFileData::release (f); // actually release pool reference - } - if (added || purged || retry) - ILOG("[ADVERT] downloaded " + tos(added) + ", purged " + tos(purged) + ", to be retried " + tos(retry)); - curl_easy_cleanup (curl); - - time_t expire_advert = ::time(NULL) - 5400; // adverts untouched for 90 mins are dropped - stackLock sml (adContentLock); - - unsigned expired_ads = 0; - - map::iterator it = adData.begin(); - while (it != adData.end()) - { - specialFileData *f = it->second; - map::iterator to_go = it; - ++it; - if (f->getRefcount() == 1 && f->m_lastUsed < expire_advert) - { - DLOG ("[ADVERT] ad " + f->m_description + " unused, dropping"); - adData.erase (to_go); // drop entry from pool - specialFileData::release (f); // actually release pool reference - ++expired_ads; - } - } - if (expired_ads) - ILOG("[ADVERT] " + tos(expired_ads) + " advert(s) expired from pool"); - - if (m_nextDownloadRun == 0) - m_nextDownloadRun = ::time(NULL) + ((count < 200) ? (retry ? 20 : 60) : 2); - - return NULL; -} - - -THREAD_FUNC streamData::adGroups::process(void* arg) -{ - streamData *sd = 0; - try - { - adGroupsRetriever*& m_retriever = reinterpret_cast(arg); - if (!iskilled() && m_retriever && m_retriever->loaded && m_retriever->m_curl && - streamData::isSourceConnected(m_retriever->m_sid)) - { - AD_DEBUG_LOG ("Trying to retrieve updated advert map", ADLOGNAME, m_retriever->m_sid); - memset(m_retriever->m_curl_error, 0, CURL_ERROR_SIZE); - CURL *curl = (!iskilled() ? m_retriever->m_curl : NULL); - - struct curl_slist *list = NULL; - std::string uuid; - if (m_retriever->last_uuid != "") - { - uuid = "Last-BlueBox-UUID: " + m_retriever->last_uuid; - list = curl_slist_append (list, uuid.c_str()); - curl_easy_setopt (curl, CURLOPT_HTTPHEADER, list); - } - CURLcode ret = (!iskilled() ? curl_easy_perform(curl) : CURLE_FAILED_INIT); - - if (list) - curl_slist_free_all (list); - - map skipped; - int duration = 60; // default retry interval - bool error = false; - string id; - - stringstream s; - s << tos(time_now_ms()); - id = s.str(); - - sd = streamData::accessStream (m_retriever->m_sid); - do - { - if (ret != CURLE_OK) - { - if (ret != CURLE_ABORTED_BY_CALLBACK) - { - ELOG ("Advert map retrieval failed with code: " + - tos(ret) + " [" + (m_retriever->m_curl_error[0] ? - m_retriever->m_curl_error : curl_easy_strerror(ret)) + "]", ADLOGNAME, m_retriever->m_sid); - } - else - { - curl = 0; // abort this attempt - if (sd) - { - sd->releaseStream(); - sd = 0; - } - break; - } - - // better to retry in 1 minute than wait 20 minutes for connection - // failure issues, etc especially if could not connect on startup - duration = 60; - break; - } - - string tag; - - map &fileContents = sd->advertGroups.adData; - - string line1; - while (!iskilled() && getline(m_retriever->ss, line1)) - { - line1 = stripWhitespace(line1); - if (line1.empty()) - { - error = true; - AD_DEBUG_LOG("Blank line detected for tag", ADLOGNAME, m_retriever->m_sid); - break; - } - - if (gOptions.adMetricsDebug()) - { - string outp = line1.substr (0, 40); - if (line1.length() > 40) - outp += "..."; - AD_DEBUG_LOG("Retrieved line: " + outp, ADLOGNAME, m_retriever->m_sid); - } - - stringstream line(line1); - line >> tag; - if (tag == "NextCall") - { - line >> duration; - if (duration < 5) - { - duration = 120; // filter out silly values. - } - continue; - } - if (tag == "ID") - { - line >> id; - continue; - } - if (tag == "G") - { - int group = 0; - string name; - line >> group >> name; - // add to group if name exists in map - map::const_iterator it = fileContents.find(name); - if (it != fileContents.end()) - { - specialFileData *f = it->second; - if (f->m_failed == false) - { - sd->advertGroups.addToGroup (id, group, f); - continue; - } - } - if (skipped.find(name) == skipped.end()) - { - WLOG("Missing advert ref " + name + " on group " + tos(group), ADLOGNAME, m_retriever->m_sid); - } - continue; - } - if (tag == "AdURL") - { - string name, url; - line >> name; - AD_DEBUG_LOG("Parse groups: ref " + name, ADLOGNAME, m_retriever->m_sid); - if (line.fail() || name[0] == '\0') - continue; - - line >> url; - if (url.empty() == false) - { - stackLock sml (adContentLock); - - map::const_iterator map_it = fileContents.find(name); - if (map_it != fileContents.end()) - continue; // already loaded - - std::list::iterator it = adContentPending.begin(); - - for (; it != adContentPending.end(); ++it) - { - if ((*it)->m_description == name) - { - if ((*it)->m_missing) - AD_DEBUG_LOG("found " + tos(name) + " waiting for retrieval", ADLOGNAME, m_retriever->m_sid); - break; - } - } - if (it != adContentPending.end()) - continue; // already scheduled to be downloaded - - specialFileData *f = new specialFileData (name, url); - if (f) - { - f->increaseRefcount(); // referenced now in the 2 following places - fileContents [name] = f; - adContentPending.push_back (f); - } - } - } - if (tag == "Ad") - { - bool process_file = true; - string name, b64; - line >> name; - AD_DEBUG_LOG("Parse groups: ref " + name, ADLOGNAME, m_retriever->m_sid); - if (line.fail() || name[0] == '\0') - continue; - -// we should allow for replacing an existing advert eventually - line >> b64; - stackLock sml (adContentLock); - - map::const_iterator it = fileContents.find(name); - if (it != fileContents.end()) - { - process_file = false; - } - - if (line.fail()) - { - stringstream enc; -#if 1 // one line per base64 encoded advert - if (getline(m_retriever->ss, line1) && process_file) - { - enc << line1; - } -#else // multiple lines for base64 content but terminates on blank line - while (getline (ss, line1)) - { - if (line1 == "") - { - break; // End of base64 block - } - //AD_DEBUG_LOG("[ADVERT sid=" + tos(SID) + "] Read " + tos(line1.size())); - if (process_file) - { - enc << line1; - } - } -#endif - b64 = enc.str(); - line.clear(); - } - if (!b64.empty()) - { - specialFileData *f = new specialFileData(name); - if (f) - { - vector<__uint8> v = base64::decode(b64); - size_t original_size = v.size(); - - - int uvoxDataType = (sd ? sd->streamUvoxDataType() : MP3_DATA), - bitrate = (sd ? sd->streamBitrate() : -1); - unsigned int read_samplerate = (sd ? sd->streamSampleRate() : 0), - samplerate = read_samplerate; - // if the bitrate is not known, setting -1 will reject things - // as we cannot be sure well insert ok if using '0' otherwise - int read_bitrate = cleanFileData("", v, v.size(), bitrate, samplerate, uvoxDataType, - "[ADVERT sid=" + tos(m_retriever->m_sid) + "] ", "advert", read_samplerate); - if (!v.empty()) - { - f->replaceData(v, uvoxDataType, read_bitrate, read_samplerate); - AD_DEBUG_LOG("Retrieved advert of length " + - tos(original_size) + " bytes" + (original_size != v.size() ? " (processed down to " + - tos(v.size()) + " bytes)" : ""), ADLOGNAME, m_retriever->m_sid); - fileContents [name] = f; - } - else - { - delete f; - AD_DEBUG_LOG("Skipping advert - does not match the current stream format. Got " + - tos(read_bitrate) + " kbps, " + sampleRateStr(read_samplerate) + - " vs " + tos(bitrate) + " kbps, " + sampleRateStr(samplerate), ADLOGNAME, m_retriever->m_sid); - - // this is a special case for when there is no advert - // group but we're getting generic fillers (which we - // cannot use as we don't know who it's intended for) - if (name.find("completions") == string::npos) - { - skipped[name] = true; - } - } - } - } - continue; - } - } - - // if we've got configured 'test' files then we - // add them in at this stage though we have the - // means to load them on-demand if not done now - if (!sd) - { - sd = streamData::accessStream(m_retriever->m_sid); - } - if (!skipped.empty()) - { - AD_DEBUG_LOG("Skipped " + tos(skipped.size()) + " adverts not matching the current stream format", ADLOGNAME, m_retriever->m_sid); - } - } while (iskilled()); - - if (!curl) - { - // abort as there's nothing we can do - // that won't otherwise make a crash - return 0; - } - else - { - stackLock sml (adContentLock); - sd->advertGroups.skippedAds = (!error ? (int)skipped.size() : -1); - AD_DEBUG_LOG("Advert update interval: " + tos(duration), ADLOGNAME, m_retriever->m_sid); - sd->advertGroups.nextUpdate = ::time(NULL) + duration; - sd->advertGroups.lastUUID = m_retriever->last_uuid; - time_t now = ::time(NULL); - if (m_nextDownloadRun && m_nextDownloadRun > (now + 6)) - m_nextDownloadRun = now + 4; - - m_retriever->cleanup = 1; - } - sd->releaseStream(); - sd = 0; - } - } - catch (...) - { - adGroupsRetriever*& m_retriever = reinterpret_cast(arg); - if (m_retriever) - { - m_retriever->cleanup = 1; - } - - if (sd) - { - sd->releaseStream(); - } - } - return 0; -} - -void streamData::adGroups::loadGroups(const utf8& url, const streamData::streamID_t sid) -{ - if (sid > 0) - { - stackLock sml(m_lock); - - if (retriever) - { - if (retriever->cleanup == 0) - { - AD_DEBUG_LOG("Retriever thread already in progress", ADLOGNAME, sid); - nextUpdate = ::time(NULL) + 30; // re-check every so often - return; - } - - delete retriever; - retriever = NULL; - } - - retriever = new adGroupsRetriever(url, sid); - if (retriever && (retriever->loaded == 1) && (retriever->cleanup == 0) && isSourceConnected(sid)) - { - SimpleThread(streamData::adGroups::process, retriever); - } - else - { - if (retriever) - { - // re-check every so often, but if we needed to re-pull - // the stream's information then force a quicker check - nextUpdate = ::time(NULL) + (!retriever->loaded ? 10 : 1); - delete retriever; - retriever = NULL; - } - else - { - nextUpdate = ::time(NULL) + 30; // re-check every so often - } - } - } -} - - -streamData::adTrigger::adTrigger(const string &id, streamID_t sid) -{ - m_inUse = 1; - m_sid = sid; - m_id = id; - m_type = ADVERT_MAP_FIXED; - m_playedAt = (time_t)0; - m_returnPtrSC1 = m_returnPtrSC2 = 0; - m_maxSizeSC1 = m_maxSizeSC2 = 0; -} - - -streamData::adTrigger::adTrigger(const char *id, streamID_t sid) -{ - m_inUse = 1; - m_sid = sid; - m_id = string(id); - m_playedAt = (time_t)0; - m_type = ADVERT_MAP_FIXED; - m_returnPtrSC1 = m_returnPtrSC2 = 0; - m_maxSizeSC1 = m_maxSizeSC2 = 0; -} - -streamData::ringBufferAccess_t streamData::adTrigger::getStartPos (bool sc2) -{ - return sc2 ? m_startPosSC2 : m_startPosSC1; -} - - -bool operator==(const streamData::adTrigger &lhs, const streamData::adTrigger &rhs) -{ - return (lhs.m_id == rhs.m_id); -} - diff --git a/Src/Plugins/DSP/sc_serv3/streamData.h b/Src/Plugins/DSP/sc_serv3/streamData.h deleted file mode 100644 index cbad5b29..00000000 --- a/Src/Plugins/DSP/sc_serv3/streamData.h +++ /dev/null @@ -1,906 +0,0 @@ -#pragma once -#ifndef streamData_H_ -#define streamData_H_ - -#include -#include -#include "threadedRunner.h" -#include "unicode/uniString.h" -#include "threading/thread.h" -#include "yp2.h" -#include -#include "uvox2Common.h" -#include "auth.h" -#include "MP3Header.h" -#include "ADTSHeader.h" - -/* - This class encapsulates all the data for a stream. It also includes - static methods to manage the collection of streams -*/ -using namespace std; - -#define BUF_SIZE 16384 -#define SEND_SIZE 8192 - -class adGroupAccess; - -class streamData -{ -public: - friend class protocol_shoutcastClient; - friend class protocol_shoutcast1Client; - friend class protocol_shoutcast2Client; - friend class protocol_HTTPClient; - friend class protocol_flvClient; - friend class protocol_m4aClient; - -#if defined(_DEBUG) || defined(DEBUG) - friend class protocol_relay_uvox; - friend class protocol_relay_shoutcast; -#endif - -#define ADVERT_MAP_FIXED 0 -#define ADVERT_MAP_FLEX 1 -#define ADVERT_MAP_PAUSE 2 -#define ADVERT_MAP_MAGIC 3 - - class specialFileData; - class adEntry; - class adGroup; - - typedef enum - { - UNKNOWN = 0x0, - SHOUTCAST1 = 0x1, - SHOUTCAST2 = 0x2, - HTML5 = 0x4, - RELAY = 0x8, - WINAMP = 0x10, - ICECAST = 0x20, - VLC = 0x40, - FB2K = 0x80, - WMP = 0x100, - ITUNES = 0x200, - IE = 0x400, - CHROME = 0x800, - SAFARI = 0x1000, - FIREFOX = 0x2000, - SC_CDN_MASTER = 0x4000, - SC_CDN_SLAVE = 0x8000, - ROKU = 0x10000, - APPLE = 0x20000, - MPLAYER = 0x40000, - WARNING = 0x80000, - PS = 0x100000, - RADIO_TOOLBOX = 0x200000, - SC_IRADIO = 0x400000, - FLV = 0x800000, - M4A = 0x1000000, - HTTP = 0x2000000, - RADIONOMY = 0x4000000, - CURL_TOOL = 0x8000000, - SYNOLOGY = 0x10000000, - WIIMC = 0x20000000 - } source_t; - - typedef size_t streamID_t; - typedef std::set streamIDs_t; - typedef uintptr_t ringBufferAccess_t; // we use power of 2 and mask trick to access ring buffer - // because of this, all related variables must have same type - struct ringBuffer_t - { - std::vector<__uint8> m_data; - ringBufferAccess_t m_writePtr; - ringBufferAccess_t m_ptrMask; // must be same type as m_sc1_write_ptr - - ringBuffer_t() : m_writePtr(0), m_ptrMask(0) {} - }; - - struct songHistoryInfo - { - uniString::utf8 m_title; // general title (or is empty) - uniString::utf8 m_metadata; // full metadata (if provided) - time_t m_when; // when it was played - - explicit songHistoryInfo(const uniString::utf8 &title, const uniString::utf8 &metadata) throw() : - m_title(title), m_metadata(metadata), m_when(::time(NULL)) {} - }; - typedef std::deque streamHistory_t; - - struct extraInfo - { - int ypConnected; - int ypErrorCode; - uniString::utf8 ypErrorMsg; - uniString::utf8 ypErrorMsgExtra; - bool isConnected; - bool isRelay; - bool isBackup; - - extraInfo() : ypConnected(0), ypErrorCode(200), isConnected(false), isRelay(false), isBackup(false) {} - }; - - struct streamInfo - { - uniString::utf8 m_streamUser; - uniString::utf8 m_streamName; - uniString::utf8 m_streamGenre[5]; - uniString::utf8 m_streamLogo; - uniString::utf8 m_streamURL; - uniString::utf8 m_radionomyID; - uniString::utf8 m_contentType; - int m_streamBitrate; // in kilobits - bool m_streamPublic; - bool m_vbr; // if it's vbr content and we need to bitrate match - bool m_backup; // signals if this a backup source being used - bool m_allowPublicRelay; - int m_streamSampleRate; // in Hz - int m_avgBitrate; // in bits - int m_maxBitrate; // in bits - int m_minBitrate; // in bits - source_t m_sourceType; - //size_t m_streamPeakUser; - int m_streamMaxUser; - int m_streamMaxBitrate; - int m_streamMinBitrate; - int m_uvoxDataType; // sc2 attributes - uniString::utf8 m_relayURL; // set if we are a relay (used in reporting) - uniString::utf8 m_backupURL; // set if we have a backup url for the source - uniString::utf8 m_srcAddr; // where is the source coming from - uniString::utf8 m_backupServer; - - // for yp2 - uniString::utf8 m_authHash; - uniString::utf8 m_publicIP; // the public IP address of the DNAS if returned by the YP - uniString::utf8 m_stationID; - uniString::utf8 m_serverID; - uniString::utf8 m_authUrl; // overriden url - uniString::utf8 m_advertsUrl; // overriden url - uniString::utf8 m_audienceUrl; // overriden url - uniString::utf8 m_tuneinAirApiUrl; // overriden url - uniString::utf8 m_targetSpotUrl; // overriden url - std::vector m_backupServersList; - - uniString::utf8 m_currentURL; // used by v1 sources to set StreamUrl='%s'; in v1 metadata - uniString::utf8 m_currentSong; - uniString::utf8 m_comingSoon; - uniString::utf8 m_sourceIdent; - std::vector m_nextSongs; - - static int m_allowSSL_global; - static int m_allowAllFormats_global; - static int m_allowMaxBitrate_global; - static int m_allowBackupURL_global; - - int m_allowSSL; - int m_allowAllFormats; - int m_allowMaxBitrate; - int m_allowBackupURL; - - int m_ypResponseCode; - int m_advertMode; - u_short m_srcPort; - - streamInfo() : m_streamBitrate(0), m_streamPublic(false), m_vbr(false), m_backup(false), - m_allowPublicRelay(true), m_streamSampleRate(0), m_avgBitrate(0), - m_maxBitrate(0), m_minBitrate(0), m_sourceType(streamData::SHOUTCAST1), - m_streamMaxUser(0), m_streamMaxBitrate(0), - m_streamMinBitrate(0), m_uvoxDataType(MP3_DATA), m_authUrl(DNAS_AUTH_URL), - m_advertsUrl(METRICS_ADVERTS_URL), m_audienceUrl(METRICS_AUDIENCE_URL), - m_targetSpotUrl(TARGETSPOT_URL), - #ifdef LICENCE_FREE - m_allowSSL(1), m_allowAllFormats(1), m_allowMaxBitrate(0), m_allowBackupURL(1), - #else - m_allowSSL(1), m_allowAllFormats(1), m_allowMaxBitrate(0), m_allowBackupURL(1), - #endif - m_advertMode(0), m_srcPort(0) {} - }; - - struct uvoxConfigData_t //(uvox2 and uvox21) - { - uniString::utf8 m_mimeType; - int m_avgBitrate; // in bits - int m_maxBitrate; // in bits - // buffer size stuff is not actually used in streamData, but is here for completeness. - // note that protocol_relay_uvox does not set these (and pretty much can't anyhow) - int m_desiredBufferSize; // in kilobytes, as requested by broadcaster - int m_minimumBufferSize; // in kilobytes, as requested by broadcaster - ///////////// - int m_icyPub; - uniString::utf8 m_icyName; - uniString::utf8 m_icyGenre; - uniString::utf8 m_icyURL; - - uniString::utf8 toLogString() const throw() - { - return "mimeType=" + m_mimeType + stringUtil::eol() + - "avgBitrate=" + stringUtil::tos(m_avgBitrate) + stringUtil::eol() + - "maxBitrate=" + stringUtil::tos(m_maxBitrate) + stringUtil::eol() + - "desiredBufferSize=" + stringUtil::tos(m_desiredBufferSize) + stringUtil::eol() + - "minimumBufferSize=" + stringUtil::tos(m_minimumBufferSize) + stringUtil::eol() + - "icyName=" + m_icyName + stringUtil::eol() + - "icyGenre=" + m_icyGenre + stringUtil::eol() + - "icyURL=" + m_icyURL + stringUtil::eol() + - "icyPub=" + stringUtil::tos(m_icyPub); - } - - uvoxConfigData_t() : m_avgBitrate(0), m_maxBitrate(0), m_desiredBufferSize(0), m_minimumBufferSize(0), m_icyPub(0) {} - }; - - struct streamSetup - { - const uniString::utf8& m_logString; - const uniString::utf8& m_srcAddr; - const uniString::utf8& m_authHash; - const uniString::utf8& m_streamUser; - const uniString::utf8& m_relayURL; - const uniString::utf8& m_backupURL; - - const source_t m_sourceType; - const streamID_t m_sid; - - const int m_srcPort; - const int m_maxStreamUser; - const int m_maxStreamBitrate; - const int m_minStreamBitrate; - const bool m_allowPublicRelay; - const bool m_backup; - const unsigned int m_sampleRate; - const bool m_vbr; - - httpHeaderMap_t m_headers; - uvoxConfigData_t m_config; - - streamSetup(const uniString::utf8 &logString, const uniString::utf8 &srcAddr, - const uniString::utf8 &authHash, const uniString::utf8 &streamUser, - const uniString::utf8 &relayURL, const uniString::utf8 &backupURL, - const source_t sourceType, const streamID_t sid, const int srcPort, - const int maxStreamUser, const int maxStreamBitrate, - const int minStreamBitrate, const bool allowPublicRelay, - const bool backup, const unsigned int sampleRate, - const bool vbr, httpHeaderMap_t headers) throw() - : m_logString(logString), m_srcAddr(srcAddr), m_authHash(authHash), - m_streamUser(streamUser), m_relayURL(relayURL), m_backupURL(backupURL), - m_sourceType(sourceType), m_sid(sid), m_srcPort(srcPort), - m_maxStreamUser(maxStreamUser), m_maxStreamBitrate(maxStreamBitrate), - m_minStreamBitrate(minStreamBitrate), m_allowPublicRelay(allowPublicRelay), - m_backup(backup), m_sampleRate(sampleRate), m_vbr(vbr), m_headers(headers) {} - - streamSetup(const uniString::utf8 &logString, const uniString::utf8 &srcAddr, - const uniString::utf8 &authHash, const uniString::utf8 &streamUser, - const uniString::utf8 &relayURL, const uniString::utf8 &backupURL, - const source_t sourceType, const streamID_t sid, const int srcPort, - const int maxStreamUser, const int maxStreamBitrate, - const int minStreamBitrate, const bool allowPublicRelay, - const bool backup, const unsigned int sampleRate, - const bool vbr, uvoxConfigData_t& config) throw() - : m_logString(logString), m_srcAddr(srcAddr), m_authHash(authHash), - m_streamUser(streamUser), m_relayURL(relayURL), m_backupURL(backupURL), - m_sourceType(sourceType), m_sid(sid), m_srcPort(srcPort), - m_maxStreamUser(maxStreamUser), m_maxStreamBitrate(maxStreamBitrate), - m_minStreamBitrate(minStreamBitrate), m_allowPublicRelay(allowPublicRelay), - m_backup(backup), m_sampleRate(sampleRate), m_vbr(vbr), m_config(config) {} - }; - - typedef pair adGroupEntry; // is the strings needed here? - - class adGroups; - class specialFileData - { - friend class adEntry; - friend class adGroups; - - private: - unsigned int m_refcount; - mutable AOL_namespace::mutex m_lock; - std::vector<__uint8> m_sc1Buffer; - std::vector<__uint8> m_sc2Buffer; - void _replaceData(const std::vector<__uint8> &data, const int uvoxDataType, - const int bitrate, const unsigned int samplerate) throw(); - - public: - const std::string m_description; - const std::string m_url; // these could be offloaded into separate object, only apply initially - int m_samplerate; - int m_bitrate; - float m_duration; - bool m_failed; - bool m_missing; - unsigned m_retried; - time_t m_lastUsed; - - explicit specialFileData(const std::string &description, const std::string &url = "") throw() : m_description(description), m_url(url) - { - m_failed = false; - m_missing = (url == "" ? false : true); - m_refcount = 1; - m_retried = 0; - m_samplerate = 0; - m_duration = 0; - m_lastUsed = (time_t)0; - } - ~specialFileData() throw() { m_lock.lock(); m_sc1Buffer.clear(); m_sc2Buffer.clear(); m_lock.unlock(); /*if (m_refcount > 1) abort();*/ } - - int loadFromFile(const uniFile::filenameType &name, const int bitrate, const int uvoxDataType, - const unsigned int samplerate, const uniString::utf8& logString) throw(); - int verifyData (const uniString::utf8& logString); - - void getSc1Data(std::vector<__uint8> &v) const throw() { stackLock sml(m_lock); v = m_sc1Buffer; } - void getSc2Data(std::vector<__uint8> &v) const throw() { stackLock sml(m_lock); v = m_sc2Buffer; } - - void updateUvoxData(const int uvoxDataType, const int bitrate, const unsigned int samplerate) throw(); - void replaceData(const std::vector<__uint8> &data, const int uvoxDataType, - const int bitrate, const unsigned int samplerate) throw(); - bool gotData(void) const throw() { stackLock sml(m_lock); return (!m_sc2Buffer.empty() && !m_sc1Buffer.empty()); } - unsigned int getRefcount () { return m_refcount; } - void increaseRefcount () { stackLock sml(m_lock); ++m_refcount; } - - static void release (specialFileData *f); - - friend class adGroup; - friend class protocol_shoutcastClient; - friend class protocol_shoutcast1Client; - friend class protocol_shoutcast2Client; - friend class protocol_HTTPClient; - friend class protocol_flvClient; - friend class protocol_m4aClient; - }; - - static int cleanFileData(uniFile::filenameType fn, vector<__uint8> &buffer, size_t siz, - const int bitrate, const unsigned int samplerate, - const int uvoxDataType, const uniString::utf8& logString, - const uniString::utf8& description, unsigned int &read_samplerate); - - class adTrigger; - class adGroupQueue; - - class adEntry - { - public: - size_t upper; - specialFileData *ad; - - ~adEntry() { if (ad) ad->release(ad); } - - explicit adEntry(specialFileData *d); - adEntry (const adEntry &e); - void flush(metrics::adSummary &summary); - }; - - class adGroup - { - friend class streamData::adGroups; - friend class streamData::adGroupQueue; - friend class adGroupAccess; - - adTrigger *m_trigger; - size_t m_totalSizeSC1; - size_t m_totalSizeSC2; - public: - std::deque ads; - adGroup() { m_totalSizeSC1 = m_totalSizeSC2 = 0; m_trigger = NULL; } - adGroup(adGroup &, adTrigger &); - ~adGroup() {;} - - void appendAdvert (specialFileData &d); - void flushCounts (metrics::adSummary &summary); - int recalculateTotalSize (); - }; - - class adGroupQueue - { - friend class adGroups; - void flushStats (metrics::adSummary &summary, adTrigger *); - public: - unsigned int listeners; - list queue; - - adGroupQueue() { listeners = 0; } - ~adGroupQueue(); - - }; - - class adTrigger - { - friend class adGroupQueue; - public: - unsigned long m_inUse; - long m_type; // fixed/flex etc - streamData::ringBufferAccess_t m_startPosSC1; - streamData::ringBufferAccess_t m_startPosSC2; - streamData::ringBufferAccess_t m_returnPtrSC1; - streamData::ringBufferAccess_t m_returnPtrSC2; - time_t m_playedAt; - streamID_t m_sid; - string m_id; - size_t m_maxSizeSC1; - size_t m_maxSizeSC2; - unsigned m_duration; - - adTrigger(const char *id, streamID_t sid); - adTrigger(const string &id, streamID_t sid); - ~adTrigger(); - ringBufferAccess_t getStartPos (bool sc2 = true); - friend bool operator==(const streamData::adTrigger &lhs, const streamData::adTrigger &rhs); - }; - - typedef std::map adGroupMap_t; - - class adGroups - { - friend class adGroupAccess; - - static AOL_namespace::mutex adContentLock; - // a global map with a custom destructor - static struct gpool : map - { ~gpool(); } adData; // global pool - static list adContentPending; // downloading to global pool - - static time_t m_nextDownloadRun; - - streamData *m_sd; - string lastUUID; // last update marker - unsigned m_recheck; // serial count - - adGroup *findGroup (adGroupAccess &ac, ringBufferAccess_t pos); - void flushStats (adTrigger *trigger); - public: - class adGroupsRetriever; - adGroupsRetriever *retriever; - mutable AOL_namespace::mutex m_lock; - streamData::ringBufferAccess_t m_returnPtrSC1; - streamData::ringBufferAccess_t m_returnPtrSC2; - - adGroupMap_t mapping; - std::list triggers; - - unsigned refcount; // prevent update to groups if in use - int skippedAds; // used to help track stream mis-matches - time_t nextUpdate; - long m_type; // fixed/flex etc - - adGroups (streamData *sd); - ~adGroups(); - - bool attachGroupQueue (adGroupAccess &ac); - void detachGroupQueue (adGroupAccess &ac); - - void createNewTrigger (const string &reqID); - void purge (streamData::ringBuffer_t &buffer); - void purgeGroups(); - void duplicateTrigger (const string &id); - void setType (const uniString::utf8 &s); - size_t overlaySize (adTrigger *t, bool sc2 = false); - - adGroup *addToGroup(const string &id, const int grp, specialFileData *f); - - void loadGroups(const uniString::utf8& url, const streamData::streamID_t sid); - adGroupQueue *findQueue (int grp); - void checkForNewAdverts(const uniString::utf8& url, const streamData::streamID_t sid); - uniString::utf8 getAdvertGroup(); - void queueNewSet(const streamData::streamID_t id, adGroups *newgroups); - void flushGroupCounts(const streamData::streamID_t sid); - void releaseTrigger (adTrigger *trigger); - - static THREAD_FUNC process(void* arg); - static THREAD_FUNC runAdDownload(void* arg); - }; - -private: - // streams fall into two groups. Those which are active and usable, and those which are "dead". - // dead streams are those which are going away due to a media type change or a uvox terminate stream message. - // since the clients cannot go away instantaneously, they are considered "dying" until all references counts go - // to zero. Streams that are not dying (including those without a source) are cross referenced in the g_streamMap - // table - static AOL_namespace::mutex g_streamMapLock; - static std::set g_streams; // all the streams, including those that are "dying" - static std::map g_streamMap; // maps stream IDs to stream objects (active only) - static std::map g_streamUptime; // tracks per-stream uptime (active only) - static std::map g_streamReferenceCounts; - static std::map g_streamSourceIsConnected; // is the source connected - static AOL_namespace::mutex g_sourceRelayMapLock; - static std::map g_streamSourceRelayIsActive; // is the source relay active e.g. connected or trying to connect or needs to die? - static AOL_namespace::mutex g_streamSongHistoryMapLock; - static std::map g_streamSongHistoryMap; -#if defined(_DEBUG) || defined(DEBUG) - static map g_streamSaving; -#endif - // note: the "source is connected" concept was originally in the streamData object itself.To avoid races, that - // flag must be manipulated under the g_streamMapLock. This was confusing, I've moved the flag to the set of tables - // above that clearly require that lock to be in place - - // create a new stream object with the given config data and install it in the static global tables above - static streamData* _createNewStream(const streamSetup& setup) throw(std::exception); - - static void _reduceReferenceCount(const uniString::utf8& logString, streamData* sd, const streamID_t id); - // return null if stream does not exist - static streamData* _increaseReferenceCount(const streamID_t ID); - - static void _moveStreamToDeadPool(const streamID_t ID) throw(); - static void _moveStreamToDeadPool(streamData *sd) throw(); - static void _moveStreamToDeadPool(std::map::iterator i) throw(); - -public: - static void removeRelayStatus(streamID_t ID); - - static source_t getClientType(source_t clientType, const uniString::utf8& userAgent); - static source_t getClientTypeCompat(source_t clientType, const uniString::utf8& userAgent); - - static bool isAllowedType(const int type); - static bool isAllowedType(const int type, bool& mp3); - - static int convertRawToUvox (vector<__uint8> &sc2buffer, const vector<__uint8> &buf, - const int uvoxDataType, const int bitrate, const unsigned int samplerate) throw(); - - - // permanently stop all sources in preparation for shutdown - static void killAllSources() throw(); - static void killStreamSource(const streamID_t id) throw(); - static void killSource(const streamID_t id, streamData *sd = 0) throw(); - static streamIDs_t getStreamIds(const int mode = 0) throw(); - static size_t totalStreams() throw(); // returns total number of streamData objects including those that are dying - static size_t totalActiveStreams(size_t &lastSID) throw(); // returns total number of active streamData objects - static streamID_t enumStreams(const size_t index) throw(); // will enumerate the available streams - static streamID_t getStreamIdFromPath(const uniString::utf8 &url, bool& htmlPage) throw(); - - // Called by sources. create a stream from a type 1 (original shoutcast/http/icecast) - // source. If stream exists and is compatible then returns existing stream - // otherwise it creates a new one. Returns null if the stream already has a source - // this will fetch an existing stream for a source if it exists, or create it if it does not or the source is incompatible - static streamData* createStream(const streamSetup& setup) throw(std::exception); - ////////////////////////////////// - - // when the source goes away - static void streamSourceLost(const uniString::utf8& logString, streamData *sd, const streamID_t id); - // when a client goes away - static void streamClientLost(const uniString::utf8& logString, streamData *sd, const streamID_t id); - - // called by clients to get access to a stream. Null if stream does not exist - // isSourceActive flag is false if the source went away or if we are using yp2 and - // the yp2::add() function hasn't returned yet. - static streamData* accessStream(const streamID_t ID) throw(); - static streamData* accessStream(const streamID_t ID, bool &isSourceActive) throw(); - // ensure this is called after calling accessStream(..) otherwise we end up - // with references to the objects kept which isn't good for larger streams - void releaseStream(); - - static bool isSourceConnected(const streamID_t id) throw(); - - static int isRelayActive(const streamID_t id, bool &noEntry) throw(); - static void setRelayActive(const streamID_t id, int state) throw(); - static int setRelayActiveFlags (streamID_t id, bool &noEntry, int flags, int mask = 0); - - // get a streams content type, return empty string if not found or not set - static uniString::utf8 getStreamContentType(const streamID_t ID) throw(); - - // get all relevant info about the stream - static bool getStreamInfo(const streamID_t id, streamInfo &info, extraInfo &extra) throw(); - - static void getStreamSongHistory(const streamID_t id, streamHistory_t& songHistory) throw(); - - static bool getStreamNextSongs(const streamID_t id, uniString::utf8& currentSong, - uniString::utf8& comingSoon, - std::vector& nextSongs) throw(); - - static time_t getStreamUptime(const streamID_t ID) throw(); - - static bool validateTitle(uniString::utf8 &m_updinfoSong) throw(); - - - static uniString::utf8 getContentType(const streamData::streamInfo &info) throw(); - - //////////////////////////////////////////////////////////////////////////////////////////////// - ////////////////////////////////// END OF STATICS ////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////////////////// -private: - ///////////////////////////////////////////////////////////////////////////////////////// - mutable AOL_namespace::mutex m_stateLock; - streamInfo m_streamInfo; - - const streamID_t m_ID; - time_t m_startTime; // when the stream started; - //// yp reporting state - time_t m_nextYPPush; // time we should send another push if not earlier - time_t m_maxYPInterval; // max seconds between reports - uniString::utf8 m_lastTouchTitle; // last title sent via tchsrv - yp2::yp2SessionKey m_yp2SessionKey; - //// - int m_creating; // 1 if in auto-creation state and 2 if completed or was an error - int m_kill; // 1 or 2 if we need to kill ourselves i.e. when using backup sources - short m_dead; - short m_adTest; // 1 if the advert trigger is for testing only - - bool m_insertAdvert; - unsigned m_duration; // for flexbreak; - // hole - - unsigned int m_lastStreamSampleRate; // in Hz (used for tracking samplerates - // to ensure we've got a 'good' match - int m_lastStreamBitrate; // used to detect vbr streams vs cbr/cbr - unsigned m_syncFrameCount; // used to see if we're failing to sync - - //////////////////// end variables covered by state lock /////////////////////////////// - - specialFileData m_introFile; - specialFileData m_backupFile; - specialFileData m_adTestFile; - specialFileData m_adTestFile2; - specialFileData m_adTestFile3; - specialFileData m_adTestFile4; - - ////////////////////////////////////////////////////// - // shoutcast1 ring buffer - AOL_namespace::rwLock m_sc1StreamLock; - AOL_namespace::rwLock m_sc21StreamLock; - - ringBuffer_t m_sc1_ring_buffer; - ringBuffer_t m_sc21_ring_buffer; // data is uvox encoded - -public: - adGroups advertGroups; - - void checkForAdverts(); - uniString::utf8 getAdvertGroup(); - static bool knownAdvertGroup(const streamData::streamID_t &sid, const int group); - -private: - // where are the start of packets - std::deque m_sc1_packet_starts;// not really important for sc1 - std::deque m_sc21_packet_starts; - ///////////////////////////////////////////////////////////// - - // the metadata table for sc1 stores metadata changes and the point in the - // buffer where they occur. The metadata is stored in the outgoing format - // a.k.a StreamTitle=.....; - // - // we also store nextTrack and comingSoon info in this table. It's a bit of a hack, but - // the code that updates yp2 uses this table to get the track title since it is quicker - // to search than the potential binary gunk that makes up uvox data. -public: - struct sc1MetadataAndExtensionInfo - { - uniString::utf8 m_songTitle; // this is in native shoutcast 1 stream format - uniString::utf8 m_songMetadataForYP2; // xml to be inserted directly into yp2 request - }; - -private: - AOL_namespace::mutex m_sc1MetadataLock; - typedef std::deque > sc1MetadataTable_t; - sc1MetadataTable_t m_sc1MetadataTable; - - // note that metadata for uvox style streams cannot be the utf8 type directly, because the utf8 type - // does sanity checks for valid utf8 codes. The metadata could just be binary junk and we must - // accept that. Instead, we use a vector of utf8::value_type which at least makes conversion to utf8 - // classes easier -public: - typedef std::vector uvoxMetadata_t; - -private: - AOL_namespace::mutex m_sc21MetadataLock; - typedef std::deque > sc21MetadataTable_t; - sc21MetadataTable_t m_sc21MetadataTable; - uvoxMetadata_t m_sc21MetadataToPutInline; // metadata that must be put inline asap - - AOL_namespace::mutex m_sc21StreamAlbumArtLock; - AOL_namespace::mutex m_sc21PlayingAlbumArtLock; - typedef std::deque > sc21AlbumArtTable_t; - sc21AlbumArtTable_t m_sc21StreamAlbumArtTable; - uvoxMetadata_t m_sc21StreamAlbumArtToPutInline; // albumart that must be put inline asap - sc21AlbumArtTable_t m_sc21PlayingAlbumArtTable; - uvoxMetadata_t m_sc21PlayingAlbumArtToPutInline; // albumart that must be put inline asap - std::vector<__uint8> m_sc21AlbumArtData[2]; - size_t m_sc21AlbumArtMime[2]; -#if 0 - // limit triggers - AOL_namespace::mutex m_sc1LimitTriggerLock; - std::set*> m_sc1LimitTriggers; - - AOL_namespace::mutex m_sc21LimitTriggerLock; - std::set*> m_sc21LimitTriggers; - - static void _scheduleLimitTrigger(pipeDrivenSignal *t, const ringBufferAccess_t readPtr, - AOL_namespace::mutex &streamLock, const ringBuffer_t &ringBuffer, - AOL_namespace::mutex &triggerSetLock, - std::set*> &triggerSet) throw(); -#endif - void _setupBuffers(const uniString::utf8& logString, const bool re_init = false) throw(); - - const bool updateSourceSampleRate(unsigned int& samplerate, const unsigned int read_samplerate) throw(); - - void YP2_add() throw(); - void _YP2_add() throw(); - void YP2_remove() throw(); - void _YP2_remove() throw(); - void YP2_update() throw(); - - // you must remove this streamData object from the g_streamMap immediately before or after calling - // this, otherwise you'll corrupt the static structures. - // Reason: die will cause the streamData to be removed from g_streams, but since die() causes ID() to return zero, - // it will not get removed from g_streamMap - void die() throw(); - - parserInfo *m_parser; - -public: - explicit streamData(const streamSetup& setup) throw(); // create shoutcast 1 - - void streamUpdate(const streamID_t ID, const uniString::utf8 &authHash, const int streamMaxUser, - const int streamMaxBitrate, const int streamMinBitrate) throw(); - - ~streamData() throw(); - - void sourceReconnect(const streamSetup& setup) throw(); // reconnect as shoutcast 1 - - static MP3_FrameInfo *detectMP3 (unsigned int &failureThresh,const unsigned char *buf, unsigned int len, unsigned chk); - int detectMP3 (MP3_FrameInfo *&parser, unsigned int &failureThresh,const unsigned char *buf, unsigned int len, unsigned chk); - - static AAC_FrameInfo *detectAAC (unsigned int &failureThresh,const unsigned char *buf, unsigned int len, unsigned chk); - int detectAAC (parserInfo *&parser, unsigned int &failureThresh,const unsigned char *buf, unsigned int len, unsigned chk); - - static int getFrameInfo (parserInfo *&parser, unsigned int &failureThresh,const unsigned char *buf, unsigned int len, unsigned chk = 6); - - const bool syncToStream(short unsigned int& remainderSize, __uint8 *remainder, - int amt, int& bitrate, const int type, const char *buf, - const uniString::utf8& logString); - - const bool isSourceCompatible(const streamSetup& setup) const throw(); // is this configuration compatible with the existing stream - - static uniString::utf8 getHTML5Player(const size_t sid) throw(); - static uniString::utf8 getStreamMessage(const size_t sid) throw(); - static void updateStreamMessage(const size_t sid, const uniString::utf8& message) throw(); - - const streamID_t ID() const { return (m_dead ? 0 : m_ID); } - const time_t getStartTime() const { return m_startTime; } - const streamInfo &getInfo() const { return m_streamInfo; } - const uniString::utf8& streamName() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_streamName; } - const uniString::utf8& streamGenre() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_streamGenre[0]; } - const uniString::utf8& streamGenre2() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_streamGenre[1]; } - const uniString::utf8& streamGenre3() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_streamGenre[2]; } - const uniString::utf8& streamGenre4() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_streamGenre[3]; } - const uniString::utf8& streamGenre5() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_streamGenre[4]; } - const uniString::utf8& streamURL() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_streamURL; } - const uniString::utf8& radionomyID() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_radionomyID; } - const uniString::utf8& streamContentType() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_contentType; } - const int streamBitrate() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_streamBitrate; } - const bool streamPublic() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_streamPublic; } - const bool streamIsVBR() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_vbr; } - const bool allowPublicRelay() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_allowPublicRelay; } - const int streamSampleRate() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_streamSampleRate; } - const int streamAvgBitrate() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_avgBitrate; } - const int streamActualMaxBitrate() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_maxBitrate; } - const int streamUvoxDataType() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_uvoxDataType; } - const uniString::utf8& streamBackupServer() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_backupServer; } - const std::vector& streamBackupServers() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_backupServersList; } - const uniString::utf8& streamPublicIP() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_publicIP; } - const uniString::utf8& streamAuthhash() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_authHash; } - const int streamMaxUser() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_streamMaxUser; } - const int streamMaxBitrate() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_streamMaxBitrate; } - const int streamMinBitrate() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_streamMinBitrate; } - - const int streamAdvertMode() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_advertMode; } - const uniString::utf8& authUrl() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_authUrl; } - const uniString::utf8& advertsUrl() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_advertsUrl; } - const uniString::utf8& audienceUrl() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_audienceUrl; } - const uniString::utf8& tuneinAirApiUrl() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_tuneinAirApiUrl; } - const uniString::utf8& targetSpotUrl() const throw() { stackLock sml(m_stateLock); return m_streamInfo.m_targetSpotUrl; } - - const std::vector<__uint8>& streamAlbumArt() const throw() { stackLock sml(m_stateLock); return m_sc21AlbumArtData[0]; } - const std::vector<__uint8>& streamPlayingAlbumArt() const throw() { stackLock sml(m_stateLock); return m_sc21AlbumArtData[1]; } - - const size_t streamAlbumArtMime() const throw() { stackLock sml(m_stateLock); return m_sc21AlbumArtMime[0]; } - const size_t streamPlayingAlbumArtMime() const throw() { stackLock sml(m_stateLock); return m_sc21AlbumArtMime[1]; } - - // streamSetMimeType is only used by uvox 2 since the determination must be delayed until the first data packet - void streamSetMimeType(const uniString::utf8 &mt) throw() { stackLock sml(m_stateLock); m_streamInfo.m_contentType = mt; } - - static bool isRelayStream(const streamID_t id) throw(); - static bool isBackupStream(const streamID_t id) throw(); - const int isDead() const throw() { stackLock sml(m_stateLock); return m_dead; } - void setKill(int kill) throw() { stackLock sml(m_stateLock); m_kill = kill; } - const int isKill() const throw() { stackLock sml(m_stateLock); return m_kill; } - - void updateSongHistorySize() throw(); - void pushMetricsYP (bool force = true); - - void updateSourceIdent(uniString::utf8& sourceIdent, const bool relay = false) throw(); - - // write data into ring buffers (sc1 and sc2) - #if defined(_DEBUG) || defined(DEBUG) - void writeSc1(const __uint8 *data, const int amt, const streamID_t id); - #else - void writeSc1(const __uint8 *data, const int amt); - #endif - void writeSc21(const std::vector<__uint8> &data) throw(); // data is exactly one uvox data packet or packet of uvox passthru metadata. - // passthru metadata is treated just like regular data, but we obviously - // can't pass it to the sc1 buffers since there is no analog for that in sc1 - - const int getStreamData(streamData::ringBufferAccess_t& amt, const streamData::ringBufferAccess_t& readPtr, - std::vector<__uint8>& data, const size_t remSize, const bool sc2 = false) throw(); /* for readers only */ - - // make sure streamData is not holding a reference to this. - void abandonLimitTrigger(pipeDrivenSignal *t, const bool sc2 = false) throw(); - void scheduleLimitTrigger(pipeDrivenSignal *t, const ringBufferAccess_t readPtr, const bool sc2 = false) throw(); - - // add shoutcast1 metadata at current position. This is just the string - int addSc1MetadataAtCurrentPosition(const uniString::utf8& logString, const uniString::utf8& sc1_metadata_raw, - const uniString::utf8& sc1_url_raw, const uniString::utf8& sc1_next_raw) throw(); - int addUvoxMetadataAtCurrentPosition(__uint16 voxMsgType,const std::vector<__uint8> &data) throw(); - - // get metadata that is appropriate for the indicated position - sc1MetadataAndExtensionInfo getSc1Metadata(const ringBufferAccess_t) throw(); - uvoxMetadata_t getSc21Metadata(const ringBufferAccess_t) throw(); - uvoxMetadata_t getSc21StreamAlbumArt(const ringBufferAccess_t) throw(); - uvoxMetadata_t getSc21PlayingAlbumArt(const ringBufferAccess_t) throw(); - // - void clearCachedMetadata() throw(); // clear all metadata that is in caches - void clearCachedArtwork(const size_t index) throw(); // clears specific artwork - // - void resetAdvertTriggers(const uniString::utf8& m_updinfoSong); - - // get good places for a client to start - const ringBufferAccess_t getClientStartPosition(const bool sc2 = false) throw(); - ringBufferAccess_t getClientStartPosition(ringBufferAccess_t ptr, bool sc2) throw(); - - specialFileData& getIntroFile() throw() { return m_introFile; } - specialFileData& getBackupFile() throw() { return m_backupFile; } - specialFileData& getAdTestFile(const int num) throw() - { - switch (num) - { - case 1: return m_adTestFile2; - case 2: return m_adTestFile3; - case 3: return m_adTestFile4; - default: return m_adTestFile; - } - } - - static int YP_SrvID(const streamID_t id) throw(); - static int YP_StnID(const streamID_t id) throw(); - - void updateStreamUser(const uniString::utf8& streamUser); - void resetStreamAuthhash(); - - // get the current title (if there is one) for touches/updates/tunein air api/etc - uniString::utf8 getYPStreamTitle() throw(); - - void YP2_updateInfo(const yp2::stationInfo &info) throw(); - bool YP2_addSuccessful(int &addFailIgnore, int &errorCode) throw(); -}; - -// advert related - -class adGroupAccess -{ - friend class streamData::adGroups; - size_t group; - int idx; - bool m_sc2; // use until the data buffer duplication is fixed - bool m_grpChanged; - streamData::adGroup *cached_ref; - streamData::adGroupQueue *m_groupQueue; - - bool foundNextAdvert (const streamData::streamID_t sid, streamData::adGroups &groups, streamData::adGroup &g); - streamData::adGroup *getGroup(streamData::streamID_t sid, streamData::adGroups &groups, const bool testing); - -public: - size_t offset; - size_t total_processed; - time_t start_time; - unsigned m_duration; - - explicit adGroupAccess(bool sc2 = false, int id = 0) { group = id; m_sc2 = sc2; idx = 0; cached_ref = NULL; offset = 0; m_grpChanged = false; m_groupQueue = NULL; } - - void setGroup (size_t id); - size_t getGroup() const { return group; } - const bool inAdvertMode() const; - - void changedGroup (streamData::adGroups &groups); - bool haveAdverts(const streamData::streamID_t sid, streamData::adGroups &groups, streamData::ringBufferAccess_t pos); - streamData::specialFileData *getAd(const streamData::streamID_t sid, streamData::adGroups &groups, const bool testing); - bool anotherAd(const streamData::streamID_t sid, streamData::adGroups &groups, const bool testing); - void stopAdRun(const streamData::streamID_t sid, streamData::adGroups &groups, const bool testing); - const streamData::adTrigger *getCurrentTrigger () const { return cached_ref ? cached_ref->m_trigger : NULL; } -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/threadedRunner.cpp b/Src/Plugins/DSP/sc_serv3/threadedRunner.cpp deleted file mode 100644 index c2e5d94d..00000000 --- a/Src/Plugins/DSP/sc_serv3/threadedRunner.cpp +++ /dev/null @@ -1,1135 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include -#include "threadedRunner.h" -#include -#include "global.h" -#include "stl/stringUtils.h" -#include "services/stdServiceImpl.h" -#include "protocol_HTTPStyle.h" -#include "protocol_HTTPSource.h" -#include "protocol_shoutcastSource.h" -#include "protocol_FlashPolicyServer.h" -#include "protocol_uvox2Source.h" -#include "uvox2Common.h" -#include "banList.h" -#include "ripList.h" -#ifdef _MSC_VER -#define MSG_DONTWAIT 0 -#else -#include -#include -#ifndef EPOLLRDHUP -#define EPOLLRDHUP 0x2000 -#endif -#endif - -using namespace std; -using namespace stringUtil; -using namespace uniString; - -#define LOGNAME "[THREADRUNNER] " -#define DEBUG_LOG(...) do { if (gOptions.threadRunnerDebug()) DLOG(__VA_ARGS__); } while (0) - -#ifndef SSL_OP_NO_COMPRESSION -#define SSL_OP_NO_COMPRESSION 0 -#endif - -// make standard string for logging address -inline utf8 addrLogString(const utf8 &addr, const u_short port, const utf8 &xff) throw() -{ - const bool use_xff = (gOptions.useXFF() && !xff.empty()); - return (use_xff ? xff : addr) + ":" + tos(port) + (use_xff ? " (xff)" : ""); -} - -// make standard string for logging src address -utf8 srcAddrLogString(const utf8 &addr, const u_short port, const size_t sid) throw() -{ - return "[SRC " + addrLogString(addr, port) + (sid > 0 ? " sid=" + tos(sid) : "") + "] "; -} -// make standard string for loggin dst address -utf8 dstAddrLogString(const utf8 &addr, const u_short port, const utf8 &xff, const size_t sid) throw() -{ - return "[DST " + addrLogString(addr, port, xff) + (sid > 0 ? " sid=" + tos(sid) : "") + "] "; -} -// make standard string for logging unknown address -utf8 recvAddrLogString(const utf8 &addr, const u_short port) throw() -{ - return "[RECV " + addrLogString(addr, port) + "] "; -} -// make standard string for socket error -string socketErrString(int err) throw() { return "err=" + socketOps::errMsg(err) + "(" + tos(err) + ")"; } - -static AOL_namespace::mutex sm_globalRunnerLock; -static set sm_runners; - -SSL_CTX *threadedRunner::m_sslCtx = NULL; -AOL_namespace::mutex *threadedRunner::m_sslMutexes = NULL; - -static bool cmp(threadedRunner* a, threadedRunner* b) throw() -{ - return (a->sizeOfRunList() < b->sizeOfRunList()); -} - -bool threadedRunner::scheduleRunnable(runnable *r) throw() -{ - if (r) - { - stackLock sml(sm_globalRunnerLock); - - // diagnostics. Print load - if (gOptions.threadRunnerDebug()) - { - utf8 msg = LOGNAME; - for (set::const_iterator i = sm_runners.begin(); i != sm_runners.end(); ++i) - { - msg += ((i == sm_runners.begin() ? "Thread " : ", thread ") + (*i)->threadNumber() + " amt=" + tos((*i)->sizeOfRunList())); - } - DEBUG_LOG(msg); - } - - // find least busy - set::const_iterator which = min_element(sm_runners.begin(), sm_runners.end(), cmp); - if ((which != sm_runners.end()) && (*which)->addRunnable(r)) - { - return true; - } - - // didn't work... schedule anywhere - DEBUG_LOG(LOGNAME "Schedule failure, trying any thread"); - for (set::const_iterator i = sm_runners.begin(); i != sm_runners.end(); ++i) - { - if ((*i)->addRunnable(r)) - { - return true; - } - } - } - return false; -} - -void threadedRunner::wakeup() throw() -{ - stackLock sml(sm_globalRunnerLock); - - for (set::const_iterator i = sm_runners.begin(); i != sm_runners.end(); ++i) - { - (*i)->wakeupRunnable(); - } -} - -uniString::utf8 threadedRunner::getRunnabledetails() throw() -{ - stackLock sml(sm_globalRunnerLock); - - utf8 details; - for (set::const_iterator i = sm_runners.begin(); i != sm_runners.end(); ++i) - { - details += (i != sm_runners.begin() ? "
" : (utf8)"") + "Thread #" + - (*i)->threadNumber() + ": " + tos((*i)->sizeOfRunList()) + - "
"; - - map runners; - (*i)->enumRunnables(runners); - for (map::const_iterator r = runners.begin(); r != runners.end(); ++r) - { - details += (r != runners.begin() ? "
" : "") + (*r).first + " - " + tos((*r).second); - } - details += "
"; - } - return details; -} - -threadedRunner::threadedRunner() throw() : m_stop(false), m_threadNumber((const short)(sm_runners.size() + 1)) -{ - stackLock sml(sm_globalRunnerLock); - sm_runners.insert(this); -} - -threadedRunner::~threadedRunner() throw() -{ - stackLock sml(sm_globalRunnerLock); - sm_runners.erase(this); -} - -// main loop of thread -const unsigned threadedRunner::operator()() throw() -{ - unsigned result = 1; - - try - { - m_lock.lock(); - while (!m_stop) - { - m_lock.unlock(); - - std::set readSet, writeSet; - int timeout = -1; - - // run everyone (as long as not scheduled) and get their status information, etc - set::const_iterator i = m_runList.begin(); - while (i != m_runList.end()) - { - runnable::timeSliceResult &tsr = (*i)->m_result; - __uint64 now = time_now_ms(); - - // if we're indicated as being scheduled then we - // need to skip doing anything else and look at - // checking if it's ok to process or not, etc - if (tsr.m_scheduleTime) - { - if (now < tsr.m_scheduleTime) - { - int time_diff = (int)(tsr.m_scheduleTime - now); - if (timeout == -1) - { - timeout = time_diff; - } - else - { - timeout = min(timeout, time_diff); - } - ++i; - continue; - } - else - { - // we clear this as we're reached time - // but not the rest as we want what was - // set to now be used in the processing - tsr.m_scheduleTime = 0; - } - } - - // make sure to reset otherwise it gets weird but - // we're only going to do this if we are able to - // run the runnable now (i.e. it's not scheduled) - tsr.reset(now); - - bool exception_occured = false; - try - { - (*i)->timeSlice(); - } - catch (const exception &ex) - { - exception_occured = true; - utf8 what = ex.what(); - if (!what.empty()) - { - ELOG(ex.what()); - } - } - - if (tsr.m_done || exception_occured) - { - set::const_iterator to_go = i; - DEBUG_LOG(LOGNAME "Removing " + (*i)->name() + " [done: " + tos(tsr.m_done) + ", exception: " + tos(exception_occured) + "]"); - removeRunnable(*to_go); - ++i; - m_runList.erase (to_go); - continue; - } - if (!tsr.m_runImmediately) - { - if (!tsr.m_scheduleTime) - { -update_sets: - if (tsr.m_readSet) - { - // filter out anything with an invalid socket - if ((*i)->m_socket != socketOps::cINVALID_SOCKET) - { - readSet.insert(readSet.end(), (*i)->m_socket); - } - if (tsr.m_customSocket != socketOps::cINVALID_SOCKET) - { - readSet.insert(readSet.end(), tsr.m_customSocket); - } - } - - if (tsr.m_writeSet) - { - // filter out anything with an invalid socket - if ((*i)->m_socket != socketOps::cINVALID_SOCKET) - { - writeSet.insert(writeSet.end(), (*i)->m_socket); - } - if (tsr.m_customSocket != socketOps::cINVALID_SOCKET) - { - writeSet.insert(writeSet.end(), tsr.m_customSocket); - } - } - - if (tsr.m_timeout != -1) - { - if (timeout == -1) - { - timeout = tsr.m_timeout; - } - else - { - timeout = min(timeout, tsr.m_timeout); - } - } - } - else - { - // if this is to be scheduled then we'll do a - // quick check to see if we're already after - // that time and if it isn't (which is how it - // should be) then we'll abort, else allow it - // and we get the time again to account for - // the time it's taken to process the runnable - now = time_now_ms(); - if (now < tsr.m_scheduleTime) - { - int time_diff = (int)(tsr.m_scheduleTime - now); - if (timeout == -1) - { - timeout = time_diff; - } - else - { - timeout = min(timeout, time_diff); - } - } - else - { - // we clear this as we're reached time - // but not the rest as we want what was - // set to now be used in the processing - tsr.m_scheduleTime = 0; - timeout = 50; - goto update_sets; - } - } - ++i; - } - } // for - - // delete the old guys, no lock required here, only we add to this set - int released = 0; - while (true) - { - set::const_iterator it = m_runnablesToRemove.begin(); - if (it == m_runnablesToRemove.end()) - break; - if (++released > 300) - { - timeout &= 15; // prevent a large stall but force a quick retry - break; - } - stlx::delete_fntr (*it); - m_runnablesToRemove.erase (it); - } - - readSet.insert (m_signal.test()); - if (timeout < 0) - timeout = 60000; - int n = socketOps::socketSelect(readSet, writeSet, timeout); - - m_lock.lock(); - - // add the new guys, requires lock as set can be added from elsewhere - m_runList.insert(m_runnablesToAdd.begin(), m_runnablesToAdd.end()); - m_runnablesToAdd.clear(); - - if (n > 0) - m_signal.clear(); - } - m_lock.unlock(); - result = 0; - } - catch (const exception &ex) - { - ELOG(LOGNAME + string(ex.what())); - } - catch (...) - { - ELOG(LOGNAME "Unknown exception"); - } - - // delete runnables in run list, and those that are queued to be added - m_lock.lock(); - for_each(m_runnablesToAdd.begin(), m_runnablesToAdd.end(), stlx::delete_fntr); - m_lock.unlock(); - - for_each(m_runList.begin(), m_runList.end(), stlx::delete_fntr); - - return result; -} - -const size_t threadedRunner::sizeOfRunList() throw() -{ - stackLock sml(m_lock); - const size_t result = (m_runList.size() + m_runnablesToAdd.size()); - const size_t subtr = m_runnablesToRemove.size(); - return (subtr > result ? 0 : result - subtr); -} - -const bool threadedRunner::addRunnable(runnable* r) throw() -{ - if (!r) - { - return false; - } - - stackLock sml(m_lock); - if (m_stop) - { - return false; - } - - m_runnablesToAdd.insert(r); - m_signal.set(); - DEBUG_LOG(LOGNAME "Adding " + r->name() + " to thread " + tos(m_threadNumber)); - - return true; -} - -const bool threadedRunner::removeRunnable(runnable *r) throw() -{ - if (!r) - { - return false; - } - - m_runnablesToRemove.insert(r); - m_signal.set(); - DEBUG_LOG(LOGNAME "Removing " + r->name() + " from thread " + tos(m_threadNumber)); - return true; -} - -void threadedRunner::enumRunnables(map& runners) throw() -{ - stackLock sml(m_lock); - - for (set::const_iterator i = m_runList.begin(); i != m_runList.end(); ++i) - { - const utf8::size_type pos = (*i)->name().find((utf8)"protocol_"); - if (pos != utf8::npos) - { - ++runners[(*i)->name().substr(pos + 9, (*i)->name().length())]; - } - else - { - ++runners[(*i)->name()]; - } - } -} - -void threadedRunner::wakeupRunnable() throw() -{ - if (m_lock.timedLock(1000)) - { - m_signal.set(); - m_lock.unlock(); - } -} - -void threadedRunner::stop() throw() -{ - stackLock sml(m_lock); - m_stop = true; - m_signal.set(); -} - -/////////////////////////// -#ifdef LOGNAME -#undef LOGNAME -#endif -#define LOGNAME "[MICROSERVER] " - -#ifdef DEBUG_LOG -#undef DEBUG_LOG -#endif -#define DEBUG_LOG(x) { if (gOptions.microServerDebug()) DLOG((x)); } - -microServer::microServer(const string &listenAddr, const u_short listenPort, - const AllowableProtocols_t protocols, - const ListenTypes_t types) throw(exception) - : m_protocols(protocols) -{ - try - { - m_socket = socketOps::createTCPSocketTHROW(); - #ifndef _WIN32 - { - int bflag = 1; - setsockopt(m_socket, SOL_SOCKET, SO_REUSEADDR, &bflag, sizeof(bflag)); - #if (defined PLATFORM_LINUX || defined PLATFORM_ARMv6 || defined PLATFORM_ARMv7) - int wait = 1; - setsockopt(m_socket, IPPROTO_TCP, TCP_DEFER_ACCEPT, &wait, sizeof(wait)); - #endif - #ifdef PLATFORM_BSD - struct accept_filter_arg af = {"dataready", ""}; - setsockopt(m_socket, SOL_SOCKET, SO_ACCEPTFILTER, &af, sizeof(af)); - #endif - } - #endif - socketOps::bindTHROW(m_socket, listenPort, listenAddr); - socketOps::listenTHROW(m_socket); - socketOps::setNonblockTHROW(m_socket, true); - - bindMessage(types, listenPort); - } - catch (const exception &ex) - { - socketOps::forgetTCPSocket(m_socket); - string error = ex.what(); - throw runtime_error(LOGNAME "Error opening port " + tos(listenPort) + " because " + toLower(error)); - } -} - -void microServer::bindMessage(const ListenTypes_t types, const u_short listenPort) throw() -{ - string message = "Listening for connections on port "; - - if ((types & microServer::L_SOURCE) && (types & microServer::L_CLIENT)) - { - message = "Listening for source and client connections on port "; - } - else if ((types & microServer::L_FLASH)) - { - message = "Listening for flash policy server connection on port "; - } - else if ((types & microServer::L_SOURCE)) - { - message = "Listening for legacy source connections on port "; - } - else if ((types & microServer::L_SOURCE2)) - { - message = "Listening for source connections on port "; - } - else if ((types & microServer::L_CLIENT_ALT)) - { - message = "Listening for client connections on alternate port "; - } - else if ((types & microServer::L_CLIENT)) - { - message = "Listening for client connections on port "; - } - ILOG(LOGNAME + message + tos(listenPort)); -} - -void microServer::updateProtocols(AllowableProtocols_t protocols, ListenTypes_t types, const u_short listenPort) throw() -{ - m_protocols = protocols; - bindMessage(types, listenPort); -} - -microServer::~microServer() throw() -{ - string addr; - u_short port = 0; - socketOps::getsockname(m_socket, addr, port); - socketOps::forgetTCPSocket(m_socket); - if (!iskilled()) - { - ELOG(LOGNAME "Unexpected stop detected for listening for connections on port " + tos(port)); - ELOG(LOGNAME "This should not happen and prevents the DNAS from working correctly."); - ELOG(LOGNAME "DNAS restart is required. If this keeps happening, enable all debugging options and provide the logs to Shoutcast support."); - } - else - { - DEBUG_LOG(LOGNAME "Stopped listening for connections on port " + tos(port)); - } -} - -void microServer::timeSlice() throw(exception) -{ - static int repeated = 0; - - // don't allow any new connections when the server is stopping - if (!iskilled()) - { - try - { - string addr; - u_short port = 0; - - socketOps::tSOCKET newSock = socketOps::acceptTHROW(m_socket, addr, port, true); - if (newSock != socketOps::cSOCKET_ERROR) - { - socketOps::getpeername(newSock, addr, port); - - string hostName = addr; - if (gOptions.nameLookups()) - { - if (socketOps::addressToHostName(addr, port, hostName)) - { - hostName = addr; - } - } - - socketOps::setNonblockTHROW(newSock, true); - DEBUG_LOG(LOGNAME "Connection received from " + addr + ":" + tos(port)); - threadedRunner::scheduleRunnable(new microConnection(newSock, hostName, addr, port, m_protocols)); - repeated = 0; - } - } - catch (const tagged_error &ex) - { - ELOG(ex.what()); - } - catch (const exception &ex) - { - string msg = ex.what(); - if (!msg.empty()) - { - if (msg.find("Could not call") == 0) - { - // serious error, log unless repeated and delay a retry - if ((repeated & 255) == 0) - ELOG(LOGNAME + msg); - ++repeated; - m_result.schedule (1000); - return; - } - ELOG(LOGNAME + msg); - } - } - - m_result.read(); - return; - } - - m_result.done(); -} - -/////////////////////////////////////////////////// -microConnection::microConnection(const socketOps::tSOCKET s, const string &hostName, const string &addr, - const u_short port, const microServer::AllowableProtocols_t protocols) throw() - : runnable(s), m_srcHostName(hostName), - m_srcAddress(addr), m_srcPort(port), - m_protocols(protocols) -{ -} - -microConnection::~microConnection() throw() -{ - socketOps::forgetTCPSocket(m_socket); -} - -void microConnection::timeSlice() throw(exception) -{ - time_t cur_time; - const int autoDumpTime = ::detectAutoDumpTimeout(cur_time, m_lastActivityTime, (recvAddrLogString(m_srcAddress, m_srcPort) + - "Got timeout waiting for data"), gOptions.microServerDebug()); - - const int maxHeaderLineSize = gOptions.maxHeaderLineSize(); - const bool flash_policy = !!(m_protocols & P_FLASHPOLICYFILE); - bool uvox_checked = false; - runnable *runnable = NULL; - - char buf[MAX_MESSAGE_SIZE] = {0}; - // if we've got a 1.x source connection then only handle - // on a per-byte basis, for everything else, try getting - // a few bytes so we can use that as a guide on how then - // to try to process things a bit quicker than per-byte. - // int amt = (!(m_protocols & P_SHOUTCAST1SOURCE) ? UV2X_HDR_SIZE : 1); - int amt = (m_ssl) ? 1 : 4096; - ssize_t rval = 0; - - while (true) - { - if (iskilled() || (size_t)amt > sizeof(buf)) - { - m_result.done(); - return; - } - - int flags = (m_lineBuffer.size() || m_ssl) ? 0 : MSG_PEEK; // use PEEK initially as SSL requires bytes in the socket - if ((rval = recv (buf, amt, flags|MSG_DONTWAIT)) < 1) - { - if (rval == 0) - { - throwEx((gOptions.microServerDebug() ? (recvAddrLogString(m_srcAddress, m_srcPort) + - "Remote socket closed while waiting for data.") : (utf8)"")); - } - else if (rval < 0) - { - rval = socketOps::errCode(); - if (rval != SOCKETOPS_WOULDBLOCK) - { - throwEx((gOptions.microServerDebug() ? (recvAddrLogString(m_srcAddress, m_srcPort) + - "Socket error while waiting for data. " + socketErrString(rval)) : (utf8)"")); - } - - m_result.schedule(); - m_result.read(); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - return; - } - } - - m_lineBuffer.insert (m_lineBuffer.end(), buf, buf + rval); - int lineSize = (int)m_lineBuffer.size(); - - if (lineSize > maxHeaderLineSize) - { - throwEx((gOptions.microServerDebug() ? (recvAddrLogString(m_srcAddress, m_srcPort) + - "Protocol header line is too large - exceeds " + tos(maxHeaderLineSize) + - " bytes") : (utf8)"")); - } - if (m_ssl == NULL && flags && (m_lineBuffer [0] == 0x16)) // SSLv3 / TLSv1.x ? - { - if (threadedRunner::m_sslCtx == NULL) - { - throwEx((gOptions.microServerDebug() ? (recvAddrLogString(m_srcAddress, m_srcPort) + - "Remote socket closed, no SSL configured.") : (utf8)"")); - } - if (lineSize < 6) - { - m_result.schedule(); - m_result.read(); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - return; - } - if ((m_lineBuffer [1] == 0x3) && (m_lineBuffer [5] == 0x1)) - { - DLOG ("detected ssl request, checking further"); - m_ssl = SSL_new (threadedRunner::m_sslCtx); - SSL_set_accept_state (m_ssl); - SSL_set_fd (m_ssl, (int)m_socket); - SSL_set_mode (m_ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER|SSL_MODE_ENABLE_PARTIAL_WRITE); - m_lineBuffer.clear(); - continue; - } - } - utf8::size_type nl = m_lineBuffer.find ((unsigned char)'\n'); - if (nl != utf8::npos) - { - rval = lineSize = (int)nl+1; // 0 offset - if (flags) m_lineBuffer.erase (lineSize); // truncate line to maintain parsing - } - - if (flags) - ::recv (m_socket, buf, rval, MSG_DONTWAIT); // pull bytes from input, passed any PEEK requirement - - if ((lineSize > 0) && (lineSize < UV2X_HDR_SIZE) && (m_lineBuffer [lineSize - 1] != '\n')) - { - if (m_lineBuffer[0] == UVOX2_SYNC_BYTE) - { - // if it looks like it might be a uvox - // frame then grab more on the next go - amt = 3; - } - else - { - // no point in doing any of the checks - // if there is not enough data to view - // e.g. we need to see a valid newline - amt = 1; - } - - m_lastActivityTime = ::time(NULL); - continue; - } - if ((lineSize >= UV2X_HDR_SIZE) && (uvox_checked == false)) - { - // look at first uvox packet to see if we're running uvox 2 or uvox 2.1 - // NOTE: This is a protocol change. We need to add a new packet to 2.1 so request cipher key - const uv2xHdr *voxhdr = reinterpret_cast(m_lineBuffer.c_str()); - if ((voxhdr->sync == UVOX2_SYNC_BYTE) && - (ntohs(voxhdr->msgType) == (u_short)MSG_CIPHER)) - { - const int wanted = (ntohs(voxhdr->msgLen) + UV2X_OVERHEAD); - if (wanted == lineSize) - { - // we have uvox 2.1 - if (m_protocols & P_SHOUTCAST2SOURCE) // only if allowed - { - runnable = new protocol_uvox2Source (*this, (const __uint8 *)m_lineBuffer.c_str(), lineSize); - } - break; - } - amt = min(MAX_MESSAGE_SIZE, (wanted - lineSize)); - m_lastActivityTime = ::time(NULL); - continue; - } - // if we've got enough and there's no sync - // byte then there's not point to re-check. - uvox_checked = true; - } - - if ((lineSize > 0) && (m_lineBuffer[lineSize - 1] == '\n')) - { - // look at start of line, if it's a GET or POST or some standard HTTP thing, then we - // have either a web request or a client connection request. If that is missing, then - // we have to assume it's a shoutcast source, and we have just received the password. - // - // this should be enough to detect absolute and relative requests made to the server - // if there's no / for absolute paths then we'll reject the request as a bad access. - if ((m_lineBuffer.find((utf8)"GET /") == 0) || - (m_lineBuffer.find((utf8)"GET h") == 0) || - (m_lineBuffer.find((utf8)"POST /") == 0) || - (m_lineBuffer.find((utf8)"POST h") == 0) || - (m_lineBuffer.find((utf8)"HEAD /") == 0) || - (m_lineBuffer.find((utf8)"HEAD h") == 0)) - { - if (m_protocols & (P_SHOUTCAST1CLIENT | - P_SHOUTCAST2CLIENT | - P_WEB | P_WEB_SETUP)) - { - runnable = new protocol_HTTPStyle (*this, stripWhitespace(m_lineBuffer).hideAsString()); - } - break; - } - else // assume shoutcast source, and this is the password (though do some checks to sanitise) - { - // and now look for invalid HTTP requests and - // reject them as the earlier handling should - // allow valid relative and absolute requests - if (lineSize > 5) - { - if ((m_lineBuffer.find((utf8)"GET ") == 0) || - (m_lineBuffer.find((utf8)"POST ") == 0) || - (m_lineBuffer.find((utf8)"SOURCE ") == 0) || - (m_lineBuffer.find((utf8)"PUT ") == 0) || - (m_lineBuffer.find((utf8)"HEAD ") == 0)) - { - throwEx((gOptions.microServerDebug() ? (recvAddrLogString(m_srcAddress, m_srcPort) + - "Invalid HTTP request detected - only valid relative and absolute paths are allowed.") : (utf8)"")); - } - } - - // if we appear to have a 'PUT' or 'SOURCE' request then we'll need to - // do some different handling in-order to get the correct details before - // we can then actually process the stream as a valid (icecast?) source - if (((m_lineBuffer.find((utf8)"SOURCE ") == 0) || - (m_lineBuffer.find((utf8)"PUT ") == 0)) && - ((m_lineBuffer.find((utf8)"HTTP/1.") != utf8::npos) || - (m_lineBuffer.find((utf8)"ICE/1.") != utf8::npos))) - { - runnable = new protocol_HTTPSource (*this, stripWhitespace(m_lineBuffer).hideAsString()); - } - else - { - runnable = new protocol_shoutcastSource (*this, stripWhitespace(m_lineBuffer)); - } - } - break; - } - if (flash_policy && (m_lineBuffer.find((utf8)"") == 0)) - { - runnable = new protocol_FlashPolicyServer (m_socket, dstAddrLogString(m_srcHostName, m_srcPort)); - break; - } - amt = 1; - m_lastActivityTime = ::time(NULL); - } // while - - if (runnable) - { - threadedRunner::scheduleRunnable (runnable); - } - m_result.done(); - return; -} - -///////////////////////////////////////////////////////////////////////////////////////// - -// return 0 if line is ready, or a timeout in seconds for next select call if we are still waiting -// lineBuffer and lastActivityTime are updated by this call -const bool runnable::getHTTPStyleHeaderLine(const size_t sid, utf8 &lineBuffer, const utf8 &logMsgPrefix, int maxLineLength) throw(exception) -{ - time_t cur_time; - const int autoDumpTime = ::detectAutoDumpTimeout (cur_time, m_lastActivityTime, - (logMsgPrefix + "Timeout waiting for data"), gOptions.microServerDebug(), sid); - - const int maxHeaderLineSize = maxLineLength > 0 ? maxLineLength : gOptions.maxHeaderLineSize(); - int count = 0; - bool ret = true; - - while (true) - { - int rval = 0; - char buf[2] = {0}; - if ((rval = recv(buf, 1, 0x0)) < 1) - { - if (rval == 0) - { - if (gOptions.microServerDebug()) - ELOG (logMsgPrefix + "Remote socket closed while waiting for data.", LOGNAME, sid); - throwEx((utf8)""); - } - rval = socketOps::errCode(); - if (rval != SOCKETOPS_WOULDBLOCK) - { - if (gOptions.microServerDebug()) - ELOG (logMsgPrefix + "Socket error while waiting for data. " + socketErrString(rval), LOGNAME, sid); - throwEx((utf8)""); - } - - // if we've read something then it's likely to be from a POST response - if (lineBuffer.empty() == false) - { - ret = false; - if (count) break; - } - - // try again but wait a bit - // so we don't overload it. - m_result.schedule(30); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - return false; - } - ++count; - - lineBuffer.insert (lineBuffer.end(), buf, buf + rval); - - const int lineSize = (int)lineBuffer.size(); - if (lineSize == maxLineLength) break; - if (lineSize > maxHeaderLineSize) - { - ELOG (logMsgPrefix + "Protocol header line is too large - exceeds " - + tos(maxHeaderLineSize) + " bytes", LOGNAME, sid); - throwEx ((utf8)""); - } - if ((lineSize > 0) && lineBuffer [lineSize - 1] == '\n') - { - break; - } - } - m_result.run(); - m_lastActivityTime = ::time(NULL); - return ret; -} - -// send a hunk of data out a socket - returns true if send is complete, -// outBuffer and outBufferSize should be initially set to point to the -// data and the size of the data - these values are moved and updated. -const bool runnable::sendDataBuffer(const size_t sid, const uniString::utf8::value_type *&outBuffer, - int &outBufferSize, const uniString::utf8 &logMsgPrefix) throw(std::exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(logMsgPrefix + __FUNCTION__ + " " + tos(outBufferSize)); -#endif - - if (outBufferSize > 0) // done - { - time_t cur_time; - const int autoDumpTime = ::detectAutoDumpTimeout(cur_time, m_lastActivityTime, - (logMsgPrefix + "Timeout waiting to send data"), - gOptions.microServerDebug(), sid); - - int rval = send ((const char *)outBuffer, outBufferSize, 0); - if (rval == 0) - { - throwEx((gOptions.microServerDebug() ? (logMsgPrefix + - "Remote socket closed while sending data") : - (uniString::utf8)"")); - } - else if (rval < 0) - { - rval = socketOps::errCode(); - if (rval != SOCKETOPS_WOULDBLOCK) - { - throwEx((gOptions.microServerDebug() ? ((( - #ifdef _WIN32 - rval == WSAECONNABORTED || rval == WSAECONNRESET - #else - rval == ECONNABORTED || rval == ECONNRESET || rval == EPIPE - #endif - ) ? (uniString::utf8)"" : logMsgPrefix + - "Socket error while waiting to send data. " + - socketErrString(rval))) : (uniString::utf8)"")); - } - - // try again but wait a bit - // so we don't overload it. - m_result.schedule(); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - return false; - } - - // move pointers - outBufferSize -= rval; - outBuffer += rval; - - // update time - m_lastActivityTime = ::time(NULL); - m_result.timeout((autoDumpTime - (int)(cur_time - m_lastActivityTime))); - - if (outBufferSize == 0) // done - { - m_result.schedule(); - return true; - } - m_result.schedule (160); - return false; - } - - m_result.write(); - m_result.schedule(); - m_result.timeoutSID(sid); - return true; -} - - -runnable::runnable (runnable &r) throw() -{ - m_socket = r.m_socket; - m_ssl = r.m_ssl; - m_lastActivityTime = ::time (NULL); - // the following are handed off to this sub-protocol, so make sure they cannot affect them - r.m_socket = socketOps::cINVALID_SOCKET; - r.m_ssl = NULL; -} - - -ssize_t runnable::recv (void *buf, size_t len, int flags) -{ - if (m_ssl) - { - ssize_t bytes = SSL_read (m_ssl, buf, len); - int code = SSL_get_error (m_ssl, bytes); - // char err[128]; - - switch (code) - { - case SSL_ERROR_NONE: - case SSL_ERROR_ZERO_RETURN: - break; - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - return -1; - default: - bytes = 0; - } - return bytes; - } - return (ssize_t)::recv (m_socket, (char*)buf, len, flags); -} - - -ssize_t runnable::send(const void *buf, size_t len, int flags) -{ - if (m_ssl) - { - ssize_t bytes = SSL_write (m_ssl, buf, len); - int code = SSL_get_error (m_ssl, bytes); - // char err[128]; - - switch (code) - { - case SSL_ERROR_NONE: - case SSL_ERROR_ZERO_RETURN: - break; - case SSL_ERROR_WANT_READ: - case SSL_ERROR_WANT_WRITE: - return -1; - default: - return -1; - } - return bytes; - } - return (ssize_t)::send(m_socket, (char*)buf, len, flags); -} - -// This pick the dump time for sources, as there is no general class for that yet, unlike listeners -int runnable::detectAutoDumpTimeout (time_t &cur_time, const size_t streamID, const utf8 &msg) throw(runtime_error) -{ - const int autoDumpTime = gOptions.stream_autoDumpSourceTime(streamID); - - cur_time = ::time(NULL); - if ((autoDumpTime > 0) && ((cur_time - m_lastActivityTime) >= autoDumpTime)) - { - WLOG (msg, LOGNAME, streamID); - throwEx(""); - } - return autoDumpTime; -} - - -unsigned long threadedRunner::SSL_idFunction (void) -{ - return threadedRunner::getCurrentThreadID(); -} - -void threadedRunner::SSL_lockingFunction (int mode, int n, const char * /*file*/, int /*line*/) -{ - if (mode & CRYPTO_LOCK) - m_sslMutexes[n].lock(); - else - m_sslMutexes[n].unlock(); -} - - -void threadedRunner::SSL_shutdown () -{ -#if !defined(WIN32) && OPENSSL_VERSION_NUMBER < 0x10000000 - CRYPTO_set_id_callback (NULL); -#endif - CRYPTO_set_locking_callback (NULL); - if (m_sslCtx) - { - ::SSL_CTX_free (m_sslCtx); - m_sslCtx = NULL; - } - if (m_sslMutexes) - delete [] m_sslMutexes; - m_sslMutexes = NULL; -} - -void threadedRunner::SSL_init () -{ - SSL_load_error_strings(); - SSL_library_init (); - utf8 cert_file = gOptions.sslCertificateFile(); - utf8 key_file = gOptions.sslCertificateKeyFile(); - - do { - if (cert_file == "") break; - - CRYPTO_set_id_callback (&threadedRunner::SSL_idFunction); -#if !defined(WIN32) && OPENSSL_VERSION_NUMBER < 0x10000000 - CRYPTO_set_locking_callback (&threadedRunner::SSL_lockingFunction); -#endif - - m_sslMutexes = new AOL_namespace::mutex [CRYPTO_num_locks()]; - if (m_sslMutexes == NULL) - break; - - m_sslCtx = ::SSL_CTX_new (::SSLv23_server_method()); - - long ssl_opts = ::SSL_CTX_get_options (m_sslCtx); - ::SSL_CTX_set_options (m_sslCtx, ssl_opts|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_COMPRESSION); - - if (::SSL_CTX_use_certificate_chain_file (m_sslCtx, (char*)cert_file.c_str()) <= 0) - { - WLOG ("[MAIN] Invalid certificate file " + cert_file); - break; - } - - utf8 &pkfile = key_file.empty() ? cert_file : key_file; - if (::SSL_CTX_use_PrivateKey_file (m_sslCtx, (char*)pkfile.c_str(), SSL_FILETYPE_PEM) <= 0) - { - WLOG ("[MAIN] Invalid private key file " + pkfile); - break; - } - if (! SSL_CTX_check_private_key (m_sslCtx)) - { - WLOG ("[MAIN] Invalid, private key does not match public key, " + pkfile); - break; - } - ILOG ("[MAIN] SSL keys installed"); - return; - - } while (0); - if (m_sslCtx) - { - WLOG ("[MAIN] failed to set up SSL, " + utf8(::ERR_reason_error_string (::ERR_peek_last_error()))); - ::SSL_CTX_free (m_sslCtx); - m_sslCtx = NULL; - } - CRYPTO_set_id_callback (NULL); - CRYPTO_set_locking_callback (NULL); - if (m_sslMutexes) - delete [] m_sslMutexes; - m_sslMutexes = NULL; -} diff --git a/Src/Plugins/DSP/sc_serv3/threadedRunner.h b/Src/Plugins/DSP/sc_serv3/threadedRunner.h deleted file mode 100644 index 155b8983..00000000 --- a/Src/Plugins/DSP/sc_serv3/threadedRunner.h +++ /dev/null @@ -1,428 +0,0 @@ -#pragma once -#ifndef threadedRunner_H_ -#define threadedRunner_H_ - -#include "openssl/ssl.h" -#include "openssl/err.h" -#include "threading/thread.h" -#include "webNet/socketOps.h" -#include "unicode/uniString.h" -#include "stl/stringUtils.h" -#include -#include -#include -#include -#include "global.h" - -#ifdef _MSC_VER -#define ssize_t int -#endif -/* - -threadedRunner - (and everything that is related to it). - -Based my work on the webNet module and the microServer class (in sc_trans), it -seems to me that there is a generic model that underlies all of this. At the top level -is a thread which manages a pool of objects (runnables). These runnables offer up -sets of sockets which the threadRunner incorporates into a select() call. When the select -exists, the runnables associated with the sockets are called. - -This makes good sense for a server like senario, where you have connections that must -wait for read/write ability on a socket. This can, however, be extended to any object -that must wait for something. Using a pipe, you can simulate wait events that can also -offer up a socket like object. You can then create an object that fits this model that -is waiting for messages or some other type of signal. - -*/ - -// class that has a mutex's interface but does nothing -class nullLock { public: static void lock() throw(){} static void unlock() throw(){}}; - -// implements a signal based on a pipe. Access to set/clear should be locked, -// but since this class is usually included in another class that already has a lock, we -// make the lock optional by templatizing it. Pass AOL_namespace::mutex as the LOCKABLE parameter -// if you want locking, otherwise pass nullLock. -#pragma pack(push, 1) -template -class pipeDrivenSignal -{ -private: - int m_signalPipe[3]; - LOCKABLE m_lock; - -public: - pipeDrivenSignal() throw(std::exception) - { - m_signalPipe[0] = -1; - m_signalPipe[1] = -1; - m_signalPipe[2] = 0; - if (pgpipe(m_signalPipe)) - { - if (socketOps::errCode()) - { - #ifdef _WIN32 - throw std::runtime_error("[MICROSERVER] Could not create signal pipe " - "[Too many file handles have been opened, " - "code: " + stringUtil::tos(socketOps::errCode()) + - " - reason: " + socketOps::errMsg() + "]"); - #else - throw std::runtime_error("[MICROSERVER] Could not create signal pipe " - "[Increase the open files (ulimit -n) limit, " - "code: " + stringUtil::tos(socketOps::errCode()) + - " - reason: " + socketOps::errMsg() + "]"); - #endif - } - else - { - throw std::runtime_error(""); - } - } - socketOps::setNonblock (m_signalPipe[0], true); - socketOps::setNonblock (m_signalPipe[1], true); - } - - ~pipeDrivenSignal() throw() - { - if (m_signalPipe[0] != -1) - { - pipeclose(m_signalPipe[0]); - m_signalPipe[0] = -1; - } - - if (m_signalPipe[1] != -1) - { - pipeclose(m_signalPipe[1]); - m_signalPipe[1] = -1; - } - - m_signalPipe[2] = 0; - } - - // set the signal - void set() throw() - { - if (m_signalPipe[1] != -1) - { - static char buf[2] = {19, 64}; // any data will do - pipewrite(m_signalPipe[1], buf, 1); - } - } - - // clear the signal - void clear() throw() - { - if (m_signalPipe[0] != -1) - { - // clear pipe - char buf[35]; - piperead(m_signalPipe[0], buf, sizeof(buf)); - } - } - - // return file descriptor to test with select(). This is a read descriptor - const int test() const throw() - { - return m_signalPipe[0]; - } -}; -#pragma pack(pop) - -// make standard string for socket error -extern std::string socketErrString(int err) throw(); - -// abstract base for classes than can be run by the threadRunner class -class runnable -{ - friend class threadedRunner; -public: - #pragma pack(push, 1) - struct timeSliceResult - { - bool m_readSet; // read socket for poll(..) / select(..) call - bool m_writeSet; // write socket for poll(..) / select(..) call - bool m_done; // runnable is done and can be dispose - bool m_runImmediately; // must be re-run immediately - int m_timeout; // must be run after an interval of time regardless. if zero, then no timeout - // if not set (-1) then will pick an appropriate timeout to keep it ticking over - __uint64 m_scheduleTime; // time from which we're going to allow this to run. if zero thnn no scheduling - __uint64 m_currentTime; // time at which the runnable is being tried - - socketOps::tSOCKET m_customSocket; // used for providing a custom case if needed - - timeSliceResult() throw() : m_readSet(false), m_writeSet(false), m_done(false), - m_runImmediately(false), m_timeout(-1), - m_scheduleTime(0), m_currentTime(0), - m_customSocket(socketOps::cINVALID_SOCKET) {} - - ~timeSliceResult() throw() - { - reset(0); - } - - void reset(__uint64 current_ms) throw() - { - m_customSocket = socketOps::cINVALID_SOCKET; - m_readSet = false; - m_writeSet = false; - m_done = false; - m_runImmediately = false; - m_timeout = -1; - m_scheduleTime = 0; - m_currentTime = current_ms; - } - - void done() throw() - { - m_done = true; - } - - void run() throw() - { - m_runImmediately = true; - } - - void read(socketOps::tSOCKET customSocket = socketOps::cINVALID_SOCKET) throw() - { - m_readSet = true; - m_customSocket = customSocket; - } - - void write() throw() - { - m_writeSet = true; - } - - const int timeout(int sec, int ms_sec = 0) - { - m_timeout = (sec > 0 ? (sec * 1000) : 0) + - (ms_sec > 0 ? ms_sec : 0); - return sec; - } - - const int timeoutSID(const size_t sid = 1) - { - int sec = gOptions.getAutoDumpTime(sid); - m_timeout = (sec > 0 ? (sec * 1000) : 0); - return sec; - } - - const __uint64 schedule(int ms_sec = 10) - { - // get the current time and schedule on from - // there so the usage just adds the duration - return (m_scheduleTime = time_now_ms() + (ms_sec > 0 ? ms_sec : 0)); - } - }; - #pragma pack(pop) - - virtual void timeSlice() throw(std::exception) = 0; // you override this to take action - virtual uniString::utf8 name() const throw() = 0; // object name for diagnostics - - explicit runnable (runnable &r) throw(); - - explicit runnable(socketOps::tSOCKET socket = socketOps::cINVALID_SOCKET) throw() - : m_ssl(NULL), m_socket(socket), m_lastActivityTime(::time(NULL)) {} - - virtual ~runnable() throw() { if (m_ssl) { SSL_shutdown (m_ssl); SSL_free (m_ssl); } } - - // utility to read an HTTP style header line off a socket. Used in most protocols - // returns zero if lineBuffer is ready, otherwise it returns a timeout in seconds that - // should be used to wait in a select - const bool getHTTPStyleHeaderLine(const size_t sid, uniString::utf8 &lineBuffer, - const uniString::utf8 &logMsgPrefix, int maxLineLength = 0) throw(std::exception); - - // send a hunk of data out a socket - returns true if send is complete, - // outBuffer and outBufferSize should be initially set to point to the - // data and the size of the data - these values are moved and updated. - const bool sendDataBuffer(const size_t sid, const uniString::utf8::value_type *&outBuffer, - int &outBufferSize, const uniString::utf8 &logMsgPrefix) throw(std::exception); - - ssize_t send (const void *buf, size_t len, int flags = 0); - ssize_t recv (void *buf, size_t len, int flags = 0); - - virtual int detectAutoDumpTimeout (time_t &cur_time, const size_t streamID, const uniString::utf8 &msg) throw(runtime_error); - -protected: - timeSliceResult m_result; // for tracking response - SSL *m_ssl; // SSL handler - socketOps::tSOCKET m_socket; // we'll need this for read / write handling so - // is easier to hold a copy of it here than do - // it at the higher class levels - time_t m_lastActivityTime; // for tracking timeouts -}; - -#pragma pack(push, 1) -class threadedRunner : public Vthread -{ -///// static for managing collection of these guys -private: - pipeDrivenSignal m_signal; // we must add/remove runnables, or stop, or some other sort of message - bool m_stop; // if true then this thread must shut down - const short m_threadNumber; // for diagnostics only - - // list of runnables to be added or removed from this thread controller - std::set m_runnablesToAdd; - std::set m_runnablesToRemove; - std::set m_runList; // things to run - - AOL_namespace::mutex m_lock; - - friend class microConnection; - - static SSL_CTX *m_sslCtx; - static AOL_namespace::mutex *m_sslMutexes; - static unsigned long SSL_idFunction (void); - static void SSL_lockingFunction (int mode, int n, const char *file, int line); - - const unsigned operator()() throw(); - - // add new runnables to the thread. returns false if the runnable could not be queued to this thread object - // False usually means that the thread is going away and can no longer accept runnables - const bool addRunnable(runnable*) throw(); - - // these runnables will be removed at the next opportunity (does not happen immediately) - // false means the runnable was not associated with that thread - const bool removeRunnable(runnable*) throw(); - - void enumRunnables(map& runners) throw(); - - void wakeupRunnable() throw(); - -public: - threadedRunner() throw(); - virtual ~threadedRunner() throw(); - - static bool scheduleRunnable(runnable *r) throw(); - - static uniString::utf8 getRunnabledetails() throw(); - - static void wakeup() throw(); - - void stop() throw(); - const size_t sizeOfRunList() throw(); - const uniString::utf8 threadNumber() const throw() { return stringUtil::tos(m_threadNumber); } // for diagnostics only - - static bool isSSLCapable() { return m_sslCtx ? true : false; } - static void SSL_init (); - static void SSL_shutdown (); -}; -#pragma pack(pop) - -// microserver is a runnable object that implements basic server functionality. -// it listens on a socket. When a connection occurs it creates a microConnection -// object to handle it -class microServer: public runnable -{ -public: - // what stuff we will accept - typedef u_short AllowableProtocols_t; - #define P_WEB 1 - #define P_SHOUTCAST1CLIENT 2 - #define P_SHOUTCAST2CLIENT 4 - #define P_SHOUTCAST1SOURCE 8 - #define P_SHOUTCAST2SOURCE 16 - #define P_FLASHPOLICYFILE 64 - #define P_WEB_SETUP 128 - - // what stuff we will listen for - typedef enum { - L_MISC = 0, - L_CLIENT = 1, - L_SOURCE = 2, - L_FLASH = 4, - L_SOURCE2 = 8, - L_CLIENT_ALT = 16 - } ListenTypes_t; - -private: - AllowableProtocols_t m_protocols; - - void bindMessage(const ListenTypes_t types, const u_short listenPort) throw(); - -protected: - virtual void timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "microServer"; } - -public: - microServer(const std::string &listenAddr, const u_short listenPort, const AllowableProtocols_t protocols, const ListenTypes_t types) throw(std::exception); - void updateProtocols(AllowableProtocols_t protocols, ListenTypes_t types, const u_short listenPort) throw(); - virtual ~microServer() throw(); -}; - -// this class receives a connection and starts processing it until it knows -// what to do with it. When it has figured that out, it creates a protocol object -// and forwards all commands to that object from now on. -class microConnection: public runnable -{ - friend class protocol_HTTPStyle; - friend class protocol_uvox2Source; - friend class protocol_HTTPSource; - friend class protocol_shoutcastSource; - -private: - std::string m_srcHostName; - std::string m_srcAddress; - uniString::utf8 m_lineBuffer; - const u_short m_srcPort; - const microServer::AllowableProtocols_t m_protocols; // what protocols I accept - -protected: - virtual void timeSlice() throw(std::exception); - virtual uniString::utf8 name() const throw() { return "microConnection"; } - -public: - microConnection(const socketOps::tSOCKET s, const std::string &hostName, - const std::string &addr, const u_short port, - const microServer::AllowableProtocols_t protocols) throw(); - virtual ~microConnection() throw(); -}; - -///////////// Utilities that are used often in related components ///////////////////////// - -// common base used for kicking clients and general bookkeeping -class clientProtocol -{ -protected: - clientProtocol() throw() {} - virtual ~clientProtocol() throw(){} - -public: - virtual void kickNextRound() throw() {} - virtual void setGroup(int /*group*/) throw() {} -}; - -// make standard string for loggin address -extern uniString::utf8 addrLogString(const uniString::utf8 &addr, const u_short port, const uniString::utf8 &xff = "") throw(); -// make standard string for logging src address -extern uniString::utf8 srcAddrLogString(const uniString::utf8 &addr, const u_short port, const size_t sid = 0) throw(); -// make standard string for loggin dst address -extern uniString::utf8 dstAddrLogString(const uniString::utf8 &addr, const u_short port, const uniString::utf8 &xff = "", const size_t sid = 0) throw(); - -// get value from map. Return default if doesn't exist -template inline T stringToType(const uniString::utf8 &s) throw(); -template<> inline uniString::utf8 stringToType(const uniString::utf8 &s) throw() { return s; } -template<> inline int stringToType(const uniString::utf8 &s) throw() { return atoi((const char *)s.c_str()); } -template<> inline u_short stringToType(const uniString::utf8 &s) throw() { return (u_short)atoi((const char *)s.c_str()); } -template<> inline std::string stringToType(const uniString::utf8 &s) throw() { return s.hideAsString(); } -template<> inline bool stringToType(const uniString::utf8 &s) throw() -{ - if (s.empty()) - { - return false; - } - uniString::utf8::value_type v = *(s.begin()); - if (v == 'f' || v == 'F' || v == 'n' || v == 'N' || v == '0') - { - return false; - } - return true; -} - -template -inline T mapGet(const httpHeaderMap_t &m, const uniString::utf8 &key, const T deflt) throw() -{ - httpHeaderMap_t::const_iterator i = m.find(key); - return (i == m.end() ? deflt : stringToType((*i).second)); -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/updater.cpp b/Src/Plugins/DSP/sc_serv3/updater.cpp deleted file mode 100644 index 3833f88e..00000000 --- a/Src/Plugins/DSP/sc_serv3/updater.cpp +++ /dev/null @@ -1,354 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include -#include "updater.h" -#include "file/fileUtils.h" -#include "stl/stringUtils.h" -#include "aolxml/aolxml.h" -#include "bandwidth.h" -#include "services/stdServiceImpl.h" -#include "./versions.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -static AOL_namespace::mutex g_UpdaterLock; -static updater *g_Updater = 0; - -#define DEBUG_LOG(...) do { if (gOptions.yp2Debug()) DLOG(__VA_ARGS__); } while (0) - -/////////////////////////////////////////////////////////////////////////////////////////// - -void updater::updaterBandWidthSent(webClient::request r) throw() -{ - // this effectively works out the size in the same manner - // as webclient::toRequest(..) does to build the request. - size_t total = r.m_content.size() + r.m_contentType.size() + - // 'POST' or 'GET' with '?' on the front - (r.m_method == webClient::request::POST ? 4 : 3) + - 64 + r.m_addr.size() + g_userAgent.size() + - (!r.m_content.empty() ? r.m_content.size() : 0); - - for (httpHeaderMap_t::const_iterator i = r.m_queryVariables.begin(); i != r.m_queryVariables.end(); ++i) - { - if (i != r.m_queryVariables.begin()) - { - ++total; - } - total += urlUtils::escapeURI_RFC3986((*i).first).size(); - if (!(*i).second.empty()) - { - total += 1 + urlUtils::escapeURI_RFC3986((*i).second).size(); - } - } - - if (!r.m_XFF.empty()) - { - total += 18 + r.m_XFF.size(); - } - - if ((r.m_method == webClient::request::POST) && r.m_content.empty()) - { - total += 48; - } - else if (!r.m_contentType.empty()) - { - total += 15 + r.m_contentType.size(); - } - - bandWidth::updateAmount(bandWidth::PRIVATE_WEB, total); -} - -void updater::updaterBandWidthReceived(const response r) throw() -{ - size_t total = r.m_body.size(); - - for (httpHeaderMap_t::const_iterator i = r.m_headers.begin(); i != r.m_headers.end(); ++i) - { - total += (*i).first.size() + 1 + (*i).second.size() + eol().size(); - } - - bandWidth::updateAmount(bandWidth::PRIVATE_WEB, total); -} - -size_t updater::requestsInQueue() throw() -{ - stackLock sml(g_UpdaterLock); - - return (g_Updater ? g_Updater->queueEntries() : 0); -} - -updater::updater() throw() : webClient(UPDATER_LOGNAME) -{ - stackLock sml(g_UpdaterLock); - - g_Updater = this; - m_running = false; -} - -updater::~updater() throw() -{ - stackLock sml(g_UpdaterLock); - - g_Updater = 0; -} - -/////////// response handling ////////////// -// handle response. retry_exceptions do just that. otherwise retry occurs in yptimeout seconds - -void updater::response_updater(const request & /*q*/, const response &r) throw(exception) -{ - FILE *f = uniFile::fopen(g_Updater->m_verInfo.fn, "wb"); - if (f) - { - if (fwrite(&(r.m_body[0]),1,r.m_body.size(),f) == r.m_body.size()) - { - ILOG(UPDATER_LOGNAME "Downloaded update to `" + g_Updater->m_verInfo.fn + "' [" + tos(r.m_body.size()) + " bytes]"); - g_Updater->m_verInfo.downloaded = 1; - g_Updater->m_verInfo.needsUpdating = 0; - } - else - { - ILOG(UPDATER_LOGNAME "Error saving the update to `" + g_Updater->m_verInfo.fn + "' [" + tos(r.m_body.size()) + " bytes]"); - g_Updater->m_verInfo.fn.clear(); - g_Updater->m_verInfo.needsUpdating = 1; - } - ::fclose(f); - } - else - { - FILE *f = uniFile::fopen(g_Updater->m_verInfo.fn_alt, "wb"); - if (f) - { - if (fwrite(&(r.m_body[0]),1,r.m_body.size(),f) == r.m_body.size()) - { - g_Updater->m_verInfo.fn = g_Updater->m_verInfo.fn_alt; - ILOG(UPDATER_LOGNAME "Downloaded update to `" + g_Updater->m_verInfo.fn + "' [" + tos(r.m_body.size()) + " bytes]"); - g_Updater->m_verInfo.downloaded = 1; - g_Updater->m_verInfo.needsUpdating = 0; - } - else - { - ILOG(UPDATER_LOGNAME "Error saving the update to `" + g_Updater->m_verInfo.fn_alt + "' [" + tos(r.m_body.size()) + " bytes]"); - g_Updater->m_verInfo.fn.clear(); - g_Updater->m_verInfo.fn_alt.clear(); - g_Updater->m_verInfo.needsUpdating = 1; - } - ::fclose(f); - } - else - { - ELOG(UPDATER_LOGNAME "Error creating file: " + errMessage()); - g_Updater->m_verInfo.fn.clear(); - g_Updater->m_verInfo.fn_alt.clear(); - g_Updater->m_verInfo.needsUpdating = 1; - } - } -} - -void updater::gotResponse(const request &q, const response &r) throw(exception) -{ - stackLock sml(m_serverMapLock); - - DEBUG_LOG(UPDATER_LOGNAME + string(__FUNCTION__) + eol() + - "Response body=[" + eol() + utf8(r.m_body.begin(),r.m_body.end()) + "]" + - eol() + "Response code=[" + tos(r.m_resultCode) + "]"); - - updaterBandWidthReceived(r); - response_updater(q, r); - m_running = false; -} - -void updater::gotFailure(const request &/*q*/) throw(std::exception) -{ - stackLock sml(g_UpdaterLock); - - DEBUG_LOG(UPDATER_LOGNAME + string(__FUNCTION__)); - m_running = false; -} - -void updater::updateVersion() throw() -{ - if (g_Updater) - { - // make sure we've got it and also an url - if (g_Updater->m_verInfo.needsUpdating && !g_Updater->m_verInfo.url.empty() && - !g_Updater->m_verInfo.fn.empty() && !g_Updater->m_verInfo.fn_alt.empty()) - { - try - { - g_Updater->pvt_downloadUpdate(); - } - catch(...) - { - } - } - } -} - -void updater::pvt_downloadUpdate() throw(exception) -{ - if (!m_running) - { - m_running = true; - ILOG(UPDATER_LOGNAME "Preparing to download update package..."); - - // build request - webClient::request r; - r.m_method = webClient::request::GET; - - config::streamConfig::urlObj downloadUrl(g_Updater->m_verInfo.url.hideAsString()); - - r.m_addr = downloadUrl.server(); - r.m_port = downloadUrl.port(); - r.m_path = downloadUrl.path(); - r.m_nonBlocking = 1; - - updaterBandWidthSent(r); - queueRequest(r); - } -} - -bool updater::getNewVersion(verInfo &ver) throw() -{ - stackLock sml(g_UpdaterLock); - - if (g_Updater) - { - // double-check that we've got things correctly - // before we provide the current update status. - bool ret = g_Updater->setNewVersion(g_Updater->m_verInfo, true); - ver = g_Updater->m_verInfo; - return ret; - } - return false; -} - -bool updater::setNewVersion(verInfo &ver, bool no_lock) throw() -{ - if (!no_lock) - { - stackLock sml(g_UpdaterLock); - } - - if (g_Updater) - { - if (g_Updater->m_verInfo.ver != ver.ver || - g_Updater->m_verInfo.url != ver.url || - g_Updater->m_verInfo.log != ver.log) - { - g_Updater->m_verInfo = ver; - - if (!g_Updater->m_verInfo.ver.empty()) - { - const std::vector newVerStr = tokenizer(g_Updater->m_verInfo.ver,'.'), - curVerStr = tokenizer(gOptions.getVersionBuildStrings(),'.'); - int newVer[] = {newVerStr[0].toInt(), newVerStr[1].toInt(), newVerStr[2].toInt(), newVerStr[3].toInt()}, - curVer[] = {curVerStr[0].toInt(), curVerStr[1].toInt(), curVerStr[2].toInt(), curVerStr[3].toInt()}; - - g_Updater->m_verInfo.needsUpdating = 0; - - // look to compare from major to minor parts of the version strings - // 2.x.x.x vs 3.x.x.x - if (newVer[0] > curVer[0]) - { - g_Updater->m_verInfo.needsUpdating = 1; - } - // 2.0.x.x vs 2.2.x.x - else if ((newVer[0] == curVer[0]) && (newVer[1] > curVer[1])) - { - g_Updater->m_verInfo.needsUpdating = 1; - } - // 2.0.0.x vs 2.0.1.x - else if ((newVer[0] == curVer[0]) && (newVer[1] == curVer[1]) && (newVer[2] > curVer[2])) - { - g_Updater->m_verInfo.needsUpdating = 1; - } - // 2.0.0.29 vs 2.0.0.30 - else if ((newVer[0] == curVer[0]) && (newVer[1] == curVer[1]) && (newVer[2] == curVer[2]) && (newVer[3] > curVer[3])) - { - g_Updater->m_verInfo.needsUpdating = 1; - } - - if (g_Updater->m_verInfo.needsUpdating) - { - #ifdef _WIN32 - g_Updater->m_verInfo.fn = gStartupDirectory + "sc_serv_update_" SERV_UPDATE_NAME "_" + tos(newVer[0]) + "_" + tos(newVer[1]) + "_" + tos(newVer[2]) + "_" + tos(newVer[3]) + ".exe"; - wchar_t m_fileName[MAX_PATH] = {0}; - uniString::utf32 u32("%temp%\\sc_serv_update_" SERV_UPDATE_NAME "_" + tos(newVer[0]) + "_" + tos(newVer[1]) + "_" + tos(newVer[2]) + "_" + tos(newVer[3]) + ".exe"); - std::wstring u16; - u32.toUtf16(u16); - ExpandEnvironmentStringsW(u16.c_str(), m_fileName, MAX_PATH); - g_Updater->m_verInfo.fn_alt = utf32(m_fileName).toUtf8(); - #else - g_Updater->m_verInfo.fn = gStartupDirectory + "sc_serv_update_" SERV_UPDATE_NAME"_" + tos(newVer[0]) + "_" + tos(newVer[1]) + "_" + tos(newVer[2]) + "_" + tos(newVer[3]) + ".tar.gz"; - g_Updater->m_verInfo.fn_alt = "/tmp/sc_serv_update_" SERV_UPDATE_NAME"_" + tos(newVer[0]) + "_" + tos(newVer[1]) + "_" + tos(newVer[2]) + "_" + tos(newVer[3]) + ".tar.gz"; - #endif - - g_Updater->m_verInfo.downloaded = uniFile::fileExists(g_Updater->m_verInfo.fn); - // if the main file cannot be found, look for the alternate file - if (!g_Updater->m_verInfo.downloaded) - { - g_Updater->m_verInfo.downloaded = uniFile::fileExists(g_Updater->m_verInfo.fn_alt); - if (g_Updater->m_verInfo.downloaded) - { - g_Updater->m_verInfo.fn = g_Updater->m_verInfo.fn_alt; - } - } - } - - ULOG(string(YP2_LOGNAME) + "A new DNAS version is now available: " + g_Updater->m_verInfo.ver); - ULOG(string(YP2_LOGNAME) + "The suggested download for your setup is: " + g_Updater->m_verInfo.url); - ULOG(string(YP2_LOGNAME) + "See " + g_Updater->m_verInfo.log + " for more information about this update and alternative download links"); - - if (!g_Updater->m_verInfo.downloaded && !g_Updater->m_verInfo.fn.empty() && !g_Updater->m_verInfo.fn_alt.empty()) - { - g_Updater->updateVersion(); - } - } - } - else - { - std::vector newVerStr = tokenizer(g_Updater->m_verInfo.ver,'.'); - if (newVerStr.size() == 4) - { - int newVer[] = {newVerStr[0].toInt(), newVerStr[1].toInt(), newVerStr[2].toInt(), newVerStr[3].toInt()}; - - #ifdef _WIN32 - g_Updater->m_verInfo.fn = gStartupDirectory + "sc_serv_update_" SERV_UPDATE_NAME "_" + tos(newVer[0]) + "_" + tos(newVer[1]) + "_" + tos(newVer[2]) + "_" + tos(newVer[3]) + ".exe"; - wchar_t m_fileName[MAX_PATH] = {0}; - uniString::utf32 u32("%temp%\\sc_serv_update_" SERV_UPDATE_NAME "_" + tos(newVer[0]) + "_" + tos(newVer[1]) + "_" + tos(newVer[2]) + "_" + tos(newVer[3]) + ".exe"); - std::wstring u16; - u32.toUtf16(u16); - ExpandEnvironmentStringsW(u16.c_str(), m_fileName, MAX_PATH); - g_Updater->m_verInfo.fn_alt = utf32(m_fileName).toUtf8(); - #else - g_Updater->m_verInfo.fn = gStartupDirectory + "sc_serv_update_" SERV_UPDATE_NAME"_" + tos(newVer[0]) + "_" + tos(newVer[1]) + "_" + tos(newVer[2]) + "_" + tos(newVer[3]) + ".tar.gz"; - g_Updater->m_verInfo.fn_alt = "/tmp/sc_serv_update_" SERV_UPDATE_NAME"_" + tos(newVer[0]) + "_" + tos(newVer[1]) + "_" + tos(newVer[2]) + "_" + tos(newVer[3]) + ".tar.gz"; - #endif - - g_Updater->m_verInfo.downloaded = uniFile::fileExists(g_Updater->m_verInfo.fn); - // if the main file cannot be found, look for the alternate file - if (!g_Updater->m_verInfo.downloaded) - { - g_Updater->m_verInfo.downloaded = uniFile::fileExists(g_Updater->m_verInfo.fn_alt); - if (g_Updater->m_verInfo.downloaded) - { - g_Updater->m_verInfo.fn = g_Updater->m_verInfo.fn_alt; - } - } - g_Updater->m_verInfo.needsUpdating = 1; - - if (!g_Updater->m_verInfo.downloaded && !g_Updater->m_verInfo.fn.empty()) - { - g_Updater->updateVersion(); - } - } - } - - return (!g_Updater->m_verInfo.ver.empty() && (g_Updater->m_verInfo.needsUpdating || (g_Updater->m_verInfo.downloaded && !g_Updater->m_verInfo.fn.empty()))); - } - return false; -} diff --git a/Src/Plugins/DSP/sc_serv3/updater.h b/Src/Plugins/DSP/sc_serv3/updater.h deleted file mode 100644 index 26e53502..00000000 --- a/Src/Plugins/DSP/sc_serv3/updater.h +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once -#ifndef download_H_ -#define download_H_ - -#include "webClient.h" -#include "webNet/urlUtils.h" -#include "yp2.h" - -#define UPDATER_LOGNAME "[UPDATER] " -class updater: public webClient -{ -public: - struct verInfo - { - int needsUpdating; - int downloaded; - uniString::utf8 ver; - uniString::utf8 url; - uniString::utf8 log; - uniString::utf8 info; - uniString::utf8 message; - uniString::utf8 slimmsg; - uniFile::filenameType fn; - uniFile::filenameType fn_alt; - verInfo() : needsUpdating(0), downloaded(0) {} - }; - - updater() throw(); - ~updater() throw(); - - // used in main during shutdown to wait for request queue to clear out - static size_t requestsInQueue() throw(); - - static bool getNewVersion(verInfo &ver) throw(); - static bool setNewVersion(verInfo &ver, bool no_lock = false) throw(); - -private: - AOL_namespace::mutex m_serverMapLock; - - verInfo m_verInfo; - bool m_running; - - virtual uniString::utf8 name() const throw() { return "updater"; } - - virtual void gotResponse(const request &q, const response &r) throw(std::exception); - virtual void gotFailure(const request &q) throw(std::exception); - - static void response_updater(const request &q,const response &r) throw(std::exception); - void failure_updater(const request &q) throw(); - - static void updaterBandWidthSent(webClient::request r) throw(); - static void updaterBandWidthReceived(const response r) throw(); - - void pvt_downloadUpdate() throw(std::exception); - static void updateVersion() throw(); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/uvox2Common.cpp b/Src/Plugins/DSP/sc_serv3/uvox2Common.cpp deleted file mode 100644 index a24df4f0..00000000 --- a/Src/Plugins/DSP/sc_serv3/uvox2Common.cpp +++ /dev/null @@ -1,201 +0,0 @@ -#ifdef _WIN32 -#include -#else -#include -#include -#endif - -#include -#include -#include "uvox2Common.h" -#include "stl/stringUtils.h" -#include -#include -#include - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -// from wikipedia. Slightly modified to be 32/64 bit clean -static void XTEA_encipher(__uint32* v, __uint32* k, unsigned int num_rounds = 32) -{ - __uint32 v0 = v[0], v1 = v[1], sum = 0; - for (unsigned int i = 0; i < num_rounds; i++) - { - v0 += (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + k[sum & 3]); - sum += 0x9E3779B9; - v1 += (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + k[(sum >> 11) & 3]); - } - v[0] = v0; - v[1] = v1; -} - -static void XTEA_decipher(__uint32* v, __uint32* k, unsigned int num_rounds = 32) -{ - __uint32 v0 = v[0], v1 = v[1], sum = 0x9E3779B9 * num_rounds; - for (unsigned int i = 0; i < num_rounds; i++) - { - v1 -= (((v0 << 4) ^ (v0 >> 5)) + v0) ^ (sum + k[(sum >> 11) & 3]); - sum -= 0x9E3779B9; - v0 -= (((v1 << 4) ^ (v1 >> 5)) + v1) ^ (sum + k[sum & 3]); - } - v[0] = v0; - v[1] = v1; -} -///// - -static __uint32 fourCharsToLong(__uint8 *s) -{ - __uint32 l = 0; - l |= s[0]; l <<= 8; - l |= s[1]; l <<= 8; - l |= s[2]; l <<= 8; - l |= s[3]; - return l; -} - -static void longToFourChars(__uint32 l, __uint8 *r) -{ - r[3] = l & 0xff; l >>= 8; - r[2] = l & 0xff; l >>= 8; - r[1] = l & 0xff; l >>= 8; - r[0] = l & 0xff; l >>= 8; -} - -#define XTEA_KEY_PAD 0 -#define XTEA_DATA_PAD 0 - -string XTEA_encipher(const __uint8* c_data, const size_t c_data_cnt, - const __uint8* c_key, const size_t c_key_cnt) throw() -{ - vector<__uint8> key(c_key, c_key + c_key_cnt); - vector<__uint8> data(c_data, c_data + c_data_cnt); - - // key is always 128 bits - while (key.size() < 16) - { - key.push_back(XTEA_KEY_PAD); // pad key with zero - } - __uint32 k[4] = {fourCharsToLong(&key[0]), fourCharsToLong(&key[4]), - fourCharsToLong(&key[8]), fourCharsToLong(&key[12])}; - - // data is multiple of 64 bits - size_t siz = data.size(); - while (siz % 8) - { - ++siz; - data.push_back(XTEA_DATA_PAD); - } // pad data with zero - - ostringstream oss; - for (size_t x = 0; x < siz; x += 8) - { - __uint32 v[2] = {fourCharsToLong(&data[x]), fourCharsToLong(&data[x+4])}; - XTEA_encipher(v, k); - oss << setw(8) << setfill('0') << hex << v[0]; - oss << setw(8) << setfill('0') << hex << v[1]; - // hex values. uvox uses colon as seperator so - // we can't use chars for fear of collision - } - - return oss.str(); -} - -utf8 XTEA_decipher(const __uint8* c_data, const size_t c_data_cnt, - const __uint8* c_key, const size_t c_key_cnt) throw() -{ - utf8 result; - - vector<__uint8> key(c_key, c_key + c_key_cnt); - vector<__uint8> data(c_data, c_data + c_data_cnt); - - // key is always 128 bits - while (key.size() < 16) - { - key.push_back(XTEA_KEY_PAD); // pad key with zero - } - __uint32 k[4] = {fourCharsToLong(&key[0]), fourCharsToLong(&key[4]), - fourCharsToLong(&key[8]), fourCharsToLong(&key[12])}; - - // data is multiple of 16 hex digits - size_t siz = data.size(); - //assert(!(siz % 16)); // should never happen if data is good - while (siz % 16) - { - ++siz; - data.push_back('0'); - } // pad data with zero - - for (size_t x = 0; x < siz; x += 16) - { - __uint32 v[2]; - sscanf((const char *)&data[x], "%8x", &v[0]); - sscanf((const char *)&data[x+8], "%8x", &v[1]); - - XTEA_decipher(v, k); - __uint8 ur[5] = {0}; - longToFourChars(v[0], ur); - result += ur; - longToFourChars(v[1], ur); - result += ur; - } - return result; -} - -// take data and create a uvox message appended to "v". Limit by MAX_PAYLOAD_SIZE. -// return amount of data UNconsumed -int formMessage(const __uint8 *data, const int len, const int type, vector<__uint8> &v) throw(runtime_error) -{ - if (len > MAX_PAYLOAD_SIZE) - { - throw runtime_error(string(__FUNCTION__) + " message payload " + tos(len) + " is too big"); - } - - const int amt = min(len, MAX_PAYLOAD_SIZE); - uv2xHdr hdr2 = {UVOX2_SYNC_BYTE, 0, (u_short)htons(type), (u_short)htons((u_short)amt)}; - v.insert(v.end(), (const __uint8 *)(&hdr2), ((const __uint8 *)(&hdr2)) + sizeof(hdr2)); - v.insert(v.end(), data, data + amt); - v.push_back(UV2X_EOM); - return (len - amt); -} - -// similar to above, except it writes data into a buffer pointed to by v -int formMessage(const __uint8 *data, const int len, const int type, __uint8 *v) throw(runtime_error) -{ - if (len > MAX_PAYLOAD_SIZE) - { - throw runtime_error(string(__FUNCTION__) + " message payload " + tos(len) + " is too big"); - } - - const int amt = min(len, MAX_PAYLOAD_SIZE); - uv2xHdr hdr2 = {UVOX2_SYNC_BYTE, 0, (u_short)htons(type), (u_short)htons((u_short)amt)}; - memcpy(v, &hdr2, sizeof(hdr2)); - v += sizeof(hdr2); - memcpy(v, data, amt); - v += amt; - v[0] = UV2X_EOM; - return (len - amt); -} - -// load vector v up with metadata packets. -void createMetadataPackets(const __uint8 *data, const int _len, const int type, - vector<__uint8> &v, const __uint16 metadataID) throw(runtime_error) -{ - const int amtPerPacket = (MAX_PAYLOAD_SIZE - UV2X_META_HDR_SIZE); - - // subdivide and load - __uint16 total_segments = (__uint16)(_len / amtPerPacket) + ((_len % amtPerPacket) ? 1 : 0), segment = 1; - int len = _len; - while (len > 0) - { - uv2xMetadataHdr h = {(u_short)htons(metadataID), (u_short)htons(total_segments), (u_short)htons(segment)}; - const int amt = min(len, amtPerPacket); - vector<__uint8> m((const __uint8 *)&h, ((const __uint8 *)&h) + sizeof(h)); - m.insert(m.end(), data, data + amt); - formMessage(&m[0], (int)m.size(), type, v); - data += amt; - len -= amt; - ++segment; - } -} diff --git a/Src/Plugins/DSP/sc_serv3/uvox2Common.h b/Src/Plugins/DSP/sc_serv3/uvox2Common.h deleted file mode 100644 index 648a368e..00000000 --- a/Src/Plugins/DSP/sc_serv3/uvox2Common.h +++ /dev/null @@ -1,116 +0,0 @@ -#pragma once -#ifndef uvox2Common_H_ -#define uvox2Common_H_ - -#include "unicode/uniString.h" - -std::string XTEA_encipher(const __uint8* c_data, const size_t c_data_cnt, const __uint8* c_key, const size_t c_key_cnt) throw(); -uniString::utf8 XTEA_decipher(const __uint8* c_data, const size_t c_data_cnt, const __uint8* c_key, const size_t c_key_cnt) throw(); - -#pragma pack(push,1) - -struct uv2xHdr -{ // uvox2 message - __uint8 sync; - __uint8 qos; - __uint16 msgType; - __uint16 msgLen; -}; - -struct uv2xMetadataHdr -{ /* uvox 2 metadata header */ - __uint16 id; /* ID (cookie) identifying a metadata package */ - __uint16 span; /* Span of messages in the metadata package being assembled */ - __uint16 index;/* Index of the message in the metadata package being assembled */ -}; - -#pragma pack(pop) - -static const int MAX_MESSAGE_SIZE = (16 * 1024); -static const int MAX_CIPHER_KEY_SIZE = 256; - -static const char UV2X_EOM = 0; -static const int UV2X_HDR_SIZE = sizeof(uv2xHdr); -static const int UV2X_OVERHEAD = (UV2X_HDR_SIZE + 1); /* header+end_of_msg */ -static const int UV2X_META_HDR_SIZE = sizeof(uv2xMetadataHdr); -static const int MAX_PAYLOAD_SIZE = MAX_MESSAGE_SIZE - UV2X_OVERHEAD; - -#define UVOX2_SYNC_BYTE 0X5A - -static const int MSG_AUTH = 0x1001; -static const int MSG_BROADCAST_SETUP = 0x1002; -static const int MSG_NEGOTIATE_BUFFER_SIZE = 0x1003; -static const int MSG_STANDBY = 0x1004; -static const int MSG_TERMINATE = 0x1005; -static const int MSG_FLUSH_CACHED_METADATA = 0x1006; -static const int MSG_LISTENER_AUTHENTICATION= 0x1007; -static const int MSG_MAX_PAYLOAD_SIZE = 0x1008; -static const int MSG_CIPHER = 0x1009; // cipher request for uvox 2.1 -static const int MSG_MIME_TYPE = 0x1040; -static const int MSG_FILE_TRANSFER_BEGIN = 0x1050; -static const int MSG_FILE_TRANSFER_DATA = 0x1051; - -static const int MSG_BROADCAST_INTERRUPTION = 0x2001; -static const int MSG_BROADCAST_TERMINATE = 0x2002; - -static const int MSG_ICYNAME = 0x1100; -static const int MSG_ICYGENRE = 0x1101; -static const int MSG_ICYURL = 0x1102; -static const int MSG_ICYPUB = 0x1103; - -static const int MSG_METADATA_CONTENTINFO = 0x3000; -static const int MSG_METADATA_URL = 0x3001; -//static const int MSG_METADATA_XML = 0x3901; -static const int MSG_METADATA_XML_NEW = 0x3902; - -// only id the start of the album art type as it's variable -static const int MSG_METADATA_ALBUMART = 0x4000; -static const int MSG_METADATA_STATION_ART = 0x0000; -static const int MSG_METADATA_PLAYING_ART = 0x0100; -/* - 0x4 0x0xx Station logo - 0x4 0x1xx Album art - - 00 = image/jpeg - 01 = image/png - 02 = image/bmp - 03 = image/gif -*/ - -static const int MSG_METADATA_TIMEREMAINING = 0x5001; - -static const int MP3_DATA = 0x7000; -static const int VLB_DATA = 0x8000; -static const int AAC_LC_DATA = 0x8001; -static const int AACP_DATA = 0x8003; -static const int OGG_DATA = 0x8004; - -/// these are the same -static const int MAX_METADATA_SEGMENTS = 32; -#define MAX_METADATA_FRAGMENTS 32 -/////// - -static const int MAX_METADATA_TIME(300); // five minutes - -// take data and create a uvox message appended to "v". Limit by MAX_PAYLOAD_SIZE. -// return amount of data UNconsumed -int formMessage(const __uint8 *data, const int len, const int type, std::vector<__uint8> &v) throw(std::runtime_error); - -// similar to above, except it writes data into a buffer pointed to by v -int formMessage(const __uint8 *data, const int len, const int type, __uint8 *v) throw(std::runtime_error); - -// this one also returns actual full message size in msgSize -inline int formMessage(const std::string &dataIn, const int type, __uint8 *v, int &msgSize) throw(std::runtime_error) -{ - msgSize = (int)(dataIn.size() + 1); // include null - - int amt_left = formMessage((const __uint8 *)dataIn.c_str(), msgSize /* include null */, type, v); - msgSize += UV2X_OVERHEAD; - return amt_left; -} - -// load vector v up with metadata packets. -void createMetadataPackets(const __uint8 *data, const int len, const int type, - std::vector<__uint8> &v, const __uint16 metadataID = 1) throw(std::runtime_error); - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/versions.h b/Src/Plugins/DSP/sc_serv3/versions.h deleted file mode 100644 index bd4fbbbc..00000000 --- a/Src/Plugins/DSP/sc_serv3/versions.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once -#ifndef versions_H_ -#define versions_H_ - -#define SERV_OSNAME "posix" - -#ifdef _WIN32 - #undef SERV_OSNAME - #ifndef _WIN64 - #define SERV_OSNAME "win32" - #define SERV_UPDATE_NAME "win32" - #else - #define SERV_OSNAME "win64" - #define SERV_UPDATE_NAME "win64" - #endif -#endif - -#ifdef __APPLE_CC__ - #undef SERV_OSNAME - #define SERV_OSNAME "mac" -#endif - -#ifdef PLATFORM_LINUX - #undef SERV_OSNAME - #ifndef __LP64__ - #define SERV_OSNAME "posix(linux x86)" - #define SERV_UPDATE_NAME "linux_x86" - #else - #define SERV_OSNAME "posix(linux x64)" - #define SERV_UPDATE_NAME "linux_x64" - #endif -#endif - -#ifdef PLATFORM_BSD - #undef SERV_OSNAME - #define SERV_OSNAME "posix(bsd)" - #define SERV_UPDATE_NAME "bsd" -#endif - -#ifdef PLATFORM_ARMv6 - #undef SERV_OSNAME - #define SERV_OSNAME "armv6(rpi)" - #define SERV_UPDATE_NAME "rpi" -#endif - -#ifdef PLATFORM_ARMv7 - #undef SERV_OSNAME - #define SERV_OSNAME "armv7(rpi2)" - #define SERV_UPDATE_NAME "rpi2" -#endif - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/w3cLog.cpp b/Src/Plugins/DSP/sc_serv3/w3cLog.cpp deleted file mode 100644 index a81cf7b4..00000000 --- a/Src/Plugins/DSP/sc_serv3/w3cLog.cpp +++ /dev/null @@ -1,319 +0,0 @@ -#include "w3cLog.h" -#include "webNet/urlUtils.h" -#include "threading/thread.h" -#include "global.h" -#include "file/fileUtils.h" -#include "stl/stringUtils.h" -#include "services/stdServiceImpl.h" -#include - -#ifndef _WIN32 -#include -#include -#include -#include -#endif - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -std::map s_w3cFileHandle; - -static AOL_namespace::mutex s_w3cLock; - -void w3cLog::open(const uniFile::filenameType &fn, size_t streamID) throw() -{ - rotate_log(fn, streamID); - - stackLock sml(s_w3cLock); - - if (!s_w3cFileHandle[streamID]) - { - s_w3cFileHandle[streamID] = uniFile::fopen(fn,"wb"); - if (!s_w3cFileHandle[streamID]) - { - ELOG("[W3C] Could not open file " + fn + " (" + errMessage() + ")"); - } - else - { - header(s_w3cFileHandle[streamID]); - } - } -} - -void w3cLog::header(FILE *w3cFileHandle) throw() -{ - // output header like done in the v1 DNAS for tool compatibility - utf8 version = gOptions.getVersionBuildStrings(); - utf8 s = "#Software: SHOUTcast" + eol() + "#Version: " + version + eol() + - "#Fields: c-ip c-dns date time cs-uri-stem c-status cs(User-Agent) sc-bytes x-duration avgbandwidth" + eol(); - size_t amt = ::fwrite(s.c_str(), 1, s.size(), w3cFileHandle); - if (amt != s.size()) - { - ELOG("[W3C] Write error"); - } - ::fflush(w3cFileHandle); -} - -void w3cLog::close(size_t streamID) throw() -{ - stackLock sml(s_w3cLock); - - if (s_w3cFileHandle[streamID]) - { - ::fclose(s_w3cFileHandle[streamID]); - s_w3cFileHandle[streamID] = 0; - } -} - -inline uniFile::filenameType make_backup_log(const uniFile::filenameType &filename, int which) throw() -{ - // 2.4.8+ we now ensure that this is giving a 'full path' to avoid issues - return fileUtil::getFullFilePath((fileUtil::stripSuffix(filename) + "_" + - tobs(which) + "." + - fileUtil::getSuffix(filename))); -} - -uniFile::filenameType make_archive_log() throw() -{ -#ifdef _WIN32 - SYSTEMTIME sysTime = {0}; - ::GetLocalTime(&sysTime); - wchar_t d[100] = {0}, t[100] = {0}; - ::GetDateFormatW(LOCALE_SYSTEM_DEFAULT,0,&sysTime,_T("yyyy'_'MM'_'dd"),d,99); - ::GetTimeFormatW(LOCALE_SYSTEM_DEFAULT,0,&sysTime,_T("HH'_'mm'_'ss"),t,99); - return tos((const wchar_t *)d) + "_" + tos((const wchar_t *)t); -#else - char buf[256] = {0}; - struct tm ttm; - time_t ttt; - ::time(&ttt); - ::strftime(buf, 255, "%Y_%m_%d_%H_%M_%S", ::localtime_r(&ttt, &ttm)); - return buf; -#endif -} - -void w3cLog::rotate_log(const uniFile::filenameType &fn, size_t streamID) throw() -{ - stackLock sml(s_w3cLock); - - if (s_w3cFileHandle[streamID]) - { - ::fclose(s_w3cFileHandle[streamID]); - s_w3cFileHandle[streamID] = 0; - } - - int numFileBackups = gOptions.logRotates(); - for (int x = numFileBackups; x > 0; --x) - { - uniFile::filenameType dest = make_backup_log(fn, x); - // archive the log file about to be removed into a gz file - if (x > 0 && x == gOptions.logRotates()) - { - #ifdef _WIN32 - uniFile::filenameType archive = dest; - utf8::size_type pos = archive.rfind(utf8("_" + tos(numFileBackups))); - if ((pos != utf8::npos) && (uniFile::fileSize(dest) > 0)) - { - archive = (dest.substr(0, pos) + utf8("_" + make_archive_log() + "_w3c.gz")); - - HANDLE m_archive = ::CreateFileW(archive.toWString().c_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (m_archive != INVALID_HANDLE_VALUE) - { - DWORD written(0); - utf8 out; - z_stream m_stream = {0}; - - FILE* m_logFile = uniFile::fopen(dest, "rb"); - if (m_logFile != NULL) - { - bool started = false; - while (!feof(m_logFile)) - { - std::vector m_logFileBuffer; - const size_t BUFSIZE(1024*16); - m_logFileBuffer.clear(); - m_logFileBuffer.resize(BUFSIZE + 1); - size_t amt = fread(&(m_logFileBuffer[0]), 1, BUFSIZE, m_logFile); - if (amt > 0) - { - out = utf8(&(m_logFileBuffer[0]), amt); - if (started == false) - { - compressDataStart(out, &m_stream, (Bytef*)"sc_w3c.log\0"); - started = true; - } - else - { - compressDataCont(out, &m_stream); - } - ::WriteFile(m_archive, out.c_str(), (DWORD)out.size(), &written, NULL); - } - } - - if (out.size() > 0) - { - compressDataFinish(out, &m_stream); - } - ::WriteFile(m_archive, out.c_str(), (DWORD)out.size(), &written, NULL); - - compressDataEnd(&m_stream); - - ::fclose(m_logFile); - forgetHandleInvalid(m_archive); - - // no need to keep any 0-byte files - // this is just incase of weirdness - if (!uniFile::fileSize(archive)) - { - uniFile::unlink(archive); - } - } - else - { - forgetHandleInvalid(m_archive); - uniFile::unlink(archive); - } - } - } - #else - uniFile::filenameType archive = dest; - utf8::size_type pos = archive.rfind(utf8("_" + tos(numFileBackups))); - if ((pos != utf8::npos) && (uniFile::fileSize(dest) > 0)) - { - archive = (dest.substr(0, pos) + utf8("_" + make_archive_log() + "_w3c.gz")); - int m_archive = ::open(archive.hideAsString().c_str(), O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - if (m_archive != -1) - { - utf8 out; - z_stream m_stream = {0}; - FILE* m_logFile = uniFile::fopen(dest, "rb"); - if (m_logFile != NULL) - { - bool started = false; - while (!feof(m_logFile)) - { - std::vector m_logFileBuffer; - const size_t BUFSIZE(1024*16); - m_logFileBuffer.clear(); - m_logFileBuffer.resize(BUFSIZE + 1); - size_t amt = fread(&(m_logFileBuffer[0]), 1, BUFSIZE, m_logFile); - if (amt > 0) - { - out = utf8(&(m_logFileBuffer[0]), amt); - if (started == false) - { - compressDataStart(out, &m_stream, (Bytef*)"sc_w3c.log\0"); - started = true; - } - else - { - compressDataCont(out, &m_stream); - } - ::write(m_archive, out.c_str(), out.size()); - } - } - - if (out.size() > 0) - { - compressDataFinish(out, &m_stream); - } - - ::write(m_archive, out.c_str(), out.size()); - - compressDataEnd(&m_stream); - - ::fclose(m_logFile); - ::close(m_archive); - - // no need to keep any 0-byte files - // this is just incase of weirdness - if (!uniFile::fileSize(archive)) - { - uniFile::unlink(archive); - } - } - else - { - ::close(m_archive); - uniFile::unlink(archive); - } - } - } - #endif - } - - uniFile::unlink(dest); - #ifdef _WIN32 - ::MoveFileW(((x - 1) ? make_backup_log(fn, (x - 1)).toWString().c_str() : fn.toWString().c_str()), dest.toWString().c_str()); - #else - ::rename(((x - 1) ? make_backup_log(fn, (x - 1)).hideAsString().c_str() : fn.hideAsString().c_str()), dest.hideAsString().c_str()); - #endif - } - - s_w3cFileHandle[streamID] = uniFile::fopen(fn,"wb"); - if (!s_w3cFileHandle[streamID]) - { - ELOG("[W3C] Could not open file " + fn); - } - else - { - header(s_w3cFileHandle[streamID]); - } -} - -void w3cLog::log(const size_t streamID, const uniString::utf8 &ipAddr, - const uniString::utf8 &hostName, const uniString::utf8 &songName, - const uniString::utf8 &userAgent, __uint64 bytesSent, - time_t timeInSeconds, int bitrate) -{ - // to prevent some of the stats / logs getting skewed - // then we filter out the SHOUTcast site 'test' users - if (isUserAgentOfficial(toLower(userAgent))) - { - return; - } - - stackLock sml(s_w3cLock); - - FILE *w3cFileHandle = s_w3cFileHandle[streamID]; - if (!w3cFileHandle && streamID) - { - w3cFileHandle = s_w3cFileHandle[0]; - } - - if (!w3cFileHandle) - { - return; - } - - static time_t last_t; - static utf8 w3c_buf; - time_t t = ::time(NULL); - if (last_t != t) - { - struct tm lt = {0}; - ::localtime_s(<, &t); - - char buf[1024] = {0}; - snprintf(buf, sizeof(buf), "%04d-%02d-%02d %02d:%02d:%02d", - (lt.tm_year % 100) + 2000, lt.tm_mon + 1, - lt.tm_mday, lt.tm_hour, lt.tm_min, lt.tm_sec); - w3c_buf = buf; - } - - // http://forums.shoutcast.com/showthread.php?t=355063 - // http://forums.shoutcast.com/showthread.php?t=358805 - utf8 s = ipAddr + " " + hostName + " " + w3c_buf + " /stream?title=" + - (songName.empty() ? utf8("Unknown") : urlUtils::escapeURI_RFC3986(songName)) + - " 200 " + urlUtils::escapeURI_RFC3986(userAgent) + " " + tos(bytesSent) + " " + - tos(timeInSeconds) + " " + tos(bitrate) + eol(); - - size_t amt = ::fwrite(s.c_str(), 1, s.size(), w3cFileHandle); - if (amt != s.size()) - { - ELOG("[W3C] Write error"); - } - ::fflush(w3cFileHandle); -} diff --git a/Src/Plugins/DSP/sc_serv3/w3cLog.h b/Src/Plugins/DSP/sc_serv3/w3cLog.h deleted file mode 100644 index 13ab6a0f..00000000 --- a/Src/Plugins/DSP/sc_serv3/w3cLog.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#ifndef w3cLog_H_ -#define w3cLog_H_ - -#include "unicode/uniString.h" -#include "unicode/uniFile.h" - -class w3cLog -{ -public: - static void open(const uniFile::filenameType &fn, const size_t streamID = 0) throw(); - static void header(FILE *w3cFileHandle) throw(); - static void close(const size_t streamID) throw(); - static void rotate_log(const uniFile::filenameType &fn, const size_t streamID = 0) throw(); - static void log(const size_t streamID, const uniString::utf8 &ipAddr, const uniString::utf8 &hostName, - const uniString::utf8 &songName, const uniString::utf8 &userAgent, __uint64 bytesSent, - time_t timeInSeconds, const int bitrate); -}; - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/webClient.cpp b/Src/Plugins/DSP/sc_serv3/webClient.cpp deleted file mode 100644 index 3006d6b9..00000000 --- a/Src/Plugins/DSP/sc_serv3/webClient.cpp +++ /dev/null @@ -1,619 +0,0 @@ -#ifdef _WIN32 -#include -#endif - -#include -#include "webClient.h" -#include "webNet/urlUtils.h" -#include "stl/stringUtils.h" -#include "file/fileUtils.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace stringUtil; -using namespace uniString; - -#define DEBUG_LOG(...) do { if (gOptions.webClientDebug()) DLOG(__VA_ARGS__); } while (0) - -////////////////// utils - -static utf8 toLogString(const webClient::request &r) throw() -{ - // using this to ensure the default YP connection is via HTTPS - // though if there is a config issue then attempt to handle it - // by reverting to the pre-HTTPS mode so we can still work-ish - const bool https = ((r.m_addr == DEFAULT_YP_ADDRESS) && uniFile::fileExists(gOptions.m_certPath)); - if (r.m_port == 80) - { - return utf8(https ? "https://" : "http://") + r.m_addr + r.m_path; - } - else - { - return utf8(https ? "https://" : "http://") + r.m_addr + ":" + tos(r.m_port) + r.m_path; - } -} - -utf8 encodeVariables(const httpHeaderMap_t &m) throw() -{ - utf8 result; - - if (!m.empty()) - { - for (httpHeaderMap_t::const_iterator i = m.begin(); i != m.end(); ++i) - { - if (i != m.begin()) - { - result += "&"; - } - result += urlUtils::escapeURI_RFC3986((*i).first) + "="; - if (!(*i).second.empty()) - { - result += urlUtils::escapeURI_RFC3986((*i).second); - } - } - } - return result; -} - -static utf8 toLogString(const httpHeaderMap_t &m) throw() -{ - utf8 result = "headers=[" + eol(); - for (httpHeaderMap_t::const_iterator i = m.begin(); i != m.end(); ++i) - { - result += " " + (*i).first + " : " + (*i).second + eol(); - } - result += "]" + eol(); - return result; -} - -static utf8 toLogString(const webClient::response &r) throw() -{ - utf8 result = "code=" + tos(r.m_resultCode) + " reason=" + r.m_resultText + eol(); - result += toLogString(r.m_headers); - result += "body=[" + eol(); - result += r.m_body + eol() + "]"; - return result; -} - -//////////////////////// - -webClient::webClient(const uniString::utf8 &logPrefix) throw() - : m_logPrefix(logPrefix), m_state(&webClient::state_Idle), - m_nextState(0), m_nonBlockingID(0), m_response() -{ - m_curl_error = new char[CURL_ERROR_SIZE]; - memset(m_curl_error, 0, CURL_ERROR_SIZE); -} - -webClient::~webClient() throw() -{ - for (curlMap_t::const_iterator i = m_curl.begin(); i != m_curl.end(); ++i) - { - if (i->second != NULL) - { - curl_easy_cleanup(i->second); - } - } - for (curlHeadersMap_t::const_iterator i = m_curl_headers.begin(); i != m_curl_headers.end(); ++i) - { - if (i->second != NULL) - { - curl_slist_free_all(i->second); - } - } - m_curl.clear(); - forgetArray(m_curl_error); -} - -/////////////////////////////////////////////////////////////////// - -void webClient::queueRequest(const request &req) throw() -{ -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(m_logPrefix + __FUNCTION__); -#endif - - stackLock sml(m_requestQueueLock); - - m_requestQueue.push(req); - m_requestSignal.set(); -} - -void webClient::timeSlice() throw(exception) -{ - try - { - if (this->m_state) - { - return (this->*m_state)(); - } - } - catch (const webClient::retry_exception &ex) - { - // increase failure counter - m_requestQueueLock.lock(); - if (!m_requestQueue.empty()) - { - ++m_requestQueue.front().m_retryCounter; - } - m_requestQueueLock.unlock(); - - m_state = &webClient::state_Wait; - m_nextState = &webClient::state_SendRequest; - m_lastActivityTime = ::time(NULL); - m_result.timeout(gOptions.ypTimeout()); - - utf8 what = ex.what(); - WLOG(((what.find(m_logPrefix) == utf8::npos) ? m_logPrefix : "") + - what + (!what.empty() ? " - " : "") + - "Retrying in " + tos(gOptions.ypTimeout()) + " seconds."); - } - catch (const exception &ex) - { - // increase failure counter - m_requestQueueLock.lock(); - if (!m_requestQueue.empty()) - { - ++m_requestQueue.front().m_retryCounter; - } - m_requestQueueLock.unlock(); - - m_state = &webClient::state_Wait; - m_nextState = &webClient::state_SendRequest; - m_lastActivityTime = ::time(NULL); - m_result.timeout(gOptions.ypTimeout()); - - utf8 what = ex.what(); - ELOG(((what.find(m_logPrefix) == utf8::npos) ? m_logPrefix : "") + - what + (!what.empty() ? " - " : "") + - "Restarting in " + tos(gOptions.ypTimeout()) + " seconds."); - } - catch(...) - { - ELOG(m_logPrefix + "Fatal error. Cannot recover."); - throw; - } -} - -// waiting for a request to be queued -void webClient::state_Idle() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(m_logPrefix + __FUNCTION__); -#endif - - stackLock sml(m_requestQueueLock); - m_requestSignal.clear(); - if (m_requestQueue.empty()) - { - m_result.schedule(1000); - m_result.read(m_requestSignal.test()); - m_result.timeout(gOptions.ypTimeout()); - } - else - { - m_result.run(); - m_state = &webClient::state_SendRequest; - } -} - -// TODO can we instead change this to be scheduled? -void webClient::state_Wait() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(m_logPrefix + __FUNCTION__); -#endif - - time_t t = ::time(NULL); - stackLock sml(m_requestQueueLock); - if (t < m_lastActivityTime) // rollover? - { - m_lastActivityTime = t; - } - - if (m_state != m_nextState) - { - m_state = m_nextState; - // this is needed to ensure that we'll not - // block on some of the YP async requests. - m_result.timeout(0, 10); - } - else - { - // we'll add this back to be tested for... - m_result.schedule (50); - m_result.timeout((gOptions.ypTimeout() - (int)(t - m_lastActivityTime))); - } -} - -size_t webClient::ParseReplyHeaders(void *buffer, size_t size, size_t count, FILE *stream) throw(runtime_error) -{ - webClient *client = reinterpret_cast(stream); - if (!client) - { - throwEx("ParseReplyHeaders parameter failure"); - } - - utf8 s = stripWhitespace(utf8((char*)buffer, (size * count))); - if (!s.empty()) - { - DEBUG_LOG(client->m_logPrefix + "HTTP header: " + s); - - if (client->m_response.m_resultCode == 0) // waiting for first line or something other than HTTP/1.1 100 Continue - { - utf8::size_type pos = s.find(utf8(" ")); - if (pos == utf8::npos) - { - throwEx(client->m_logPrefix + "Badly formed HTTP response [" + s + "]"); - } - s = stripWhitespace(s.substr(pos)); - pos = s.find(utf8(" ")); - if (pos == utf8::npos) - { - throwEx(client->m_logPrefix + "Badly formed HTTP response [" + s + "]"); - } - client->m_response.m_resultCode = utf8(s.substr(0,pos)).toInt(); - if (client->m_response.m_resultCode != 100) - { - s = stripWhitespace(s.substr(pos)); - client->m_response.m_resultText = s; - } - else - { - client->m_response.m_resultCode = 0; - } - } - else - { - // header lines - utf8::size_type pos = s.find(utf8(":")); - if (pos == utf8::npos) - { - throwEx(client->m_logPrefix + "Badly formed HTTP header line [" + s + "]"); - } - if ((int)client->m_response.m_headers.size() > gOptions.maxHeaderLineCount()) - { - throwEx(client->m_logPrefix + "Badly formed HTTP response. Max header lines exceeded."); - } - - utf8 key = toLower(stripWhitespace(s.substr(0,pos))); - utf8 value = stripWhitespace(s.substr(pos+1)); - // allow empty values. (for urls and what-not) - if (key.empty()) - { - throwEx(client->m_logPrefix + "Bad HTTP header string [" + s + "]"); - } - client->m_response.m_headers[key] = value; - } - } - - size_t received = (size * count); - client->m_response.m_received += received; - return received; -} - -size_t webClient::GetBody(void *buffer, size_t size, size_t count, FILE *stream) -{ - webClient *client = reinterpret_cast(stream); - size_t received = (size * count); - unsigned char *arr = (unsigned char *)buffer; - - if (gOptions.webClientDebug()) - { - // skip outputting the DNAS download updates - DLOG(client->m_logPrefix + "HTTP body: " + arr); - } - client->m_requestQueueLock.lock(); - client->m_response.m_body.insert(client->m_response.m_body.end(), arr, &arr[received]); - client->m_lastActivityTime = ::time(NULL); - - client->m_response.m_received += received; - client->m_requestQueueLock.unlock(); - return received; -} - -void webClient::gotCurlRespose() -{ - this->m_nextState = &webClient::state_RequestComplete; - this->m_lastActivityTime = ::time(NULL); -} - -// will still need to set certain aspects like the error buffer or any of the header / processing options -CURL* webClient::setupCurlDefaults(CURL* oldCurl, const char *logPrefix, const utf8& requestUrl, - const int timeout, const int connnectTimeout, size_t SID) -{ - CURL *curl = (oldCurl == NULL ? curl_easy_init() : oldCurl); - if (curl) - { - if (requestUrl != utf8("")) - { - if (oldCurl) - { - curl_easy_reset(curl); - DEBUG_LOG ("Recycling curl handle for: " + requestUrl, logPrefix, SID); - } - else - { - DEBUG_LOG ("Creating new curl handle for: " + requestUrl, logPrefix, SID); - } - curl_easy_setopt(curl, CURLOPT_URL, requestUrl.hideAsString().c_str()); - } - - curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1); - curl_easy_setopt(curl, CURLOPT_USERAGENT, g_userAgent.c_str()); - curl_easy_setopt(curl, CURLOPT_TIMEOUT, (timeout == -1 ? gOptions.ypTimeout() : timeout)); - curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, (connnectTimeout == -1 ? 3L : connnectTimeout)); - curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L); - curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); - curl_easy_setopt(curl, CURLOPT_MAXREDIRS, gOptions.maxHTTPRedirects()); - curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, ""); - -/*#if defined(_DEBUG) || defined(DEBUG) - if (gOptions.webClientDebug()) - { - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - } -#endif*/ - - // this is needed (mainly for the Windows builds) so things will work with SSL and also - // self-signed certificates as we appear to be using (as CURLOPT_SSL_VERIFYPEER = FALSE - // is an absolute no-no due to the man in the middle attack which it allows to succeed. - //DEBUG_LOG(logPrefix + "Certificate path: `" + gOptions.m_certPath + "'"); - if (!gOptions.m_certPath.empty()) - { - curl_easy_setopt(curl, CURLOPT_CAINFO, gOptions.m_certPath.hideAsString().c_str()); - } - else - { - WLOG ("Certificate path is invalid - cacert.pem location not known", logPrefix, SID); - } - } - return curl; -} - -// build the entire web request, and send it -void webClient::state_SendRequest() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(m_logPrefix + __FUNCTION__); -#endif - - do - { - m_requestQueueLock.lock(); - - if (m_requestQueue.empty()) - { - // queue is empty, move to idle state - m_requestSignal.clear(); - m_state = &webClient::state_Idle; - m_requestQueueLock.unlock(); - break; - } - // construct request - request &r = m_requestQueue.front(); // leave it in the queue until request succeeds - struct curl_slist *header = m_curl_headers[r.m_sid]; - - if (r.m_retryCounter < gOptions.ypMaxRetries()) - { - m_curl_path.clear(); - m_curl_path = toLogString(r); - - if (r.m_method == webClient::request::GET && !r.m_queryVariables.empty()) - { - m_curl_path += utf8("?") + encodeVariables(r.m_queryVariables); - } - - // create or re-use the handle as needed (doing a reset to avoid some quirks with authhash vs general YP usage) - CURL* curl = setupCurlDefaults(m_curl[r.m_sid], (char *)m_logPrefix.c_str(), m_curl_path); - if (curl) - { - if (r.m_method == webClient::request::POST) - { - utf8 contentType = ""; - if (r.m_content.empty()) - { - utf8 u8 = encodeVariables(r.m_queryVariables); - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, u8.size()); - curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, &u8[0]); - } - else - { - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, r.m_content.size()); - curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, &r.m_content[0]); - } - if (r.m_contentType.empty() == false) - { - string contentType = "Content-Type:" + r.m_contentType.hideAsString(); - header = curl_slist_append (header, contentType.c_str()); - } - } - else - curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); - - utf8 m_XFF = ""; - if (!r.m_XFF.empty()) - { - m_XFF = "X-Forwarded-For:" + r.m_XFF; - header = curl_slist_append(header, m_XFF.hideAsString().c_str()); - } - - curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header); - - // send it, then get ready to receive the reply - m_lastActivityTime = ::time(NULL); - m_response.clear(); - r.m_content.clear(); - - DEBUG_LOG(m_logPrefix + "Request URL: " + m_curl_path); - curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, &this->ParseReplyHeaders); - curl_easy_setopt(curl, CURLOPT_HEADERDATA, this); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &this->GetBody); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, this); - curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &(m_curl_error[0])); - - if (r.m_nonBlocking) - { - m_nonBlockingID = r.m_sid; - m_curl_headers[r.m_sid] = header; - m_curl[r.m_sid] = curl; - - m_state = m_nextState = &webClient::state_Wait; - m_requestQueueLock.unlock(); - SimpleThread (webClient::process, this); - } - else - { - m_requestQueueLock.unlock(); - CURLcode ret = curl_easy_perform(curl); - m_requestQueueLock.lock(); - if (ret != CURLE_OK) - { - getCurlError(curl, ret); - } - else - { - m_state = &webClient::state_RequestComplete; - } - - if (header) - { - curl_slist_free_all(header); - m_curl_headers[r.m_sid] = NULL; - } - m_requestQueueLock.unlock(); - } - } - break; - } - ELOG(m_logPrefix + "Request [" + toLogString(r) + "] failed. Retries exceeded."); - gotFailure(r); - m_requestQueue.pop(); - m_requestQueueLock.unlock(); - } while (0); - - m_result.run(); -} - -void webClient::getCurlError(CURL* curl, const CURLcode ret) throw(exception) -{ - if (!m_requestQueue.empty()) - { - webClient::request &r = m_requestQueue.front(); - r.m_received = 0; - if (curl) - { - curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &r.m_received); - curl_easy_cleanup(curl); - } - m_curl[r.m_sid] = NULL; - - ELOG(m_logPrefix + "Request [" + toLogString(r) + "] failed, code: " + tos(ret) + - " [" + (m_curl_error[0] ? m_curl_error : curl_easy_strerror(ret)) + "]"); - gotFailure(r); - m_requestQueue.pop(); - - m_lastActivityTime = ::time(NULL); - m_state = m_nextState = &webClient::state_Idle; - } -} - -THREAD_FUNC webClient::process(void* arg) -{ - try - { - webClient* m_client = reinterpret_cast(arg); - if (m_client) - { - if (!iskilled()) - { - m_client->m_requestQueueLock.lock(); - - CURL* curl = m_client->getCurlHandle(); - m_client->m_requestQueueLock.unlock(); - - CURLcode ret = (curl ? curl_easy_perform(curl) : CURLE_READ_ERROR); - if (!iskilled()) - { - stackLock sml(m_client->m_requestQueueLock); - - if (ret != CURLE_OK) - { - m_client->getCurlError(curl, ret); - } - else - { - m_client->gotCurlRespose(); - } - - m_client->clearCurlHeader(); - } - } - } - } - catch (...) - { - } - return 0; -} - -// need to let things run in the background so sit and spin and wait... -void webClient::state_Send() throw(std::exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(m_logPrefix + __FUNCTION__); -#endif - - SimpleThread(webClient::process, this); - - m_state = m_nextState = &webClient::state_Wait; - m_result.run(); -} - -// request complete. Issue virtual callback, pop request, then move to idle -// state and wait for next request -void webClient::state_RequestComplete() throw(exception) -{ -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(m_logPrefix + __FUNCTION__); -#endif - - m_requestQueueLock.lock(); - if (!m_requestQueue.empty()) - { - request &r = m_requestQueue.front(); - m_requestQueueLock.unlock(); - gotResponse(r, m_response); // could throw - - m_requestQueueLock.lock(); - m_requestQueue.pop(); - } - - m_lastActivityTime = ::time(NULL); - m_state = m_nextState = &webClient::state_Idle; - m_result.run(); - m_requestQueueLock.unlock(); -} - -// this method should be overridden. The base class here just dumps diagnostics -// throw an exception if you want to treat the result as a retryable error -void webClient::gotResponse(const request &/*q*/, const response &r) throw(exception) -{ - DEBUG_LOG(m_logPrefix + toLogString(r)); -} - -void webClient::gotFailure(const request &q) throw(exception) -{ - DEBUG_LOG(m_logPrefix + toLogString(q)); -} - -const size_t webClient::queueEntries() throw() -{ -#if defined(_DEBUG) || defined(DEBUG) - DEBUG_LOG(m_logPrefix + __FUNCTION__); -#endif - - stackLock sml(m_requestQueueLock); - - return !m_requestQueue.empty(); -} diff --git a/Src/Plugins/DSP/sc_serv3/webClient.h b/Src/Plugins/DSP/sc_serv3/webClient.h deleted file mode 100644 index 1a3d178a..00000000 --- a/Src/Plugins/DSP/sc_serv3/webClient.h +++ /dev/null @@ -1,153 +0,0 @@ -#pragma once -#ifndef webClient_H_ -#define webClient_H_ - -#include "threadedRunner.h" -#include "curl/curl.h" -#include - -// runnable that provides generic web client functionality to a single host -// you can subclass this to provide specific behaviour -#pragma pack(push, 1) -class webClient: public runnable -{ -public: - struct request - { - typedef enum { GET,POST } method_t; - - uniString::utf8 m_addr; - uniString::utf8 m_path; - - // content - std::vector<__uint8> m_content; - uniString::utf8 m_contentType; - - // used for the setting the 'X-Forwarded-For' header field which - // is a bit of a fiddle to allow destip to be different so the YP - // can test an alternative external IP from that it auto detects - uniString::utf8 m_XFF; - - httpHeaderMap_t m_queryVariables; - method_t m_method; - - int m_port; - size_t m_sid; - int m_retryCounter; - - int m_userData_i; - - size_t m_received; // size of data got - int m_nonBlocking; // do on an additional thread e.g. the YP add needs - // this else it blocks the YP test exists connetion - - // two random pieces of user data - unsigned m_userData_u; - void* m_userData_p; - - request() : m_path(uniString::utf8("/")), m_method(GET), m_port(80), - m_sid(0), m_retryCounter(0), m_userData_i(0), m_received(0), - m_nonBlocking(0), m_userData_u(0), m_userData_p(0) {} - }; - - struct response - { - uniString::utf8 m_resultText; - uniString::utf8 m_body; // body of response - httpHeaderMap_t m_headers; // response headers - size_t m_resultCode; // HTTP result code - size_t m_received; // size of data got - - response() : m_resultCode(0), m_received(0) {} - - void clear() throw() - { - m_resultCode = 0; - m_received = 0; - m_headers.clear(); - m_body.clear(); - m_resultText.clear(); - } - }; - - static size_t ParseReplyHeaders(void *buffer, size_t size, size_t count, FILE *stream) throw(std::runtime_error); - static size_t GetBody(void *buffer, size_t size, size_t count, FILE *stream); - - CURL* getCurlHandle(const size_t SID = 0) { return m_curl[(!SID ? m_nonBlockingID : SID)]; } - void clearCurlHeader(const size_t SID = 0) - { - size_t id = (!SID ? m_nonBlockingID : SID); - struct curl_slist *header = m_curl_headers[id]; - if (header) - { - curl_slist_free_all(header); - m_curl_headers[id] = 0; - } - } - void gotCurlRespose(); - void getCurlError(CURL* curl, const CURLcode ret) throw(std::exception); - - static CURL* setupCurlDefaults(CURL* oldCurl, const char *logPrefix, const uniString::utf8& requestUrl, - const int timeout = -1, const int connnectTimeout = -1, size_t SID = 0); - - static THREAD_FUNC process(void* arg); - -protected: - class retry_exception : public std::runtime_error - { - public: - explicit retry_exception(const uniString::utf8 &msg) : runtime_error(msg.hideAsString()){} - }; - -private: - typedef void (webClient::*state_t)(); - const uniString::utf8 m_logPrefix; - - state_t m_state; - state_t m_nextState; - - // curl specific parts - typedef std::map curlMap_t; - curlMap_t m_curl; - - size_t m_nonBlockingID; - uniString::utf8 m_curl_path; - - typedef std::map curlHeadersMap_t; - curlHeadersMap_t m_curl_headers; - - response m_response; - char* m_curl_error; - - AOL_namespace::mutex m_requestQueueLock; - std::queue m_requestQueue; - pipeDrivenSignal m_requestSignal; - - void state_Idle() throw(std::exception); - void state_Wait() throw(std::exception); - void state_ResolveServer() throw(std::exception); - void state_Connect() throw(std::exception); - void state_ConnectWait() throw(std::exception); - void state_Send() throw(std::exception); - void state_Get() throw(std::exception); - void state_SendRequest() throw(std::exception); - void state_RequestComplete() throw(std::exception); - - virtual void timeSlice() throw(std::exception); - -protected: - explicit webClient(const uniString::utf8 &logPrefix) throw(); - virtual ~webClient() throw(); - - void queueRequest(const request &req) throw(); - // throw to treat as an error and retry entire request - virtual void gotResponse(const request &q, const response &r) throw(std::exception); // called when response is received - virtual void gotFailure(const request &q) throw(std::exception); // called when retries are exhausted - - const size_t queueEntries() throw(); -}; -#pragma pack(pop) - -uniString::utf8 encodeVariables(const httpHeaderMap_t &m) throw(); - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/webNet/socketOps.cpp b/Src/Plugins/DSP/sc_serv3/webNet/socketOps.cpp deleted file mode 100644 index 59587b39..00000000 --- a/Src/Plugins/DSP/sc_serv3/webNet/socketOps.cpp +++ /dev/null @@ -1,716 +0,0 @@ -#ifdef _WIN32 -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0601 -#include "socketOps.h" -#include -#include -#include -#include "stl/stringUtils.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace stringUtil; - -static std::map s_errMsgs; - -const SOCKET socketOps::cINVALID_SOCKET = INVALID_SOCKET; -const SOCKET socketOps::cSOCKET_ERROR = (SOCKET)SOCKET_ERROR; - -class win32_socket_init -{ -public: - ~win32_socket_init() { ::WSACleanup(); } - win32_socket_init() - { - WORD wVersion = MAKEWORD( 1, 1 ); - WSADATA wsaData = {0}; - - ::WSAStartup(wVersion, &wsaData); - - s_errMsgs[WSAEINTR] = "Interrupted function call: A blocking operation was interrupted by a call to WSACancelBlockingCall."; - s_errMsgs[WSAEFAULT] = "Bad address: The system detected an invalid pointer address in attempting to use a pointer argument of a call."; - s_errMsgs[WSAEINVAL] = "Invalid argument: Some invalid argument was supplied."; - s_errMsgs[WSAEMFILE] = "Too many open descriptors: No more socket descriptors are available."; - s_errMsgs[WSAEWOULDBLOCK] = "Call would block: Non-blocking call will block."; - s_errMsgs[WSAEINPROGRESS] = "Operation now in progress: A blocking operation is currently executing."; - s_errMsgs[WSAEALREADY] = "Operation already in progress: An operation was attempted on a nonblocking socket with an operation already in progress."; - s_errMsgs[WSAENOTSOCK] = "Socket operation on non socket: An operation was attempted on something that is not a socket."; - s_errMsgs[WSAEDESTADDRREQ] = "Destination address required: A required address was omitted from an operation on a socket."; - s_errMsgs[WSAEMSGSIZE] = "Message too long: A message sent on a datagram socket was larger than the internal message buffer."; - s_errMsgs[WSAEPROTOTYPE] = "The specified protocol is the wrong type for this socket."; - s_errMsgs[WSAENOPROTOOPT] = "Bad Protocol option."; - s_errMsgs[WSAEPROTONOSUPPORT] = "The specified protocol is not supported."; - s_errMsgs[WSAESOCKTNOSUPPORT] = "The specified socket type is not supported in this address family."; - s_errMsgs[WSAEOPNOTSUPP] = "Socket operation not supported."; - s_errMsgs[WSAEPFNOSUPPORT] = "Protocol family not supported."; - s_errMsgs[WSAEAFNOSUPPORT] = "The specified address family is not supported"; - s_errMsgs[WSAEADDRINUSE] = "Address already in use."; - s_errMsgs[WSAEADDRNOTAVAIL] = "Cannot assign requested address."; - s_errMsgs[WSAENETDOWN] = "A network subsystem or the associated service provider has failed"; - s_errMsgs[WSAENETUNREACH] = "Nework is unreachable."; - s_errMsgs[WSAENETRESET] = "Network dropped connection on reset."; - s_errMsgs[WSAECONNABORTED] = "Software caused connection abort."; - s_errMsgs[WSAECONNRESET] = "Connection reset by peer."; - s_errMsgs[WSAENOBUFS] = "No buffer space is available. The socket cannot be created."; - s_errMsgs[WSAEISCONN] = "Socket is already connected."; - s_errMsgs[WSAENOTCONN] = "Socket is not connected."; - s_errMsgs[WSAESHUTDOWN] = "Cannot send after socket shutdown."; - s_errMsgs[WSAETIMEDOUT] = "Connection timed out."; - s_errMsgs[WSAECONNREFUSED] = "Connection refused."; - s_errMsgs[WSAEHOSTDOWN] = "Host is down."; - s_errMsgs[WSAEHOSTUNREACH] = "No route to host."; - s_errMsgs[WSAEPROCLIM] = "Too many processes."; - } -}; - -static win32_socket_init win32_socket_init_force; - -std::string socketOps::errMsg(int errCode) throw() -{ - std::map::const_iterator i = s_errMsgs.find(errCode); - return (i == s_errMsgs.end() ? "error code " + tos(errCode) : (*i).second); -} - -int socketOps::errCode() throw() { return ::WSAGetLastError(); } - -#else - -#include -#include "socketOps.h" -#include "stl/stringUtils.h" -#include - -using namespace std; -using namespace stringUtil; - -const int socketOps::cINVALID_SOCKET = -1; -const int socketOps::cSOCKET_ERROR = -1; - -int socketOps::errCode() throw() { return errno; } - -std::string socketOps::errMsg(int errCode) throw() -{ - std::string result = "error code " + tos(errCode); - - char *e = strerror(errCode); - if (e) - { - result = e; - } - return result; -} -#endif - -std::string socketOps::endpoint::toString() const throw() -{ - return m_address + ":" + tos(m_port); -} - -socketOps::tSOCKET socketOps::createTCPSocket() throw() -{ - return ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); -} - -socketOps::tSOCKET socketOps::createTCPSocketTHROW() throw(std::runtime_error) -{ - tSOCKET result = socketOps::createTCPSocket(); - if (result == socketOps::cINVALID_SOCKET) - { - throw std::runtime_error("socketOps::createTCPSocketTHROW() - Could not create socket because " + socketOps::errMsg()); - } - return result; -} - -int socketOps::setNonblock(const socketOps::tSOCKET s, bool nonBlock) throw() -{ -#ifdef _WIN32 - unsigned long i = (nonBlock ? 1 : 0); - return ioctlsocket(s, FIONBIO, &i); -#else - int flags, err; - - if ((flags = fcntl(s, F_GETFL, 0)) == socketOps::cSOCKET_ERROR) - { - return flags; - } - - if (nonBlock) - { - flags |= O_NONBLOCK; - } - else - { - flags &= ~O_NONBLOCK; - } - - if ((err = fcntl(s, F_SETFL, flags)) == socketOps::cSOCKET_ERROR) - { - return err; - } - return 0; -#endif -} - -void socketOps::setNonblockTHROW(const socketOps::tSOCKET s, const bool nonblock) throw(std::runtime_error) -{ - int err = socketOps::setNonblock(s, nonblock); - if (err == socketOps::cSOCKET_ERROR) - { - throw std::runtime_error("socketOps::setNonblockTHROW() - Could not get socket flags because " + socketOps::errMsg()); - } -} - -void socketOps::closeTCPSocket(socketOps::tSOCKET s) throw() -{ -#ifdef _WIN32 - ::shutdown(s, SD_BOTH); - ::closesocket(s); -#else - ::shutdown(s, SHUT_RDWR); - ::close(s); -#endif -} - -void socketOps::forgetTCPSocket(tSOCKET &s) throw() -{ - if (s != socketOps::cINVALID_SOCKET) - { - socketOps::closeTCPSocket(s); - s = socketOps::cINVALID_SOCKET; - } -} - -int socketOps::connect(const socketOps::tSOCKET s, const std::string &address, const u_short port) throw() -{ - unsigned long iaddr = inet_addr(address.c_str()); - struct sockaddr_in addr = {0}; - - addr.sin_family = AF_INET; - addr.sin_port = htons(port); - memcpy(&(addr.sin_addr), &iaddr, 4); - - return ::connect(s, (struct sockaddr *)&addr, sizeof(struct sockaddr)); -} - -int socketOps::connect(tSOCKET s,const endpoint &e) throw() -{ - return socketOps::connect(s, e.m_address, e.m_port); -} - -void socketOps::connectTHROW(const socketOps::tSOCKET s, const std::string &address, const u_short port) throw(std::runtime_error) -{ - if (socketOps::connect(s, address, port) == socketOps::cSOCKET_ERROR) - { - int err = socketOps::errCode(); -#ifdef _WIN32 - if ((err == WSAEINPROGRESS) || (err == WSAEWOULDBLOCK)) -#else - if ((err == EINPROGRESS) || (err == EWOULDBLOCK) || (err == ECONNABORTED) || (err == EINTR)) -#endif - return; - - throw std::runtime_error("Could not connect to " + address + ":" + tos(port) + " because " + socketOps::errMsg()); - } -} - -void socketOps::connectTHROW(tSOCKET s, const endpoint &e) throw(std::runtime_error) -{ - if (socketOps::connect(s, e) == socketOps::cSOCKET_ERROR) - { - int err = socketOps::errCode(); -#ifdef _WIN32 - if ((err == WSAEINPROGRESS) || (err == WSAEWOULDBLOCK)) -#else - if ((err == EINPROGRESS) || (err == EWOULDBLOCK) || (err == ECONNABORTED) || (err == EINTR)) -#endif - return; - - throw std::runtime_error("Could not connect to " + e.toString() + " because " + socketOps::errMsg()); - } -} - -socketOps::nonBlockConnect_t socketOps::nonBlockingConnectWait(const socketOps::tSOCKET s, std::string &errorString) throw() -{ - try - { -#ifdef _WIN32 - // non-blocking connects suck - fd_set rset, wset, eset; - struct timeval tval; - - FD_ZERO(&rset); FD_ZERO(&wset); FD_ZERO(&eset); - FD_SET(s,&rset); - FD_SET(s,&wset); - FD_SET(s,&eset); - - tval.tv_sec = 0; - tval.tv_usec = 1; - - int n = ::select(((int)s)+1,&rset,&wset,&eset,&tval); - - // if n == 0 then we timed out, and must stay in this state - if (n == 0) - { - return socketOps::NBC_INPROGRESS; - } - - if (n < 0) // fatal select error - { - try - { - errorString = socketOps::errMsg(); - } - catch(...) - { - errorString = "Impossible connection failure. (1)"; - } - return socketOps::NBC_ERROR; - } - - // detecting when a non-blocking connect is ready (or has errored) - // is highly platform dependent. Microsoft docs specify one way, Stevens - // (2nd edition page 411) specifies another way to cover various Unix flavors - if (FD_ISSET(s,&eset)) - { - errorString = "Connection failure."; - return socketOps::NBC_ERROR; - } - else if (FD_ISSET(s,&wset)) - { - return socketOps::NBC_CONNECTED; - } - else - { - errorString = "Impossible connection failure. (2)"; - return socketOps::NBC_ERROR; - } -#else - struct pollfd check; - int val = -1; - socklen_t size = sizeof val; - check.fd = s; - check.events = POLLOUT; - switch (poll (&check, 1, 0)) - { - case 0: - { - return socketOps::NBC_INPROGRESS; - } - default: - { - if (getsockopt (s, SOL_SOCKET, SO_ERROR, (void*) &val, &size) == 0) - { - if (val == 0) - { - return socketOps::NBC_CONNECTED; - } - errno = val; - } - // fall thru - } - case -1: - { - if (errno == EINTR) - { - return socketOps::NBC_INPROGRESS; - } - throw std::runtime_error(""); - } - } -#endif - } - catch(...) - { -#ifdef _WIN32 - errorString = "Impossible connection failure. (3)"; -#else - errorString = "Connection failure."; -#endif - return socketOps::NBC_ERROR; - } -} - -socketOps::tSOCKET socketOps::bind(tSOCKET s, u_short port, const std::string &address) throw() -{ - struct sockaddr_in servaddr = {0}; - servaddr.sin_family = AF_INET; - - if (address == "") - { - servaddr.sin_addr.s_addr = htonl(INADDR_ANY); - } - else - { - unsigned long iaddr = inet_addr(address.c_str()); - memcpy(&(servaddr.sin_addr), &iaddr, 4); - } - - servaddr.sin_port = htons(port); - return ::bind(s, (const sockaddr *)&servaddr, sizeof(servaddr)); -} - -socketOps::tSOCKET socketOps::bind(tSOCKET s, const socketOps::endpoint &e) throw() -{ - return socketOps::bind(s,e.m_port,e.m_address); -} - -void socketOps::bindTHROW(tSOCKET s, u_short port, const std::string &address) throw(std::runtime_error) -{ - if (socketOps::bind(s,port,address) == socketOps::cSOCKET_ERROR) - { - throw std::runtime_error("Could not bind to " + (!address.empty() ? address + ":" : "") + tos(port) + " because " + socketOps::errMsg()); - } -} - -void socketOps::bindTHROW(tSOCKET s,const endpoint &e) throw(std::runtime_error) -{ - if (socketOps::bind(s,e) == socketOps::cSOCKET_ERROR) - { - throw std::runtime_error("Could not bind to " + e.toString() + " because " + socketOps::errMsg()); - } -} - -int socketOps::accept(tSOCKET s, std::string &address, u_short &port) throw() -{ - struct sockaddr_in client_addr = {0}; -#ifdef _WIN32 - int len = sizeof(client_addr); -#else - socklen_t len = sizeof(client_addr); -#endif - - socketOps::tSOCKET sC = ::accept(s, (sockaddr*)&client_addr, &len); - if (sC != socketOps::cSOCKET_ERROR) - { - port = ntohs(client_addr.sin_port); - address = inet_ntoa(client_addr.sin_addr); - } - return (int)sC; -} - -int socketOps::accept(tSOCKET s,endpoint &e) throw() -{ - return socketOps::accept(s,e.m_address,e.m_port); -} - -int socketOps::acceptTHROW(tSOCKET s, std::string &address, u_short &port, bool nonblocking) throw(std::runtime_error) -{ - socketOps::tSOCKET sC = socketOps::accept(s, address, port); - if (sC == socketOps::cSOCKET_ERROR) - { - if (!nonblocking) - { - throw std::runtime_error(socketOps::errMsg()); - } - - int e = socketOps::errCode(); -#ifdef _WIN32 - if ((e == WSAEINPROGRESS) || (e == WSAEWOULDBLOCK)) - { - return (int)socketOps::cSOCKET_ERROR; - } -#else - if ((e == EWOULDBLOCK) || (e == ECONNABORTED) || (e == EINTR)) - { - return socketOps::cSOCKET_ERROR; - } -#endif - throw std::runtime_error("Could not call accept() on socket because " + socketOps::errMsg(e)); - } - - return (int)sC; -} - -int socketOps::acceptTHROW(tSOCKET s, endpoint &e, bool nonblocking) throw(std::runtime_error) -{ - return socketOps::acceptTHROW(s, e.m_address, e.m_port, nonblocking); -} - -void socketOps::listenTHROW(tSOCKET s, int backlog) throw(std::runtime_error) -{ - if (::listen(s, backlog) == socketOps::cSOCKET_ERROR) - { - throw std::runtime_error("Could not call listen() on socket because " + socketOps::errMsg()); - } -} - -int socketOps::getsockname(tSOCKET s, std::string &address, u_short &port) throw() -{ - sockaddr_in in4 = {0}; -#ifdef _WIN32 - int in4len = sizeof(in4); -#else - socklen_t in4len = sizeof(in4); -#endif - - int result = ::getsockname(s,(sockaddr*)&in4,&in4len); - if (result != socketOps::cSOCKET_ERROR) - { - port = ntohs(in4.sin_port); - address = inet_ntoa(in4.sin_addr); - } - return result; -} - -int socketOps::getsockname(tSOCKET s,endpoint &e) throw() -{ - return socketOps::getsockname(s, e.m_address, e.m_port); -} - -void socketOps::getsocknameTHROW(tSOCKET s, endpoint &e) throw(std::runtime_error) -{ - if (socketOps::getsockname(s, e) == socketOps::cSOCKET_ERROR) - { - throw std::runtime_error(socketOps::errMsg()); - } -} - -void socketOps::getsocknameTHROW(tSOCKET s, std::string &address, u_short &port) throw(std::runtime_error) -{ - if (socketOps::getsockname(s, address, port) == socketOps::cSOCKET_ERROR) - { - throw std::runtime_error(socketOps::errMsg()); - } -} - -int socketOps::getpeername(tSOCKET s, std::string &address, u_short &port) throw() -{ - address = ""; - port = 0; - sockaddr_in in4 = {0}; -#ifdef _WIN32 - int in4len = sizeof(in4); -#else - socklen_t in4len = sizeof(in4); -#endif - - int result = ::getpeername(s, (sockaddr*)&in4,&in4len); - if (result != socketOps::cSOCKET_ERROR) - { - port = ntohs(in4.sin_port); - address = inet_ntoa(in4.sin_addr); - } - return result; -} - -int socketOps::getpeername(tSOCKET s, endpoint &e) throw() -{ - return socketOps::getpeername(s, e.m_address, e.m_port); -} - -void socketOps::getpeernameTHROW(tSOCKET s, endpoint &e) throw(std::runtime_error) -{ - if (socketOps::getpeername(s, e) == socketOps::cSOCKET_ERROR) - { - throw std::runtime_error(socketOps::errMsg()); - } -} - -void socketOps::getpeernameTHROW(tSOCKET s, std::string &address, u_short &port) throw(std::runtime_error) -{ - if (socketOps::getpeername(s, address, port) == socketOps::cSOCKET_ERROR) - { - throw std::runtime_error(socketOps::errMsg()); - } -} - -// accepts IPv4 or IPv6 -int socketOps::addressToHostName(const std::string &address, u_short port, std::string &hostname) throw() -{ - struct addrinfo *result/*, hints = {AI_PASSIVE | AI_CANONNAME, AF_INET, SOCK_STREAM}*/; - - std::string portS = tos(port); - int err = ::getaddrinfo(address.c_str(),portS.c_str(),0,&result); - if ((!err) && result) - { - char h[NI_MAXHOST + 1] = {0}; - err = ::getnameinfo(result->ai_addr, (int)result->ai_addrlen, h, NI_MAXHOST, 0, 0, 0); - hostname = h; - ::freeaddrinfo(result); - } - return err; -} - -int socketOps::addressToHostName(const endpoint &e, std::string &hostname) throw() -{ - return socketOps::addressToHostName(e.m_address, e.m_port, hostname); -} - -void socketOps::addressToHostNameTHROW(const std::string &address, u_short port, std::string &hostname) throw(std::runtime_error) -{ - if (socketOps::addressToHostName(address, port, hostname) == socketOps::cSOCKET_ERROR) - { - throw std::runtime_error(socketOps::errMsg()); - } -} - -void socketOps::addressToHostNameTHROW(const endpoint &e, std::string &hostname) throw(std::runtime_error) -{ - socketOps::addressToHostNameTHROW(e.m_address, e.m_port, hostname); -} - -int socketOps::hostNameToAddress(std::string &address, const std::string &hostname, u_short port) throw(std::runtime_error) -{ - struct addrinfo *result, hints = {AI_PASSIVE | AI_CANONNAME, AF_INET, SOCK_STREAM}; - address = ""; - - std::string portS = tos(port); - int err = ::getaddrinfo(hostname.c_str(), (port ? portS.c_str() : 0), &hints, &result); - if ((!err) && result) - { - address = ::inet_ntoa(((sockaddr_in*)(result->ai_addr))->sin_addr); - if (!address.empty() && address.find("0.") == 0) - { - address = ""; - } - ::freeaddrinfo(result); - } - return err; -} - -std::string socketOps::hostNameToAddress(const std::string &hostname, u_short port) throw(std::runtime_error) -{ - std::string address; - hostNameToAddress(address, hostname, port); - return address; -} - -std::string socketOps::hostNameToAddressTHROW(const std::string &hostname, u_short port) throw(std::runtime_error) -{ - std::string address; - if (hostNameToAddress(address, hostname, port)) - { - throw std::runtime_error(socketOps::errMsg()); - } - return address; -} - -#ifdef _WIN32 -LPFN_WSAPOLL fnWSAPoll = NULL; -typedef unsigned long nfds_t; - -static void add_to_fd_set_fntr(const socketOps::tSOCKET s, fd_set *fdset) throw() -{ - FD_SET(s, fdset); -} -#else -#define fnWSAPoll poll -#endif - -#include -int socketOps::socketSelect(std::set &readSockets, std::set writeSockets, const int timeout) throw() -{ - //ELOG("socketSelect: " + tos(readSet.size()) + " - " + tos(writeSet.size()) + " - " + tos(timeout)); - -#ifdef _WIN32 - if (!fnWSAPoll) - { - fd_set readSet; - fd_set writeSet; - fd_set excepSet; - FD_ZERO(&readSet); - FD_ZERO(&writeSet); - FD_ZERO(&excepSet); - for_each(readSockets.begin(), readSockets.end(), std::bind2nd(std::ptr_fun(add_to_fd_set_fntr), &readSet)); - for_each(writeSockets.begin(), writeSockets.end(), std::bind2nd(std::ptr_fun(add_to_fd_set_fntr), &writeSet)); - for_each(readSockets.begin(), readSockets.end(), std::bind2nd(std::ptr_fun(add_to_fd_set_fntr), &excepSet)); - for_each(writeSockets.begin(), writeSockets.end(), std::bind2nd(std::ptr_fun(add_to_fd_set_fntr), &excepSet)); - - // as we're workig in milliseconds then we need to convert to - // provide select the timeout that is wanted as a timeval - struct timeval tm = {(timeout / 1000), ((timeout % 1000) * 1000)}; - // The Windows version ignores the first arg, no need to calculate it - return ::select(0, &readSet, &writeSet, &excepSet, &tm); - } -#endif - - size_t i = 0; - nfds_t length = (nfds_t)(readSockets.size() + writeSockets.size()); - std::vector dataSet (length); - - for (std::set::iterator it = readSockets.begin(); it != readSockets.end(); ++it) - { - dataSet[i].events = POLLIN; - dataSet[i++].fd = *it; - } - - for (std::set::iterator it = writeSockets.begin(); it != writeSockets.end(); ++it) - { - dataSet[i].events = POLLOUT; - dataSet[i++].fd = *it; - } - - return fnWSAPoll (&dataSet[0], length, timeout); -} - -#ifdef _WIN32 -/*------------------------------------------------------------------------- - * - * This is a replacement version of pipe for Win32 which allows - * returned handles to be used in select(). Note that read/write calls - * must be replaced with recv/send. - * - * - *------------------------------------------------------------------------- - */ - -int pgpipe(int handles[2]) -{ - SOCKET s = {0}; - struct sockaddr_in serv_addr = {0}; - int len = sizeof(serv_addr); - - handles[0] = handles[1] = (int)INVALID_SOCKET; - - if ((s = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) - { - return -1; - } - - serv_addr.sin_family = AF_INET; - serv_addr.sin_port = htons(0); - serv_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - if (::bind(s, (SOCKADDR *)&serv_addr, len) == SOCKET_ERROR) - { - ::closesocket(s); - return -1; - } - - if (::listen(s, 1) == SOCKET_ERROR) - { - ::closesocket(s); - return -1; - } - - if (::getsockname(s, (SOCKADDR *)&serv_addr, &len) == SOCKET_ERROR) - { - ::closesocket(s); - return -1; - } - - if ((handles[1] = (int)::socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) - { - ::closesocket(s); - return -1; - } - - if (::connect(handles[1], (SOCKADDR *)&serv_addr, len) == socketOps::cSOCKET_ERROR) - { - ::closesocket(s); - return -1; - } - - if ((handles[0] = (int)::accept(s, (SOCKADDR *)&serv_addr, &len)) == INVALID_SOCKET) - { - ::closesocket(handles[1]); - handles[1] = (int)INVALID_SOCKET; - ::closesocket(s); - return -1; - } - - ::closesocket(s); - return 0; -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/webNet/socketOps.h b/Src/Plugins/DSP/sc_serv3/webNet/socketOps.h deleted file mode 100644 index 10ea2124..00000000 --- a/Src/Plugins/DSP/sc_serv3/webNet/socketOps.h +++ /dev/null @@ -1,182 +0,0 @@ -#pragma once -#ifndef _socketOps_H_ -#define _socketOps_H_ - -#ifdef _WIN32 -#include -#else -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif -#include -#include "stl/stringUtils.h" -#include -#include -#include -#include -#include - -using namespace std; - -/* - socketOps namespace - - Encased in this namespace is a collection of constants, types and functions - to help bridge the gap between Win32 and Unix socket implementations, and also - to simplify some socket coding. - - Since the Win32 and Unix berkeley socket implementations are extremely similar, I - felt that a collection of helper functions were of more use, and more flexible, than - full blown socket wrapper classes. -*/ - -namespace socketOps -{ -#ifdef _WIN32 - typedef SOCKET tSOCKET; - extern const SOCKET cINVALID_SOCKET; - extern const SOCKET cSOCKET_ERROR; - //#define EINPROGRESS WSAEINPROGRESS - //#define EWOULDBLOCK WSAEWOULDBLOCK - #define SOCKETOPS_WOULDBLOCK WSAEWOULDBLOCK -#else - typedef int tSOCKET; - extern const int cINVALID_SOCKET; - extern const int cSOCKET_ERROR; - #define WSAEINPROGRESS EINPROGRESS - #define WSAEWOULDBLOCK EWOULDBLOCK - #define SOCKETOPS_WOULDBLOCK EWOULDBLOCK -#endif - - // socket endpoint - struct endpoint - { - std::string m_address; - u_short m_port; - - endpoint() : m_port(0) {} - endpoint(const std::string &address, u_short port) : m_address(address), m_port(port) {} - - bool operator==(const endpoint &e) const throw() - { - return ((m_address == e.m_address) && (m_port == e.m_port)); - } - - bool operator<(const endpoint &e) const throw() - { - if (m_address < e.m_address) return true; - if (m_address > e.m_address) return false; - if (m_port < e.m_port) return true; - if (m_port > e.m_port) return false; - return false; - } - - std::string toString() const throw(); // for messages - }; - - std::string errMsg(int code) throw(); - int errCode() throw(); - inline std::string errMsg() throw() { return socketOps::errMsg(socketOps::errCode()); } - - // createTCPSocket: creates a standard TCP/IP stream socket. The "throw" version - // will throw an exception if an error occurs instead of returning cSOCKET_ERROR - tSOCKET createTCPSocket() throw(); - tSOCKET createTCPSocketTHROW() throw(std::runtime_error); - - // setNonblock: non blocking is set different under unix and windows. These calls - // hide the different. First version returns the typical cSOCKET_ERROR when - // there is a problem. Second will throw an exception instead - int setNonblock(tSOCKET s,bool nonblock) throw(); - void setNonblockTHROW(tSOCKET s,bool nonblock) throw(std::runtime_error); - - // closeTCPSocket: does a blocking shutdown() and close() - void closeTCPSocket(tSOCKET s) throw(); - void forgetTCPSocket(tSOCKET &s) throw(); // similar, but checks s first and then clear it - - // connect: connects are the same across platforms. These just simplify the calls - // addresses for these calls most be #.#.#.# - int connect(tSOCKET s, const std::string &address, u_short port) throw(); - int connect(tSOCKET s, const endpoint &e) throw(); - void connectTHROW(tSOCKET s, const std::string &address, u_short port) throw(std::runtime_error); - void connectTHROW(tSOCKET s, const endpoint &e) throw(std::runtime_error); - - // bind: binds are the same across platforms. These just simplify the calls - tSOCKET bind(tSOCKET s, u_short port, const std::string &address = "") throw(); - tSOCKET bind(tSOCKET s, const endpoint &e) throw(); - void bindTHROW(tSOCKET s, u_short port, const std::string &address = "") throw(std::runtime_error); - void bindTHROW(tSOCKET s, const endpoint &e) throw(std::runtime_error); - - // note: for non-blocking accepts, the various "errno" errors can be different - // under different OS's. If you use the calls that do not throw exception you - // will have to handle these differences yourself. If you call the ones that - // throw, I try to handle it for you. In these calls, if the nonblocking parameter - // is true, the call will return cSOCKET_ERROR if accept has nothing to do (returns - // EWOULDBLOCK or similar). If a REAL error occurs, then it throws an exception. - int accept(tSOCKET s, endpoint &e) throw(); - int accept(tSOCKET s, std::string &address, u_short &port) throw(); - int acceptTHROW(tSOCKET s, endpoint &e, bool nonblocking) throw(std::runtime_error); - int acceptTHROW(tSOCKET s, std::string &address, u_short &port, bool nonblocking) throw(std::runtime_error); - - // listen: helper func that throws an exception instead of returning an error code - void listenTHROW(tSOCKET s, int backlog = SOMAXCONN) throw(std::runtime_error); - - // waiting on a non-blocking connect call is messy. Use this call to avoid - // the muck - typedef enum { NBC_ERROR, NBC_INPROGRESS, NBC_CONNECTED } nonBlockConnect_t; - nonBlockConnect_t nonBlockingConnectWait(tSOCKET s, std::string &error) throw(); - - int socketSelect(std::set &readSockets, std::set writeSockets, const int timeout) throw(); - - int getsockname(tSOCKET s, endpoint &e) throw(); - int getsockname(tSOCKET s, std::string &address, u_short &port) throw(); - void getsocknameTHROW(tSOCKET s, endpoint &e) throw(std::runtime_error); - void getsocknameTHROW(tSOCKET s, std::string &address, u_short &port) throw(std::runtime_error); - - int getpeername(tSOCKET s, endpoint &e) throw(); - int getpeername(tSOCKET s, std::string &address, u_short &port) throw(); - void getpeernameTHROW(tSOCKET s, endpoint &e) throw(std::runtime_error); - void getpeernameTHROW(tSOCKET s, std::string &address, u_short &port) throw(std::runtime_error); - - int addressToHostName(const endpoint &e, std::string &hostname) throw(); - int addressToHostName(const std::string &address, u_short port, std::string &hostname) throw(); - void addressToHostNameTHROW(const endpoint &e, std::string &hostname) throw(std::runtime_error); - void addressToHostNameTHROW(const std::string &address, u_short port, std::string &hostname) throw(std::runtime_error); - - int hostNameToAddress(std::string &address, const std::string &hostname, u_short port = 0) throw(std::runtime_error); - std::string hostNameToAddress(const std::string &hostname, u_short port = 0) throw(std::runtime_error); - std::string hostNameToAddressTHROW(const std::string &hostname, u_short port = 0) throw(std::runtime_error); -} - -#ifdef _WIN32 -/*------------------------------------------------------------------------- - * - * This is a replacement version of pipe for Win32 which allows - * returned handles to be used in select(). Note that read/write calls - * must be replaced with recv/send. - * - * - *------------------------------------------------------------------------- - */ -int pgpipe(int handles[2]); -#endif - -#ifndef _WIN32 -#define pgpipe(a) pipe(a) -#define piperead(a,b,c) read(a,b,c) -#define pipewrite(a,b,c) write(a,b,c) -#define pipeclose(a) { ::shutdown(a,2); ::close(a);} -#else -#define piperead(a,b,c) recv(a,b,c,0) -#define pipewrite(a,b,c) send(a,b,c,0) -#define pipeclose(a) { ::shutdown(a,SD_BOTH); ::closesocket(a); } -#endif - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/webNet/urlUtils.cpp b/Src/Plugins/DSP/sc_serv3/webNet/urlUtils.cpp deleted file mode 100644 index 75c0d492..00000000 --- a/Src/Plugins/DSP/sc_serv3/webNet/urlUtils.cpp +++ /dev/null @@ -1,240 +0,0 @@ -#include "urlUtils.h" -#include "stl/stringUtils.h" -#include -#include -#ifdef _WIN32 -#include -#define snprintf _snprintf -#define unused_attribute -#else -#include -#include -#include -#define _ASSERTE assert -#define unused_attribute __attribute__((unused)) -#endif - -using namespace std; -using namespace stringUtil; - -static string gExcluded = " <>#%\"{}|\\^[]`"; -static string gReserved = ";/?:@&=+$,"; -static string gMark = "-_.!~*'()"; -static string gDigit = "0123456789"; -static string gLowAlpha = "abcdefghijklmnopqrstuvwxyz"; -static string gHiAlpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -static string gUnreserved_RFC3986 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~"; -static string gReserved_RFC3986 = "!*'();:@&=+$,/?%#[]"; - -template -static set setunion(const set &s1, const set &s2) -{ - set result(s1); - result.insert(s2.begin(), s2.end()); - return result; -} - -static set gSetExcluded(gExcluded.begin(), gExcluded.end()); -static set gSetReserved(gReserved.begin(), gReserved.end()); -static set gSetExcludedAndReserved(setunion(gSetExcluded, gSetReserved)); -static set gSetMark(gMark.begin(), gMark.end()); -static set gSetLowAlpha(gLowAlpha.begin(), gLowAlpha.end()); -static set gSetHiAlpha(gHiAlpha.begin(), gHiAlpha.end()); -static set gSetDigit(gDigit.begin(), gDigit.end()); -static set gSetAlpha(setunion(gSetLowAlpha, gSetHiAlpha)); -static set gSetAlphanum(setunion(gSetAlpha, gSetDigit)); -static set gSetUnreserved(setunion(gSetAlphanum, gSetMark)); -static set gSetUnreserved_RFC3986(gUnreserved_RFC3986.begin(), gUnreserved_RFC3986.end()); -static set gSetReserved_RFC3986(gReserved_RFC3986.begin(), gReserved_RFC3986.end()); - -//////////////////////////////////////////////// -////////// Escaping Funcs ////////////////////// -/////////////////////////////////////////////// - -// convert a character to its hex representation -static string escapeChar(__uint8 c) throw() -{ - char buf[8] = {0}; - int len unused_attribute = snprintf(buf, sizeof(buf), "%%%02X", (int)c); - _ASSERTE(len == 3); - return buf; -} - -// convert the char if it's in the set -static string escapeIfInSet(char c,const set &st) throw() -{ - return (st.find(c) == st.end() ? string(1, c) : escapeChar(c)); -} - -static string escapeIfNotInSet(char c, const set &st) throw() -{ - return (st.find(c) == st.end() ? escapeChar(c) : string(1, c)); -} - -template -static string escapeString(const STYPE &s, const set &st, ESC func) throw() -{ - string result; - for (typename STYPE::const_iterator i = s.begin(); i != s.end(); ++i) - { - result += func(*i,st); - } - return result; -} - -string urlUtils::escape(const std::string &s) throw() -{ - return escapeString(s, gSetExcludedAndReserved, escapeIfInSet); -} - -string urlUtils::escapeURI_RFC3986(const uniString::utf8 &s) throw() -{ - return escapeString(s, gSetUnreserved_RFC3986, escapeIfNotInSet); -} - -///////////////////////////////////////////////////// -//////////// Unescaping funcs ////////////////////// -//////////////////////////////////////////////////// - -// convert %xx to a character -inline char unescapeSequence(const string &s) throw() -{ - _ASSERTE(s.size() == 3); - _ASSERTE(s[0] == '%' && isxdigit(s[1]) && isxdigit(s[2])); - unsigned int v = 0; - sscanf(s.c_str(), "%%%02x", &v); - return (char)v; -} - -uniString::utf8 urlUtils::unescapeString(const string &s) throw() -{ - string result; - string escTok; - int ccnt(0); - - for (string::const_iterator i = s.begin(); i != s.end(); ++i) - { - bool escChar(false); - switch (ccnt) - { - case 0: - { - escChar = ((*i) == '%'); - break; - } - case 1: - { - escChar = (isxdigit(*i) ? true : false); - break; - } - case 2: - { - escChar = (isxdigit(*i) ? true : false); - break; - } - } - - if (escChar) - { - escTok += (*i); - ++ccnt; - } - else - { - result += escTok; - ccnt = 0; - if ((*i) == '+') - { - result += " "; - } - else - { - result += (*i); - } - } - if (ccnt == 3) - { - result += unescapeSequence(escTok); - escTok = ""; - ccnt = 0; - } - } - - result += escTok; - return uniString::utf8(result); -} - -//////////////////////////////////////////// -/////////// Classes //////////////////////// -string urlUtils::urlQueryEntry::escape() const throw() -{ - string result(escapeString(m_entry.first, gSetExcludedAndReserved, escapeIfInSet)); - - if (!m_entry.second.empty()) - { - result += "=" + escapeString(m_entry.second, gSetExcludedAndReserved, escapeIfInSet); - } - - return result; -} - -urlUtils::urlQueryEntry urlUtils::urlQueryEntry::parse(const string &s) throw() -{ - urlUtils::urlQueryEntry result; - - if (!s.empty()) - { - string::size_type pos = s.find("="); - result.m_entry.first = unescapeString(s.substr(0,pos)); - result.m_entry.second = (pos == string::npos ? "" : unescapeString(s.substr(pos+1))); - } - - return result; -} - -string urlUtils::urlQuery::escape() const throw() -{ - string result; - - for (vector::const_iterator i = m_query.begin(); i != m_query.end(); ++i) - { - result += (*i).escape(); - if (i + 1 != m_query.end()) - { - result += "&"; - } - } - - return result; -} - -urlUtils::urlQuery urlUtils::urlQuery::parse(const std::string &sin) throw() -{ - urlUtils::urlQuery result; - parse(sin, result); - return result; -} - -void urlUtils::urlQuery::parse(const std::string &sin, urlQuery &q) throw() -{ - q.clear(); - string s(sin); - - while (s != "") - { - if (!s.empty()) - { - string::size_type pos = s.find("&"); - q.m_query.push_back(urlUtils::urlQueryEntry::parse(s.substr(0, pos))); - if (pos == string::npos) - { - break; - } - s = s.substr(pos + 1); - } - else - { - break; - } - } -} diff --git a/Src/Plugins/DSP/sc_serv3/webNet/urlUtils.h b/Src/Plugins/DSP/sc_serv3/webNet/urlUtils.h deleted file mode 100644 index 0dfa344e..00000000 --- a/Src/Plugins/DSP/sc_serv3/webNet/urlUtils.h +++ /dev/null @@ -1,196 +0,0 @@ -#pragma once -#ifndef _urlUtils_H_ -#define _urlUtils_H_ - -#include -#include -#include -#include -#include -#include "unicode/uniString.h" -#include "stl/stringUtils.h" - -//*************************************************************************// -/* urlUtils - - Collection of classes to help create properly escaped URLs, and to - parse out and convert escaped URLs (see RFC 2396). - - 1) Creating a properly escaped url - - Create an urlBuilder object. Add the query data to it. Call escape() to - retrieve the entire URL as a properly escaped string. - - urlBuilder ub("http",urlAuthority("127.0.0.1","80","neil%%%radisch"),"/this/is/a/test"); - ub.addQueryEntry(urlQueryEntry("full name","Neil Mark Radisch")); - ub.addQueryEntry(urlQueryEntry("flag","")); - ub.addQueryEntry(urlQueryEntry("wierd_stuff","!@#$%^&&&===\"\'*()")); - cout << ub.escape() << endl; // print escaped url to screen - - 2) Parse out query data from an escaped url - - These utilities do not parse out a complete url. They were designed - to work in conjunction with the mclib webserver utility which - takes care of parsing out everything up to the query string. As such, - the parsing here is limited to the query. - - urlQuery uq(urlQuery::parse(getEscapedQueryString())); // parse the query string - // now walk through the results and print to screen - for (urlQuery::const_iterator i = uq.begin(); i != uq.end(); ++i) - { - cout << "key = " << (*i).getKey() << endl; - cout << "value = " << (*i).getValue() << endl; - cout << endl; - } -*/ -//*************************************************************************// - -namespace urlUtils { - - class urlQueryEntry - { - std::pair m_entry; - public: - urlQueryEntry(){} - template // can be string or utf8 - urlQueryEntry(const KEY &key, const VALUE &value) - :m_entry(key, value){} - urlQueryEntry(const urlQueryEntry &uqe) - :m_entry(uqe.m_entry){} - urlQueryEntry& operator = (const urlQueryEntry &uqe) - { m_entry = uqe.m_entry; return *this; } - bool operator == (const urlQueryEntry &uqe) const throw() { return m_entry == uqe.m_entry; } - - // set with unescaped data - template // string or utf8 - void set(const KEY &key, const VALUE &value) - { m_entry = std::pair(key, value); } - - // return query as escaped string - std::string escape() const throw(); - - // parse from escaped data - static urlQueryEntry parse(const std::string &s) throw(); - - // get unescaped values - std::pair get() const throw() { return m_entry; } - uniString::utf8 getKey() const throw() { return m_entry.first; } - uniString::utf8 getValue() const throw() { return m_entry.second; } - }; - - class urlQuery - { - std::vector m_query; - public: - typedef std::vector::iterator iterator; - typedef std::vector::const_iterator const_iterator; - - urlQuery(){} - bool operator==(const urlQuery &uq) const throw() { return m_query == uq.m_query; } - - void addQueryEntry(const urlQueryEntry &uqe) { m_query.push_back(uqe); } - void addQueryEntry(const std::string &key, const std::string &value) { m_query.push_back(urlQueryEntry(key, value)); } - void addQueryEntry(const uniString::utf8 &key, const uniString::utf8 &value) { m_query.push_back(urlQueryEntry(key, value)); } - std::string escape() const throw(); - bool empty() const throw() { return m_query.empty(); } - size_t size() const throw() { return m_query.size(); } - urlQueryEntry& operator[](size_t index) { return m_query[index]; } - iterator begin() throw() { return m_query.begin(); } - iterator end() throw() { return m_query.end(); } - const_iterator begin() const throw() { return m_query.begin(); } - const_iterator end() const throw() { return m_query.end(); } - void clear() throw() { m_query.clear(); } - - static urlQuery parse(const std::string &s) throw(); - static void parse(const std::string &s, urlQuery &q) throw(); - - void parseString(const std::string &s) throw() { parse(s,*this); } - - urlQuery::const_iterator findKey(const uniString::utf8 &key) const throw() - { - for (std::vector::const_iterator i = m_query.begin(); i != m_query.end(); ++i) - { - if ((*i).getKey() == key) - return i; - } - return m_query.end(); - } - - bool hasKey(const uniString::utf8 &key) const throw() { return (findKey(key) != m_query.end()); } - - template - T keyValue(const uniString::utf8 &key,const T &deflt) const throw() - { - urlQuery::const_iterator i = findKey(key); - return (i != m_query.end() ? (*i).getValue() : deflt); - } - template - T keyValue(const uniString::utf8 &key) const throw() - { - return keyValue(key,T()); - } - }; - - template<> - inline bool urlQuery::keyValue(const uniString::utf8 &key, const bool &deflt) const throw() - { - urlQuery::const_iterator i = findKey(key); - if (i == m_query.end()) - { - return deflt; - } - - uniString::utf8 v = (*i).getValue(); - while (!v.empty() && stringUtil::safe_is_space(v[0])) - { - v = v.substr(1); - } - if (v.empty()) - { - return deflt; - } - return (v[0] == 't' || v[0] == 'T' || v[0] == '1' || v[0] == 'y' || v[0] == 'Y'); - } - - template<> - inline int urlQuery::keyValue(const uniString::utf8 &key, const int &deflt) const throw() - { - urlQuery::const_iterator i = findKey(key); - return (i != m_query.end() ? atoi((const char *)(*i).getValue().c_str()) : deflt); - } - - template<> - inline long urlQuery::keyValue(const uniString::utf8 &key, const long &deflt) const throw() - { - urlQuery::const_iterator i = findKey(key); - return (i != m_query.end() ? atol((const char *)(*i).getValue().c_str()) : deflt); - } - - template<> - inline unsigned int urlQuery::keyValue(const uniString::utf8 &key, const unsigned int &deflt) const throw() - { - urlQuery::const_iterator i = findKey(key); - return (i != m_query.end() ? (unsigned int)atol((const char *)(*i).getValue().c_str()) : deflt); - } - -#ifdef _WIN32 - template<> - inline __int64 urlQuery::keyValue(const uniString::utf8 &key, const __int64 &deflt) const throw() - { - urlQuery::const_iterator i = findKey(key); - return (i != m_query.end() ? _atoi64((const char *)(*i).getValue().c_str()) : deflt); - } -#endif - - template<> - inline bool urlQuery::keyValue(const uniString::utf8 &key) const throw() - { - return keyValue(key, false); - } - - std::string escape(const std::string &s) throw(); - uniString::utf8 unescapeString(const std::string &s) throw(); - std::string escapeURI_RFC3986(const uniString::utf8 &s) throw(); -} - -#endif diff --git a/Src/Plugins/DSP/sc_serv3/yp2.cpp b/Src/Plugins/DSP/sc_serv3/yp2.cpp deleted file mode 100644 index 8e7fd5d0..00000000 --- a/Src/Plugins/DSP/sc_serv3/yp2.cpp +++ /dev/null @@ -1,1233 +0,0 @@ -#ifdef _WIN32 -#include -#endif -#include -#include "cpucount.h" -#include "yp2.h" -#include "updater.h" -#include "stl/stringUtils.h" -#include "file/fileUtils.h" -#include "aolxml/aolxml.h" -#include "bandwidth.h" -#include "streamData.h" -#include "stats.h" -#include "metadata.h" -#include "services/stdServiceImpl.h" - -using namespace std; -using namespace uniString; -using namespace stringUtil; - -static AOL_namespace::mutex g_YP2Lock; -static yp2 *gYP2 = 0; -extern int auth_enabled; - -// for production we don't need to prettify the xml for the YP -#ifdef XML_DEBUG -#define EOL "\n" -#else -#define EOL "" -#endif - -#define DEBUG_LOG(...) do { if (gOptions.yp2Debug()) DLOG(__VA_ARGS__); } while (0) - -#define ADD_CMD 0 -#define REM_CMD 1 -#define UPD_CMD 2 - -#define REQUEST_KEY m_userData_u -#define REQUEST_CMD m_userData_i -#define REQUEST_USR m_userData_p - -uniString::utf8 yp2::logString(const yp2::yp2SessionKey &key) throw() { return "key=" + tos(key); } - -yp2::stationInfo::stationInfo() throw() : m_updateFrequency(gOptions.ypReportInterval()), m_advertMode(0) -{ - m_allowSSL = -1; - m_allowAllFormats = -1; - m_allowMaxBitrate = 0; - m_allowBackupURL = -1; -} - - -/////////////////////////////////////////////////////////////////////////////////////////// -void yp2::updateYPBandWidthSent(webClient::request r) throw() -{ - // this effectively works out the size in the same manner - // as webclient::toRequest(..) does to build the request. - size_t total = r.m_content.size() + r.m_contentType.size() + - // 'POST' or 'GET' with '?' on the front - (r.m_method == webClient::request::POST ? 4 : 3) + - 64 + r.m_addr.size() + g_userAgent.size() + - (!r.m_content.empty() ? r.m_content.size() : 0); - - for (httpHeaderMap_t::const_iterator i = r.m_queryVariables.begin(); i != r.m_queryVariables.end(); ++i) - { - if (i != r.m_queryVariables.begin()) - { - ++total; - } - total += urlUtils::escapeURI_RFC3986((*i).first).size(); - if (!(*i).second.empty()) - { - total += 1 + urlUtils::escapeURI_RFC3986((*i).second).size(); - } - } - - if (!r.m_XFF.empty()) - { - total += 18 + r.m_XFF.size(); - } - - if ((r.m_method == webClient::request::POST) && r.m_content.empty()) - { - total += 48; - } - else if (!r.m_contentType.empty()) - { - total += 15 + r.m_contentType.size(); - } - - bandWidth::updateAmount(bandWidth::YP_SENT, total); -} - -size_t yp2::requestsInQueue() throw() -{ - stackLock sml(g_YP2Lock); - - return (gYP2 ? gYP2->queueEntries() : 0); -} - -yp2::yp2() throw() : webClient(YP2_LOGNAME) -{ - stackLock sml(g_YP2Lock); - - gYP2 = this; - m_addFailed = false; - m_ignoreAdd = false; - m_errorCode = 200; - m_errorMsg = ""; - m_errorMsgExtra = ""; - m_sessionKeyCounter = 1; -} - -yp2::~yp2() throw() -{ - stackLock sml(g_YP2Lock); - - gYP2 = 0; -} - -void yp2::getAddUpdateBody(webClient::request& r, const ypInfo& info, const bool update) throw() -{ - r.m_method = webClient::request::POST; - r.m_addr = gOptions.ypAddr(); - r.m_port = gOptions.ypPort(); - r.m_path = gOptions.ypPath(); - r.m_nonBlocking = 1; - r.m_contentType = "text/xml;charset=utf-8"; - r.REQUEST_KEY = info.key; - r.REQUEST_CMD = (!update ? ADD_CMD : UPD_CMD); - r.REQUEST_USR = reinterpret_cast(info.streamPublic); - r.m_sid = (!info.sid ? DEFAULT_CLIENT_STREAM_ID : info.sid); - r.m_XFF = metrics::metrics_verifyDestIP(gOptions); - - utf8 id; - if (update) - { - yp2_server_state &yp2ss = m_serverMap[info.key]; - id = ("" + yp2ss.m_serverID.escapeXML() + ""); - } - - const utf8 xml = "" EOL\ - "" EOL\ - "" EOL\ - "" + tos(::time(NULL)) + "" EOL\ - "" EOL\ - "" + tos(g_portForClients) + "" EOL\ - "" + getStreamPath(info.sid).escapeXML() + "" EOL\ - "" + tos(r.m_sid) + "" EOL\ - "" + gOptions.m_usedAlternatePorts + "" EOL\ - "" EOL\ - + ((!info.streamPublic && !gOptions.cdn().empty()) ? "1" : "") + EOL\ - "" + tos(info.bitrate) + "" EOL\ - "" + tos(info.samplerate) + "" EOL\ - "" + tos(info.vbr) + "" EOL\ - "" + info.mimeType.escapeXML() + "" EOL\ - + (update ? id : "") + EOL\ - "" + tos(info.streamArtwork) + "" EOL\ - "" + tos(info.playingArtwork) + "" EOL\ - "" + tos(info.peakClientConnections) + "" EOL\ - "" + (info.maxClientConnections > 0 ? tos(info.maxClientConnections) : "unlimited") + "" EOL\ - "" + info.authhash.escapeXML() + "" EOL\ - "" + info.sourceUser.escapeXML() + "" EOL\ - "" + (!info.sourceIdent.empty() ? info.sourceIdent.escapeXML() : "Legacy / Unknown") + "" EOL\ - "" + gOptions.getVersionBuildStrings().c_str() + "/" SERV_OSNAME"" EOL\ - "" + tos(gOptions.getCPUCount()) + "/" + tos(cpucount()) + "" EOL\ - + (!info.relayURL.empty() ? "" + info.relayURL.escapeXML() + "" : "") + EOL\ - + (update ? "" EOL\ - "" + tos(info.numListeners) + "" EOL\ - "" + tos(info.numUniqueListeners) + "" EOL\ - "" + tos(info.avgUserListenTime) + "" EOL\ - "" + tos(info.numberOfClientsConnectedMoreThanFiveMinutes) + "" EOL\ - "" + tos(info.numberOfClientConnectsSinceLastUpdate) + "" EOL\ - "" : "") + EOL\ - + (!info.songMetadataForYP2.empty() ? METADATA + EOL + - info.songMetadataForYP2 + EOL + E_METADATA : "") + EOL\ - "" EOL""; - - r.m_content.insert(r.m_content.end(), xml.begin(), xml.end()); - updateYPBandWidthSent(r); - - if (!update) - { - yp2_server_state &yp2ss = m_serverMap[info.key]; - DEBUG_LOG(YP2_LOGNAME + string(__FUNCTION__) + " add for " + logString(info.key) + - " [" + tos(yp2ss.m_addRetries) + "]" + eol() + xml); - - ++yp2ss.m_addRetries; - yp2ss.m_addState = ADD_PENDING; - yp2ss.m_lastOperationTime = ::time(NULL); - - queueRequest((yp2ss.m_lastRequest = r)); - } - else - { - DEBUG_LOG(YP2_LOGNAME + string(__FUNCTION__) + " " + logString(info.key) + eol() + xml); - queueRequest(r); - } -} - -/* - It is called before each update to confirm that the connection to yp is still good. - Normally this wouldn't really be necessary, but if yp goes down, we want to re-establish - without having to restart sc_serv -*/ -yp2::yp2SessionKey yp2::pvt_add(ypInfo& info) throw(exception) -{ - if (info.key == INVALID_SESSION_KEY) - { - info.key = m_sessionKeyCounter; - while (++m_sessionKeyCounter == INVALID_SESSION_KEY) {;} - } - - stackLock sml(m_serverMapLock); - - if (gOptions.yp2Debug()) - { - // either is okay since this is called continuouslly - serverMap_t::const_iterator i = m_serverMap.find(info.key); - if (i == m_serverMap.end()) - { - DEBUG_LOG(YP2_LOGNAME + string(__FUNCTION__) + " No entry for " + logString(info.key)); - } - } - - yp2_server_state &yp2ss = m_serverMap[info.key]; - yp2ss.m_authHash = info.authhash; - yp2ss.m_sessionKey = info.key; - yp2ss.m_streamID = info.sid; - - assert(yp2ss.m_addState != ADD_REMOVEISSUED); - - bool must_delay_add = false; - if (yp2ss.m_addState == ADD_FAILED) - { - must_delay_add = true; - - static time_t ADD_RETRY_INTERVAL(gOptions.ypTimeout()); - time_t t = ::time(NULL); - if (t < yp2ss.m_lastOperationTime) // rollover compensation - { - yp2ss.m_lastOperationTime = t; - } - if (t - yp2ss.m_lastOperationTime >= ADD_RETRY_INTERVAL) - { - must_delay_add = false; - } - } - - // if state is NONE (just created) or failed, we try again - if (((yp2ss.m_addState == ADD_NONE) || (yp2ss.m_addState == ADD_FAILED) || - (yp2ss.m_addState == UPDATE_FAILED)) && (!must_delay_add)) - { - webClient::request r; - getAddUpdateBody(r, info, false); - return info.key; - } - return INVALID_SESSION_KEY; -} - -/* - remove() is called when a stream is destroyed, and this can lead to a number of cases - that interact with add - - 1) ADD_NONE - no problem here. Nothing has been done, nothing needs to be done. just remove table entry - 2) ADD_FAILED - again no problem. remove table entry - 3) ADD_SUCCEDED - again no problem. Send remove to yp(). Response function will remove table entry - 4) ADD_PENDING - This is trouble. We cannot queue a remove() because we don't have the - serverID yet. We also don't know what will happen with the pending add. - To deal with this we transition to the ADD_REMOVEISSUED state. - If add() succeeds and finds this state, we assume that - remove() occured, and then we post the actual remove to yp. If the subsequent add fails, it must - remove the table entry -*/ -void yp2::pvt_queue_remove(const ypInfo& info) throw() -{ - if (info.key != INVALID_SESSION_KEY) - { - webClient::request r; - r.m_method = webClient::request::POST; - r.m_addr = gOptions.ypAddr(); - r.m_port = gOptions.ypPort(); - r.m_path = gOptions.ypPath(); - r.m_nonBlocking = 0; - r.m_contentType = "text/xml;charset=utf-8"; - r.REQUEST_KEY = info.key; - r.REQUEST_CMD = REM_CMD; - r.REQUEST_USR = reinterpret_cast(info.streamPublic); - r.m_sid = (!info.sid ? DEFAULT_CLIENT_STREAM_ID : info.sid); - - yp2_server_state &yp2ss = m_serverMap[info.key]; - assert(yp2ss.m_sessionKey == info.key); - - utf8 cdn = ((!info.streamPublic && !gOptions.cdn().empty()) ? "1" EOL : ""); - utf8 xml = "" EOL\ - "" EOL\ - "" EOL\ - "" + tos(::time(NULL)) + "" EOL\ - "" EOL\ - "" + tos(g_portForClients) + "" EOL\ - "" + getStreamPath(info.sid).escapeXML() + "" EOL\ - "" + tos(r.m_sid) + "" EOL\ - "" + gOptions.m_usedAlternatePorts + "" EOL\ - "" EOL\ - + cdn +\ - "" + yp2ss.m_serverID.escapeXML() + "" EOL\ - + (info.peakClientConnections != (size_t)-1 ? "" + tos(info.peakClientConnections) + "" : "") + EOL\ - + (info.maxClientConnections != (size_t)-1 ? "" + - (info.maxClientConnections > 0 ? tos(info.maxClientConnections) : "unlimited") + "" : "") + EOL\ - "" + info.authhash.escapeXML() + "" EOL\ - "" EOL\ - ""; - - DEBUG_LOG(YP2_LOGNAME + string(__FUNCTION__) + " " + logString(info.key) + eol() + xml); - - r.m_content.insert(r.m_content.end(),xml.begin(),xml.end()); - - updateYPBandWidthSent(r); - queueRequest(r); - } -} - -void yp2::pvt_remove(ypInfo& info) throw(exception) -{ - assert(info.key != INVALID_SESSION_KEY); - - stackLock sml(m_serverMapLock); - - serverMap_t::iterator i = m_serverMap.find(info.key); - if (i == m_serverMap.end()) - { - throwEx("Internal error. " + logString(info.key) + - " does not exist in server map."); - } - - yp2_server_state &yp2ss = (*i).second; - - assert(yp2ss.m_authHash == info.authhash); - assert(yp2ss.m_sessionKey == info.key); - - metrics::metrics_stream_down (yp2ss.m_streamID, yp2ss.m_stationInfo.m_radionomyID, - yp2ss.m_serverID, yp2ss.m_stationInfo.m_publicIP, info.streamStartTime); - - switch (yp2ss.m_addState) - { - case ADD_NONE: - case ADD_FAILED: - case UPDATE_FAILED: - { - DEBUG_LOG(YP2_LOGNAME + string(__FUNCTION__) + " erasing map entry for key=" + tos(info.key)); - m_serverMap.erase(info.key); - break; - } - - case ADD_PENDING: - { - yp2ss.m_addState = ADD_REMOVEISSUED; - break; - } - - case ADD_SUCCEEDED: - { - if (yp2ss.m_serverID.empty()) - { - throwEx("Internal error. serverID for " + - logString(info.key) + " is empty."); - } - - DEBUG_LOG(YP2_LOGNAME "Sending remove for " + (*i).second.logString()); - pvt_queue_remove(info); - break; - } - - case ADD_REMOVEISSUED: - default: - { - throwEx(YP2_LOGNAME + string(__FUNCTION__) + " Internal error. Bad state"); - break; - } - } -} - -// only send an update if everything is ok (ADD_SUCCEEDED) -yp2::updateResult yp2::pvt_update(const ypInfo& info) throw(exception) -{ - assert(info.key != INVALID_SESSION_KEY); - - stackLock sml(m_serverMapLock); - - serverMap_t::const_iterator i = m_serverMap.find(info.key); - if (i == m_serverMap.end()) - { - throwEx("Internal error. " + logString(info.key) + " does not exist in server map."); - } - - yp2::updateResult result; - if ((*i).second.m_addState == ADD_SUCCEEDED) - { - if ((*i).second.m_serverID.empty()) - { - throwEx("Internal error. serverID for " + logString(info.key) + " is empty."); - } - - webClient::request r; - getAddUpdateBody(r, info, true); - result.m_requestQueued = 1; - } - else - { - // tinkered this after build 10 to prevent a mass of debug spam when we have an - // add fail so we will keep a track of the previous state and if it's different - assert(m_serverMap.find(info.key) != m_serverMap.end()); - yp2_server_state &yp2ss = m_serverMap[info.key]; - assert(yp2ss.m_sessionKey == info.key); - - static time_t ADD_RETRY_INTERVAL(gOptions.ypTimeout()); - time_t t = ::time(NULL); - if (t - yp2ss.m_lastOperationTime >= ADD_RETRY_INTERVAL) - { - DEBUG_LOG(YP2_LOGNAME + string(__FUNCTION__) + " add still pending for " + logString(info.key) + - " [" + tos((int)(*i).second.m_addState) + "] [" + tos((*i).second.m_addRetries)+ "]"); - - webClient::request r = yp2ss.m_lastRequest; - yp2ss.m_lastOperationTime = t; - ++yp2ss.m_addRetries; - - r.m_addr = gOptions.ypAddr(); - r.m_port = gOptions.ypPort(); - r.m_path = gOptions.ypPath(); - - r.m_XFF = metrics::metrics_verifyDestIP(gOptions); - - yp2ss.m_addState = ADD_PENDING; - yp2ss.m_lastOperationTime = ::time(NULL); - - updateYPBandWidthSent(r); - queueRequest((yp2ss.m_lastRequest = r)); - result.m_requestQueued = 1; - return result; - } - } - - result.m_maxYPInterval = (*i).second.m_stationInfo.m_updateFrequency; - - return result; -} - -yp2::addState_t yp2::pvt_addStatus(yp2SessionKey key, int &addFailIgnore, int &errorCode) throw() -{ - stackLock sml(m_serverMapLock); - - serverMap_t::const_iterator i = m_serverMap.find(key); - bool updateFail = false; - // if the YP cannot be resolved then allow clients to connect by faking a success - if (i != m_serverMap.end() && ((*i).second.m_addState == ADD_SUCCEEDED || (*i).second.m_addState == UPDATE_FAILED)) - { - updateFail = ((*i).second.m_addState == UPDATE_FAILED); - } - // allow clients if there was a YP failure or it's down for maintenance - addFailIgnore = (updateFail ? 2 : m_addFailed || (m_errorCode == YP_MAINTENANCE_CODE)); - errorCode = m_errorCode; - - return (i != m_serverMap.end() ? (*i).second.m_addState : ADD_NONE); -} - -/////////// response handling ////////////// -// handle response. retry_exceptions do just that. otherwise retry occurs in yptimeout seconds - -// what kind of response we get is unimportant, but we will log it if it's an error -void yp2::response_remove(const request &q, const response &r) throw(exception) -{ - yp2SessionKey key = q.REQUEST_KEY; - - serverMap_t::const_iterator i = m_serverMap.find(key); - if (i == m_serverMap.end()) - { - throwEx("Internal error in " + string(__FUNCTION__) + - " serverMap entry missing for " + logString(key)); - } - - const yp2_server_state &yp2ss = (*i).second; - size_t streamID = yp2ss.m_streamID; - - DEBUG_LOG(YP2_LOGNAME + string(__FUNCTION__) + " Erasing serverMap entry for " + logString(key)); - assert(m_serverMap.find(key) != m_serverMap.end()); - m_serverMap.erase(key); - - aolxml::node *n = 0; - - try - { - n = aolxml::node::parse(&(r.m_body[0]),r.m_body.size()); - - int code = aolxml::subNodeText(n, "/yp/resp/status/statuscode", 200); - utf8 msg = aolxml::subNodeText(n, "/yp/resp/status/statustext", (utf8)""); - if (code != 200) - { - throwEx("Remove error. " + logString(key) + - " code=" + tos(code) + " text=" + msg); - } - else - { - int error = aolxml::subNodeText(n, "/yp/resp/error/code", -1); - if (error != -1) - { - ELOG(YP2_LOGNAME "De-listing stream #" + tos(streamID) + " failed. YP2 error code is " + - tos(error) + " [" + aolxml::subNodeText(n, "/yp/resp/error/message", (utf8)"") + "]"); - utf8 detailed = aolxml::subNodeText(n, "/yp/resp/error/messagedetail", (utf8)""); - if (!detailed.empty()) - { - ELOG(YP2_LOGNAME + detailed); - } - } - else - { - if (q.REQUEST_USR) - { - ILOG(YP2_LOGNAME "Stream #" + tos(streamID) + " has been removed from the Shoutcast Directory."); - } - } - } - } - catch(const exception &ex) - { - ELOG(string(YP2_LOGNAME) + ex.what()); - } - - forget(n); -} - -void updateDetail(aolxml::node *n, string path, utf8 &original) -{ - utf8 value = aolxml::subNodeText(n, path, (utf8)""); - if (!value.empty()) - { - original = value; - DEBUG_LOG ("changing setting " + path + " to " + value); - } -} - -// we generally don't care about the result here (from a state machine standpoint), except that -// a bad serverID error means we should probably re-add ourselves. We rely on the fact that streamData -// will initiate an add before every touch if things have failed, so we enter a failed state -void yp2::response_update(const request &q, const response &r) throw(exception) -{ - yp2SessionKey key = q.REQUEST_KEY; - - assert(m_serverMap.find(key) != m_serverMap.end()); - yp2_server_state &yp2ss = m_serverMap[key]; - assert(yp2ss.m_sessionKey == key); - - aolxml::node *n = 0; - - try - { - // we must check our state, to avoid going berserk if we've queued up a lot of updates - // and they are failing. This will cause addState to transition to ADD_FAILED, which causes - // "add" to be reposted and state to become ADD_PENDING. In this situation we don't want our - // queued updates to fail because that will force the state to ADD_FAILED which will queue up - // even more "adds" - if (yp2ss.m_addState == yp2::ADD_SUCCEEDED) - { - m_errorCode = 200; - m_errorMsg = ""; - m_errorMsgExtra = ""; - - n = aolxml::node::parse(&(r.m_body[0]),r.m_body.size()); - int code = aolxml::subNodeText(n, "/yp/resp/status/statuscode", 200); - utf8 msg = aolxml::subNodeText(n, "/yp/resp/status/statustext", (utf8)""); - if (code != 200) - { - throwEx("Update error. " + logString(key) + - " code=" + tos(code) + " msg=" + msg); - } - - int error = aolxml::subNodeText(n, "/yp/resp/error/code", -1); - if (error != -1) - { - ELOG(YP2_LOGNAME "Updating listing details for stream #" + tos(yp2ss.m_streamID) + - " failed. YP2 error code is " + tos(error) + " [" + - aolxml::subNodeText(n, "/yp/resp/error/message", (utf8)"") + "]"); - utf8 detailed = aolxml::subNodeText(n, "/yp/resp/error/messagedetail", (utf8)""); - if (!detailed.empty()) - { - ELOG(YP2_LOGNAME + detailed); - } - - yp2ss.m_addState = UPDATE_FAILED; - } - else - { - updateDetail(n, "/yp/resp/id", yp2ss.m_serverID); - updateDetail(n, "/yp/resp/stnid", yp2ss.m_stationID); - - yp2ss.m_stationInfo.m_updateFrequency = aolxml::subNodeText(n, "/yp/resp/updatefreq", yp2ss.m_stationInfo.m_updateFrequency); - - updateDetail(n, "/yp/resp/backupserver", yp2ss.m_stationInfo.m_backupServer); - yp2ss.m_stationInfo.m_backupServersList.clear(); - aolxml::node::nodeList_t nodes = aolxml::node::findNodes(n,"/yp/resp/backupservers/server"); - if (!nodes.empty()) - { - for (aolxml::node::nodeList_t::const_iterator b = nodes.begin(); b != nodes.end(); ++b) - { - yp2ss.m_stationInfo.m_backupServersList.push_back((*b)->pcdata()); - } - } - else - { - yp2ss.m_stationInfo.m_backupServersList.clear(); - } - updateDetail(n, "/yp/resp/publicip", yp2ss.m_stationInfo.m_publicIP); - updateDetail(n, "/yp/resp/station/name", yp2ss.m_stationInfo.m_streamTitle); - updateDetail(n, "/yp/resp/station/genre", yp2ss.m_stationInfo.m_streamGenre[0]); - updateDetail(n, "/yp/resp/station/genre2", yp2ss.m_stationInfo.m_streamGenre[1]); - updateDetail(n, "/yp/resp/station/genre3", yp2ss.m_stationInfo.m_streamGenre[2]); - updateDetail(n, "/yp/resp/station/genre4", yp2ss.m_stationInfo.m_streamGenre[3]); - updateDetail(n, "/yp/resp/station/genre5", yp2ss.m_stationInfo.m_streamGenre[4]); - updateDetail(n, "/yp/resp/station/logo", yp2ss.m_stationInfo.m_streamLogo); - updateDetail(n, "/yp/resp/station/url", yp2ss.m_stationInfo.m_broadcasterURL); - updateDetail(n, "/yp/resp/station/callsign", yp2ss.m_stationInfo.m_radionomyID); - yp2ss.m_stationInfo.m_advertMode = aolxml::subNodeText(n, "/yp/resp/station/admode", yp2ss.m_stationInfo.m_advertMode); - yp2ss.m_stationInfo.m_allowSSL = aolxml::subNodeText(n, "/yp/resp/station/allowssl", -1); - yp2ss.m_stationInfo.m_allowMaxBitrate = aolxml::subNodeText(n, "/yp/resp/station/allowmaxbitrate", 0); - yp2ss.m_stationInfo.m_allowBackupURL = aolxml::subNodeText(n, "/yp/resp/station/allowbackupurl", -1); - yp2ss.m_stationInfo.m_allowAllFormats = aolxml::subNodeText(n, "/yp/resp/station/allowallformats", -1); - - if (q.REQUEST_USR) - { - ILOG(YP2_LOGNAME "Updating listing details for stream #" + tos(yp2ss.m_streamID) + " succeeded."); - } - - // we get notified of updated DNAS via this on add and update (for long running instances) - updater::verInfo m_verInfo; - updater::getNewVersion(m_verInfo); - m_verInfo.ver = aolxml::subNodeText(n, "/yp/resp/dnas/ver", m_verInfo.ver); - m_verInfo.url = aolxml::subNodeText(n, "/yp/resp/dnas/url", m_verInfo.url); - m_verInfo.log = aolxml::subNodeText(n, "/yp/resp/dnas/log", m_verInfo.log); - m_verInfo.info = aolxml::subNodeText(n, "/yp/resp/dnas/info", m_verInfo.info); - m_verInfo.message = aolxml::subNodeText(n, "/yp/resp/dnas/msg", m_verInfo.message); - m_verInfo.slimmsg = aolxml::subNodeText(n, "/yp/resp/dnas/slim", m_verInfo.slimmsg); - updater::setNewVersion(m_verInfo); - - // YP overridable urls for anything to do with metrics, adverts, etc - updateDetail(n, "/yp/resp/meu", yp2ss.m_stationInfo.m_metrics_audience_url); - updateDetail(n, "/yp/resp/adu", yp2ss.m_stationInfo.m_metrics_adverts_url); - updateDetail(n, "/yp/resp/mer", yp2ss.m_stationInfo.m_metrics_reset_url); - updateDetail(n, "/yp/resp/aut", yp2ss.m_stationInfo.m_metrics_auth_url); - updateDetail(n, "/yp/resp/air", yp2ss.m_stationInfo.m_tunein_air_api_url); - updateDetail(n, "/yp/resp/tsu", yp2ss.m_stationInfo.m_targetspot_url); - - // this will ensure that the info from the update - // is set asap as this is needed for advert mode. - streamData *sd = streamData::accessStream(yp2ss.m_streamID); - if (sd) - { - sd->YP2_updateInfo(yp2ss.m_stationInfo); - sd->releaseStream(); - } - } - } - } - catch (const exception &) - { - m_errorCode = aolxml::subNodeText(n, "/yp/resp/error/code", -1); - if (m_errorCode != -1) - { - m_errorMsg = aolxml::subNodeText(n, "/yp/resp/error/message", (utf8)""); - m_errorMsgExtra = aolxml::subNodeText(n, "/yp/resp/error/messagedetail", (utf8)""); - } - else - { - m_errorCode = aolxml::subNodeText(n, "/yp/resp/status/statuscode", 400); - m_errorMsg = aolxml::subNodeText(n, "/yp/resp/status/statustext", utf8("Generic Error")); - m_errorMsgExtra = ""; - } - - ELOG(YP2_LOGNAME "Updating listing details for stream #" + tos(yp2ss.m_streamID) + " failed. YP2 error code is " + - tos(m_errorCode) + " [" + m_errorMsg + "]"); - if (!m_errorMsgExtra.empty()) - { - ELOG(YP2_LOGNAME + m_errorMsgExtra); - } - - yp2ss.m_addState = UPDATE_FAILED; - } - - forget(n); -} - -/* - We have a special case if state of ADD_REMOVEISSUED. The streamData object called - yp2::remove() while the add was still pending. If we fail, then it doesn't matter, but if - we succeed, we have to post the remove command to yp to make sure we clean up after ourselves -*/ -void yp2::response_add(const request &q, const response &r) throw(exception) -{ - yp2SessionKey key = q.REQUEST_KEY; - - serverMap_t::iterator i = m_serverMap.find(key); - if (i == m_serverMap.end()) - { - throwEx("Internal error in " + string(__FUNCTION__) + - " serverMap entry missing for " + logString(key)); - } - - yp2_server_state &yp2ss = (*i).second; - aolxml::node *n = 0; - - try - { - n = aolxml::node::parse(&(r.m_body[0]),r.m_body.size()); - - int code = aolxml::subNodeText(n, "/yp/resp/status/statuscode", 200); - utf8 msg = aolxml::subNodeText(n, "/yp/resp/status/statustext", (utf8)""); - - if (code != 200) - { - throwEx("Add error. " + logString(key) + - " code=" + tos(code) + " text=" + msg); - } - - // success case. Again there are two scenarios. If the serverMap state is ADD_REMOVEISSUED - // then remove() was called. We need to repost the remove since yp2::remove() won't actually - // issue it when the add has not succeeded. Otherwise, life is normal - if (yp2ss.m_addState != ADD_REMOVEISSUED) - { - aolxml::subNodeTextTHROW(n, "/yp/resp/id", yp2ss.m_serverID); - aolxml::subNodeTextTHROW(n, "/yp/resp/stnid", yp2ss.m_stationID); - - yp2ss.m_stationInfo.m_updateFrequency = aolxml::subNodeText(n, "/yp/resp/updatefreq", yp2ss.m_stationInfo.m_updateFrequency); - yp2ss.m_stationInfo.m_backupServer = aolxml::subNodeText(n, "/yp/resp/backupserver", (utf8)""); - yp2ss.m_stationInfo.m_backupServersList.clear(); - aolxml::node::nodeList_t nodes = aolxml::node::findNodes(n, "/yp/resp/backupservers/server"); - if (!nodes.empty()) - { - for (aolxml::node::nodeList_t::iterator b = nodes.begin(); b != nodes.end(); ++b) - { - yp2ss.m_stationInfo.m_backupServersList.push_back((*b)->pcdata()); - } - } - yp2ss.m_stationInfo.m_publicIP = aolxml::subNodeText(n, "/yp/resp/publicip", (utf8)""); - aolxml::subNodeTextTHROW(n, "/yp/resp/station/name", yp2ss.m_stationInfo.m_streamTitle); - aolxml::subNodeTextTHROW(n, "/yp/resp/station/genre", yp2ss.m_stationInfo.m_streamGenre[0]); - - for (int i = 1; i < 5; i++) - { - yp2ss.m_stationInfo.m_streamGenre[i] = aolxml::subNodeText(n, "/yp/resp/station/genre" + tos(i + 1), yp2ss.m_stationInfo.m_streamGenre[i]); - } - - yp2ss.m_stationInfo.m_streamLogo = aolxml::subNodeText(n, "/yp/resp/station/logo", yp2ss.m_stationInfo.m_streamLogo); - yp2ss.m_stationInfo.m_broadcasterURL = aolxml::subNodeText(n, "/yp/resp/station/url", (utf8)""); - yp2ss.m_stationInfo.m_radionomyID = aolxml::subNodeText(n, "/yp/resp/station/callsign", (utf8)""); - yp2ss.m_stationInfo.m_advertMode = aolxml::subNodeText(n, "/yp/resp/station/admode", yp2ss.m_stationInfo.m_advertMode); - yp2ss.m_stationInfo.m_allowSSL = aolxml::subNodeText(n, "/yp/resp/station/allowssl", -1); - yp2ss.m_stationInfo.m_allowMaxBitrate = aolxml::subNodeText(n, "/yp/resp/station/allowmaxbitrate", 0); - yp2ss.m_stationInfo.m_allowBackupURL = aolxml::subNodeText(n, "/yp/resp/station/allowbackupurl", -1); - yp2ss.m_stationInfo.m_allowAllFormats = aolxml::subNodeText(n, "/yp/resp/station/allowallformats", -1); - - int peak = aolxml::subNodeText(n, "/yp/resp/peak", -1); - if (peak > 0) - { - stats::updatePeak(yp2ss.m_streamID, peak); - } - - yp2ss.m_addRetries = 0; - m_errorCode = 200; - m_errorMsg = ""; - m_errorMsgExtra = ""; - - yp2ss.m_addState = ADD_SUCCEEDED; - if (q.REQUEST_USR) - { - ILOG(YP2_LOGNAME "Stream #" + tos(yp2ss.m_streamID) + " has been added to the Shoutcast Directory."); - } - - // we get notified of updated DNAS via this on add and update (for long running instances) - updater::verInfo m_verInfo; - updater::getNewVersion(m_verInfo); - m_verInfo.ver = aolxml::subNodeText(n, "/yp/resp/dnas/ver", m_verInfo.ver); - m_verInfo.url = aolxml::subNodeText(n, "/yp/resp/dnas/url", m_verInfo.url); - m_verInfo.log = aolxml::subNodeText(n, "/yp/resp/dnas/log", m_verInfo.log); - m_verInfo.info = aolxml::subNodeText(n, "/yp/resp/dnas/info", m_verInfo.info); - m_verInfo.message = aolxml::subNodeText(n, "/yp/resp/dnas/msg", m_verInfo.message); - m_verInfo.slimmsg = aolxml::subNodeText(n, "/yp/resp/dnas/slim", m_verInfo.slimmsg); - updater::setNewVersion(m_verInfo); - - // YP overridable urls for anything to do with metrics, adverts, etc - yp2ss.m_stationInfo.m_metrics_audience_url = aolxml::subNodeText(n, "/yp/resp/meu", (utf8)METRICS_AUDIENCE_URL); - yp2ss.m_stationInfo.m_metrics_adverts_url = aolxml::subNodeText(n, "/yp/resp/adu", (utf8)METRICS_ADVERTS_URL); - yp2ss.m_stationInfo.m_metrics_reset_url = aolxml::subNodeText(n, "/yp/resp/mer", (utf8)METRICS_RESET_URL); - yp2ss.m_stationInfo.m_metrics_auth_url = aolxml::subNodeText(n, "/yp/resp/aut", (utf8)DNAS_AUTH_URL); - yp2ss.m_stationInfo.m_targetspot_url = aolxml::subNodeText(n, "/yp/resp/tsu", (utf8)TARGETSPOT_URL); - - // this will ensure that the info from the update - // is set asap as this is needed for advert mode. - // as well as only doing metrics if the stream is - // still determined to be accessible at the time. - streamData *sd = streamData::accessStream(yp2ss.m_streamID); - if (sd) - { - metrics::metrics_stream_up (yp2ss.m_streamID, yp2ss.m_stationInfo.m_radionomyID, - yp2ss.m_serverID, yp2ss.m_stationInfo.m_publicIP, sd->getStartTime()); - - sd->YP2_updateInfo(yp2ss.m_stationInfo); - sd->releaseStream(); - } - - // we use this to look at the existing listeners and if - // any have m_group = -1 then we'll 'add' them to the - // metrics since they will otherwise not be known about - stats::catchPreAddClients(yp2ss.m_streamID); - } - else - { - // we're done but have to issue the actual remove command to YP - if (!iskilled()) - { - WLOG(YP2_LOGNAME "Remove called while add was pending. Re-issuing remove. " + logString(key)); - } - yp2ss.m_serverID = aolxml::subNodeText(n, "/yp/resp/id", (utf8)""); - - ypInfo info(key, yp2ss.m_streamID, yp2ss.m_authHash); - info.peakClientConnections = (size_t)-1; - info.maxClientConnections = (size_t)-1; - pvt_queue_remove(info); - } - } - catch(const exception &ex) - { - bool missing = false; - utf8 message = ex.what(); - // skip missing xml response entries to avoid user confusion - if (message.rfind(utf8(" missing")) == utf8::npos) - { - ELOG(string(YP2_LOGNAME) + message); - } - else - { - missing = true; - } - - // if failure occurs and the state was ADD_REMOVEISSUED, we have to delete the entry from the serverMap - if (yp2ss.m_addState == ADD_REMOVEISSUED) - { - m_serverMap.erase(key); - WLOG(YP2_LOGNAME "Remove called while add was pending. Deleting serverMap entry " + logString(key)); - } - else - { - yp2ss.m_addState = ADD_FAILED; - - m_errorCode = aolxml::subNodeText(n, "/yp/resp/error/code", -1); - if (m_errorCode != -1) - { - m_errorMsg = aolxml::subNodeText(n, "/yp/resp/error/message", (utf8)""); - m_errorMsgExtra = aolxml::subNodeText(n, "/yp/resp/error/messagedetail", (utf8)""); - } - else - { - if (!missing) - { - m_errorCode = aolxml::subNodeText(n, "/yp/resp/status/statuscode", 400); - m_errorMsg = aolxml::subNodeText(n, "/yp/resp/status/statustext", utf8("Generic Error")); - m_errorMsgExtra = ""; - } - else - { - m_errorCode = YP_AUTH_ISSUE_CODE; - m_errorMsg = "Required authhash parameter is missing, please contact support to resolve this issue"; - m_errorMsgExtra = ""; - } - } - - ELOG(YP2_LOGNAME "Stream #" + tos(yp2ss.m_streamID) + " connection attempt " + - (m_errorCode == YP_MAINTENANCE_CODE ? "ignored" : "failed") + ". YP2 error code is " + - tos(m_errorCode) + " [" + m_errorMsg + "]"); - if (!m_errorMsgExtra.empty()) - { - ELOG(YP2_LOGNAME + m_errorMsgExtra); - } - } - } - - forget(n); -} - -void yp2::gotResponse(const request &q, const response &r) throw(exception) -{ - // if we've got a response then clear the pass-through flag - gYP2->m_addFailed = false; - - DEBUG_LOG(YP2_LOGNAME + string(__FUNCTION__) + " Request " + logString(q.REQUEST_KEY) + - " cmd=" + tos(q.REQUEST_CMD) + eol() + - "Response body=[" + eol() + r.m_body + "]" + - eol() + "Response code=[" + tos(r.m_resultCode) + "]"); - - bandWidth::updateAmount(bandWidth::YP_RECV, r.m_received); - - switch (q.REQUEST_CMD) - { - case ADD_CMD: - { - response_add(q, r); - break; - } - case REM_CMD: - { - response_remove(q, r); - break; - } - case UPD_CMD: - { - response_update(q, r); - break; - } - case CHECK_AUTH: - { - // store the response in a sanitised format for when it is then queried - authhashMap_t::iterator i = m_authhashMap.find(q.REQUEST_KEY); - if (i != m_authhashMap.end()) - { - (*i).second.m_response = r.m_body; - (*i).second.m_status = r.m_resultCode; - DEBUG_LOG(YP2_LOGNAME + (*i).second.m_response + " " + tos((*i).second.m_status)); - } - break; - } - case VER_CHECK: - { - aolxml::node *n = 0; - - try - { - n = aolxml::node::parse(&(r.m_body[0]), r.m_body.size()); - - int code = aolxml::subNodeText(n, "/yp/resp/status/statuscode", 200); - utf8 msg = aolxml::subNodeText(n, "/yp/resp/status/statustext", (utf8)""); - if (code != 200) - { - throwEx("version check error. " + logString(q.REQUEST_KEY) + - " code=" + tos(code) + " text=" + msg); - } - else - { - // we get notified of updated DNAS via this on add and update (for long running instances) - updater::verInfo m_verInfo; - updater::getNewVersion(m_verInfo); - m_verInfo.ver = aolxml::subNodeText(n, "/yp/resp/dnas/ver", m_verInfo.ver); - m_verInfo.url = aolxml::subNodeText(n, "/yp/resp/dnas/url", m_verInfo.url); - m_verInfo.log = aolxml::subNodeText(n, "/yp/resp/dnas/log", m_verInfo.log); - m_verInfo.info = aolxml::subNodeText(n, "/yp/resp/dnas/info", m_verInfo.info); - m_verInfo.message = aolxml::subNodeText(n, "/yp/resp/dnas/msg", m_verInfo.message); - m_verInfo.slimmsg = aolxml::subNodeText(n, "/yp/resp/dnas/slim", m_verInfo.slimmsg); - updater::setNewVersion(m_verInfo); - } - } - catch(const exception &) - { - } - - forget(n); - break; - { - } - - forget(n); - break; - } - default: - { - ELOG(YP2_LOGNAME "Internal error. Unknown cmd value in response (" + tos(q.REQUEST_CMD) + ")"); - break; - } - } -} - -void yp2::gotFailure(const request &q) throw(exception) -{ - DEBUG_LOG(YP2_LOGNAME + string(__FUNCTION__) + " Request " + - logString(q.REQUEST_KEY) + " cmd=" + tos(q.REQUEST_CMD)); - - bandWidth::updateAmount(bandWidth::YP_RECV, q.m_received); - - switch (q.REQUEST_CMD) - { - case ADD_CMD: - case REM_CMD: - case UPD_CMD: - { - gYP2->m_errorCode = -1; - gYP2->m_addFailed = true; - break; - } - case CHECK_AUTH: - { - // we cannot assume we got anything back in the request if it failed - // so if we've got a pending action then we need to get it cancelled - // and direct people to the log for the cause as too messy otherwise - authhashMap_t::iterator i = m_authhashMap.find(q.REQUEST_KEY); - if (i != m_authhashMap.end()) - { - (*i).second.m_response = utf8("Unable to process the request. Check the server logs for more details."); - (*i).second.m_status = 669; - DEBUG_LOG(YP2_LOGNAME + (*i).second.m_response + " " + tos((*i).second.m_status)); - } - break; - } - default: - { - ELOG(YP2_LOGNAME "Internal error. Unknown cmd value in response (" + tos(q.REQUEST_CMD) + ")"); - break; - } - } -} - -yp2::yp2SessionKey yp2::add(ypInfo& info, const int creating) throw() -{ - stackLock sml(g_YP2Lock); - - yp2SessionKey result = INVALID_SESSION_KEY; - - try - { - // abort asap if there is no authhash present - if (info.authhash.empty()) - { - if (gYP2 && !gYP2->m_ignoreAdd) - { - gYP2->m_ignoreAdd = true; - throwEx((creating == 2 ? "Manual authhash creation for stream #" + - tos(info.sid) + " is required. Aborting listing the " - "stream in the Shoutcast Directory." : "No authhash " - "specified for stream #" + tos(info.sid) + ". Aborting " - "listing the stream in the Shoutcast Directory. ")); - } - } - else if (!isValidAuthhash(info.authhash)) - { - if (gYP2 && !gYP2->m_ignoreAdd) - { - gYP2->m_ignoreAdd = true; - throwEx("Invalid authhash specified for stream #" + tos(info.sid) + - ". Aborting listing the stream in the Shoutcast Directory."); - } - } - else - { - if (gYP2) - { - gYP2->m_ignoreAdd = false; - } - } - - if (!iskilled() && gYP2 && !gYP2->m_ignoreAdd) - { - result = gYP2->pvt_add(info); - } - } - catch(const exception &ex) - { - ELOG(string(YP2_LOGNAME) + ex.what()); - } - return result; -} - -void yp2::remove(ypInfo& info) throw() -{ - stackLock sml(g_YP2Lock); - - try - { - if (gYP2) - { - gYP2->pvt_remove(info); - } - } - catch(const exception &ex) - { - ELOG(string(YP2_LOGNAME) + ex.what()); - } -} - -yp2::updateResult yp2::update(ypInfo& info) -{ - stackLock sml(g_YP2Lock); - - yp2::updateResult result; - result.m_maxYPInterval = gOptions.ypReportInterval(); - try - { - if (gYP2) - { - result = gYP2->pvt_update(info); - } - } - catch(const exception &ex) - { - ELOG(string(YP2_LOGNAME) + ex.what()); - } - return result; -} - -yp2::addState_t yp2::addStatus(yp2SessionKey key, int &addFailIgnore, int &errorCode) throw() -{ - stackLock sml(g_YP2Lock); - - return (gYP2 ? gYP2->pvt_addStatus(key, addFailIgnore, errorCode) : ADD_NONE); -} - -void yp2::pvt_runAuthHashAction(const uniString::utf8 &tempId, const int action, - const uniString::utf8 &urlPath, - const httpHeaderMap_t &queryParameters, - const uniString::utf8 &content) throw() -{ - int actionId = tempId.toInt(); - yp2::authhashResult authhash; - authhash.m_action = action; - m_authhashMap[actionId] = authhash; - - webClient::request r; - r.m_method = webClient::request::POST; - r.m_addr = gOptions.ypAddr(); - r.m_port = gOptions.ypPort(); - // adjust the YP path if using non-standard urls so authhash ones work - r.m_path = ((gOptions.ypPath() != utf8("/yp2")) ? "/yp" : "") + urlPath; - r.m_queryVariables = queryParameters; - r.REQUEST_KEY = actionId; - r.REQUEST_CMD = action; - - if (!content.empty()) - { - r.m_content.insert(r.m_content.end(), content.begin(), content.end()); - } - - DEBUG_LOG(YP2_LOGNAME + string(__FUNCTION__) + " Request " + - logString(r.REQUEST_KEY) + " cmd=" + tos(r.REQUEST_CMD)); - - updateYPBandWidthSent(r); - queueRequest(r); -} - -void yp2::runAuthHashAction(const uniString::utf8 &tempId, const int action, - const uniString::utf8 &urlPath, - const httpHeaderMap_t &queryParameters, - const uniString::utf8 &content) throw() -{ - stackLock sml(g_YP2Lock); - - try - { - if (gYP2 && !queryParameters.empty() && !tempId.empty()) - { - gYP2->pvt_runAuthHashAction(tempId, action, urlPath, queryParameters, content); - } - } - catch(const exception &ex) - { - ELOG(string(YP2_LOGNAME) + ex.what()); - } -} - -bool yp2::pvt_authHashActionStatus(const uniString::utf8& tempId, authhashResult &info, const bool remove) throw() -{ - if (!tempId.empty()) - { - size_t actionId = tempId.toInt(); - authhashMap_t::const_iterator i = m_authhashMap.find(actionId); - if (i != m_authhashMap.end()) - { - // copy to the passed structure - info = (*i).second; - // and then remove from the map - if(remove) - { - m_authhashMap.erase(actionId); - } - return true; - } - } - return false; -} - -bool yp2::authHashActionStatus(const uniString::utf8& tempId, authhashResult &info, const bool remove) throw() -{ - stackLock sml(g_YP2Lock); - - return (gYP2 ? gYP2->pvt_authHashActionStatus(tempId, info, remove) : false); -} - -bool yp2::isValidAuthhash(uniString::utf8 authhash) -{ - if (authhash.empty() || (authhash.size() != 20 && authhash.size() != 36)) - return false; - - // check the authhash only contains - int n = -1; - const char *s = (char*)authhash.c_str(); - if (sscanf (s, "%*36[a-fA-F0-9-]%n", &n) == 0 && n == 36 && s[36] == '\0') // match 36-char GUID only - return true; - if (sscanf (s, "%*20[a-zA-Z0-9]%n", &n) == 0 && n == 20 && s[20] == '\0') // match 20-char Hash only - return true; - return false; -} - -int yp2::pvt_getSrvID(yp2SessionKey key) throw() -{ - stackLock sml(m_serverMapLock); - - serverMap_t::const_iterator i = m_serverMap.find(key); - return (i != m_serverMap.end() ? (*i).second.m_serverID.toInt() : 0); -} - -int yp2::getSrvID(yp2SessionKey key) throw() -{ - stackLock sml(g_YP2Lock); - - return (gYP2 ? gYP2->pvt_getSrvID(key) : 0); -} - -int yp2::pvt_getStnID(yp2SessionKey key) throw() -{ - stackLock sml(m_serverMapLock); - - serverMap_t::const_iterator i = m_serverMap.find(key); - return (i != m_serverMap.end() ? (*i).second.m_stationID.toInt() : 0); -} - -int yp2::getStnID(yp2SessionKey key) throw() -{ - stackLock sml(g_YP2Lock); - - return (gYP2 ? gYP2->pvt_getStnID(key) : 0); -} diff --git a/Src/Plugins/DSP/sc_serv3/yp2.h b/Src/Plugins/DSP/sc_serv3/yp2.h deleted file mode 100644 index d0111d94..00000000 --- a/Src/Plugins/DSP/sc_serv3/yp2.h +++ /dev/null @@ -1,270 +0,0 @@ -#pragma once -#ifndef yp2_H_ -#define yp2_H_ - -#include "webClient.h" - -/* - The operational model for yp2 is somewhat different from that of yp1. - In yp1, there is no reason for the core of sc_serv to wait for result. The - only bit of information that is truly required for correct operation is the serverID - returned by addserv in yp1. This, however, is handled internally by the code dealing with - yp1 since any subsequent yp requests cannot be cleared until the addsrv succeeds and the - serverID is obtained. - - In yp2, the actual streaming to the client cannot proceed until the addition of the server - is complete, since some information like stream title and genre must be obtained from the - database. Therefore, we need to build some sort of waiting mechanism, but one that obviously - does not block processing since the responses from yp2 may not come as fast as required for - code that blocks. - -*/ - -#define YP2_LOGNAME "[YP] " -#define YP_MAINTENANCE_CODE 503 -#define YP_AUTH_ISSUE_CODE 123 -#define YP_NOT_VISIBLE 480 -#define YP_COMMS_FAILURE -1 - -class yp2: public webClient -{ -public: - // stationInfo data gets returned from YP in response to "add" request - struct stationInfo - { - int m_updateFrequency; - int m_advertMode; - int m_allowSSL; - int m_allowAllFormats; - int m_allowMaxBitrate; - int m_allowBackupURL; - int m_responseCode; - uniString::utf8 m_stationID; - uniString::utf8 m_serverID; - uniString::utf8 m_streamTitle; - uniString::utf8 m_streamGenre[5]; - uniString::utf8 m_streamLogo; - uniString::utf8 m_radionomyID; - uniString::utf8 m_advertType; - uniString::utf8 m_advertTrigger; - uniString::utf8 m_metrics_audience_url; - uniString::utf8 m_metrics_adverts_url; - uniString::utf8 m_metrics_reset_url; - uniString::utf8 m_metrics_auth_url; - uniString::utf8 m_tunein_air_api_url; - uniString::utf8 m_targetspot_url; - uniString::utf8 m_broadcasterURL; - uniString::utf8 m_backupServer; - std::vector m_backupServersList; - uniString::utf8 m_publicIP; - - uniString::utf8 logString() const throw() - { - return "title=" + m_streamTitle + " genre=" + m_streamGenre[0] + - " genre2=" + m_streamGenre[1] + " genre3=" + m_streamGenre[2] + - " genre4=" + m_streamGenre[3] + " genre5=" + m_streamGenre[4] + - " logo=" + m_streamLogo; - } - stationInfo() throw(); - }; - - typedef unsigned yp2SessionKey; - static const yp2SessionKey INVALID_SESSION_KEY=0; - - static uniString::utf8 logString(const yp2SessionKey &key) throw(); - - enum addState_t - { - ADD_NONE = 0, - ADD_PENDING = 1, - ADD_SUCCEEDED = 2, - ADD_FAILED = 3, - ADD_REMOVEISSUED = 4, // we issued a remove - UPDATE_FAILED = 5 - }; - - struct ypInfo - { - yp2SessionKey key; - - bool streamPublic; - bool streamArtwork; - bool playingArtwork; - bool vbr; - - size_t sid; - uniString::utf8 authhash; - - int bitrate; - int samplerate; - uniString::utf8 mimeType; - uniString::utf8 relayURL; - - size_t peakClientConnections; - size_t maxClientConnections; - - size_t numListeners; // update only - size_t numUniqueListeners; // update only - time_t avgUserListenTime; // update only - time_t streamStartTime; - size_t numberOfClientsConnectedMoreThanFiveMinutes; // update only - size_t numberOfClientConnectsSinceLastUpdate; // update only - - uniString::utf8 songMetadataForYP2; - uniString::utf8 sourceIdent; - uniString::utf8 sourceUser; - - ypInfo(const yp2SessionKey _key, const size_t _sid, const uniString::utf8& _authhash, - const bool _vbr = false, const bool _streamPublic = true, - const bool _streamArtwork = false, const bool _playingArtwork = false) : - key(_key), streamPublic(_streamPublic), streamArtwork(_streamArtwork), - playingArtwork(_playingArtwork), vbr(_vbr), sid(_sid), - authhash(_authhash), bitrate(0), samplerate(0), - peakClientConnections(0), maxClientConnections(0), - numListeners(0), numUniqueListeners(0), avgUserListenTime(0), - numberOfClientsConnectedMoreThanFiveMinutes(0), - numberOfClientConnectsSinceLastUpdate(0) { streamStartTime = 0; } - }; - - typedef enum - { - CREATE_AUTH = 3, - CHECK_AUTH = 4, - UPDATE_AUTH = 5, - //REMOVE_AUTH = 6, - ALLOW_AUTH = 7, - VER_CHECK = 8 - } authMethodState_t; - - // function result from call to update - struct updateResult - { - int m_maxYPInterval; // touch interval if no title change - int m_requestQueued; // if false, then "add" has not finished so this request was ignored - - updateResult() throw() : m_maxYPInterval(0), m_requestQueued(0) {} - }; - - // structures for handling the authhash management requests - struct authhashResult - { - int m_action; // action - create, check, update, remove - int m_restart; // should we restart the stream - size_t m_status; // status code from response - uniString::utf8 m_response; // response body back from the YP request - - authhashResult() throw() : m_action(0), m_restart(0), m_status(0), m_response("") {} - }; - - typedef std::map authhashMap_t; - authhashMap_t m_authhashMap; - -private: - struct yp2_server_state - { - yp2::stationInfo m_stationInfo; - - yp2SessionKey m_sessionKey; - - addState_t m_addState; - - uniString::utf8 m_serverID; // as assigne by YP - uniString::utf8 m_stationID; // as assigne by YP - - uniString::utf8 m_authHash; // needed for reposting removes - - size_t m_streamID; - - time_t m_lastOperationTime; // for error delays - - webClient::request m_lastRequest; // keep a copy of the last request incase it needs to be resent - - size_t m_addRetries; - - yp2_server_state() : m_sessionKey(INVALID_SESSION_KEY), m_addState(ADD_NONE), m_streamID(1), m_lastOperationTime(0), m_addRetries(0) {} - explicit yp2_server_state(const yp2SessionKey &key) : m_sessionKey(key), m_addState(ADD_NONE), m_streamID(1), m_lastOperationTime(0), m_addRetries(0) {} - - uniString::utf8 logString() const throw() - { - return yp2::logString(m_sessionKey) + " state=" + stringUtil::tos((int)m_addState) + " serverId=" + m_serverID + " " + m_stationInfo.logString(); - } - }; - - yp2SessionKey m_sessionKeyCounter; - int m_errorCode; // keeps a copy of the last YP response code (good or bad) - - typedef std::map serverMap_t; - serverMap_t m_serverMap; - uniString::utf8 m_errorMsg; - uniString::utf8 m_errorMsgExtra; - - AOL_namespace::mutex m_serverMapLock; - - bool m_addFailed; - bool m_ignoreAdd; - - virtual void gotResponse(const request &q, const response &r) throw(std::exception); - virtual void gotFailure(const request &q) throw(std::exception); - - void response_add(const request &q, const response &r) throw(std::exception); - void response_remove(const request &q, const response &r) throw(std::exception); - void response_update(const request &q, const response &r) throw(std::exception); - - void getAddUpdateBody(webClient::request& r, const ypInfo& info, const bool update) throw(); - - yp2SessionKey pvt_add(ypInfo& info) throw(std::exception); - - void pvt_queue_remove(const ypInfo& info) throw(); - - void pvt_remove(ypInfo& info) throw(std::exception); - - updateResult pvt_update(const ypInfo& info) throw(std::exception); - - addState_t pvt_addStatus(yp2SessionKey key, int &addFailIgnore, int &errorCode) throw(); - - virtual uniString::utf8 name() const throw() { return "yp2"; } - - void pvt_runAuthHashAction(const uniString::utf8 &tempId, const int action, - const uniString::utf8 &urlPath, - const httpHeaderMap_t &queryParameters, - const uniString::utf8 &content) throw(); - - bool pvt_authHashActionStatus(const uniString::utf8 &tempId, authhashResult &info, const bool remove) throw(); - - int pvt_getSrvID(yp2SessionKey key) throw(); - int pvt_getStnID(yp2SessionKey key) throw(); - - static void updateYPBandWidthSent(webClient::request r) throw(); - -public: - yp2() throw(); - ~yp2() throw(); - - // return new key if yp2_server_state_key == YP2_UNDEFINED_SERVER_STATE_KEY - static yp2SessionKey add(ypInfo& info, const int creating) throw(); - - // return true if add has succeeded - static addState_t addStatus(yp2SessionKey key, int &addFailIgnore, int &errorCode) throw(); - - static void remove(ypInfo& info) throw(); - - static updateResult update(ypInfo& info); - - // used in main during shutdown to wait for request queue to clear out - static size_t requestsInQueue() throw(); - - // used for managing authhashes within the dnas - static void runAuthHashAction(const uniString::utf8 &tempId, const int action, - const uniString::utf8 &urlPath, - const httpHeaderMap_t &queryParameters, - const uniString::utf8 &content = "") throw(); - - static bool authHashActionStatus(const uniString::utf8& tempId, authhashResult &info, bool remove) throw(); - - static bool isValidAuthhash(uniString::utf8 authhash); - - static int getSrvID(yp2SessionKey key) throw(); - static int getStnID(yp2SessionKey key) throw(); -}; - -#endif