From 53d49b8dafb8eb35c18056fe742d28620d6d87f0 Mon Sep 17 00:00:00 2001 From: ColumPaget Date: Sun, 9 Feb 2014 00:35:15 +0000 Subject: [PATCH] first commit --- CHANGES | 92 + Docs/HowToAddSites.txt | 71 + Docs/Proxys.txt | 14 + Docs/Radio.txt | 173 + Docs/Usage.txt | 139 + INSTALL | 27 + LICENCE | 674 ++++ Makefile | 55 + Makefile.in | 55 + README | 11 + autom4te.cache/output.0 | 4892 +++++++++++++++++++++++ autom4te.cache/requests | 129 + autom4te.cache/traces.0 | 264 ++ cbsnews.c | 32 + cbsnews.h | 10 + common.c | 17 + common.h | 40 + config.log | 296 ++ config.status | 759 ++++ configure | 4892 +++++++++++++++++++++++ configure.in | 57 + containerfiles.c | 341 ++ containerfiles.h | 14 + dailymotion.c | 41 + dailymotion.h | 9 + display.c | 152 + display.h | 12 + download.c | 224 ++ download.h | 12 + ehow.c | 39 + ehow.h | 10 + extract_text.c | 87 + extract_text.h | 22 + install-sh | 251 ++ libUseful-2.0/Compression.c | 21 + libUseful-2.0/Compression.h | 18 + libUseful-2.0/ConnectManager.c | 329 ++ libUseful-2.0/ConnectManager.h | 50 + libUseful-2.0/ConnectionChain.c | 299 ++ libUseful-2.0/ConnectionChain.h | 28 + libUseful-2.0/Copy.sh | 6 + libUseful-2.0/DataProcessing.c | 1069 +++++ libUseful-2.0/DataProcessing.h | 64 + libUseful-2.0/Docs/ConnectManager.txt | 50 + libUseful-2.0/Docs/DataProcessing.txt | 64 + libUseful-2.0/Docs/EncryptedFiles.txt | 33 + libUseful-2.0/Docs/GeneralFunctions.txt | 73 + libUseful-2.0/Docs/Hash.txt | 56 + libUseful-2.0/Docs/Log.txt | 23 + libUseful-2.0/Docs/directory | 1 + libUseful-2.0/Docs/expect.txt | 43 + libUseful-2.0/Docs/file.txt | 113 + libUseful-2.0/Docs/http.txt | 98 + libUseful-2.0/Docs/includes.txt | 29 + libUseful-2.0/Docs/inet.txt | 29 + libUseful-2.0/Docs/list.txt | 58 + libUseful-2.0/Docs/pty.txt | 48 + libUseful-2.0/Docs/socket.txt | 91 + libUseful-2.0/Docs/sound.txt | 55 + libUseful-2.0/Docs/string.txt | 59 + libUseful-2.0/Docs/unix_socket.txt | 11 + libUseful-2.0/EncryptedFiles.c | 76 + libUseful-2.0/EncryptedFiles.h | 33 + libUseful-2.0/FileSystem.c | 173 + libUseful-2.0/FileSystem.h | 26 + libUseful-2.0/GeneralFunctions.c | 339 ++ libUseful-2.0/GeneralFunctions.h | 47 + libUseful-2.0/Hash.c | 395 ++ libUseful-2.0/Hash.h | 42 + libUseful-2.0/LICENCE | 674 ++++ libUseful-2.0/Log.c | 318 ++ libUseful-2.0/Log.h | 35 + libUseful-2.0/Makefile | 124 + libUseful-2.0/Makefile.in | 124 + libUseful-2.0/Markup.c | 242 ++ libUseful-2.0/Markup.h | 24 + libUseful-2.0/MathExpr.c | 257 ++ libUseful-2.0/MathExpr.h | 19 + libUseful-2.0/ParseURL.c | 132 + libUseful-2.0/ParseURL.h | 18 + libUseful-2.0/PatternMatch.c | 528 +++ libUseful-2.0/PatternMatch.h | 31 + libUseful-2.0/SpawnPrograms.c | 325 ++ libUseful-2.0/SpawnPrograms.h | 37 + libUseful-2.0/Time.c | 89 + libUseful-2.0/Time.h | 23 + libUseful-2.0/Vars.c | 338 ++ libUseful-2.0/Vars.h | 23 + libUseful-2.0/autom4te.cache/directory | 1 + libUseful-2.0/autom4te.cache/output.0 | 4779 ++++++++++++++++++++++ libUseful-2.0/autom4te.cache/requests | 145 + libUseful-2.0/autom4te.cache/traces.0 | 307 ++ libUseful-2.0/base64.c | 97 + libUseful-2.0/base64.h | 16 + libUseful-2.0/config.cache | 38 + libUseful-2.0/config.log | 341 ++ libUseful-2.0/config.status | 892 +++++ libUseful-2.0/configure | 4779 ++++++++++++++++++++++ libUseful-2.0/configure.in | 88 + libUseful-2.0/crc32.c | 103 + libUseful-2.0/crc32.h | 30 + libUseful-2.0/defines.h | 29 + libUseful-2.0/expect.c | 133 + libUseful-2.0/expect.h | 37 + libUseful-2.0/file.c | 1112 ++++++ libUseful-2.0/file.h | 155 + libUseful-2.0/formattest.c | 10 + libUseful-2.0/http.c | 1222 ++++++ libUseful-2.0/http.h | 121 + libUseful-2.0/httptest.c | 18 + libUseful-2.0/includes.h | 30 + libUseful-2.0/inet.c | 100 + libUseful-2.0/inet.h | 20 + libUseful-2.0/install-sh | 251 ++ libUseful-2.0/libUseful.h | 42 + libUseful-2.0/libsettings.c | 28 + libUseful-2.0/libsettings.h | 22 + libUseful-2.0/list.c | 639 +++ libUseful-2.0/list.h | 62 + libUseful-2.0/md5-global.h | 32 + libUseful-2.0/md5.h | 49 + libUseful-2.0/md5c.c | 339 ++ libUseful-2.0/oauth.c | 261 ++ libUseful-2.0/oauth.h | 19 + libUseful-2.0/pty.c | 235 ++ libUseful-2.0/pty.h | 31 + libUseful-2.0/sha1.c | 331 ++ libUseful-2.0/sha1.h | 81 + libUseful-2.0/sha2.c | 1064 +++++ libUseful-2.0/sha2.h | 197 + libUseful-2.0/socket.c | 867 ++++ libUseful-2.0/socket.h | 80 + libUseful-2.0/sound.c | 640 +++ libUseful-2.0/sound.h | 81 + libUseful-2.0/string.c | 773 ++++ libUseful-2.0/string.h | 61 + libUseful-2.0/tar.c | 285 ++ libUseful-2.0/tar.h | 23 + libUseful-2.0/tartest.c | 48 + libUseful-2.0/unix_socket.c | 76 + libUseful-2.0/unix_socket.h | 21 + libUseful-2.0/ziptest.c | 53 + main.c | 529 +++ outputfiles.c | 262 ++ outputfiles.h | 14 + servicetypes.c | 2364 +++++++++++ servicetypes.h | 19 + youtube.c | 163 + youtube.h | 10 + 149 files changed, 45878 insertions(+) create mode 100644 CHANGES create mode 100644 Docs/HowToAddSites.txt create mode 100644 Docs/Proxys.txt create mode 100644 Docs/Radio.txt create mode 100644 Docs/Usage.txt create mode 100644 INSTALL create mode 100644 LICENCE create mode 100644 Makefile create mode 100644 Makefile.in create mode 100644 README create mode 100644 autom4te.cache/output.0 create mode 100644 autom4te.cache/requests create mode 100644 autom4te.cache/traces.0 create mode 100644 cbsnews.c create mode 100644 cbsnews.h create mode 100644 common.c create mode 100644 common.h create mode 100644 config.log create mode 100755 config.status create mode 100755 configure create mode 100644 configure.in create mode 100644 containerfiles.c create mode 100644 containerfiles.h create mode 100644 dailymotion.c create mode 100644 dailymotion.h create mode 100644 display.c create mode 100644 display.h create mode 100644 download.c create mode 100644 download.h create mode 100644 ehow.c create mode 100644 ehow.h create mode 100644 extract_text.c create mode 100644 extract_text.h create mode 100755 install-sh create mode 100644 libUseful-2.0/Compression.c create mode 100644 libUseful-2.0/Compression.h create mode 100644 libUseful-2.0/ConnectManager.c create mode 100644 libUseful-2.0/ConnectManager.h create mode 100644 libUseful-2.0/ConnectionChain.c create mode 100644 libUseful-2.0/ConnectionChain.h create mode 100644 libUseful-2.0/Copy.sh create mode 100644 libUseful-2.0/DataProcessing.c create mode 100644 libUseful-2.0/DataProcessing.h create mode 100644 libUseful-2.0/Docs/ConnectManager.txt create mode 100644 libUseful-2.0/Docs/DataProcessing.txt create mode 100644 libUseful-2.0/Docs/EncryptedFiles.txt create mode 100644 libUseful-2.0/Docs/GeneralFunctions.txt create mode 100644 libUseful-2.0/Docs/Hash.txt create mode 100644 libUseful-2.0/Docs/Log.txt create mode 100644 libUseful-2.0/Docs/directory create mode 100644 libUseful-2.0/Docs/expect.txt create mode 100644 libUseful-2.0/Docs/file.txt create mode 100644 libUseful-2.0/Docs/http.txt create mode 100644 libUseful-2.0/Docs/includes.txt create mode 100644 libUseful-2.0/Docs/inet.txt create mode 100644 libUseful-2.0/Docs/list.txt create mode 100644 libUseful-2.0/Docs/pty.txt create mode 100644 libUseful-2.0/Docs/socket.txt create mode 100644 libUseful-2.0/Docs/sound.txt create mode 100644 libUseful-2.0/Docs/string.txt create mode 100644 libUseful-2.0/Docs/unix_socket.txt create mode 100644 libUseful-2.0/EncryptedFiles.c create mode 100644 libUseful-2.0/EncryptedFiles.h create mode 100644 libUseful-2.0/FileSystem.c create mode 100644 libUseful-2.0/FileSystem.h create mode 100644 libUseful-2.0/GeneralFunctions.c create mode 100644 libUseful-2.0/GeneralFunctions.h create mode 100644 libUseful-2.0/Hash.c create mode 100644 libUseful-2.0/Hash.h create mode 100644 libUseful-2.0/LICENCE create mode 100644 libUseful-2.0/Log.c create mode 100644 libUseful-2.0/Log.h create mode 100644 libUseful-2.0/Makefile create mode 100644 libUseful-2.0/Makefile.in create mode 100644 libUseful-2.0/Markup.c create mode 100644 libUseful-2.0/Markup.h create mode 100644 libUseful-2.0/MathExpr.c create mode 100644 libUseful-2.0/MathExpr.h create mode 100644 libUseful-2.0/ParseURL.c create mode 100644 libUseful-2.0/ParseURL.h create mode 100644 libUseful-2.0/PatternMatch.c create mode 100644 libUseful-2.0/PatternMatch.h create mode 100644 libUseful-2.0/SpawnPrograms.c create mode 100644 libUseful-2.0/SpawnPrograms.h create mode 100644 libUseful-2.0/Time.c create mode 100644 libUseful-2.0/Time.h create mode 100644 libUseful-2.0/Vars.c create mode 100644 libUseful-2.0/Vars.h create mode 100644 libUseful-2.0/autom4te.cache/directory create mode 100644 libUseful-2.0/autom4te.cache/output.0 create mode 100644 libUseful-2.0/autom4te.cache/requests create mode 100644 libUseful-2.0/autom4te.cache/traces.0 create mode 100644 libUseful-2.0/base64.c create mode 100644 libUseful-2.0/base64.h create mode 100644 libUseful-2.0/config.cache create mode 100644 libUseful-2.0/config.log create mode 100755 libUseful-2.0/config.status create mode 100755 libUseful-2.0/configure create mode 100644 libUseful-2.0/configure.in create mode 100644 libUseful-2.0/crc32.c create mode 100644 libUseful-2.0/crc32.h create mode 100644 libUseful-2.0/defines.h create mode 100644 libUseful-2.0/expect.c create mode 100644 libUseful-2.0/expect.h create mode 100644 libUseful-2.0/file.c create mode 100644 libUseful-2.0/file.h create mode 100644 libUseful-2.0/formattest.c create mode 100644 libUseful-2.0/http.c create mode 100644 libUseful-2.0/http.h create mode 100644 libUseful-2.0/httptest.c create mode 100644 libUseful-2.0/includes.h create mode 100644 libUseful-2.0/inet.c create mode 100644 libUseful-2.0/inet.h create mode 100644 libUseful-2.0/install-sh create mode 100644 libUseful-2.0/libUseful.h create mode 100644 libUseful-2.0/libsettings.c create mode 100644 libUseful-2.0/libsettings.h create mode 100644 libUseful-2.0/list.c create mode 100644 libUseful-2.0/list.h create mode 100644 libUseful-2.0/md5-global.h create mode 100644 libUseful-2.0/md5.h create mode 100644 libUseful-2.0/md5c.c create mode 100644 libUseful-2.0/oauth.c create mode 100644 libUseful-2.0/oauth.h create mode 100644 libUseful-2.0/pty.c create mode 100644 libUseful-2.0/pty.h create mode 100644 libUseful-2.0/sha1.c create mode 100644 libUseful-2.0/sha1.h create mode 100644 libUseful-2.0/sha2.c create mode 100644 libUseful-2.0/sha2.h create mode 100644 libUseful-2.0/socket.c create mode 100644 libUseful-2.0/socket.h create mode 100644 libUseful-2.0/sound.c create mode 100644 libUseful-2.0/sound.h create mode 100644 libUseful-2.0/string.c create mode 100644 libUseful-2.0/string.h create mode 100644 libUseful-2.0/tar.c create mode 100644 libUseful-2.0/tar.h create mode 100644 libUseful-2.0/tartest.c create mode 100644 libUseful-2.0/unix_socket.c create mode 100644 libUseful-2.0/unix_socket.h create mode 100644 libUseful-2.0/ziptest.c create mode 100644 main.c create mode 100644 outputfiles.c create mode 100644 outputfiles.h create mode 100644 servicetypes.c create mode 100644 servicetypes.h create mode 100644 youtube.c create mode 100644 youtube.h diff --git a/CHANGES b/CHANGES new file mode 100644 index 0000000..d3c737e --- /dev/null +++ b/CHANGES @@ -0,0 +1,92 @@ +Version 1.2.1 + Fixes for many sites. + Added 'sshtunnel' proxy type + +Version 1.2.0 + Removed 'Clipshack' (Dead Site) + Removed '5 min' (better dead than AOL) + Removed 'PressTV' (Switched to rtmp? In this day and age?) + Added 'Funny or die' + Fixes for most sites + Much work done on 'ipad streaming' downloads (.m3u8 files) + + +Version 1.1.15 + Added a basic 'ETA' meter (bounces around a lot depending on speed of download) + Added support form links from google-video search + Fixed dailymotion titles + +Version 1.1.14 + Largefile (> 2GB) support + Added 'Animehere' website + +Version 1.1.13 + Fixed Academic Earth. + Fixed Teachertube. + Fixed Escapist Magazine. + + Added "International Business Times", + Added "Sidney Morning Herald", + Added "Press TV (Iran)", + Added www.videojug.com + + Removed Dead Site: VideosFacebook + + Added support for youtube /embed/ format links + +Version 1.1.12 + Big thank you to Abhisek Sanyal for submitting a patch that fixed broken youtube! + Thanks to 'nibbles' for a bunch of bugfixes that let movgrab compile under OSX + +Version 1.1.11 + Fixes for various sites + +Version 1.1.10 + Fixed '-w' flag, which wasn't working + Added 'National Geographic' + Added 'Videobash' + +Version 1.1.9 + Fixes for mefeedia and metatube + Added filesizes to 'Available Formats' list + +Version 1.1.8 + Added crazy new youtube formats like 'webm-3D'. + Movgrab now honors the 'http_proxy' environment variable + +Version 1.1.7 + Added Bloomberg + Added Discovery Channel + Fixed Mobango + Fixed Redbalcony + Assorted bugfixes + +Version 1.1.6 + Fixed Dailymotion + Youtube more reliable + 'help' now goes to stdout + +Version 1.1.5 + Fixed TED + Fixed Dailymotion + +Version 1.1.4 + Makefile bugfix + Other minor bugfixes + Seen working on OSX + +Version 1.1.3 + Added -r flag for resuming downloads + Added 'TeachTube' downloads + MacOSX segfault fixed (hopefully) + +Version 1.1.2: + Vimeo working again + Debianized Makefile + +Version 1.1.1: + Various bugfixes. + Removed '-s' and '-sc', which related to previous streaming methods, and replaced with '-P'. '-P ' allows you to specify a 'player program' that will be used to play the downloaded file. By default this will launch after 25% of the file is downloaded, but this value can be set with '-Pp '. + Added '+o' flag, which allows additional files for writing a download to, so that you can stream it and record it at the same time. + + diff --git a/Docs/HowToAddSites.txt b/Docs/HowToAddSites.txt new file mode 100644 index 0000000..dedc35f --- /dev/null +++ b/Docs/HowToAddSites.txt @@ -0,0 +1,71 @@ +Everything relating to adding sites is now in the files 'servicetypes.c' and 'servicetypes.h'. + +servicetypes.h contains an enumerated type of values that defines a TYPE_ for each download type. You must add a TYPE_ to this too. + +Everything else is in 'servicetypes.c'. Near the top of this file are 3 arrays of strings: + +DownloadTypes +DownloadNames +TestLinks + +When you add a site, you add an entry to each of these. A 'type code' that is used to select it from the command line with the -t option, a longer 'DownloadName' for the download type/website and a link to a video page that can be used to test if this download method is working. All three must be added to the same place in their respective arrays, so if you insert a new download type as the tenth type, then it's entries must be at position ten in all these arrays. + + +Now find a function called 'ExtractItemInfo'. It contains a massive switch statement, with an entry for each of the download TYPE_ values. Most have a format like this: + +case TYPE_MYVIDEO: +#define MYVIDEO_URL_START "link rel='image_src' href='" +#define MYVIDEO_URL_END "/thumbs" +#define MYVIDEO_VIDID_END "_" + +if (strstr(Tempstr,MYVIDEO_URL_START)) +{ + ptr=GenericExtractFromLine(Tempstr, "MyVidURL",MYVIDEO_URL_START,MYVIDEO_URL_END,Vars,EXTRACT_DEQUOTE + | EXTRACT_NOSPACES); + ptr=GenericExtractFromLine(ptr, "item:flv","/",MYVIDEO_VIDID_END,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPA +CES); +} + + +if (strstr(Tempstr,GENERIC_TITLE_START)) +{ + GenericExtractFromLine(Tempstr, "Title",GENERIC_TITLE_START,GENERIC_TITLE_END,Vars,EXTRACT_DEQUOTE); +} +break; + + +They call the function 'GenericExtractFromLine' to clip out bits of text. These are then added to the variable list 'Vars' with the name given as the second argument. These variables can then be accessed from the list with 'GetVar' or with 'SubstituteVarsInString'. GenericExtractFromLine is normally used to clip serveral values from a webpage, that can be used in the actual download later. + +The 'Title' variable is generally used to name the downloaded file. The 'item' variables contain the final download url for the movie. The following 'item' variables can exist. 'item:flv', 'item:mp4', 'item:mov', 'item:mpg', 'item:wmv', 'item:w4a', 'item:avi', 'item:3gp' 'item:mp3', 'item:m4a'. There is also the special value 'item:reference', which is used to tell the system not to download the link as a video, but rather to get it as a webpage, and go through the process of ExtractItemInfo again. + +Other variables have meaning on a download-type by download-type basis. + +After 'ExtractItemInfo' has done its thing we should have a list of Variables that are used in 'GetNextURL'. This function is another switch statement, containing entries of the form: + +case TYPE_MYVIDEO: + Tempstr=SubstituteVarsInString(Tempstr,"$(MyVidURL)/$(ID).flv",Vars,0); + RetVal=DownloadItem(Tempstr, Title,Post); +break; + + +The 'SubstituteVarsInString' fuction is used to construct a video URL from all the vars that were clipped out in 'ExtractItemInfo'. The 'ID' variable is a special case, it is the final selection from the 'item:' variables that were found on the website. Some websites might have many 'item' variables of different formats and video qualities, so we might have item:flv item:mp4 and item:wmv available for the same movie. The 'SelectDownloadFormat' function chooses one of these based on command-line options, and sets the 'ID' variable to have the same value. + +'DownloadItem' is the final function that uses all this information to actually download the video. + + +One last thing remains. With all this work done, movgrab should now be able to download from your website using: + + movgrab -t + +However, it's a good idea to add an entry to 'IdentifyServiceType'. This function checks for strings in the video website URL to decide which type of download we're dealing with. It contains entries like: + +else if (strstr(Server,"myvideo")) +{ + Type=TYPE_MYVIDEO; +} + + +And with that added, movgrab should now be able to download videos just from the appropriate url. + + + diff --git a/Docs/Proxys.txt b/Docs/Proxys.txt new file mode 100644 index 0000000..62de774 --- /dev/null +++ b/Docs/Proxys.txt @@ -0,0 +1,14 @@ +Movgrab currently supports http and ssltunnel proxys. These an either be set using the -p/-proxy command-line switches, or using the http_proxy and sshtunnel_proxy environment variables. + +proxy URLs have the form: + + ://:@: + +If no authentication is needed to use the proxy then the ':@' section can be ommited. + +'type' can be: + http A standard http proxy + https An http proxy that uses encrypted connections + ssltunnel An ssh server that supports connection forwarding + +All connections will then be forwarded through the proxy. diff --git a/Docs/Radio.txt b/Docs/Radio.txt new file mode 100644 index 0000000..1cc47a8 --- /dev/null +++ b/Docs/Radio.txt @@ -0,0 +1,173 @@ +As some of the video download sites that movgrab accesses use the 'IPad Streaming' technique, which involves the use of the .m3u container file, I decided to include support for container files in movgrab. + +The main use for this is internet radio stations. These generally advertise themselves with a .m3u, .pls or .asx file, you download the file and within the file are details of where the radio stream can be found on the net. + +Media players like mplayer can generally handle such streams without any assistance, however some players have less support than others. Also I have found that even mplayer and mpg123 have trouble with some streams, for example: http://www.triplag.com/webradio/darkpsy/triplag-darkpsy-playlist.asx + +Using movgrab's "-o -" flag to stream the download to stdout, and then piping it into the player allows these problems to be overcome. So: + +movgrab -o - 'http://www.triplag.com/webradio/darkpsy/triplag-darkpsy-playlist.asx' | mplayer - -cache 1024 + +Will get you your dark trance fix even if mplayer balks at the .asx file. Recent versions of mplayer require a -cache argument to stream from stdin. Even with this argument they complain about the cache emptying, but if you use a -cache it will eventually start to play. + +Similarly mpg123 can be used thusly + +movgrab -o - 'http://www.triplag.com/webradio/darkpsy/triplag-darkpsy-playlist.asx' | mpg123 - + +For ogg-vorbis streams there's "ogg123" which comes as part of the vorbis distrobution. + +Of course, movgrab can also write the stream to a file, + +movgrab 'http://www.triplag.com/webradio/darkpsy/triplag-darkpsy-playlist.asx' -o darktrance.mp3 + +Best of all, a flag in the form '+o ' can be used to output the stream to a second (or third, or forth...) file, allowing you to listen to the stream and record it, thusly + +movgrab 'http://www.triplag.com/webradio/darkpsy/triplag-darkpsy-playlist.asx' -o - +o darktrance.mp3 | mpg123 - + +This both pipes it into 'mpg123' and writes it to 'darktrance.mp3' + + + + + +RADIO STATIONS: + +There's a Europe wide list at http://www.listenlive.eu/index.html + +Here are some of the highlights of it + +BBC world service. mpg123 doesn't seem to like this .pls, but movgrab can handle it and pipe the output into mpg123 +http://www.bbc.co.uk/worldservice/meta/tx/nb/live/eneuk.pls + +Chill - chillout/lounge +http://media-ice.musicradio.com/ChillMP3.m3u + +Kerrang - Rock +http://tx.whatson.com/icecast.php?i=kerrang.mp3.m3u + +Planet Rock - Rock +http://sharpflow.sharp-stream.com:8000/planetrock.mp3.m3u + +Total Rock +http://icecast.playlouder.com:8000/totalrock.m3u + +XFM - Rock and alternative +http://media-ice.musicradio.com/XFMMP3.m3u + +Classic FM - Classical music +http://www.classicfm.com/ + +French Radio London +http://icy-e-01.sharp-stream.com/frenchradiolon.mp3.m3u + + + +Trance/Dance Stations: + + I've been listening to a lot of psy-trance recently (John OO Fleming's "Global Trance Grooves" podcast in particular) so there's a lot of these! + + +ETN.fm +http://etn.fm/playlists/etn1-mp3-medium.m3u - trace programme +http://etn.fm/playlists/etn2-mp3-medium.m3u - house programme + +Club Lounge, mostly nice, lazy trance +http://www.club-lounge-radio.com/Club-Lounge-Radio.pls + +Schizoid Radio, Broadcasting out of india, have 4 nice channels +http://schizoid.in/schizoid-chill.pls - Chillout +http://schizoid.in/schizoid-prog.pls - Progressive Trance +http://schizoid.in/schizoid-psy.pls - Psy-trance +http://schizoid.in/schizoid-edm.pls - General electronic dance music + +French trance, more of a harder, techno sound +http://www.paris-one.com/pls/radio_trance.pls + +Techno.fm +http://techno.fm/m3u/techno.mp3.m3u - Techno programme +http://techno.fm/m3u/trance.mp3.m3u - Trance programme + +Trance moon, dark psy-trance +http://www.trancemoon.com/DARK.pls + +http://89.238.166.195:9162/listen.pls +http://178.32.57.58:8382/listen.pls +http://london02.discovertrance.com:80/listen.pls +http://www.pulsradio.com/pls/pulsradio.pls +http://files.hard.fm/128.pls + +Digitally Imported has a lot of channels for different types of electronic music + +Chiptunes, music made with old computers and gaming consoles. Whatever will they think of next? +http://listen.di.fm/public3/chiptunes.pls + +Spacemusic channel, very, very dreamy ambient +http://listen.di.fm/public3/spacemusic.pls + +Maybe a few more BPM than spacemusic, but not much +http://listen.di.fm/public3/ambient.pls + +Not quite as drugged out as spacemusic, but still lazy +http://listen.di.fm/public3/chillout.pls +http://listen.di.fm/public3/chilloutdreams.pls + +#and a little more energetic +http://listen.di.fm/public3/lounge.pls +http://listen.di.fm/public3/soulfulhouse.pls + +#Sound of the early 90's +http://listen.di.fm/public3/oldschoolhouse.pls + +Chillout with more of an edgy sound, more psychadelic, alien or computery +http://listen.di.fm/public3/psychill.pls + +I still don't know what 'progressive' means here +http://listen.di.fm/public3/progressive.pls + +#more vocals, more dancy +http://listen.di.fm/public3/vocaltrance.pls +http://listen.di.fm/public3/eurodance.pls +http://listen.di.fm/public3/classiceurodance.pls +http://listen.di.fm/public3/club.pls +http://listen.di.fm/public3/house.pls +http://listen.di.fm/public3/discohouse.pls +http://listen.di.fm/public3/funkyhouse.pls + +Arrrrriba!!! +http://listen.di.fm/public3/latinhouse.pls + +Here come the drums! +http://listen.di.fm/public3/tribalhouse.pls + +Dance-oriented with lots of effects and samples +http://listen.di.fm/public3/trance.pls +http://listen.di.fm/public3/classictrance.pls +http://listen.di.fm/public3/techno.pls +http://listen.di.fm/public3/electro.pls +http://listen.di.fm/public3/techhouse.pls +http://listen.di.fm/public3/minimal.pls +http://listen.di.fm/public3/classictechno.pls + +Up to fifth gear. High BPM sci-fi dance +http://listen.di.fm/public3/goapsy.pls + +#beats a little too fast to dance to really +http://listen.di.fm/public3/liquiddnb.pls +http://listen.di.fm/public3/drumandbass.pls + +Breakbeat uses complex rhythmn arrangements +http://listen.di.fm/public3/breaks.pls + +http://listen.di.fm/public3/futuresynthpop.pls + +Grimy, dark and mechanical, straight outta Croydon! +http://listen.di.fm/public3/dubstep.pls + + +Insanely fast +http://listen.di.fm/public3/hardcore.pls +http://listen.di.fm/public3/harddance.pls + +Dance music for skinheads. Simply horrible. +http://listen.di.fm/public3/gabber.pls +http://listen.di.fm/public3/hardstyle.pls diff --git a/Docs/Usage.txt b/Docs/Usage.txt new file mode 100644 index 0000000..d41ba64 --- /dev/null +++ b/Docs/Usage.txt @@ -0,0 +1,139 @@ + +USAGE: +Generally you need to get the url of the webpage that the video would normally appear on if it were playing in your browser. Here are some examples of what URLs might look like: + +Youtube: http://www.youtube.com/watch?v=oP59tQf_njc +Daily Motion: http://www.dailymotion.com/video/xbfxzk_making-friends-with-the-polar-bear_news +UCSD.tv: http://www.ucsd.tv/naturematters/desert/ +TED: http://www.ted.com/talks/john_gerzema_the_post_crisis_consumer.html + +So: + +movgrab 'http://www.dailymotion.com/video/xbfxzk_making-friends-with-the-polar-bear_news' + +Note the use of quotes (') is a good idea, as many urls have characters like '&' in them that will confuse the shell if they are not in quotes. + +'movgrab -?' or just 'movgrab' will print out a short usage instruction. + +If you want to specify the file to save the move to, use '-o '. +Using '-o -' will pump the movie data out of stdout, so you can feed it to another program, like this: + +movgrab -o - http://www.youtube.com/watch?v=oP59tQf_njc | mplayer - + +But an even better solution is + +movgrab -s http://www.youtube.com/watch?v=oP59tQf_njc | mplayer - + +This will activate 'streaming mode' in which data is written to a file, and then written out of standard out. This handles 'pause' on mplayer better, movgrab will keep writing to the cache file, even downloading the whole movie while mplayer is paused, and then resuming transfer to mplayer when it is unpaused. + +movgrab -sc http://www.youtube.com/watch?v=oP59tQf_njc | mplayer - + +This command works the same as the -s streaming command, except that the file will be kept after playing is finished (not deleted as with -s). If movgrab is asked to get the same file again, it will check in the current directory to see if a previous download exists, and replay that rather than downloading a fresh copy. + +-q will tell movgrab to be 'quiet', not to print out any information as it works. + +-b will tell movgrab to fork into the background so you can carry on using the console (implies -q too) + +-v increases the debugging level. Two -v will cause every webpage visited to be printed out for inspection. Three -v will cause some extra information about headers etc to be printed out. + +-p allows you to specify a proxy server in http://username:password@url:port format. So, something like 'movgrab -p http://guest:password@myproxy.com:8080 . 'Username', 'password' and 'port' are optional if there is no user logon and the port is 80. + +-x attempts to get around 'family filter' on some websites + +-P allows you to specify a 'Player program' (e.g. 'mplayer') to run when a certain percentage (default, 25%) of the file has been downloaded. + +-Pp allow you to set what percent of download to launch the 'Player program' at. + + +In some cases websites have more than one format of a video on offer. In general movgrab tries to extract Flash video (flv) first. If you want a different format, you can first see what the website offers by doing this: + +movgrab -T http://www.dailymotion.com/video/xbfxzk_making-friends-with-the-polar-bear_news + + +----- OUTPUT FROM MOVGRAB ------ + +Formats available for this Movie: flv-h264:640x360 mp4:480x360 flv:400x240 + +TEST MODE: would have downloaded 'SPIN' url=http://v21.lscache1.c.youtube.com/videoplayback?sparams=id,expire,ip,ipbits,itag,algorithm,burst,factor&fexp=903903,910700&algorithm=throttle-factor&itag=18&ipbits=8&burst=40&sver=3&signature=6995A96BF52D06725F81299EC069F97E11FDED26.9403E631ABB0D480F9B1BDDF90B6333456D662C0&expire=1299823200&key=yt1&ip=82.0.0.0&factor=1.25&id=a0fe7db507ff9e37 + +----- OUTPUT FROM MOVGRAB ------ + +This tells you that you can specify 'flv' or 'flv-h264' or 'mp4' (movgrab will go with the first thing that matches, regardless of resolution) or to be more specific 'flv:400x240' or 'flv-h264:640x360', thusly: + + +movgrab -f flv:80x60 http://www.dailymotion.com/video/xbfxzk_making-friends-with-the-polar-bear_news + +You can combine formats in preference lists like this: + +movgrab -f flv:320x240,flv-h264:512x384,flv,mp4,mov,wmv,mp3,m4a http://www.dailymotion.com/video/xbfxzk_making-friends-with-the-polar-bear_news + +Note, no gaps between formats, use ',' as a separator + +'*' can be used to mean 'any format' (but don't forget to put quotes round the whole format list, or the shell will mess with it. + +movgrab -f flv:320x240,flv,mp4,* http://www.dailymotion.com/video/xbfxzk_making-friends-with-the-polar-bear_news + +The above line asks for 320x240 flv first, then flv, then mp4, then says 'anything you can get'. + +Some websites (currently only Berkeley) have many media files on one page. If you movgrab such a page, you will see: + + +----- OUTPUT FROM MOVGRAB ------ +Multiple downloads exist on this page. +Please select by using the command-line argument -n + e.g. -n all + -n 0-4 + -n 3- + + 0: .mp4 + 1: .mp4 Lecture 2 + 2: .mp4 Lecture 3 +----- OUTPUT FROM MOVGRAB ------ + +use of the -f flag can limit which downloads appear in this numeric list. Berkeley offers both .mp4 video and .m4a audio, which appear in the list as seperate programs. Ideally you want to use '-f' to select one or the other. Then you can use the -n flag to say: + + -n all Download all items in list + -n 2-6 Only items 2-6 + -n 2- 2 onwards + -n -4 Up to item 4 + +Changes made to websites frequently break the downloading systems, and other times websites are down or go out of business. In order to test which ones are working and which broken use 'movgrab -test-sites'. Currently it will produce output like: + +Checking youtube okay +Checking metacafe BROKEN +Checking dailymotion okay +Checking break okay +Checking ehow BROKEN +Checking vimeo BROKEN +Checking almostkilled okay +Checking 5min okay +Checking ign BROKEN +Checking vbox7 okay +Checking blip.tv okay +Checking ted okay +Checking myvideo okay +Checking clipshack okay +Checking mytopclip okay +Checking redbalcony okay +Checking mobango okay +Checking izlese okay +Checking izles BROKEN +Checking berkeley okay +Checking yale okay +Checking sdnhm okay +Checking uchannel BROKEN +Checking princeton BROKEN +Checking uctv.tv okay +Checking reuters okay +Checking clipfish.de okay +Checking liveleak okay +Checking academicearth okay +Checking photobucket okay +Checking videoemo okay +Checking videosfacebook BROKEN +Checking aljazeera okay +Checking mefeedia okay +Checking myvido1 BROKEN +Checking iviewtube okay + +That's about it! Have fun! diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..2b8f3a8 --- /dev/null +++ b/INSTALL @@ -0,0 +1,27 @@ +Movgrab compilation should be as simple as: + +./configure +make +make install + +You can use the --prefix argument to ./configure to specify an install root e.g. + +./configure --prefix=/usr +make +make install + +The default is /usr/local + +./configure will accept the arguments: + +--enable-ssl + +Which enables https for downloading (not often useful) + +and + +--enable-largefiles + +Which enables support for downloading files large than 2G. This is a GNU extension, so may not work on all systems. + +More docs in the 'Docs' directory! diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/LICENCE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If 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 convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state 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 program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a20ec68 --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +CC = gcc +VERSION = 1.2.1 +CFLAGS = -g -O2 +LIBS = -lz +INSTALL=/bin/install -c +prefix=/usr/local +bindir=$(prefix)${exec_prefix}/bin +DESTDIR= +FLAGS=$(CFLAGS) -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_LIBZ=1 +OBJ=containerfiles.o outputfiles.o common.o cbsnews.o dailymotion.o ehow.o youtube.o servicetypes.o extract_text.o download.o display.o + +all: $(OBJ) + @cd libUseful-2.0; $(MAKE) + $(CC) $(FLAGS) -o movgrab main.c $(LIBS) $(OBJ) libUseful-2.0/libUseful-2.0.a + +clean: + @rm -f movgrab *.o libUseful-2.0/*.o libUseful-2.0/*.a libUseful-2.0/*.so + +containerfiles.o: containerfiles.c containerfiles.h + $(CC) $(FLAGS) -c containerfiles.c + +outputfiles.o: outputfiles.c outputfiles.h + $(CC) $(FLAGS) -c outputfiles.c + +common.o: common.c common.h + $(CC) $(FLAGS) -c common.c + +cbsnews.o: cbsnews.c cbsnews.h + $(CC) $(FLAGS) -c cbsnews.c + +dailymotion.o: dailymotion.c dailymotion.h + $(CC) $(FLAGS) -c dailymotion.c + +ehow.o: ehow.c ehow.h + $(CC) $(FLAGS) -c ehow.c + +youtube.o: youtube.c youtube.h + $(CC) $(FLAGS) -c youtube.c + +servicetypes.o: servicetypes.c servicetypes.h + $(CC) $(FLAGS) -c servicetypes.c + +download.o: download.c download.h + $(CC) $(FLAGS) -c download.c + +display.o: display.c display.h + $(CC) $(FLAGS) -c display.c + +extract_text.o: extract_text.c extract_text.h + $(CC) $(FLAGS) -c extract_text.c + + +install: + $(INSTALL) -d $(DESTDIR)$(bindir) + $(INSTALL) movgrab $(DESTDIR)$(bindir) diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..ba3cbe8 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,55 @@ +CC = @CC@ +VERSION = @VERSION@ +CFLAGS = @CFLAGS@ +LIBS = @LIBS@ +INSTALL=@INSTALL@ +prefix=@prefix@ +bindir=$(prefix)@bindir@ +DESTDIR= +FLAGS=$(CFLAGS) @DEFS@ +OBJ=containerfiles.o outputfiles.o common.o cbsnews.o dailymotion.o ehow.o youtube.o servicetypes.o extract_text.o download.o display.o + +all: $(OBJ) + @cd libUseful-2.0; $(MAKE) + $(CC) $(FLAGS) -o movgrab main.c $(LIBS) $(OBJ) libUseful-2.0/libUseful-2.0.a + +clean: + @rm -f movgrab *.o libUseful-2.0/*.o libUseful-2.0/*.a libUseful-2.0/*.so + +containerfiles.o: containerfiles.c containerfiles.h + $(CC) $(FLAGS) -c containerfiles.c + +outputfiles.o: outputfiles.c outputfiles.h + $(CC) $(FLAGS) -c outputfiles.c + +common.o: common.c common.h + $(CC) $(FLAGS) -c common.c + +cbsnews.o: cbsnews.c cbsnews.h + $(CC) $(FLAGS) -c cbsnews.c + +dailymotion.o: dailymotion.c dailymotion.h + $(CC) $(FLAGS) -c dailymotion.c + +ehow.o: ehow.c ehow.h + $(CC) $(FLAGS) -c ehow.c + +youtube.o: youtube.c youtube.h + $(CC) $(FLAGS) -c youtube.c + +servicetypes.o: servicetypes.c servicetypes.h + $(CC) $(FLAGS) -c servicetypes.c + +download.o: download.c download.h + $(CC) $(FLAGS) -c download.c + +display.o: display.c display.h + $(CC) $(FLAGS) -c display.c + +extract_text.o: extract_text.c extract_text.h + $(CC) $(FLAGS) -c extract_text.c + + +install: + $(INSTALL) -d $(DESTDIR)$(bindir) + $(INSTALL) movgrab $(DESTDIR)$(bindir) diff --git a/README b/README new file mode 100644 index 0000000..78b42f4 --- /dev/null +++ b/README @@ -0,0 +1,11 @@ +AUTHOR: +Movgrab and libUseful are (C) 2009 Colum Paget. They are released under the GPL so you may do anything with them that the GPL allows. + +Email: colums.projects@gmail.com +Blog: http://idratherhack.blogspot.com + + +DISCLAIMER: + This is free software. It comes with no guarentees and I take no responsiblity if it makes your computer explode or opens a portal to the demon dimensions, or does anything. + +Installation and usage instructions are now in the 'Docs' subdirectory diff --git a/autom4te.cache/output.0 b/autom4te.cache/output.0 new file mode 100644 index 0000000..3483cb4 --- /dev/null +++ b/autom4te.cache/output.0 @@ -0,0 +1,4892 @@ +@%:@! /bin/sh +@%:@ Guess values for system-dependent variables and create Makefiles. +@%:@ Generated by GNU Autoconf 2.60. +@%:@ +@%:@ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +@%:@ 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +@%:@ This configure script is free software; the Free Software Foundation +@%:@ gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + 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 + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +# 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 + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +# 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 + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf@gnu.org about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +# Find out whether ``test -x'' works. Don't use a zero-byte file, as +# systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + as_executable_p="test -x" +else + as_executable_p=: +fi +rm -f conf$$.file + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIB@&t@OBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="main.c" +ac_subst_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +VERSION +subdirs +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +SET_MAKE +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +CPP +GREP +EGREP +LIB@&t@OBJS +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +CPPFLAGS +CPP' +ac_subdirs_all='libUseful-2.0' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval enable_$ac_feature=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval enable_$ac_feature=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval with_$ac_package=\$ac_optarg ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval with_$ac_package=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root @<:@DATAROOTDIR/doc/PACKAGE@:>@ + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-largefiles enable largefile support + --enable-ssl use Secure Sockets Layer + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +configure +generated by GNU Autoconf 2.60 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.60. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +@%:@@%:@ --------- @%:@@%:@ +@%:@@%:@ Platform. @%:@@%:@ +@%:@@%:@ --------- @%:@@%:@ + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +@%:@@%:@ ----------- @%:@@%:@ +@%:@@%:@ Core tests. @%:@@%:@ +@%:@@%:@ ----------- @%:@@%:@ + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +@%:@@%:@ ---------------- @%:@@%:@ +@%:@@%:@ Cache variables. @%:@@%:@ +@%:@@%:@ ---------------- @%:@@%:@ +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +@%:@@%:@ ----------------- @%:@@%:@ +@%:@@%:@ Output variables. @%:@@%:@ +@%:@@%:@ ----------------- @%:@@%:@ +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +@%:@@%:@ ------------------- @%:@@%:@ +@%:@@%:@ File substitutions. @%:@@%:@ +@%:@@%:@ ------------------- @%:@@%:@ +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +@%:@@%:@ ----------- @%:@@%:@ +@%:@@%:@ confdefs.h. @%:@@%:@ +@%:@@%:@ ----------- @%:@@%:@ +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" +fi +shift +for ac_site_file +do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +VERSION="1.1.14" + + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +subdirs="$subdirs libUseful-2.0" + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $@%:@ != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } + +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } +set x ${MAKE-make}; ac_make=`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 + echo $ECHO_N "(cached) $ECHO_C" >&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 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + SET_MAKE= +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done +IFS=$as_save_IFS + + +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 +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@ifdef __STDC__ +@%:@ include +@%:@else +@%:@ include +@%:@endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@ifdef __STDC__ +@%:@ include +@%:@else +@%:@ include +@%:@endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_EGREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +@%:@define STDC_HEADERS 1 +_ACEOF + +fi + + + +{ echo "$as_me:$LINENO: checking for deflate in -lz" >&5 +echo $ECHO_N "checking for deflate in -lz... $ECHO_C" >&6; } +if test "${ac_cv_lib_z_deflate+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char deflate (); +int +main () +{ +return deflate (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_z_deflate=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_z_deflate=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_deflate" >&5 +echo "${ECHO_T}$ac_cv_lib_z_deflate" >&6; } +if test $ac_cv_lib_z_deflate = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_LIBZ 1 +_ACEOF + + LIBS="-lz $LIBS" + +fi + +cf_have_libz=$ac_cv_lib_z_deflate + +# Check whether --enable-largefiles was given. +if test "${enable_largefiles+set}" = set; then + enableval=$enable_largefiles; cf_use_largefiles=$enableval +fi + +# Check whether --enable-ssl was given. +if test "${enable_ssl+set}" = set; then + enableval=$enable_ssl; cf_use_ssl=$enableval +fi + + +if test "$cf_use_largefiles" = "yes" +then +cat >>confdefs.h <<\_ACEOF +@%:@define _LARGEFILE64_SOURCE 1 +_ACEOF + +cat >>confdefs.h <<\_ACEOF +@%:@define _FILE_OFFSET_BITS 64 +_ACEOF + +fi + +if test "$cf_use_ssl" = "yes" +then + +{ echo "$as_me:$LINENO: checking for SSL_library_init in -lssl" >&5 +echo $ECHO_N "checking for SSL_library_init in -lssl... $ECHO_C" >&6; } +if test "${ac_cv_lib_ssl_SSL_library_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lssl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char SSL_library_init (); +int +main () +{ +return SSL_library_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ssl_SSL_library_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_ssl_SSL_library_init=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_library_init" >&5 +echo "${ECHO_T}$ac_cv_lib_ssl_SSL_library_init" >&6; } +if test $ac_cv_lib_ssl_SSL_library_init = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_LIBSSL 1 +_ACEOF + + LIBS="-lssl $LIBS" + +fi + +cf_have_libssl=$ac_cv_lib_ssl_SSL_library_init + + +{ echo "$as_me:$LINENO: checking for EVP_CIPHER_CTX_init in -lcrypto" >&5 +echo $ECHO_N "checking for EVP_CIPHER_CTX_init in -lcrypto... $ECHO_C" >&6; } +if test "${ac_cv_lib_crypto_EVP_CIPHER_CTX_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcrypto $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char EVP_CIPHER_CTX_init (); +int +main () +{ +return EVP_CIPHER_CTX_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_crypto_EVP_CIPHER_CTX_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_crypto_EVP_CIPHER_CTX_init=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&5 +echo "${ECHO_T}$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&6; } +if test $ac_cv_lib_crypto_EVP_CIPHER_CTX_init = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_LIBCRYPTO 1 +_ACEOF + + LIBS="-lcrypto $LIBS" + +fi + +cf_have_libcrypto=$ac_cv_lib_crypto_EVP_CIPHER_CTX_init +fi + + +ac_config_files="$ac_config_files 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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# 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=' +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 : $LIB@&t@OBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIB@&t@OBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + 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 + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +# Find out whether ``test -x'' works. Don't use a zero-byte file, as +# systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + as_executable_p="test -x" +else + as_executable_p=: +fi +rm -f conf$$.file + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.60. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.60, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX +@%:@@%:@ Running $as_me. @%:@@%:@ +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +_ACEOF + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +VERSION!$VERSION$ac_delim +subdirs!$subdirs$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +SET_MAKE!$SET_MAKE$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +LIB@&t@OBJS!$LIB@&t@OBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 55; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + + + + esac + +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + +# +# CONFIG_SUBDIRS section. +# +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + eval "set x $ac_configure_args" + shift + for ac_arg + do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case $ac_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + ;; + *) + case $ac_arg in + *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;; + esac + done + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + ac_arg="--prefix=$prefix" + case $ac_arg in + *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + ac_sub_configure_args="$ac_arg $ac_sub_configure_args" + + ac_popdir=`pwd` + for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + test -d "$srcdir/$ac_dir" || continue + + ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" + echo "$as_me:$LINENO: $ac_msg" >&5 + echo "$ac_msg" >&6 + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + cd "$ac_dir" + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f "$ac_srcdir/configure.gnu"; then + ac_sub_configure=$ac_srcdir/configure.gnu + elif test -f "$ac_srcdir/configure"; then + ac_sub_configure=$ac_srcdir/configure + elif test -f "$ac_srcdir/configure.in"; then + # This should be Cygnus configure. + ac_sub_configure=$ac_aux_dir/configure + else + { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5 +echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative name. + ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; + esac + + { echo "$as_me:$LINENO: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} + # The eval makes quoting arguments work. + eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ + --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || + { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5 +echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;} + { (exit 1); exit 1; }; } + fi + + cd "$ac_popdir" + done +fi + + +echo +echo "********** Movgrab Settings *********" +if test "$cf_have_libssl" != "yes" +then +echo "SSL/https NOT enabled" +else +echo "SSL and https enabled" +fi + +if test "$cf_use_largefiles" != "yes" +then +echo "Largefiles NOT enabled" +else +echo "Largefiles enabled" +fi + + diff --git a/autom4te.cache/requests b/autom4te.cache/requests new file mode 100644 index 0000000..5d439b1 --- /dev/null +++ b/autom4te.cache/requests @@ -0,0 +1,129 @@ +# This file was generated. +# It contains the lists of macros which have been traced. +# It can be safely removed. + +@request = ( + bless( [ + '0', + 1, + [ + '/usr/share/autoconf' + ], + [ + '/usr/share/autoconf/autoconf/autoconf.m4f', + 'configure.in' + ], + { + '_LT_AC_TAGCONFIG' => 1, + 'AM_PROG_F77_C_O' => 1, + 'm4_pattern_forbid' => 1, + 'AC_CANONICAL_TARGET' => 1, + 'AC_CONFIG_LIBOBJ_DIR' => 1, + 'AC_TYPE_OFF_T' => 1, + 'AC_C_VOLATILE' => 1, + 'AC_FUNC_CLOSEDIR_VOID' => 1, + 'AC_REPLACE_FNMATCH' => 1, + 'AC_PROG_LIBTOOL' => 1, + 'AC_FUNC_STAT' => 1, + 'AC_HEADER_TIME' => 1, + 'AC_FUNC_WAIT3' => 1, + 'AM_AUTOMAKE_VERSION' => 1, + 'AC_STRUCT_TM' => 1, + 'AC_FUNC_LSTAT' => 1, + 'AC_TYPE_MODE_T' => 1, + 'AC_FUNC_GETMNTENT' => 1, + 'AC_FUNC_STRTOD' => 1, + 'AC_CHECK_HEADERS' => 1, + 'LT_CONFIG_LTDL_DIR' => 1, + 'AC_FUNC_STRNLEN' => 1, + 'm4_sinclude' => 1, + 'AC_PROG_CXX' => 1, + 'AC_PATH_X' => 1, + 'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1, + 'AC_PROG_AWK' => 1, + '_m4_warn' => 1, + 'AC_HEADER_STDC' => 1, + 'AC_HEADER_MAJOR' => 1, + 'AM_PROG_CXX_C_O' => 1, + 'LT_INIT' => 1, + 'AC_FUNC_ERROR_AT_LINE' => 1, + 'AC_PROG_GCC_TRADITIONAL' => 1, + 'AC_LIBSOURCE' => 1, + 'AC_FUNC_MBRTOWC' => 1, + 'AC_STRUCT_ST_BLOCKS' => 1, + 'AM_PROG_FC_C_O' => 1, + 'AC_CANONICAL_BUILD' => 1, + 'AC_TYPE_SIGNAL' => 1, + 'AC_TYPE_UID_T' => 1, + '_AM_SUBST_NOTMAKE' => 1, + 'AC_CONFIG_AUX_DIR' => 1, + 'AC_PROG_MAKE_SET' => 1, + 'sinclude' => 1, + 'm4_pattern_allow' => 1, + 'AC_DEFINE_TRACE_LITERAL' => 1, + 'AC_FUNC_STRERROR_R' => 1, + 'AC_PROG_CC' => 1, + 'AC_FUNC_FORK' => 1, + 'AC_DECL_SYS_SIGLIST' => 1, + 'AC_FUNC_VPRINTF' => 1, + 'AC_FUNC_STRCOLL' => 1, + 'AC_PROG_YACC' => 1, + 'AC_SUBST_TRACE' => 1, + 'AC_INIT' => 1, + 'AC_STRUCT_TIMEZONE' => 1, + 'AC_FUNC_CHOWN' => 1, + 'AC_SUBST' => 1, + 'AC_FUNC_ALLOCA' => 1, + 'AC_FC_SRCEXT' => 1, + 'AC_CANONICAL_HOST' => 1, + 'AC_FUNC_GETPGRP' => 1, + 'AC_PROG_RANLIB' => 1, + 'AM_INIT_AUTOMAKE' => 1, + 'AC_FUNC_SETPGRP' => 1, + 'AC_CONFIG_SUBDIRS' => 1, + 'AC_FUNC_MMAP' => 1, + 'AC_FUNC_REALLOC' => 1, + 'AC_TYPE_SIZE_T' => 1, + 'AC_REQUIRE_AUX_FILE' => 1, + 'AC_CONFIG_LINKS' => 1, + 'AC_CHECK_TYPES' => 1, + 'LT_SUPPORTED_TAG' => 1, + 'AC_CHECK_MEMBERS' => 1, + 'AM_MAINTAINER_MODE' => 1, + 'AC_FUNC_UTIME_NULL' => 1, + 'AC_FUNC_SELECT_ARGTYPES' => 1, + 'AC_FUNC_STRFTIME' => 1, + 'AC_HEADER_STAT' => 1, + 'AC_C_INLINE' => 1, + 'AC_PROG_CPP' => 1, + 'AC_TYPE_PID_T' => 1, + 'AC_C_CONST' => 1, + 'AC_PROG_LEX' => 1, + 'AC_CONFIG_FILES' => 1, + 'include' => 1, + 'AC_FUNC_SETVBUF_REVERSED' => 1, + 'AC_PROG_INSTALL' => 1, + 'AM_GNU_GETTEXT' => 1, + 'AC_FUNC_OBSTACK' => 1, + 'AC_CHECK_LIB' => 1, + 'AC_FUNC_MALLOC' => 1, + 'AC_FUNC_GETGROUPS' => 1, + 'AC_FC_FREEFORM' => 1, + 'AC_FUNC_GETLOADAVG' => 1, + 'AH_OUTPUT' => 1, + 'AC_FUNC_FSEEKO' => 1, + 'AM_PROG_CC_C_O' => 1, + 'AM_CONDITIONAL' => 1, + 'AC_CANONICAL_SYSTEM' => 1, + 'AC_FUNC_MKTIME' => 1, + 'AC_CONFIG_HEADERS' => 1, + 'AC_HEADER_SYS_WAIT' => 1, + 'AC_FUNC_MEMCMP' => 1, + 'AC_PROG_LN_S' => 1, + 'm4_include' => 1, + 'AC_HEADER_DIRENT' => 1, + 'AC_CHECK_FUNCS' => 1 + } + ], 'Autom4te::Request' ) + ); + diff --git a/autom4te.cache/traces.0 b/autom4te.cache/traces.0 new file mode 100644 index 0000000..b1117a4 --- /dev/null +++ b/autom4te.cache/traces.0 @@ -0,0 +1,264 @@ +m4trace:configure.in:3: -1- AC_INIT([main.c]) +m4trace:configure.in:3: -1- m4_pattern_forbid([^_?A[CHUM]_]) +m4trace:configure.in:3: -1- m4_pattern_forbid([_AC_]) +m4trace:configure.in:3: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) +m4trace:configure.in:3: -1- m4_pattern_allow([^AS_FLAGS$]) +m4trace:configure.in:3: -1- m4_pattern_forbid([^_?m4_]) +m4trace:configure.in:3: -1- m4_pattern_forbid([^dnl$]) +m4trace:configure.in:3: -1- m4_pattern_forbid([^_?AS_]) +m4trace:configure.in:3: -1- AC_SUBST([SHELL], [${CONFIG_SHELL-/bin/sh}]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([SHELL]) +m4trace:configure.in:3: -1- m4_pattern_allow([^SHELL$]) +m4trace:configure.in:3: -1- AC_SUBST([PATH_SEPARATOR]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([PATH_SEPARATOR]) +m4trace:configure.in:3: -1- m4_pattern_allow([^PATH_SEPARATOR$]) +m4trace:configure.in:3: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([PACKAGE_NAME]) +m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_NAME$]) +m4trace:configure.in:3: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([PACKAGE_TARNAME]) +m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) +m4trace:configure.in:3: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([PACKAGE_VERSION]) +m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_VERSION$]) +m4trace:configure.in:3: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([PACKAGE_STRING]) +m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_STRING$]) +m4trace:configure.in:3: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([PACKAGE_BUGREPORT]) +m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) +m4trace:configure.in:3: -1- AC_SUBST([exec_prefix], [NONE]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([exec_prefix]) +m4trace:configure.in:3: -1- m4_pattern_allow([^exec_prefix$]) +m4trace:configure.in:3: -1- AC_SUBST([prefix], [NONE]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([prefix]) +m4trace:configure.in:3: -1- m4_pattern_allow([^prefix$]) +m4trace:configure.in:3: -1- AC_SUBST([program_transform_name], [s,x,x,]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([program_transform_name]) +m4trace:configure.in:3: -1- m4_pattern_allow([^program_transform_name$]) +m4trace:configure.in:3: -1- AC_SUBST([bindir], ['${exec_prefix}/bin']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([bindir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^bindir$]) +m4trace:configure.in:3: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([sbindir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^sbindir$]) +m4trace:configure.in:3: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([libexecdir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^libexecdir$]) +m4trace:configure.in:3: -1- AC_SUBST([datarootdir], ['${prefix}/share']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([datarootdir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^datarootdir$]) +m4trace:configure.in:3: -1- AC_SUBST([datadir], ['${datarootdir}']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([datadir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^datadir$]) +m4trace:configure.in:3: -1- AC_SUBST([sysconfdir], ['${prefix}/etc']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([sysconfdir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^sysconfdir$]) +m4trace:configure.in:3: -1- AC_SUBST([sharedstatedir], ['${prefix}/com']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([sharedstatedir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^sharedstatedir$]) +m4trace:configure.in:3: -1- AC_SUBST([localstatedir], ['${prefix}/var']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([localstatedir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^localstatedir$]) +m4trace:configure.in:3: -1- AC_SUBST([includedir], ['${prefix}/include']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([includedir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^includedir$]) +m4trace:configure.in:3: -1- AC_SUBST([oldincludedir], ['/usr/include']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([oldincludedir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^oldincludedir$]) +m4trace:configure.in:3: -1- AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], + ['${datarootdir}/doc/${PACKAGE_TARNAME}'], + ['${datarootdir}/doc/${PACKAGE}'])]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([docdir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^docdir$]) +m4trace:configure.in:3: -1- AC_SUBST([infodir], ['${datarootdir}/info']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([infodir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^infodir$]) +m4trace:configure.in:3: -1- AC_SUBST([htmldir], ['${docdir}']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([htmldir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^htmldir$]) +m4trace:configure.in:3: -1- AC_SUBST([dvidir], ['${docdir}']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([dvidir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^dvidir$]) +m4trace:configure.in:3: -1- AC_SUBST([pdfdir], ['${docdir}']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([pdfdir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^pdfdir$]) +m4trace:configure.in:3: -1- AC_SUBST([psdir], ['${docdir}']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([psdir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^psdir$]) +m4trace:configure.in:3: -1- AC_SUBST([libdir], ['${exec_prefix}/lib']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([libdir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^libdir$]) +m4trace:configure.in:3: -1- AC_SUBST([localedir], ['${datarootdir}/locale']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([localedir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^localedir$]) +m4trace:configure.in:3: -1- AC_SUBST([mandir], ['${datarootdir}/man']) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([mandir]) +m4trace:configure.in:3: -1- m4_pattern_allow([^mandir$]) +m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME]) +m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_NAME$]) +m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */ +#undef PACKAGE_NAME]) +m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME]) +m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) +m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME]) +m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION]) +m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_VERSION$]) +m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */ +#undef PACKAGE_VERSION]) +m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING]) +m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_STRING$]) +m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING]) +m4trace:configure.in:3: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT]) +m4trace:configure.in:3: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) +m4trace:configure.in:3: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT]) +m4trace:configure.in:3: -1- AC_SUBST([DEFS]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([DEFS]) +m4trace:configure.in:3: -1- m4_pattern_allow([^DEFS$]) +m4trace:configure.in:3: -1- AC_SUBST([ECHO_C]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([ECHO_C]) +m4trace:configure.in:3: -1- m4_pattern_allow([^ECHO_C$]) +m4trace:configure.in:3: -1- AC_SUBST([ECHO_N]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([ECHO_N]) +m4trace:configure.in:3: -1- m4_pattern_allow([^ECHO_N$]) +m4trace:configure.in:3: -1- AC_SUBST([ECHO_T]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([ECHO_T]) +m4trace:configure.in:3: -1- m4_pattern_allow([^ECHO_T$]) +m4trace:configure.in:3: -1- AC_SUBST([LIBS]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.in:3: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.in:3: -1- AC_SUBST([build_alias]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([build_alias]) +m4trace:configure.in:3: -1- m4_pattern_allow([^build_alias$]) +m4trace:configure.in:3: -1- AC_SUBST([host_alias]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([host_alias]) +m4trace:configure.in:3: -1- m4_pattern_allow([^host_alias$]) +m4trace:configure.in:3: -1- AC_SUBST([target_alias]) +m4trace:configure.in:3: -1- AC_SUBST_TRACE([target_alias]) +m4trace:configure.in:3: -1- m4_pattern_allow([^target_alias$]) +m4trace:configure.in:6: -1- AC_SUBST([VERSION]) +m4trace:configure.in:6: -1- AC_SUBST_TRACE([VERSION]) +m4trace:configure.in:6: -1- m4_pattern_allow([^VERSION$]) +m4trace:configure.in:8: -1- AC_CONFIG_SUBDIRS([libUseful-2.0]) +m4trace:configure.in:8: -1- AC_SUBST([subdirs], ["$subdirs m4_normalize([libUseful-2.0])"]) +m4trace:configure.in:8: -1- AC_SUBST_TRACE([subdirs]) +m4trace:configure.in:8: -1- m4_pattern_allow([^subdirs$]) +m4trace:configure.in:10: -1- AC_PROG_CC +m4trace:configure.in:10: -1- AC_SUBST([CC]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:10: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:10: -1- AC_SUBST([CFLAGS]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([CFLAGS]) +m4trace:configure.in:10: -1- m4_pattern_allow([^CFLAGS$]) +m4trace:configure.in:10: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([LDFLAGS]) +m4trace:configure.in:10: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.in:10: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.in:10: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.in:10: -1- AC_SUBST([CC]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:10: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:10: -1- AC_SUBST([CC]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:10: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:10: -1- AC_SUBST([CC]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:10: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:10: -1- AC_SUBST([CC]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:10: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:10: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([ac_ct_CC]) +m4trace:configure.in:10: -1- m4_pattern_allow([^ac_ct_CC$]) +m4trace:configure.in:10: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([EXEEXT]) +m4trace:configure.in:10: -1- m4_pattern_allow([^EXEEXT$]) +m4trace:configure.in:10: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([OBJEXT]) +m4trace:configure.in:10: -1- m4_pattern_allow([^OBJEXT$]) +m4trace:configure.in:11: -1- _m4_warn([obsolete], [The macro `AC_LANG_C' is obsolete. +You should run autoupdate.], [../../lib/autoconf/c.m4:73: AC_LANG_C is expanded from... +configure.in:11: the top level]) +m4trace:configure.in:12: -1- AC_PROG_MAKE_SET +m4trace:configure.in:12: -1- AC_SUBST([SET_MAKE]) +m4trace:configure.in:12: -1- AC_SUBST_TRACE([SET_MAKE]) +m4trace:configure.in:12: -1- m4_pattern_allow([^SET_MAKE$]) +m4trace:configure.in:13: -1- AC_PROG_INSTALL +m4trace:configure.in:13: -1- AC_REQUIRE_AUX_FILE([install-sh]) +m4trace:configure.in:13: -1- AC_SUBST([INSTALL_PROGRAM]) +m4trace:configure.in:13: -1- AC_SUBST_TRACE([INSTALL_PROGRAM]) +m4trace:configure.in:13: -1- m4_pattern_allow([^INSTALL_PROGRAM$]) +m4trace:configure.in:13: -1- AC_SUBST([INSTALL_SCRIPT]) +m4trace:configure.in:13: -1- AC_SUBST_TRACE([INSTALL_SCRIPT]) +m4trace:configure.in:13: -1- m4_pattern_allow([^INSTALL_SCRIPT$]) +m4trace:configure.in:13: -1- AC_SUBST([INSTALL_DATA]) +m4trace:configure.in:13: -1- AC_SUBST_TRACE([INSTALL_DATA]) +m4trace:configure.in:13: -1- m4_pattern_allow([^INSTALL_DATA$]) +m4trace:configure.in:14: -1- AC_HEADER_STDC +m4trace:configure.in:14: -1- AC_PROG_CPP +m4trace:configure.in:14: -1- AC_SUBST([CPP]) +m4trace:configure.in:14: -1- AC_SUBST_TRACE([CPP]) +m4trace:configure.in:14: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.in:14: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:14: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.in:14: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.in:14: -1- AC_SUBST([CPP]) +m4trace:configure.in:14: -1- AC_SUBST_TRACE([CPP]) +m4trace:configure.in:14: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.in:14: -1- AC_SUBST([GREP]) +m4trace:configure.in:14: -1- AC_SUBST_TRACE([GREP]) +m4trace:configure.in:14: -1- m4_pattern_allow([^GREP$]) +m4trace:configure.in:14: -1- AC_SUBST([GREP]) +m4trace:configure.in:14: -1- AC_SUBST_TRACE([GREP]) +m4trace:configure.in:14: -1- m4_pattern_allow([^GREP$]) +m4trace:configure.in:14: -1- AC_SUBST([EGREP]) +m4trace:configure.in:14: -1- AC_SUBST_TRACE([EGREP]) +m4trace:configure.in:14: -1- m4_pattern_allow([^EGREP$]) +m4trace:configure.in:14: -1- AC_SUBST([EGREP]) +m4trace:configure.in:14: -1- AC_SUBST_TRACE([EGREP]) +m4trace:configure.in:14: -1- m4_pattern_allow([^EGREP$]) +m4trace:configure.in:14: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS]) +m4trace:configure.in:14: -1- m4_pattern_allow([^STDC_HEADERS$]) +m4trace:configure.in:14: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS]) +m4trace:configure.in:16: -1- AC_CHECK_LIB([z], [deflate], [], []) +m4trace:configure.in:16: -1- AH_OUTPUT([HAVE_LIBZ], [/* Define to 1 if you have the `z\' library (-lz). */ +#undef HAVE_LIBZ]) +m4trace:configure.in:16: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBZ]) +m4trace:configure.in:16: -1- m4_pattern_allow([^HAVE_LIBZ$]) +m4trace:configure.in:24: -1- AC_DEFINE_TRACE_LITERAL([_LARGEFILE64_SOURCE]) +m4trace:configure.in:24: -1- m4_pattern_allow([^_LARGEFILE64_SOURCE$]) +m4trace:configure.in:25: -1- AC_DEFINE_TRACE_LITERAL([_FILE_OFFSET_BITS]) +m4trace:configure.in:25: -1- m4_pattern_allow([^_FILE_OFFSET_BITS$]) +m4trace:configure.in:30: -1- AC_CHECK_LIB([ssl], [SSL_library_init], [], []) +m4trace:configure.in:30: -1- AH_OUTPUT([HAVE_LIBSSL], [/* Define to 1 if you have the `ssl\' library (-lssl). */ +#undef HAVE_LIBSSL]) +m4trace:configure.in:30: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBSSL]) +m4trace:configure.in:30: -1- m4_pattern_allow([^HAVE_LIBSSL$]) +m4trace:configure.in:33: -1- AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_init], [], []) +m4trace:configure.in:33: -1- AH_OUTPUT([HAVE_LIBCRYPTO], [/* Define to 1 if you have the `crypto\' library (-lcrypto). */ +#undef HAVE_LIBCRYPTO]) +m4trace:configure.in:33: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBCRYPTO]) +m4trace:configure.in:33: -1- m4_pattern_allow([^HAVE_LIBCRYPTO$]) +m4trace:configure.in:39: -1- AC_CONFIG_FILES([Makefile]) +m4trace:configure.in:39: -1- _m4_warn([obsolete], [AC_OUTPUT should be used without arguments. +You should run autoupdate.], []) +m4trace:configure.in:39: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) +m4trace:configure.in:39: -1- AC_SUBST_TRACE([LIB@&t@OBJS]) +m4trace:configure.in:39: -1- m4_pattern_allow([^LIB@&t@OBJS$]) +m4trace:configure.in:39: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) +m4trace:configure.in:39: -1- AC_SUBST_TRACE([LTLIBOBJS]) +m4trace:configure.in:39: -1- m4_pattern_allow([^LTLIBOBJS$]) +m4trace:configure.in:39: -1- AC_SUBST_TRACE([top_builddir]) +m4trace:configure.in:39: -1- AC_SUBST_TRACE([srcdir]) +m4trace:configure.in:39: -1- AC_SUBST_TRACE([abs_srcdir]) +m4trace:configure.in:39: -1- AC_SUBST_TRACE([top_srcdir]) +m4trace:configure.in:39: -1- AC_SUBST_TRACE([abs_top_srcdir]) +m4trace:configure.in:39: -1- AC_SUBST_TRACE([builddir]) +m4trace:configure.in:39: -1- AC_SUBST_TRACE([abs_builddir]) +m4trace:configure.in:39: -1- AC_SUBST_TRACE([abs_top_builddir]) +m4trace:configure.in:39: -1- AC_SUBST_TRACE([INSTALL]) diff --git a/cbsnews.c b/cbsnews.c new file mode 100644 index 0000000..71035d3 --- /dev/null +++ b/cbsnews.c @@ -0,0 +1,32 @@ +#include "cbsnews.h" + +void ExtractCBSNews(ListNode *Vars, char *Line) +{ +char *ptr, *Tempstr=NULL, *Token=NULL; + +#define CBSNEWS_ITEM_START "var sourc = '" +#define CBSNEWS_ITEM_END "'" + +if (strstr(Line,CBSNEWS_ITEM_START)) +{ + + GenericExtractFromLine(Line, "tmpitem",CBSNEWS_ITEM_START,CBSNEWS_ITEM_END,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); + + Token=CopyStr(Token,GetVar(Vars,"tmpitem")); + if (StrLen(Token) > 7) + { + ptr=strstr(Token+7,"http://"); + + if (ptr) Tempstr=CopyStrLen(Tempstr,Token,ptr-Token); + else Tempstr=CopyStr(Tempstr,Token); + SetVar(Vars,"item:mp4",Tempstr); + + if (StrLen(ptr)) SetVar(Vars,"item:m4v",ptr); + } + +} + +DestroyString(Tempstr); +DestroyString(Token); +} + diff --git a/cbsnews.h b/cbsnews.h new file mode 100644 index 0000000..2be43f4 --- /dev/null +++ b/cbsnews.h @@ -0,0 +1,10 @@ + +#ifndef MOVGRAB_CBSNEWS +#define MOVGRAB_CBSNEWS + +#include "common.h" + +void ExtractCBSNews(ListNode *Vars, char *Line); + +#endif + diff --git a/common.c b/common.c new file mode 100644 index 0000000..8cf63da --- /dev/null +++ b/common.c @@ -0,0 +1,17 @@ +#include "common.h" + +char *FileTypes[]={".flv",".mp3",".mp4",".mov",".wma",".m4a",".m4v",".wmv",".webm",".avi",".3gp",NULL}; +char *ItemSelectionArg=NULL; + +char *FileTypeFromURL(char *URL) +{ +static char *Tempstr=NULL; +char *ptr; + +Tempstr=CopyStr(Tempstr,URL); +ptr=strrchr(Tempstr,'?'); +if (ptr) *ptr='\0'; +ptr=strrchr(Tempstr,'.'); +if (ptr) ptr++; +return(ptr); +} diff --git a/common.h b/common.h new file mode 100644 index 0000000..c04fa8d --- /dev/null +++ b/common.h @@ -0,0 +1,40 @@ + +#ifndef MOVGRAB_COMMON +#define MOVGRAB_COMMON +//This is doable through autoconf, but I'm sick of fighting with it +#define Version "1.2.1" + +#include "libUseful-2.0/libUseful.h" +#include +#include +#include "extract_text.h" + +#define FLAG_QUIET 1 +#define FLAG_BACKGROUND 2 +#define FLAG_DEBUG1 4 +#define FLAG_DEBUG2 8 +#define FLAG_DEBUG3 16 +#define FLAG_DEBUG (FLAG_DEBUG1 | FLAG_DEBUG2 | FLAG_DEBUG3) +#define FLAG_PORN 32 +#define FLAG_PRINT_USAGE 64 +#define FLAG_PRINT_VERSION 128 +#define FLAG_TEST 256 +#define FLAG_STDIN 512 +#define FLAG_STDOUT 1024 +#define FLAG_WAIT_INPUT 2048 +#define FLAG_TEST_SITES 4096 +#define FLAG_STREAM 8192 +#define FLAG_STREAMCACHE 16384 +#define FLAG_RETRY_DOWNLOAD 32768 +#define FLAG_RESUME 65536 +#define FLAG_HTTPS 131072 +#define FLAG_POST 262144 + + +extern int Type, Flags; +extern char *FileTypes[]; +extern char *ItemSelectionArg; + +char *FileTypeFromURL(char *URL); + +#endif diff --git a/config.log b/config.log new file mode 100644 index 0000000..2e19f6d --- /dev/null +++ b/config.log @@ -0,0 +1,296 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by configure, which was +generated by GNU Autoconf 2.60. Invocation command line was + + $ ./configure + +## --------- ## +## Platform. ## +## --------- ## + +hostname = lifebook +uname -m = i686 +uname -r = 3.13.1-p4-smp +uname -s = Linux +uname -v = #1 SMP PREEMPT Wed Feb 5 00:08:02 UTC 2014 + +/usr/bin/uname -p = unknown +/bin/uname -X = unknown + +/bin/arch = unknown +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +/usr/bin/hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH: /usr/prebin +PATH: /usr/local/bin +PATH: /usr/bin +PATH: /usr/X11R7/bin +PATH: /bin +PATH: /usr/games/bin +PATH: /opt/git-1.9.rc0/bin + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:1717: checking for gcc +configure:1733: found /usr/bin/gcc +configure:1744: result: gcc +configure:1982: checking for C compiler version +configure:1989: gcc --version >&5 +gcc (GCC) 4.7.3 +Copyright (C) 2012 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. + +configure:1992: $? = 0 +configure:1999: gcc -v >&5 +Using built-in specs. +COLLECT_GCC=gcc +COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i486-pc-linux-gnu/4.7.3/lto-wrapper +Target: i486-pc-linux-gnu +Configured with: ../gcc-4.7.3-src/configure --prefix=/usr --sysconfdir=/etc --includedir=/usr/include --localstatedir=/var --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,c++ --host=i486-pc-linux-gnu --build=i486-pc-linux-gnu --target=i486-pc-linux-gnu --enable-bootstrap +Thread model: posix +gcc version 4.7.3 (GCC) +configure:2002: $? = 0 +configure:2009: gcc -V >&5 +gcc: error: unrecognized command line option '-V' +gcc: fatal error: no input files +compilation terminated. +configure:2012: $? = 1 +configure:2035: checking for C compiler default output file name +configure:2062: gcc conftest.c >&5 +configure:2065: $? = 0 +configure:2111: result: a.out +configure:2116: checking whether the C compiler works +configure:2126: ./a.out +configure:2129: $? = 0 +configure:2146: result: yes +configure:2153: checking whether we are cross compiling +configure:2155: result: no +configure:2158: checking for suffix of executables +configure:2165: gcc -o conftest conftest.c >&5 +configure:2168: $? = 0 +configure:2192: result: +configure:2198: checking for suffix of object files +configure:2224: gcc -c conftest.c >&5 +configure:2227: $? = 0 +configure:2250: result: o +configure:2254: checking whether we are using the GNU C compiler +configure:2283: gcc -c conftest.c >&5 +configure:2289: $? = 0 +configure:2296: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:2299: $? = 0 +configure:2306: test -s conftest.o +configure:2309: $? = 0 +configure:2323: result: yes +configure:2328: checking whether gcc accepts -g +configure:2358: gcc -c -g conftest.c >&5 +configure:2364: $? = 0 +configure:2371: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:2374: $? = 0 +configure:2381: test -s conftest.o +configure:2384: $? = 0 +configure:2514: result: yes +configure:2531: checking for gcc option to accept ISO C89 +configure:2605: gcc -c -g -O2 conftest.c >&5 +configure:2611: $? = 0 +configure:2618: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:2621: $? = 0 +configure:2628: test -s conftest.o +configure:2631: $? = 0 +configure:2651: result: none needed +configure:2675: checking whether make sets $(MAKE) +configure:2696: result: yes +configure:2718: checking for a BSD-compatible install +configure:2774: result: /bin/install -c +configure:2791: checking how to run the C preprocessor +configure:2831: gcc -E conftest.c +configure:2837: $? = 0 +configure:2875: gcc -E conftest.c +conftest.c:8:28: fatal error: ac_nonexistent.h: No such file or directory +compilation terminated. +configure:2881: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| #define PACKAGE_NAME "" +| #define PACKAGE_TARNAME "" +| #define PACKAGE_VERSION "" +| #define PACKAGE_STRING "" +| #define PACKAGE_BUGREPORT "" +| /* end confdefs.h. */ +| #include +configure:2921: result: gcc -E +configure:2950: gcc -E conftest.c +configure:2956: $? = 0 +configure:2994: gcc -E conftest.c +conftest.c:8:28: fatal error: ac_nonexistent.h: No such file or directory +compilation terminated. +configure:3000: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| #define PACKAGE_NAME "" +| #define PACKAGE_TARNAME "" +| #define PACKAGE_VERSION "" +| #define PACKAGE_STRING "" +| #define PACKAGE_BUGREPORT "" +| /* end confdefs.h. */ +| #include +configure:3045: checking for grep that handles long lines and -e +configure:3119: result: /bin/grep +configure:3124: checking for egrep +configure:3202: result: /bin/grep -E +configure:3207: checking for ANSI C header files +configure:3237: gcc -c -g -O2 conftest.c >&5 +configure:3243: $? = 0 +configure:3250: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:3253: $? = 0 +configure:3260: test -s conftest.o +configure:3263: $? = 0 +configure:3359: gcc -o conftest -g -O2 conftest.c >&5 +configure:3362: $? = 0 +configure:3368: ./conftest +configure:3371: $? = 0 +configure:3388: result: yes +configure:3400: checking for deflate in -lz +configure:3435: gcc -o conftest -g -O2 conftest.c -lz >&5 +configure:3441: $? = 0 +configure:3448: test -z "$ac_c_werror_flag" || test ! -s conftest.err +configure:3451: $? = 0 +configure:3458: test -s conftest +configure:3461: $? = 0 +configure:3475: result: yes +configure:3825: creating ./config.status + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.60. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on lifebook + +config.status:568: creating Makefile +configure:4758: === configuring in libUseful-2.0 (/home/meta/movgrab-1.2.1/libUseful-2.0) +configure:4861: running /bin/sh ./configure --prefix=/usr/local --cache-file=/dev/null --srcdir=. + +## ---------------- ## +## Cache variables. ## +## ---------------- ## + +ac_cv_c_compiler_gnu=yes +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_set= +ac_cv_env_CFLAGS_value= +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_CPP_set= +ac_cv_env_CPP_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_header_stdc=yes +ac_cv_lib_z_deflate=yes +ac_cv_objext=o +ac_cv_path_EGREP='/bin/grep -E' +ac_cv_path_GREP=/bin/grep +ac_cv_path_install='/bin/install -c' +ac_cv_prog_CPP='gcc -E' +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_cc_c89= +ac_cv_prog_cc_g=yes +ac_cv_prog_make_make_set=yes + +## ----------------- ## +## Output variables. ## +## ----------------- ## + +CC='gcc' +CFLAGS='-g -O2' +CPP='gcc -E' +CPPFLAGS='' +DEFS='-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_LIBZ=1' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EGREP='/bin/grep -E' +EXEEXT='' +GREP='/bin/grep' +INSTALL_DATA='${INSTALL} -m 644' +INSTALL_PROGRAM='${INSTALL}' +INSTALL_SCRIPT='${INSTALL}' +LDFLAGS='' +LIBOBJS='' +LIBS='-lz ' +LTLIBOBJS='' +OBJEXT='o' +PACKAGE_BUGREPORT='' +PACKAGE_NAME='' +PACKAGE_STRING='' +PACKAGE_TARNAME='' +PACKAGE_VERSION='' +PATH_SEPARATOR=':' +SET_MAKE='' +SHELL='/bin/sh' +VERSION='1.2.1' +ac_ct_CC='gcc' +bindir='${exec_prefix}/bin' +build_alias='' +datadir='${datarootdir}' +datarootdir='${prefix}/share' +docdir='${datarootdir}/doc/${PACKAGE}' +dvidir='${docdir}' +exec_prefix='${prefix}' +host_alias='' +htmldir='${docdir}' +includedir='${prefix}/include' +infodir='${datarootdir}/info' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' +localedir='${datarootdir}/locale' +localstatedir='${prefix}/var' +mandir='${datarootdir}/man' +oldincludedir='/usr/include' +pdfdir='${docdir}' +prefix='/usr/local' +program_transform_name='s,x,x,' +psdir='${docdir}' +sbindir='${exec_prefix}/sbin' +sharedstatedir='${prefix}/com' +subdirs=' libUseful-2.0' +sysconfdir='${prefix}/etc' +target_alias='' + +## ----------- ## +## confdefs.h. ## +## ----------- ## + +#define PACKAGE_NAME "" +#define PACKAGE_TARNAME "" +#define PACKAGE_VERSION "" +#define PACKAGE_STRING "" +#define PACKAGE_BUGREPORT "" +#define STDC_HEADERS 1 +#define HAVE_LIBZ 1 + +configure: exit 0 diff --git a/config.status b/config.status new file mode 100755 index 0000000..8e10cc5 --- /dev/null +++ b/config.status @@ -0,0 +1,759 @@ +#! /bin/sh +# Generated by configure. +# 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-/bin/sh} +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + 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 + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +# Find out whether ``test -x'' works. Don't use a zero-byte file, as +# systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + as_executable_p="test -x" +else + as_executable_p=: +fi +rm -f conf$$.file + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.60. 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` +" + +# Files that config.status was made for. +config_files=" Makefile" + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." + +ac_cs_version="\ +config.status +configured by ./configure, generated by GNU Autoconf 2.60, + with options \"\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='/home/meta/movgrab-1.2.1' +srcdir='.' +INSTALL='/bin/install -c' +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +if $ac_cs_recheck; then + echo "running CONFIG_SHELL=/bin/sh /bin/sh ./configure " $ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=/bin/sh + export CONFIG_SHELL + exec /bin/sh "./configure" $ac_configure_extra_args --no-create --no-recursion +fi + +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +cat >"$tmp/subs-1.sed" <<\CEOF +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +s,@SHELL@,|#_!!_#|/bin/sh,g +s,@PATH_SEPARATOR@,|#_!!_#|:,g +s,@PACKAGE_NAME@,|#_!!_#|,g +s,@PACKAGE_TARNAME@,|#_!!_#|,g +s,@PACKAGE_VERSION@,|#_!!_#|,g +s,@PACKAGE_STRING@,|#_!!_#|,g +s,@PACKAGE_BUGREPORT@,|#_!!_#|,g +s,@exec_prefix@,|#_!!_#|${prefix},g +s,@prefix@,|#_!!_#|/usr/local,g +s,@program_transform_name@,|#_!!_#|s\,x\,x\,,g +s,@bindir@,|#_!!_#|${exec_prefix}/bin,g +s,@sbindir@,|#_!!_#|${exec_prefix}/sbin,g +s,@libexecdir@,|#_!!_#|${exec_prefix}/libexec,g +s,@datarootdir@,|#_!!_#|${prefix}/share,g +s,@datadir@,|#_!!_#|${datarootdir},g +s,@sysconfdir@,|#_!!_#|${prefix}/etc,g +s,@sharedstatedir@,|#_!!_#|${prefix}/com,g +s,@localstatedir@,|#_!!_#|${prefix}/var,g +s,@includedir@,|#_!!_#|${prefix}/include,g +s,@oldincludedir@,|#_!!_#|/usr/include,g +s,@docdir@,|#_!!_#|${datarootdir}/doc/${PACKAGE},g +s,@infodir@,|#_!!_#|${datarootdir}/info,g +s,@htmldir@,|#_!!_#|${docdir},g +s,@dvidir@,|#_!!_#|${docdir},g +s,@pdfdir@,|#_!!_#|${docdir},g +s,@psdir@,|#_!!_#|${docdir},g +s,@libdir@,|#_!!_#|${exec_prefix}/lib,g +s,@localedir@,|#_!!_#|${datarootdir}/locale,g +s,@mandir@,|#_!!_#|${datarootdir}/man,g +s,@DEFS@,|#_!!_#|-DPACKAGE_NAME=\\"\\" -DPACKAGE_TARNAME=\\"\\" -DPACKAGE_VERSION=\\"\\" -DPACKAGE_STRING=\\"\\" -DPACKAGE_BUGREPORT=\\"\\" -DSTDC_HEADERS=1 -DHAVE_LIBZ=1,g +s,@ECHO_C@,|#_!!_#|,g +s,@ECHO_N@,|#_!!_#|-n,g +s,@ECHO_T@,|#_!!_#|,g +s,@LIBS@,|#_!!_#|-lz ,g +s,@build_alias@,|#_!!_#|,g +s,@host_alias@,|#_!!_#|,g +s,@target_alias@,|#_!!_#|,g +s,@VERSION@,|#_!!_#|1.2.1,g +s,@subdirs@,|#_!!_#| libUseful-2.0,g +s,@CC@,|#_!!_#|gcc,g +s,@CFLAGS@,|#_!!_#|-g -O2,g +s,@LDFLAGS@,|#_!!_#|,g +s,@CPPFLAGS@,|#_!!_#|,g +s,@ac_ct_CC@,|#_!!_#|gcc,g +s,@EXEEXT@,|#_!!_#|,g +s,@OBJEXT@,|#_!!_#|o,g +s,@SET_MAKE@,|#_!!_#|,g +s,@INSTALL_PROGRAM@,|#_!!_#|${INSTALL},g +s,@INSTALL_SCRIPT@,|#_!!_#|${INSTALL},g +s,@INSTALL_DATA@,|#_!!_#|${INSTALL} -m 644,g +s,@CPP@,|#_!!_#|gcc -E,g +s,@GREP@,|#_!!_#|/bin/grep,g +s,@EGREP@,|#_!!_#|/bin/grep -E,g +s,@LIBOBJS@,|#_!!_#|,g +s,@LTLIBOBJS@,|#_!!_#|,g +:end +s/|#_!!_#|//g +CEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + ac_datarootdir_hack=' + s&@datadir@&${datarootdir}&g + s&@docdir@&${datarootdir}/doc/${PACKAGE}&g + s&@infodir@&${datarootdir}/info&g + s&@localedir@&${datarootdir}/locale&g + s&@mandir@&${datarootdir}/man&g + s&\${datarootdir}&${prefix}/share&g' ;; +esac + sed "/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +} + +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + + + + esac + +done # for ac_tag + + +{ (exit 0); exit 0; } diff --git a/configure b/configure new file mode 100755 index 0000000..7763bfb --- /dev/null +++ b/configure @@ -0,0 +1,4892 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.60. +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + 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 + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + case $as_dir in + /*) + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +# 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 + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +# 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 + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf@gnu.org about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +# Find out whether ``test -x'' works. Don't use a zero-byte file, as +# systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + as_executable_p="test -x" +else + as_executable_p=: +fi +rm -f conf$$.file + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + + +exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="main.c" +ac_subst_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +VERSION +subdirs +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +SET_MAKE +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +CPP +GREP +EGREP +LIBOBJS +LTLIBOBJS' +ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +CPPFLAGS +CPP' +ac_subdirs_all='libUseful-2.0' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval enable_$ac_feature=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval enable_$ac_feature=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval with_$ac_package=\$ac_optarg ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval with_$ac_package=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-largefiles enable largefile support + --enable-ssl use Secure Sockets Layer + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +configure +generated by GNU Autoconf 2.60 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.60. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" +fi +shift +for ac_site_file +do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +VERSION="1.2.1" + + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { (exit 1); exit 1; }; } +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +subdirs="$subdirs libUseful-2.0" + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } + +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_c89=$ac_arg +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; +esac + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } +set x ${MAKE-make}; ac_make=`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 + echo $ECHO_N "(cached) $ECHO_C" >&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 + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + SET_MAKE= +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done +IFS=$as_save_IFS + + +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 +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi + +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi + +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_EGREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + + +{ echo "$as_me:$LINENO: checking for deflate in -lz" >&5 +echo $ECHO_N "checking for deflate in -lz... $ECHO_C" >&6; } +if test "${ac_cv_lib_z_deflate+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char deflate (); +int +main () +{ +return deflate (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_z_deflate=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_z_deflate=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_deflate" >&5 +echo "${ECHO_T}$ac_cv_lib_z_deflate" >&6; } +if test $ac_cv_lib_z_deflate = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBZ 1 +_ACEOF + + LIBS="-lz $LIBS" + +fi + +cf_have_libz=$ac_cv_lib_z_deflate + +# Check whether --enable-largefiles was given. +if test "${enable_largefiles+set}" = set; then + enableval=$enable_largefiles; cf_use_largefiles=$enableval +fi + +# Check whether --enable-ssl was given. +if test "${enable_ssl+set}" = set; then + enableval=$enable_ssl; cf_use_ssl=$enableval +fi + + +if test "$cf_use_largefiles" = "yes" +then +cat >>confdefs.h <<\_ACEOF +#define _LARGEFILE64_SOURCE 1 +_ACEOF + +cat >>confdefs.h <<\_ACEOF +#define _FILE_OFFSET_BITS 64 +_ACEOF + +fi + +if test "$cf_use_ssl" = "yes" +then + +{ echo "$as_me:$LINENO: checking for SSL_library_init in -lssl" >&5 +echo $ECHO_N "checking for SSL_library_init in -lssl... $ECHO_C" >&6; } +if test "${ac_cv_lib_ssl_SSL_library_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lssl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char SSL_library_init (); +int +main () +{ +return SSL_library_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ssl_SSL_library_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_ssl_SSL_library_init=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_library_init" >&5 +echo "${ECHO_T}$ac_cv_lib_ssl_SSL_library_init" >&6; } +if test $ac_cv_lib_ssl_SSL_library_init = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSSL 1 +_ACEOF + + LIBS="-lssl $LIBS" + +fi + +cf_have_libssl=$ac_cv_lib_ssl_SSL_library_init + + +{ echo "$as_me:$LINENO: checking for EVP_CIPHER_CTX_init in -lcrypto" >&5 +echo $ECHO_N "checking for EVP_CIPHER_CTX_init in -lcrypto... $ECHO_C" >&6; } +if test "${ac_cv_lib_crypto_EVP_CIPHER_CTX_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcrypto $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char EVP_CIPHER_CTX_init (); +int +main () +{ +return EVP_CIPHER_CTX_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_crypto_EVP_CIPHER_CTX_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_crypto_EVP_CIPHER_CTX_init=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&5 +echo "${ECHO_T}$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&6; } +if test $ac_cv_lib_crypto_EVP_CIPHER_CTX_init = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBCRYPTO 1 +_ACEOF + + LIBS="-lcrypto $LIBS" + +fi + +cf_have_libcrypto=$ac_cv_lib_crypto_EVP_CIPHER_CTX_init +fi + + +ac_config_files="$ac_config_files 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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# 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=' +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=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be 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 + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; +esac + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +# Find out whether ``test -x'' works. Don't use a zero-byte file, as +# systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +#! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + as_executable_p="test -x" +else + as_executable_p=: +fi +rm -f conf$$.file + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 + +# Save the log message, to keep $[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.60. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.60, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2006 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +# +# Set up the sed scripts for CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + +_ACEOF + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +VERSION!$VERSION$ac_delim +subdirs!$subdirs$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +SET_MAKE!$SET_MAKE$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 55; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF + + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + + + + esac + +done # for ac_tag + + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + +# +# CONFIG_SUBDIRS section. +# +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + eval "set x $ac_configure_args" + shift + for ac_arg + do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case $ac_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + ;; + *) + case $ac_arg in + *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;; + esac + done + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + ac_arg="--prefix=$prefix" + case $ac_arg in + *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + ac_sub_configure_args="$ac_arg $ac_sub_configure_args" + + ac_popdir=`pwd` + for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + test -d "$srcdir/$ac_dir" || continue + + ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" + echo "$as_me:$LINENO: $ac_msg" >&5 + echo "$ac_msg" >&6 + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + cd "$ac_dir" + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f "$ac_srcdir/configure.gnu"; then + ac_sub_configure=$ac_srcdir/configure.gnu + elif test -f "$ac_srcdir/configure"; then + ac_sub_configure=$ac_srcdir/configure + elif test -f "$ac_srcdir/configure.in"; then + # This should be Cygnus configure. + ac_sub_configure=$ac_aux_dir/configure + else + { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5 +echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative name. + ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; + esac + + { echo "$as_me:$LINENO: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} + # The eval makes quoting arguments work. + eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ + --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || + { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5 +echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;} + { (exit 1); exit 1; }; } + fi + + cd "$ac_popdir" + done +fi + + +echo +echo "********** Movgrab Settings *********" +if test "$cf_have_libssl" != "yes" +then +echo "SSL/https NOT enabled" +else +echo "SSL and https enabled" +fi + +if test "$cf_use_largefiles" != "yes" +then +echo "Largefiles NOT enabled" +else +echo "Largefiles enabled" +fi + + diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..26896aa --- /dev/null +++ b/configure.in @@ -0,0 +1,57 @@ + + +AC_INIT([main.c]) + +VERSION="1.2.1" +AC_SUBST(VERSION) + +AC_CONFIG_SUBDIRS([libUseful-2.0]) + +AC_PROG_CC +AC_LANG_C +AC_PROG_MAKE_SET +AC_PROG_INSTALL +AC_HEADER_STDC + +AC_CHECK_LIB(z,deflate,,) +cf_have_libz=$ac_cv_lib_z_deflate + +AC_ARG_ENABLE(largefiles, [ --enable-largefiles enable largefile support], cf_use_largefiles=$enableval ) +AC_ARG_ENABLE(ssl, [ --enable-ssl use Secure Sockets Layer], cf_use_ssl=$enableval ) + +if test "$cf_use_largefiles" = "yes" +then +AC_DEFINE([_LARGEFILE64_SOURCE]) +AC_DEFINE([_FILE_OFFSET_BITS],[64]) +fi + +if test "$cf_use_ssl" = "yes" +then +AC_CHECK_LIB(ssl,SSL_library_init,,) +cf_have_libssl=$ac_cv_lib_ssl_SSL_library_init + +AC_CHECK_LIB(crypto,EVP_CIPHER_CTX_init,,) +cf_have_libcrypto=$ac_cv_lib_crypto_EVP_CIPHER_CTX_init +fi + + +dnl read Makefile.in and write Makefile +AC_OUTPUT(Makefile) + +echo +echo "********** Movgrab Settings *********" +if test "$cf_have_libssl" != "yes" +then +echo "SSL/https NOT enabled" +else +echo "SSL and https enabled" +fi + +if test "$cf_use_largefiles" != "yes" +then +echo "Largefiles NOT enabled" +else +echo "Largefiles enabled" +fi + + diff --git a/containerfiles.c b/containerfiles.c new file mode 100644 index 0000000..94cec24 --- /dev/null +++ b/containerfiles.c @@ -0,0 +1,341 @@ +#include "containerfiles.h" +#include "outputfiles.h" +#include "servicetypes.h" + + +#define M3U_STREAMINFO 1 +#define M3U_PLAYLIST 2 + +char *ContainerTypes[]={".m3u",".m3u8",".pls",".asx",NULL}; + +int GetContainerFileType(char *URL) +{ +char *Tempstr=NULL, *ptr; +int val; + + +Tempstr=CopyStr(Tempstr,URL); +//strip off any 'http GET' style arguments +ptr=strrchr(Tempstr,'?'); +if (ptr) *ptr='\0'; + +//get path file extension +ptr=strrchr(Tempstr,'.'); + +val=MatchTokenFromList(ptr,ContainerTypes,0); + +DestroyString(Tempstr); + +return(val); +} + + +int DownloadStream(char *URL, char *Title, ListNode *Items, int Flags) +{ +STREAM *Con=NULL, *S=NULL; +ListNode *Curr; +char *Tempstr=NULL, *ptr; +char *Token=NULL; +int Port; +double len=0, ApproxDocSize=0, BytesRead=0; + + Curr=ListGetNext(Items); + + if (Flags & (FLAG_TEST | FLAG_TEST_SITES) ) + { + if (Flags & FLAG_TEST) fprintf(stderr,"TEST MODE: would have downloaded '%s' url=%s\n",Title,Curr->Item); + if (Curr) return(TRUE); + return(FALSE); + } + + OpenOutputFiles(Title,URL,&BytesRead); + while (Curr) + { + if (strncmp((char *) Curr->Item,"http:",5)==0) Tempstr=CopyStr(Tempstr,(char *) Curr->Item); + else + { + Tempstr=CopyStr(Tempstr,URL); + ptr=strrchr(Tempstr,'/'); + if (ptr) *ptr='\0'; + Tempstr=MCatStr(Tempstr,"/",(char *) Curr->Item,NULL); + } + + Con=ConnectAndRetryUntilDownload(Tempstr, 0, 0); + if (Con) + { + ptr=STREAMGetValue(Con,"HTTP:content-length"); + if (ptr) len=atof(ptr); + if (ApproxDocSize==0) ApproxDocSize=ListSize(Items) * len; + TransferItem(Con, Title, Curr->Item, "", len, ApproxDocSize, &BytesRead, BytesRead==0); + STREAMClose(Con); + } + Curr=ListGetNext(Curr); + } + CloseOutputFiles(); + +DestroyString(Tempstr); +DestroyString(Token); + +return(TRUE); +} + + +void M3UParseStreamInfo(char *Line, char **Resolution, char **Bandwidth) +{ +char *Name=NULL, *Value=NULL, *ptr; + +ptr=GetToken(Line,":",&Name,0); +ptr=GetNameValuePair(ptr,",","=",&Name,&Value); +while (ptr) +{ + StripLeadingWhitespace(Name); + StripTrailingWhitespace(Name); + StripLeadingWhitespace(Value); + StripTrailingWhitespace(Value); + if (strcasecmp(Name,"RESOLUTION")==0) *Resolution=CopyStr(*Resolution,Value); + if (strcasecmp(Name,"BANDWIDTH")==0) *Bandwidth=CopyStr(*Bandwidth,Value); +ptr=GetNameValuePair(ptr,",","=",&Name,&Value); +} + +DestroyString(Name); +DestroyString(Value); +} + + + + +int M3UStreamInfo(STREAM *S, char *Title, char *URL, char *FirstLine, int Flags) +{ + char *Tempstr=NULL, *Doc=NULL, *Resolution=NULL, *Bandwidth=NULL, *ptr; + ListNode *Vars=NULL; + int RetVal=FALSE; + + Vars=ListCreate(); + Tempstr=CopyStr(Tempstr,FirstLine); + while (Tempstr) + { + StripTrailingWhitespace(Tempstr); + if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"%s\n",Tempstr); + + if (strncmp("#EXT-X-STREAM-INF",Tempstr,StrLen("#EXT-X-STREAM-INF"))==0) M3UParseStreamInfo(Tempstr, &Resolution, &Bandwidth); + else if (*Tempstr != '#') + { + if (strncasecmp(Tempstr,"http",4) !=0) + { + Doc=CopyStr(Doc,URL); + ptr=strrchr(Doc,'/'); + if (ptr) *ptr='\0'; + Doc=MCatStr(Doc,"/",Tempstr,NULL); + } + else Doc=CopyStr(Doc,Tempstr); + + ptr=FileTypeFromURL(Doc); + if (strcmp(ptr,"m3u8")==0) ptr="stream"; + if (StrLen(Resolution)) + { + if (StrLen(ptr)) Tempstr=MCopyStr(Tempstr,"item:",ptr,":",Resolution,NULL); + else Tempstr=MCopyStr(Tempstr,"item:stream:",Resolution,NULL); + } + else if (StrLen(Bandwidth)) + { + if (StrLen(ptr)) Tempstr=MCopyStr(Tempstr,"item:",ptr,":",Bandwidth,NULL); + else Tempstr=MCopyStr(Tempstr,"item:stream:",Bandwidth,NULL); + } + else Tempstr=CopyStr(Tempstr,"ID"); + SetVar(Vars,Tempstr,Doc); + } + Tempstr=STREAMReadLine(Tempstr,S); + } + + ptr=GetVar(Vars,"ID"); + if (! StrLen(ptr)) Type=SelectDownloadFormat(Vars, TYPE_REFERENCE, FALSE); + ptr=GetVar(Vars,"ID"); + if (StrLen(ptr)) RetVal=DownloadM3U(ptr, Title, Flags); + + ListDestroy(Vars,DestroyString); + DestroyString(Tempstr); + DestroyString(Resolution); + DestroyString(Bandwidth); + DestroyString(Doc); + + return(RetVal); +} + + +int DownloadM3U(char *URL, char *Title, int Flags) +{ +char *Tempstr=NULL, *ID=NULL, *Doc=NULL, *ptr; +int Port=0, BytesRead=0, len=0, count=0; +int RetVal=FALSE; +ListNode *Items, *Curr; +int M3UType=M3U_PLAYLIST; +STREAM *Con; + +if (Flags & FLAG_DEBUG) fprintf(stderr,"M3U STREAM: %s\n",URL); + + +Items=ListCreate(); +Con=ConnectAndRetryUntilDownload(URL, 0, 0); +if (Con) +{ +Tempstr=STREAMReadLine(Tempstr,Con); +while (Tempstr) +{ +StripTrailingWhitespace(Tempstr); +StripLeadingWhitespace(Tempstr); + +if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"%s\n",Tempstr); +if (StrLen(Tempstr)) +{ + if (strncmp("#EXT-X-STREAM-INF",Tempstr,StrLen("#EXT-X-STREAM-INF"))==0) + { + RetVal=M3UStreamInfo(Con,Title,URL,Tempstr,Flags); + M3UType=M3U_STREAMINFO; + } + else if (strncmp("#EXT-X-MEDIA-SEQUENCE",Tempstr,StrLen("#EXT-X-MEDIA-SEQUENCE"))==0) M3UType=M3U_PLAYLIST; + else if (*Tempstr != '#') + { + if (strncasecmp(Tempstr,"http",4) !=0) + { + Doc=CopyStr(Doc,URL); + ptr=strrchr(Doc,'/'); + if (ptr) *ptr='\0'; + Doc=MCatStr(Doc,"/",Tempstr,NULL); + } + else Doc=CopyStr(Doc,Tempstr); + ListAddItem(Items,CopyStr(NULL,Doc)); + } +} + +Tempstr=STREAMReadLine(Tempstr,Con); +} + +STREAMClose(Con); +if (M3UType == M3U_PLAYLIST) RetVal=DownloadStream(URL, Title, Items, Flags); +} + +ListDestroy(Items,DestroyString); +DestroyString(Tempstr); +DestroyString(Doc); +DestroyString(ID); + + +return(RetVal); +} + + +int DownloadPLS(char *URL, char *Title, int Flags) +{ +char *Tempstr=NULL, *Token=NULL, *ptr; +int Port=0, len=0; +STREAM *Con=NULL; +int RetVal=FALSE; +ListNode *Items; + +if (Flags & FLAG_DEBUG) fprintf(stderr,"PLS STREAM: %s\n",URL); + +Items=ListCreate(); +Con=ConnectAndRetryUntilDownload(URL, 0, 0); +if (Con) +{ +Tempstr=STREAMReadLine(Tempstr,Con); +while (Tempstr) +{ +StripTrailingWhitespace(Tempstr); +StripLeadingWhitespace(Tempstr); + + if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"%s\n",Tempstr); +if (StrLen(Tempstr)) +{ + ptr=GetToken(Tempstr,"=",&Token,0); + if (strncmp(Token,"File",4)==0) ListAddItem(Items,CopyStr(NULL,ptr)); +} + +Tempstr=STREAMReadLine(Tempstr,Con); +} + +//Close the Connection and Download the next stage +STREAMClose(Con); + +RetVal=DownloadStream(URL, Title, Items, Flags); +} + +ListDestroy(Items,DestroyString); +DestroyString(Tempstr); + +return(RetVal); +} + + +int DownloadASX(char *URL, char *Title, int Flags) +{ +char *Tempstr=NULL, *Token=NULL, *ptr; +int Port=0, len=0; +int RetVal=FALSE; +STREAM *Con=NULL; +ListNode *Items; + +if (Flags & FLAG_DEBUG) fprintf(stderr,"ASX STREAM: %s\n",URL); + +Items=ListCreate(); +Con=ConnectAndRetryUntilDownload(URL, 0, 0); +if (Con) +{ +Tempstr=STREAMReadLine(Tempstr,Con); +while (Tempstr) +{ +StripTrailingWhitespace(Tempstr); +StripLeadingWhitespace(Tempstr); + + if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"%s\n",Tempstr); + if (StrLen(Tempstr) && (strncasecmp(Tempstr," 0) +{ + Bps=(bytes_read - PrevBytesRead) / (Now-SpeedStart); + BpsStr=MCopyStr(BpsStr,GetHumanReadableDataQty(Bps,0),"/s ",NULL); +} + +if (DocSize) +{ + HUDocSize=CopyStr(HUDocSize,GetHumanReadableDataQty(DocSize,0)); + + Percent=bytes_read * 100.0 / DocSize; + + if (! (Flags & FLAG_QUIET)) + { + if (bytes_read > 0) + { + ETAsecs=(DocSize-bytes_read) / Bps; + ETAStr=FormatStr(ETAStr,"%d:%02d",(int) ETAsecs/60, (int) ETAsecs % 60); + } + else ETAStr=CopyStr(ETAStr,"??:??"); + + fprintf(stderr," Progress: %0.2f%% %s of %s %s ETA: %s \r",Percent,GetHumanReadableDataQty(bytes_read,0),HUDocSize,BpsStr,ETAStr); + + } + + + sprintf(CmdLine,"%s %0.2f%% %s \0",ProgName,Percent,Title); + + if ((PlayerPid==0) && (Percent > PlayerLaunchPercent) && (Player)) LaunchPlayer(); +} +else +{ + if (! (Flags & FLAG_QUIET)) fprintf(stderr," Progress: %s %s \r",GetHumanReadableDataQty((double) bytes_read,0),BpsStr); + sprintf(CmdLine,"%s %s \0",ProgName,Title); +} + +fflush(NULL); +if (Now - SpeedStart > 5) +{ + SpeedStart=Now; + PrevBytesRead=bytes_read; +} +LastDisplay=Now; +} + +DestroyString(HUDocSize); +DestroyString(BpsStr); +DestroyString(Title); +} + diff --git a/display.h b/display.h new file mode 100644 index 0000000..1c3df21 --- /dev/null +++ b/display.h @@ -0,0 +1,12 @@ +#ifndef MOVGRAB_DISPLAY_H +#define MOVGRAB_DISPLAY_H + +#include "common.h" + +extern char *Player; + +int DisplayAvailableFormats(ListNode *Vars, char *Formats, int ShowSize); +void DisplayProgress(char *FullTitle, char *Format, double bytes_read, double DocSize, int PrintName); + +#endif + diff --git a/download.c b/download.c new file mode 100644 index 0000000..8f13134 --- /dev/null +++ b/download.c @@ -0,0 +1,224 @@ +#include "download.h" +#include "outputfiles.h" +#include "display.h" + +/* +Functions relating to connecting to hosts and downloading webpages. +All the HTTP stuff is in here +*/ + + +char *Proxy=NULL; +extern int STREAMTimeout; + +STREAM *ConnectAndSendHeaders(char *URL, int Flags, double BytesRange) +{ +STREAM *Con; +char *Tempstr=NULL, *Method=NULL; +HTTPInfoStruct *Info; +static char *LastPage=NULL; + +if (StrLen(Proxy)) HTTPSetProxy(Proxy); + +if (Flags & FLAG_POST) Method=CopyStr(Method,"POST"); +else Method=CopyStr(Method,"GET"); + +Info=HTTPInfoFromURL(Method, URL); +//if (DLFlags & DL_NOREDIRECT) Info->Flags |=HTTP_NOREDIRECT; +if (Flags & FLAG_HTTPS) Info->Flags |= HTTP_SSL|HTTP_SSL_REWRITE; +if (Flags & FLAG_DEBUG3) Info->Flags |= HTTP_DEBUG; + + +if (StrLen(LastPage)) SetVar(Info->CustomSendHeaders,"Referer",LastPage); + +LastPage=CopyStr(LastPage,Tempstr); +if (BytesRange > 0) +{ + Tempstr=FormatStr(Tempstr,"bytes=%lld-",(long long) BytesRange); + SetVar(Info->CustomSendHeaders,"Range",Tempstr); +} + +Con=HTTPTransact(Info); +if ((! Con) && (! (Flags & FLAG_QUIET))) +{ + if (StrLen(Info->ResponseCode)) fprintf(stderr,"ERROR: Server %s item '%s' not retrieved\nResponseCode: %s\n",Info->Host, Info->Doc,Info->ResponseCode); + else fprintf(stderr,"ERROR: Connection failed to %s can't get file=%s \n",Info->Host, Info->Doc); +} +DestroyString(Tempstr); +DestroyString(Method); + +return(Con); +} + + + +STREAM *ConnectAndRetryUntilDownload(char *URL, int Flags, double BytesRead) +{ +STREAM *Con; +int i; +char *Tempstr=NULL, *ptr; + + +for (i=0; i < 20; i++) +{ +Con=ConnectAndSendHeaders(URL, Flags, BytesRead); + +if (! (Flags & FLAG_RETRY_DOWNLOAD)) break; + +if (Con) +{ +Tempstr=CopyStr(Tempstr,STREAMGetValue(Con,"HTTP:Content-Type")); +if (Flags & FLAG_DEBUG) fprintf(stderr,"ContentType: %s\n",Tempstr); + +//If the Content Type is not text, then we have the video +//else read the text, disconnect, and reconnect +ptr=STREAMGetValue(Con,"HTTP:Content-Length"); +if ((strcmp(ptr,"0") !=0) && (strncmp(Tempstr,"text/",5) !=0)) break; + +Tempstr=STREAMReadLine(Tempstr,Con); +while (Tempstr) Tempstr=STREAMReadLine(Tempstr,Con); +STREAMClose(Con); +Con=NULL; +} + +if (Flags & FLAG_TEST_SITES) break; + +fprintf(stderr,"Failed to get item. Sleeping 5s and retrying\n"); +sleep(5); +CheckForKeyboardInput(); + +} + +DestroyString(Tempstr); + +return(Con); +} + + + + + +int TransferItem(STREAM *Con, char *Title, char *URL, char *Format, double SegmentSize, double DocSize, double *BytesRead, int PrintName) +{ +char *Tempstr=NULL; +int result, RetVal=FALSE, PrintDownloadName; +double ReadThisTime=0; + +DisplayProgress(Title, Format, *BytesRead, DocSize, PrintName); +Tempstr=SetStrLen(Tempstr,BUFSIZ); +result=STREAMReadBytes(Con,Tempstr,BUFSIZ); +while (result != EOF) +{ + ReadThisTime +=result; + (*BytesRead) +=result; + + DisplayProgress(Title, Format, *BytesRead,DocSize,FALSE); + + WriteOutputFiles(Tempstr,result); + if ((SegmentSize > 0) && (ReadThisTime >= SegmentSize)) + { + break; + } + result=STREAMReadBytes(Con,Tempstr,BUFSIZ); +} +RetVal=TRUE; + +//give a bit of time for 'player' program to finish +sleep(3); + +DisplayProgress(Title, Format, *BytesRead,DocSize,FALSE); + +DestroyString(Tempstr); + +return(RetVal); +} + + + +//----- Download an actual Video ---------------------- +int DownloadItem(char *URL, char *Title, char *Format, int Flags) +{ +STREAM *Con=NULL, *S=NULL; +char *Tempstr=NULL, *Token=NULL, *ptr; +char *ContentType=NULL; +int RetVal=FALSE; +char *Extn=NULL; +double DocSize=0, BytesRead=0; + + +if (Flags & FLAG_TEST) +{ + fprintf(stderr,"TEST MODE: would have downloaded '%s' url=%s\n",Title,URL); + return(FALSE); +} + +if (Flags & FLAG_DEBUG) fprintf(stderr,"Next URL: %s\n",URL); + +if (! (Flags & FLAG_TEST_SITES)) OpenOutputFiles(Title,URL,&BytesRead); + +if (! Con) Con=ConnectAndRetryUntilDownload(URL, Flags, BytesRead); +if (Con) +{ + //Some sites throttle excessively + STREAMSetTimeout(Con,STREAMTimeout); + + + Token=CopyStr(Token,STREAMGetValue(Con,"HTTP:Content-Range")); + if (StrLen(Token)) + { + ptr=strrchr(Token,'/'); + ptr++; + DocSize=strtod(ptr,NULL); + } + else + { + Token=CopyStr(Token,STREAMGetValue(Con,"HTTP:content-length")); + if (StrLen(Token)) DocSize=strtod(Token,NULL); + } + + if (Flags & FLAG_TEST_SITES) RetVal=TRUE; + else + { + RetVal=TransferItem(Con,Title, URL, Format, DocSize, DocSize, &BytesRead,TRUE); + + Tempstr=CopyStr(Tempstr,URL); + ptr=strrchr(Tempstr,'?'); + if (ptr) *ptr='\0'; + + Extn=CopyStr(Extn,GuessExtn(GetVar(Con->Values,"HTTP:Content-Type"), Format, Tempstr)); + CloseOutputFiles(Extn); + } + STREAMClose(Con); +} + + +DestroyString(ContentType); +DestroyString(Tempstr); +DestroyString(Extn); +DestroyString(Token); + +return(RetVal); +} + + + +int DownloadPage(char *URL, int Type, char *Title, int DLFlags) +{ +char *ptr, *Args=NULL; +char *Tempstr=NULL, *Token=NULL; +int Port; +STREAM *S; +int RetVal=FALSE; + +if (Flags & (FLAG_DEBUG)) fprintf(stderr,"Next URL: %s\n",URL); +S=ConnectAndSendHeaders(URL, Flags, 0); + +if (S) if (ExtractItemInfo(S, Type, URL, Title, DLFlags)) RetVal=TRUE; +else if (! (Flags & FLAG_QUIET)) fprintf(stderr,"ERROR: failed to Connect to %s\n",URL); + +DestroyString(Tempstr); +DestroyString(Token); + +return(RetVal); +} + diff --git a/download.h b/download.h new file mode 100644 index 0000000..9650a8c --- /dev/null +++ b/download.h @@ -0,0 +1,12 @@ +#ifndef MOVGRAB_DOWNLOAD +#define MOVGRAB_DOWNLOAD + +#include "common.h" + +int DownloadItem(char *URL, char *Format, char *Path, int Flags); +int DownloadPage(char *Path, int Type, char *Title, int Flags); + +extern char *Proxy; +extern int PlayerLaunchPercent; + +#endif diff --git a/ehow.c b/ehow.c new file mode 100644 index 0000000..3945dd8 --- /dev/null +++ b/ehow.c @@ -0,0 +1,39 @@ +#include "ehow.h" + +void EhowExtractShowPlayer(STREAM *S, char *Data, ListNode *Vars) +{ +char *Tempstr=NULL, *PlayerData=NULL, *ItemType=NULL, *ptr; +int wide=0, high=0; + +PlayerData=CopyStr(PlayerData,Data); +while (! strstr(PlayerData,"});")) +{ + Tempstr=STREAMReadLine(Tempstr,S); + PlayerData=MCatStr(PlayerData,Tempstr,",",NULL); +} + +ptr=GetToken(PlayerData,"width: ",&Tempstr,0); +if (ptr) ptr=GetToken(PlayerData,",",&Tempstr,0); +wide=atoi(Tempstr); + +ptr=GetToken(PlayerData,"height: ",&Tempstr,0); +if (ptr) ptr=GetToken(PlayerData,",",&Tempstr,0); +high=atoi(Tempstr); + +ptr=GetToken(PlayerData,"id: ",&Tempstr,0); +if (ptr) ptr=GetToken(PlayerData,",",&Tempstr,0); +ptr=strrchr(Tempstr,'.'); +if (ptr) ptr++; +else ptr="flv"; + +if ((wide==0) || (high==0)) ItemType=MCopyStr(ItemType,"item:",ptr,NULL); +else ItemType=FormatStr(ItemType,"item:%s:%dx%d",ptr,wide,high); + +SetVar(Vars,ItemType,Tempstr); + + +DestroyString(PlayerData); +DestroyString(ItemType); +DestroyString(Tempstr); +} + diff --git a/ehow.h b/ehow.h new file mode 100644 index 0000000..b646efd --- /dev/null +++ b/ehow.h @@ -0,0 +1,10 @@ + +#ifndef MOVGRAB_EHOW +#define MOVGRAB_EHOW + +#include "common.h" + +void EhowExtractShowPlayer(STREAM *S, char *Data, ListNode *Vars); + +#endif + diff --git a/extract_text.c b/extract_text.c new file mode 100644 index 0000000..0639365 --- /dev/null +++ b/extract_text.c @@ -0,0 +1,87 @@ +#include "extract_text.h" + +char *ItemCodeFromFileExtension(char *RetBuf, char *Default, char *Path) +{ +char *Tempstr=NULL, *RetStr=NULL, *ptr; + +Tempstr=CopyStr(Tempstr,Path); +ptr=strrchr(Tempstr,'?'); +if (ptr) *ptr='\0'; +ptr=strrchr(Tempstr,'.'); +if (ptr) +{ +ptr++; +RetStr=MCopyStr(RetBuf,"item:",ptr,NULL); +} +else RetStr=MCopyStr(RetBuf,Default); + +DestroyString(Tempstr); +return(RetStr); +} + +//This function Extracts Text from a line that's found between two specified +//chunks of text 'ItemStart' and 'ItemEnd' +char *GenericExtractFromLine(char *Line, char *ItemName, char *ItemStart, char *ItemEnd, ListNode *Vars, int Flags) +{ +char *ptr, *ptr2, *Token=NULL, *Item=NULL; +int GTF=0; + + if (Flags & EXTRACT_WITHIN_QUOTES) GTF=GETTOKEN_QUOTES; + + if (StrLen(ItemStart)) ptr=GetToken(Line,ItemStart,&Token,0); + else ptr=Line; + + ptr=GetToken(ptr,ItemEnd,&Token,GTF); + + //check if the start string occurs more than once in the Token that we've grabbed + if (StrLen(ItemStart)) ptr2=strstr(Token,ItemStart); + else ptr2=NULL; + + while (ptr2) + { + ptr2+=StrLen(ItemStart); + memmove(Token,ptr2,Token+StrLen(Token)-ptr2+1); + //because of memmove we can strstr in Token again + ptr2=strstr(Token,ItemStart); + } + + if (Flags & EXTRACT_INCLUDE_START) + { + Item=MCopyStr(Item,ItemStart,Token,NULL); + Token=CopyStr(Token,Item); + } + + + if (Flags & EXTRACT_DEQUOTE) Item=HTTPUnQuote(Item,Token); + else if (Flags & EXTRACT_DEHTMLQUOTE) Item=HtmlDeQuote(Item,Token); + else if (Flags & EXTRACT_DESLASHQUOTE) Item=DeQuoteStr(Item,Token); + else Item=CopyStr(Item,Token); + StripLeadingWhitespace(Item); + StripTrailingWhitespace(Item); + StripQuotes(Item); + + if (Flags & EXTRACT_NOSPACES) + { + ptr2=strchr(Item,' '); + while (ptr2) + { + *ptr2='+'; + ptr2=strchr(ptr2,' '); + } + } + + //Do this without disturbing ptr, as we must return ptr + ptr2=ItemName; + if (Flags & EXTRACT_GUESSTYPE) + { + Token=ItemCodeFromFileExtension(Token, ItemName, Item); + } + + SetVar(Vars,ptr2,Item); + +DestroyString(Token); +DestroyString(Item); + +return(ptr); +} + diff --git a/extract_text.h b/extract_text.h new file mode 100644 index 0000000..5695891 --- /dev/null +++ b/extract_text.h @@ -0,0 +1,22 @@ + +#ifndef MOVGRAB_EXTRACT_H +#define MOVGRAB_EXTRACT_H + +#include "common.h" + + +#define EXTRACT_DEQUOTE 1 +#define EXTRACT_WITHIN_QUOTES 2 +#define EXTRACT_NOSPACES 4 +#define EXTRACT_INCLUDE_START 8 +#define EXTRACT_GUESSTYPE 16 +#define EXTRACT_DESLASHQUOTE 32 +#define EXTRACT_DEHTMLQUOTE 64 + + +//This function Extracts Text from a line that's found between two specified +//chunks of text 'ItemStart' and 'ItemEnd' +char *GenericExtractFromLine(char *Line, char *ItemName, char *ItemStart, char *ItemEnd, ListNode *Vars, int Flags); + +#endif + diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..e9de238 --- /dev/null +++ b/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/libUseful-2.0/Compression.c b/libUseful-2.0/Compression.c new file mode 100644 index 0000000..41c553b --- /dev/null +++ b/libUseful-2.0/Compression.c @@ -0,0 +1,21 @@ +#include "DataProcessing.h" + +int CompressBytes(char **Out, char *Alg, char *In, int Len, int Level) +{ +TProcessingModule *Mod=NULL; +char *Tempstr=NULL; +int result, val; + +Tempstr=FormatStr(Tempstr,"CompressionLevel=%d",Level); +Mod=StandardDataProcessorCreate("compression",Alg,Tempstr); +if (! Mod) return(-1); + +val=Len *2; +*Out=SetStrLen(*Out,val); +result=Mod->Write(Mod,In,Len,Out,&Len,TRUE); + +DestroyString(Tempstr); +DataProcessorDestroy(Mod); + +return(result); +} diff --git a/libUseful-2.0/Compression.h b/libUseful-2.0/Compression.h new file mode 100644 index 0000000..1019dbf --- /dev/null +++ b/libUseful-2.0/Compression.h @@ -0,0 +1,18 @@ +#ifndef LIBUSEFUL_COMPRESSION_H +#define LIBUSEFUL_COMPRESSION_H + +#include "includes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int CompressBytes(char **Out, char *Alg, char *In, int Len, int Level); + +#ifdef __cplusplus +} +#endif + + + +#endif diff --git a/libUseful-2.0/ConnectManager.c b/libUseful-2.0/ConnectManager.c new file mode 100644 index 0000000..0aa543e --- /dev/null +++ b/libUseful-2.0/ConnectManager.c @@ -0,0 +1,329 @@ +#include "ConnectManager.h" +#include "socket.h" +#include "SpawnPrograms.h" + +ListNode *ConnectManServers=NULL; +ListNode *ConnectManClients=NULL; +ListNode *Timers=NULL; + + +int ConnectManagerAddServer(int sock, char *Name, CONNECT_FUNC OnConnect, ONDATA_FUNC OnData) +{ +TConnectManagerItem *Item; + +if (! ConnectManServers) ConnectManServers=ListCreate(); + +if (sock==-1) return(FALSE); + +Item=(TConnectManagerItem *) calloc(1,sizeof(TConnectManagerItem)); +Item->OnConnect=OnConnect; +Item->OnData=OnData; +Item->Data=(void *) STREAMFromFD(sock); +Item->Name=CopyStr(Item->Name,Name); + +ListAddItem(ConnectManServers,Item); +return(TRUE); +} + + + + +STREAM *ConnectManagerAddClient(char *Host, int Port, int Flags, char *Name, CONNECT_FUNC OnConnect, ONDATA_FUNC OnData) +{ +STREAM *S; +TConnectManagerItem *Item; + +if (! ConnectManClients) ConnectManClients=ListCreate(); + +S=STREAMCreate(); +if (! STREAMConnectToHost(S,Host,Port,Flags)) +{ +STREAMClose(S); +return(NULL); +} + +Item=(TConnectManagerItem *) calloc(1,sizeof(TConnectManagerItem)); +Item->OnConnect=OnConnect; +Item->OnData=OnData; +Item->Data=(void *) S; +Item->Name=CopyStr(Item->Name,Name); +Item->Host=CopyStr(Item->Host,Host); +Item->Port=Port; + +if (Item->OnConnect && STREAMIsConnected(S)) Item->OnConnect(Item); + +ListAddItem(ConnectManClients,Item); +return(S); +} + + + +TConnectManagerItem *ConnectManagerAddIncoming(STREAM *S, char *Name, ONDATA_FUNC OnData) +{ +TConnectManagerItem *Item=NULL; + +if (! ConnectManClients) ConnectManClients=ListCreate(); + +Item=(TConnectManagerItem *) calloc(1,sizeof(TConnectManagerItem)); +Item->OnData=OnData; +Item->Data=(void *) S; +Item->Name=CopyStr(Item->Name,Name); + +ListAddItem(ConnectManClients,Item); +return(Item); +} + + + + +int ConnectManagerAddTimer(int Secs, char *Name, ONTIMER_FUNC OnTime, void *Data) +{ +TConnectManagerItem *Item; + +if (! Timers) Timers=ListCreate(); + +Item=(TConnectManagerItem *) calloc(1,sizeof(TConnectManagerItem)); +Item->OnData=(ONDATA_FUNC) OnTime; +Item->Name=CopyStr(Item->Name,Name); +Item->TimerVal=Secs; +Item->LastTimerFire=time(NULL); +Item->Data=Data; + +ListAddItem(Timers,Item); +return(TRUE); +} + + + +int ConnectManagerCountNamedConnections(char *Name) +{ +TConnectManagerItem *Item; +ListNode *Curr; +int count=0; + + Curr=ListGetNext(ConnectManClients); + while (Curr) + { + Item=(TConnectManagerItem *) Curr->Item; + if (strcmp(Item->Name,Name)==0) count++; + Curr=ListGetNext(Curr); + } + +return(count); +} + + +STREAM *ConnectManagerGetStreamByName(char *Name) +{ +TConnectManagerItem *Item; +ListNode *Curr; +int count=0; + + Curr=ListGetNext(ConnectManClients); + while (Curr) + { + Item=(TConnectManagerItem *) Curr->Item; + if (strcmp(Item->Name,Name)==0) return((STREAM *) Item->Data); + Curr=ListGetNext(Curr); + } + +return(NULL); +} + + +ListNode *ConnectManagerGetConnectionList() +{ + return(ConnectManClients); +} + +void ConnectManagerMainLoop() +{ +TConnectManagerItem *Item, *NewItem; +ListNode *Curr, *Prev; +int highfd=0; +fd_set ReadSet, WriteSet; +int ipaddr, sock, result, SelectResult, NextTimerFire; +STREAM *S; +time_t Now; +struct timeval tv; +int MoreData=FALSE; + +while (1) +{ + MoreData=FALSE; + time(&Now); + NextTimerFire=60; + Curr=ListGetNext(Timers); + while (Curr) + { + Item=(TConnectManagerItem *) Curr->Item; + if (Item->LastTimerFire==0) Item->LastTimerFire=Now; + result=(Item->LastTimerFire + Item->TimerVal) - Now; + if (result < NextTimerFire) NextTimerFire=result; + Curr=ListGetNext(Curr); + } + + + + FD_ZERO(&ReadSet); + FD_ZERO(&WriteSet); + Curr=ListGetNext(ConnectManServers); + while (Curr) + { + Item=(TConnectManagerItem *) Curr->Item; + S=(STREAM *) Item->Data; + FD_SET(S->in_fd,&ReadSet); + if (S->in_fd > highfd) highfd=S->in_fd; + Curr=ListGetNext(Curr); + } + + + Curr=ListGetNext(ConnectManClients); + while (Curr) + { + Item=(TConnectManagerItem *) Curr->Item; + S=(STREAM *) Item->Data; + if (! S) + { + ListDeleteNode(Curr); + continue; + } + + if (S->State & SS_CONNECTING) + { + FD_SET(S->in_fd,&WriteSet); + } + if (S->InEnd > S->InStart) MoreData=TRUE; + else + { + //always add to read set + FD_SET(S->in_fd,&ReadSet); + if (S->in_fd > highfd) highfd=S->in_fd; + } + + Curr=ListGetNext(Curr); + } + + if (MoreData) + { + tv.tv_usec = 10; + tv.tv_sec = 0; + SelectResult=0; + } + else + { + //SELECT!!! + tv.tv_usec = 20000; + tv.tv_sec = NextTimerFire; + } + SelectResult=select(highfd+1,&ReadSet,&WriteSet,NULL,&tv); + + + if (SelectResult > 0) + { + Curr=ListGetNext(ConnectManServers); + while (Curr) + { + Item=(TConnectManagerItem *) Curr->Item; + + S=(STREAM *) Item->Data; + if (! S) + { + ListDeleteNode(Curr); + continue; + } + + + if (FD_ISSET(S->in_fd,&ReadSet)) + { + sock=TCPServerSockAccept(S->in_fd,&ipaddr); + if (sock > -1) + { + S=STREAMFromFD(sock); + STREAMSetFlushType(S,FLUSH_LINE,0); + S->Path=CopyStr(S->Path,IPtoStr(ipaddr)); + NewItem=ConnectManagerAddIncoming(S,Item->Name, Item->OnData); + if (Item->OnConnect) Item->OnConnect(NewItem); + } + } + + Curr=ListGetNext(Curr); + } + } + + + Curr=ListGetNext(ConnectManClients); + while (Curr) + { + Item=(TConnectManagerItem *) Curr->Item; + S=(STREAM *) Item->Data; + if (! S) + { + ListDeleteNode(Curr); + continue; + } + + if ((SelectResult > 0) && FD_ISSET(S->in_fd,&WriteSet)) + { + if (S->State & SS_CONNECTING) + { + if (STREAMIsConnected(S)) + { + STREAMSetNonBlock(S,FALSE); + if (Item->OnConnect) Item->OnConnect(Item); + } + + } + } + + if ( + (S->InEnd > S->InStart) || + ((SelectResult > 0) && (FD_ISSET(S->in_fd,&ReadSet))) + ) + { + if (! (S->State & SS_CONNECTING)) + { + if (Item->OnData) + { + result=Item->OnData(S, Item->Name); + if (! result) + { + STREAMClose(S); + Prev=ListGetPrev(Curr); + ListDeleteNode(Curr); + free(Item); + Curr=Prev; + } + else if (result==RECONNECT) + { + STREAMClose(S); + S=STREAMCreate(); + STREAMConnectToHost(S,Item->Host,Item->Port,CONNECT_NONBLOCK); + Item->Data=(void *) S; + } + + } + } + } + Curr=ListGetNext(Curr); + } + + + time(&Now); + Curr=ListGetNext(Timers); + while (Curr) + { + Item=(TConnectManagerItem *) Curr->Item; + if ( (Now - Item->LastTimerFire) >= Item->TimerVal ) + { + if (Item->OnData) ((ONTIMER_FUNC)Item->OnData)(Item->Data,Item->Name); + Item->LastTimerFire=Now; + } + Curr=ListGetNext(Curr); + } + + +} + +} + diff --git a/libUseful-2.0/ConnectManager.h b/libUseful-2.0/ConnectManager.h new file mode 100644 index 0000000..7330029 --- /dev/null +++ b/libUseful-2.0/ConnectManager.h @@ -0,0 +1,50 @@ +#ifndef LIBUSEFUL_CONNECT_MANAGER_H +#define LIBUSEFUL_CONNECT_MANAGER_H + +#include "file.h" +#include "includes.h" + +#define RECONNECT 2 + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct t_con_man_item TConnectManagerItem; + + +typedef int (*CONNECT_FUNC)(TConnectManagerItem *Item); +typedef int (*ONDATA_FUNC)(STREAM *S, char *Name); +typedef int (*ONTIMER_FUNC)(void *Data, char *Name); + + + +struct t_con_man_item +{ +char *Name; +void *Data; +int TimerVal; +int LastTimerFire; +char *Host; +int Port; +CONNECT_FUNC OnConnect; +ONDATA_FUNC OnData; +}; + + +int ConnectManagerAddServer(int sock, char *Name, CONNECT_FUNC OnConnect, ONDATA_FUNC OnData); +STREAM *ConnectManagerAddClient(char *Host, int Port, int Flags, char *Name, CONNECT_FUNC OnConnect, ONDATA_FUNC OnData); +TConnectManagerItem *ConnectManagerAddIncoming(STREAM *S, char *Name, ONDATA_FUNC OnData); +int ConnectManagerAddTimer(int Secs, char *Name, ONTIMER_FUNC OnTime, void *Data); +int ConnectManagerCountNamedConnections(char *Name); +STREAM *ConnectManagerGetStreamByName(char *Name); +ListNode *ConnectManagerGetConnectionList(); +void ConnectManagerMainLoop(); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/ConnectionChain.c b/libUseful-2.0/ConnectionChain.c new file mode 100644 index 0000000..8255511 --- /dev/null +++ b/libUseful-2.0/ConnectionChain.c @@ -0,0 +1,299 @@ +#include "ConnectionChain.h" +#include "ParseURL.h" +#include "SpawnPrograms.h" + +char *HopTypes[]={"none","direct","http_proxy","ssh","sshtunnel","shell","telnet",NULL}; +typedef enum {CONNECT_HOP_NONE, CONNECT_HOP_TCP, CONNECT_HOP_HTTP_PROXY, CONNECT_HOP_SSH, CONNECT_HOP_SSHTUNNEL, CONNECT_HOP_SHELL_CMD, CONNECT_HOP_TELNET} THopTypes; + + +int DoHTTPProxyTunnel(STREAM *S, char *Host, int Port, int Flags) +{ +char *Tempstr=NULL, *Token=NULL, *ptr=NULL; +int result=FALSE; + + if (Flags & CONNECT_SSL) Tempstr=FormatStr(Tempstr,"CONNECT https://%s:%d HTTP/1.1\r\n\r\n",Host,Port); + else Tempstr=FormatStr(Tempstr,"CONNECT http://%s:%d HTTP/1.1\r\n\r\n",Host,Port); + STREAMWriteLine(Tempstr,S); + STREAMFlush(S); + + Tempstr=STREAMReadLine(Tempstr,S); + StripTrailingWhitespace(Tempstr); + + ptr=GetToken(Tempstr," ",&Token,0); + ptr=GetToken(ptr," ",&Token,0); + + if (*Token==2) result=TRUE; + while (StrLen(Tempstr)) + { + Tempstr=STREAMReadLine(Tempstr,S); + StripTrailingWhitespace(Tempstr); + } + +DestroyString(Tempstr); +DestroyString(Token); + +return(result); +} + + +int SendPublicKeyToRemote(STREAM *S, char *KeyFile, char *LocalPath) +{ +char *Tempstr=NULL, *RetStr=NULL, *Line=NULL; +STREAM *LocalFile; + + +Tempstr=FormatStr(Tempstr,"rm -f %s ; touch %s; chmod 0600 %s\n",KeyFile,KeyFile,KeyFile); +STREAMWriteLine(Tempstr,S); +LocalFile=STREAMOpenFile(LocalPath,O_RDONLY); +if (LocalFile) +{ +Line=STREAMReadLine(Line,LocalFile); +while (Line) +{ +StripTrailingWhitespace(Line); +Tempstr=FormatStr(Tempstr,"echo '%s' >> %s\n",Line,KeyFile); +STREAMWriteLine(Tempstr,S); +Line=STREAMReadLine(Line,LocalFile); +} +STREAMClose(LocalFile); +} + +return(TRUE); +} + + + +int ConnectHopSSH(STREAM *S,int Type, char *Host, int Port, char *User, char *Pass, char *NextHop) +{ +char *Tempstr=NULL, *KeyFile=NULL, *Token=NULL, *Token2=NULL, *ptr; +STREAM *AuthS; +int result=FALSE, val; +unsigned int TunnelPort=0; + +if (Type==CONNECT_HOP_SSHTUNNEL) +{ + TunnelPort=(rand() % (0xFFFF - 9000)) +9000; + //Host will be Token, and port Token2 + ParseConnectDetails(NextHop, NULL, &Token, &Token2, NULL, NULL, NULL); + Tempstr=FormatStr(Tempstr,"ssh -2 -N %s@%s -L %d:%s:%s ",User,Host,TunnelPort,Token,Token2); + +} +else Tempstr=MCopyStr(Tempstr,"ssh -2 -T ",User,"@",Host, " ", NULL ); + +if (strncmp(Pass,"keyfile:",8)==0) +{ + + if (S->in_fd != -1) + { + Token=FormatStr(Token,".%d-%d",getpid(),time(NULL)); + SendPublicKeyToRemote(S,Token,Pass+8); + KeyFile=CopyStr(KeyFile,Token); + } + Tempstr=MCatStr(Tempstr,"-i ",KeyFile," ",NULL); + } + + if (Port > 0) + { + Token=FormatStr(Token," -p %d ",Port); + Tempstr=CatStr(Tempstr,Token); + } + + if (Type==CONNECT_HOP_SSHTUNNEL) + { + Tempstr=CatStr(Tempstr, " 2> /dev/null"); + AuthS=STREAMSpawnCommand(Tempstr,COMMS_BY_PTY); + STREAMSetValue(S,"HelperPID:SSH",STREAMGetValue(AuthS,"PeerPID")); + } + else if (S->in_fd==-1) + { + Tempstr=CatStr(Tempstr, " 2> /dev/null"); + PseudoTTYSpawn(&S->in_fd,Tempstr,0); + S->out_fd=S->in_fd; + if (S->in_fd > -1) + { + result=TRUE; + STREAMSetFlushType(S,FLUSH_LINE,0); + } + AuthS=S; + } + else + { + if (StrLen(KeyFile)) Tempstr=MCatStr(Tempstr," ; rm -f ",KeyFile,NULL); + Tempstr=CatStr(Tempstr,"; exit\n"); + STREAMWriteLine(Tempstr,S); + result=TRUE; + AuthS=S; + } + + if ((StrLen(KeyFile)==0) && (StrLen(Pass) > 0)) + { + Token=MCopyStr(Token,Pass,"\n",NULL); + for (val=0; val < 3; val++) + { + if (STREAMExpectAndReply(AuthS,"assword:",Token)) break; + } + } + STREAMSetTimeout(AuthS,1); + //STREAMExpectSilence(AuthS); + sleep(3); + + if (Type==CONNECT_HOP_SSHTUNNEL) + { + S->in_fd=ConnectToHost("127.0.0.1",TunnelPort,0); + S->out_fd=S->in_fd; + if (S->in_fd > -1) result=TRUE; + } + + +DestroyString(Tempstr); +DestroyString(KeyFile); +DestroyString(Token2); +DestroyString(Token); + +return(result); +} + + +int STREAMProcessConnectHop(STREAM *S, char *HopURL, int LastHop) +{ +int val, result=FALSE; +char *Token=NULL, *Token2=NULL, *ptr; +char *Tempstr=NULL; +char *User=NULL, *Host=NULL,*Pass=NULL, *KeyFile=NULL; +int Port=0; + +ParseConnectDetails(HopURL, &Token, &Host, &Token2, &User, &Pass, NULL); +Port=atoi(Token2); + +val=MatchTokenFromList(Token,HopTypes,0); +switch (val) +{ + case CONNECT_HOP_TCP: + if (S->in_fd==-1) + { + S->in_fd=ConnectToHost(Host,Port,0); + S->out_fd=S->in_fd; + if (S->in_fd > -1) result=TRUE; + } + break; + + case CONNECT_HOP_HTTP_PROXY: + result=DoHTTPProxyTunnel(S, Host, Port, 0); + break; + + case CONNECT_HOP_SSH: + case CONNECT_HOP_SSHTUNNEL: + result=ConnectHopSSH(S, val, Host, Port, User, Pass, S->Path); + break; + + case CONNECT_HOP_SHELL_CMD: + break; + + case CONNECT_HOP_TELNET: + if (Port > 0) + { + Tempstr=FormatStr(Tempstr,"telnet -8 %s %d ",Host, Port); + } + else Tempstr=FormatStr(Tempstr,"telnet -8 %s ",Host); + + if (S->in_fd==-1) + { + PseudoTTYSpawn(& S->in_fd,Tempstr,0); + S->out_fd=S->in_fd; + if (S->in_fd > -1) + { + result=TRUE; + STREAMSetFlushType(S,FLUSH_LINE,0); + } + + } + else + { + Tempstr=CatStr(Tempstr,";exit\n"); + STREAMWriteLine(Tempstr,S); + result=TRUE; + } + if (StrLen(User) > 0) + { + Tempstr=MCopyStr(Tempstr,User,"\n",NULL); + STREAMExpectAndReply(S,"ogin:",Tempstr); + } + if (StrLen(Pass) > 0) + { + Tempstr=MCopyStr(Tempstr,Pass,"\n",NULL); + STREAMExpectAndReply(S,"assword:",Tempstr); + } + STREAMSetTimeout(S,2); + STREAMExpectSilence(S); + break; + + +} + +DestroyString(Tempstr); +DestroyString(Token); +DestroyString(KeyFile); +DestroyString(Host); +DestroyString(User); +DestroyString(Pass); + +STREAMSetTimeout(S,30); +STREAMFlush(S); +return(result); +} + + +/* +int STREAMInternalLastHop(STREAM *S,char *DesiredHost,int DesiredPort, char *LastHop) +{ +int result, Type,Port; +char *Host=NULL, *User=NULL, *Pass=NULL, *KeyFile=NULL; + +ParseConnectHop(LastHop, &Type, &Host, &User, &Pass, &KeyFile, &Port); +switch (Type) +{ + +} +result=STREAMProcessConnectHop(S, Tempstr, TRUE); + +DestroyString(Tempstr); +DestroyString(Host); +DestroyString(User); +DestroyString(Pass); +DestroyString(KeyFile); +return(result); +} +*/ + + + +int STREAMAddConnectionHop(STREAM *S, char *Value) +{ +char *Tempstr=NULL; +char *ConnectType=NULL; +int i; + +StripTrailingWhitespace(Value); +StripLeadingWhitespace(Value); + +if (! S->Values) S->Values=ListCreate(); +Tempstr=FormatStr(Tempstr,"ConnectHop:%d",ListSize(S->Values)); +STREAMSetValue(S,Tempstr,Value); + +DestroyString(Tempstr); +return(TRUE); +} + +void STREAMAddConnectionHopList(STREAM *S, char *HopList) +{ +char *Hop=NULL, *ptr; + +ptr=GetToken(HopList,",",&Hop,0); +while (ptr) +{ +STREAMAddConnectionHop(S,Hop); +ptr=GetToken(ptr,",",&Hop,0); +} + +DestroyString(Hop); +} diff --git a/libUseful-2.0/ConnectionChain.h b/libUseful-2.0/ConnectionChain.h new file mode 100644 index 0000000..830a7c4 --- /dev/null +++ b/libUseful-2.0/ConnectionChain.h @@ -0,0 +1,28 @@ +#ifndef LIBUSEFUL_CONNECTCHAIN +#define LIBUSEFUL_CONNECTCHAIN + +#define PMATCH_SUBSTR 1 +#define PMATCH_NOWILDCARDS 2 +#define PMATCH_NOCASE 4 +#define PMATCH_NOEXTRACT 8 +#define PMATCH_NEWLINEEND 16 +#define PMATCH_NOTSTART 32 +#define PMATCH_NOTEND 64 + +#include "includes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int STREAMProcessConnectHop(STREAM *S, char *Value, int LastHop); +int STREAMAddConnectionHop(STREAM *S, char *Value); + +#ifdef __cplusplus +} +#endif + +#endif + + + diff --git a/libUseful-2.0/Copy.sh b/libUseful-2.0/Copy.sh new file mode 100644 index 0000000..1f33ae3 --- /dev/null +++ b/libUseful-2.0/Copy.sh @@ -0,0 +1,6 @@ +for FILE in ../*.c +do +NAME=`basename $FILE` +cat $FILE | sed "s/AddItemToList/ListAddItem/g" | sed "s/AddNamedItemToList/ListAddNamedItem/g" | sed "s/GetListHead/ListGetHead/g" | sed "s/GetNextListItem/ListGetNext/g" | sed "s/GetPrevListItem/ListGetPrev/g" | sed "s/DeleteNodeFromList/ListDeleteNode/g" | sed "s/ClearList/ListClear/g" | sed "s/DestroyList/ListDestroy/g" | sed "s/CloneList/ListClone/g" | sed "s/GetNthListItem/ListGetNth/g" | sed "s/GetLastListitem/ListGetLast/g" | sed "s/CreateEmptyList/ListCreate/g" | sed "s/CountItemsInList/ListSize/g" | sed "s/InsertItemIntoList/ListInsertItem/g" > $NAME + +done diff --git a/libUseful-2.0/DataProcessing.c b/libUseful-2.0/DataProcessing.c new file mode 100644 index 0000000..a0b39c8 --- /dev/null +++ b/libUseful-2.0/DataProcessing.c @@ -0,0 +1,1069 @@ +#include "DataProcessing.h" +#include "SpawnPrograms.h" + +#ifdef HAVE_LIBSSL + +#include +#include +#include +#include +#include +#include + + +typedef struct +{ +char *Key; +int KeyLen; +char *InputVector; +int InputVectorLen; +int BlockSize; +const EVP_CIPHER *Cipher; +EVP_CIPHER_CTX *enc_ctx; +EVP_CIPHER_CTX *dec_ctx; +} libCryptoProcessorData; +#endif + + +void DataProcessorDestroy(void *In) +{ +TProcessingModule *Mod; + +Mod=(TProcessingModule *) In; +if (! Mod) return; +if (Mod->Close) Mod->Close(Mod); +DestroyString(Mod->Name); +DestroyString(Mod->Args); +DestroyString(Mod->ReadBuff); +DestroyString(Mod->WriteBuff); +free(Mod); +} + + + +char *DataProcessorGetValue(TProcessingModule *M, const char *Name) +{ +char *ptr; +ListNode *Curr; + +if (! M->Values) return(NULL); +Curr=ListFindNamedItem(M->Values,Name); +if (Curr) return(Curr->Item); +return(NULL); +} + + +void DataProcessorSetValue(TProcessingModule *M, const char *Name, const char *Value) +{ +char *ptr; +ListNode *Curr; + +if (! M->Values) M->Values=ListCreate(); +Curr=ListFindNamedItem(M->Values,Name); +if (Curr) Curr->Item = (void *) CopyStr( (char *) Curr->Item, Value); +else ListAddNamedItem(M->Values,Name,CopyStr(NULL,Value)); +} + + + +void DataProcessorUpdateBuffer(char **Buffer, int *Used, int *Size, const char *Data, int DataLen) +{ +int len; + +if (DataLen < 1) return; + +len=*Used+DataLen; + + +if (len > *Size) +{ + *Buffer=(char *) realloc(*Buffer,len); + *Size=len; +} + +//if we've been supplied actual data to put in the buffer, then do so +//otherwise just expand it if needed +if (Data) +{ + memcpy((*Buffer) + (*Used) ,Data,DataLen); + *Used=len; +} +} + + +int PipeCommandProcessorInit(TProcessingModule *ProcMod, const char *Args) +{ +int result=FALSE; +char *Tempstr=NULL; +char *Name=NULL, *Value=NULL, *ptr; +STREAM *S; + +ptr=GetNameValuePair(Args,"\\S","=",&Name,&Value); +while (ptr) +{ + if (strcasecmp(Name,"Command")==0) Tempstr=CopyStr(Tempstr,Value); + +ptr=GetNameValuePair(ptr,"\\S","=",&Name,&Value); +} + +if (! StrLen(Tempstr) ) +{ + DestroyString(Name); + DestroyString(Value); + DestroyString(Tempstr); + return(FALSE); +} + +GetToken(Tempstr,"\\S",&Name,0); +Value=FindFileInPath(Value,Name,getenv("PATH")); + +if (! StrLen(Value) ) +{ + DestroyString(Name); + DestroyString(Value); + DestroyString(Tempstr); + return(FALSE); +} + + +S=STREAMSpawnCommand(Value, COMMS_BY_PIPE); +ProcMod->Data=(void *) S; +result=TRUE; + +DestroyString(Name); +DestroyString(Value); +DestroyString(Tempstr); + +return(result); +} + + +int PipeCommandProcessorWrite(TProcessingModule *ProcMod, const char *InData, int InLen, char **OutData, int *OutLen, int Flush) +{ +STREAM *S; + +S=(STREAM *) ProcMod->Data; +if (InLen > 0) +{ + STREAMWriteBytes(S,InData,InLen); + STREAMFlush(S); +} + +if (Flush) +{ + if (S->out_fd > -1) close(S->out_fd); + S->out_fd=-1; +} +else if (! STREAMCheckForBytes(S)) return(0); +return(STREAMReadBytes(S,*OutData,*OutLen)); +} + + +int PipeCommandProcessorClose(TProcessingModule *ProcMod) +{ +STREAMClose((STREAM *) ProcMod->Data); +ProcMod->Data=NULL; + +return(TRUE); +} + + + +void InitialiseEncryptionComponents(const char *Args, char **Cipher, char **InputVector, int *IVLen, char **Key, int *KeyLen, int *Flags) +{ +char *TmpKey=NULL, *Tempstr=NULL; +int klen=0, slen=0; +char *Name=NULL, *Value=NULL, *ptr; +char *Salt=NULL; + +*IVLen=0; +ptr=GetNameValuePair(Args,"\\S","=",&Name,&Value); +while (ptr) +{ + if (StrLen(Name)) + { + if (strcasecmp(Name,"Cipher")==0) + { + *Cipher=CopyStr(*Cipher,Value); + } + + + if (strcasecmp(Name,"Key")==0) + { + TmpKey=CopyStr(TmpKey,Value); + klen=StrLen(TmpKey); + } + + if (strcasecmp(Name,"Salt")==0) + { + Salt=CopyStr(Salt,Value); + slen=StrLen(Salt); + } + + + + if ( + (strcasecmp(Name,"iv")==0) || + (strcasecmp(Name,"InputVector")==0) + ) + { + *InputVector=CopyStr(*InputVector,Value); + *IVLen=StrLen(*InputVector); + } + + if (strcasecmp(Name,"HexKey")==0) + { + klen=HexStrToBytes(&TmpKey, Value); + } + + if ( + (strcasecmp(Name,"HexIV")==0) || + (strcasecmp(Name,"HexInputVector")==0) + ) + + { + *IVLen=HexStrToBytes(InputVector,Value); + } + + if (strcasecmp(Name,"PadBlock")==0) + { + if (strcasecmp(Value,"N")==0) *Flags |= DPM_NOPAD_DATA; + } + + } + +ptr=GetNameValuePair(ptr,"\\S","=",&Name,&Value); +} + + +Tempstr=SetStrLen(Tempstr,klen+slen); +memcpy(Tempstr,Salt,slen); +memcpy(Tempstr+slen,TmpKey,klen); + +*KeyLen=HashBytes(Key,"md5",Tempstr,slen+klen,0); + + +DestroyString(Name); +DestroyString(Value); +DestroyString(Tempstr); +DestroyString(TmpKey); +DestroyString(Salt); +} + + + +#ifdef HAVE_LIBCRYPTO + +typedef enum {CI_BLOWFISH, CI_RC2, CI_RC4, CI_RC5, CI_DES, CI_DESX, CI_CAST,CI_IDEA,CI_AES, CI_AES_256} LIBUSEFUL_CRYPT_CIPHERS; + +int libCryptoCipherAvailable(int CipherNum) +{ +switch(CipherNum) +{ + case CI_BLOWFISH: + #ifdef HAVE_EVP_BF_CBC + return(TRUE); + #endif + break; + + case CI_RC2: + #ifdef HAVE_EVP_RC2_CBC + return(TRUE); + #endif + break; + + case CI_RC4: + #ifdef HAVE_EVP_RC4_CBC + return(TRUE); + #endif + break; + + case CI_RC5: + #ifdef HAVE_EVP_RC5_CBC + return(TRUE); + #endif + break; + + case CI_DES: + #ifdef HAVE_EVP_DES_CBC + return(TRUE); + #endif + break; + + case CI_DESX: + #ifdef HAVE_EVP_DESX_CBC + return(TRUE); + #endif + break; + + case CI_CAST: + #ifdef HAVE_EVP_CAST5_CBC + return(TRUE); + #endif + break; + + case CI_IDEA: + #ifdef HAVE_EVP_IDEA_CBC + return(TRUE); + #endif + break; + + case CI_AES: + #ifdef HAVE_EVP_AES_129_CBC + return(TRUE); + #endif + break; + + case CI_AES_256: + #ifdef HAVE_EVP_AES_256_CBC + return(TRUE); + #endif + break; +} +return(FALSE); +} + + +int libCryptoProcessorInit(TProcessingModule *ProcMod, const char *Args) +{ +int result=FALSE; + +#ifdef HAVE_LIBSSL +libCryptoProcessorData *Data; +EVP_CIPHER_CTX *ctx; +char *CipherList[]={"blowfish","rc2","rc4","rc5","des","desx","cast","idea","aes","aes-256",NULL}; +int val; +char *Tempstr=NULL; + +val=MatchTokenFromList(ProcMod->Name,CipherList,0); +if (val==-1) return(FALSE); +if (! libCryptoCipherAvailable(val)) return(FALSE); +Data=(libCryptoProcessorData *) calloc(1,sizeof(libCryptoProcessorData)); + +//Tempstr here holds the cipher name +InitialiseEncryptionComponents(Args, &Tempstr, &Data->InputVector, &Data->InputVectorLen, & Data->Key, &Data->KeyLen,&ProcMod->Flags); + +if (StrLen(ProcMod->Name)==0) ProcMod->Name=CopyStr(ProcMod->Name,Tempstr); + +switch(val) +{ +/* + case CI_NONE: + Data->Cipher=EVP_enc_null(); + break; +*/ + + case CI_BLOWFISH: + #ifdef HAVE_EVP_BF_CBC + Data->Cipher=EVP_bf_cbc(); + #endif + break; + + case CI_RC2: + #ifdef HAVE_EVP_RC2_CBC + Data->Cipher=EVP_rc2_cbc(); + #endif + break; + + case CI_RC4: + #ifdef HAVE_EVP_RC4_CBC + Data->Cipher=EVP_rc4(); + #endif + break; + + case CI_RC5: + #ifdef HAVE_EVP_RC5_32_12_16_CBC + //Data->Cipher=EVP_rc5_32_12_16_cbc(); + #endif + break; + + case CI_DES: + #ifdef HAVE_EVP_DES_CBC + Data->Cipher=EVP_des_cbc(); + #endif + break; + + case CI_DESX: + #ifdef HAVE_EVP_DESX_CBC + Data->Cipher=EVP_desx_cbc(); + #endif + break; + + case CI_CAST: + #ifdef HAVE_EVP_CAST5_CBC + Data->Cipher=EVP_cast5_cbc(); + #endif + break; + + case CI_IDEA: + #ifdef HAVE_EVP_IDEA_CBC + Data->Cipher=EVP_idea_cbc(); + #endif + break; + + case CI_AES: + #ifdef HAVE_EVP_AES_128_CBC + Data->Cipher=EVP_aes_128_cbc(); + #endif + break; + + case CI_AES_256: + #ifdef HAVE_EVP_AES_256_CBC + Data->Cipher=EVP_aes_256_cbc(); + #endif + break; +} + + +if (Data->Cipher) +{ +Data->enc_ctx=(EVP_CIPHER_CTX *) calloc(1,sizeof(EVP_CIPHER_CTX)); +Data->dec_ctx=(EVP_CIPHER_CTX *) calloc(1,sizeof(EVP_CIPHER_CTX)); +EVP_CIPHER_CTX_init(Data->enc_ctx); +EVP_CIPHER_CTX_init(Data->dec_ctx); +Data->BlockSize=EVP_CIPHER_block_size(Data->Cipher); + +EVP_EncryptInit_ex(Data->enc_ctx,Data->Cipher,NULL,Data->Key,Data->InputVector); +EVP_DecryptInit_ex(Data->dec_ctx,Data->Cipher,NULL,Data->Key,Data->InputVector); + +if (ProcMod->Flags & DPM_NOPAD_DATA) EVP_CIPHER_CTX_set_padding(Data->enc_ctx,FALSE); + +ProcMod->Data=Data; +result=TRUE; + +DataProcessorSetValue(ProcMod,"Cipher",Tempstr); +Tempstr=FormatStr(Tempstr,"%d",Data->BlockSize); +DataProcessorSetValue(ProcMod,"BlockSize",Tempstr); +} + +DestroyString(Tempstr); +#endif +return(result); +} + + +int libCryptoProcessorClose(TProcessingModule *ProcMod) +{ +#ifdef HAVE_LIBSSL +libCryptoProcessorData *Data; +EVP_CIPHER_CTX *ctx; + +Data=(libCryptoProcessorData *) ProcMod->Data; +if (Data) +{ +EVP_CIPHER_CTX_cleanup(Data->enc_ctx); +EVP_CIPHER_CTX_cleanup(Data->dec_ctx); + +DestroyString(Data->Key); +DestroyString(Data->InputVector); +free(Data); +} +ProcMod->Data=NULL; +#endif +return(TRUE); +} + + + + + + + +int libCryptoProcessorWrite(TProcessingModule *ProcMod, const char *InData, int InLen, char **OutData, int *OutLen, int Flush) +{ +int wrote=0; + +#ifdef HAVE_LIBSSL +int len, result, val; +libCryptoProcessorData *Data; +EVP_CIPHER_CTX *ctx; +char *ptr, *Tempstr=NULL; + +/* +if (ProcMod->Flags & DPM_WRITE_FINAL) return(0); +ptr=OutData; + +Data=(libCryptoProcessorData *) ProcMod->Data; +ctx=Data->enc_ctx; + +ProcMod->Flags = ProcMod->Flags & ~DPM_WRITE_FINAL; +*/ + +/* +if (ProcMod->Flags & DPM_NOPAD_DATA) +{ + val=InLen % Data->BlockSize; + Tempstr=CopyStrLen(Tempstr,InData,InLen); + if (val !=0) + { + Tempstr=SetStrLen(Tempstr,InLen + (Data->BlockSize-val)); + memset(Tempstr+InLen,' ', (Data->BlockSize-val)); + val=InLen+(Data->BlockSize-val); + } + else val=InLen; + + result=EVP_EncryptUpdate(ctx, ptr, &len, Tempstr, val); +} +else +*/ +{ +//result=EVP_EncryptUpdate(ctx, ptr, &len, InData, InLen); +} + + +if (! result) wrote=0; +else wrote=len; + +DestroyString(Tempstr); +#endif +return(wrote); +} + + + +int libCryptoProcessorFlush(TProcessingModule *ProcMod, const char *InData, int InLen, char *OutData, int OutLen) +{ +int result=0, wrote=0, len; +libCryptoProcessorData *Data; + +/* +if (ProcMod->Flags & DPM_WRITE_FINAL) return(0); +Data=(libCryptoProcessorData *) ProcMod->Data; + +if (Data) +{ +if (InLen > 0) +{ +result=libCryptoProcessorWrite(ProcMod, InData, InLen, OutData, OutLen,TRUE); +if (result > 0) return(result); +} + +len=OutLen; +result=EVP_EncryptFinal_ex(Data->enc_ctx, OutData, &len); +ProcMod->Flags |= DPM_WRITE_FINAL; +} +if (! result) wrote=0; +else wrote=len; + +*/ + +return(wrote); +} + + +int libCryptoProcessorRead(TProcessingModule *ProcMod, const char *InData, int InLen, char **OutData, int *OutLen, int Flush) +{ +int bytes_read=0; +#ifdef HAVE_LIBSSL +int len, ivlen, result, val; +libCryptoProcessorData *Data; +EVP_CIPHER_CTX *ctx; +char *ptr; + +/* +ptr=OutData; + +Data=(libCryptoProcessorData *) ProcMod->Data; +if (!Data) return(0); +*/ + +/* +if (ProcMod->Flags & DPM_READ_FINAL) +{ + if (InLen==0) return(0); + EVP_DecryptInit_ex(Data->dec_ctx,Data->Cipher,NULL,Data->Key,Data->InputVector); + +} +*/ + +/* +ctx=Data->dec_ctx; + +if (InLen==0) +{ + len=0; + result=EVP_DecryptFinal_ex(ctx, ptr, &len); + ProcMod->Flags |= DPM_READ_FINAL; //this so we don't try + //another read + +} +else +{ + len=OutLen; + result=EVP_DecryptUpdate(ctx, ptr, &len, InData, InLen); +} + +if (! result) bytes_read=-1; +else bytes_read+=InLen; //should be 'len' but DecryptUpdate returns the + //number of bytes output, not the number consumed +*/ + +#endif +return(bytes_read); +} + +#endif + + + +#ifdef HAVE_LIBZ + +#include + +typedef struct +{ +z_stream z_in; +z_stream z_out; +} zlibData; +#endif + + +int zlibProcessorInit(TProcessingModule *ProcMod, const char *Args) +{ +int result=FALSE; + +#ifdef HAVE_LIBZ +zlibData *ZData; +int CompressionLevel=5; +char *ptr, *Name=NULL, *Value=NULL; + +ptr=GetNameValuePair(Args,"\\S","=",&Name,&Value); +while (ptr) +{ + if (strcasecmp(Name,"CompressionLevel")==0) CompressionLevel=atoi(Value); + if (strcasecmp(Name,"Level")==0) CompressionLevel=atoi(Value); +ptr=GetNameValuePair(ptr,"\\S","=",&Name,&Value); +} + + +ProcMod->ReadMax=4096; +ProcMod->WriteMax=4096; + + +ZData=(zlibData *) calloc(1,sizeof(zlibData)); +ZData->z_in.avail_in=0; +ZData->z_in.avail_out=0; +result=inflateInit(&ZData->z_in); + +ZData->z_out.avail_in=0; +ZData->z_out.avail_out=0; +deflateInit(&ZData->z_out,CompressionLevel); + + +ProcMod->Data=(void *) ZData; +result=TRUE; + +DestroyString(Name); +DestroyString(Value); + +#endif +return(result); +} + + +int gzipProcessorInit(TProcessingModule *ProcMod, const char *Args) +{ +int result=FALSE; + +#ifdef HAVE_LIBZ +zlibData *ZData; +int CompressionLevel=5; +char *ptr, *Name=NULL, *Value=NULL; + +ptr=GetNameValuePair(Args,"\\S","=",&Name,&Value); +while (ptr) +{ + if (strcasecmp(Name,"CompressionLevel")==0) CompressionLevel=atoi(Value); + if (strcasecmp(Name,"Level")==0) CompressionLevel=atoi(Value); +ptr=GetNameValuePair(ptr,"\\S","=",&Name,&Value); +} + +ProcMod->ReadMax=4096; +ProcMod->WriteMax=4096; + +ZData=(zlibData *) calloc(1,sizeof(zlibData)); +ZData->z_in.avail_in=0; +ZData->z_in.avail_out=0; +result=inflateInit2(&ZData->z_in,47); + +ZData->z_out.avail_in=0; +ZData->z_out.avail_out=0; +deflateInit2(&ZData->z_out,5,Z_DEFLATED,30,8,Z_DEFAULT_STRATEGY); + +ProcMod->Data=(void *) ZData; +result=TRUE; + +DestroyString(Name); +DestroyString(Value); + +#endif +return(result); +} + + +//Zlib is a little weird. It accepts a pointer to a buffer (next_in) and a buffer length (avail_in) to specify the input +//and another buffer (next_out) and length (avail_out) to write data into. When called it reads bytes from next_in, updates +//next_in to point to the end of what it read, and subtracts the number of bytes it read from avail_in so that avail_in +//now says how many UNUSED bytes there are pointed to by next_in. Similarly it writes to next_out, updating that pointer +//to point to the end of the write, and updating avail_out to say how much room is LEFT usused in the output buffer +// +//However, if zlib doesn't use all avail_in, then you can't mess with that buffer until it has. Hence you can't take the unusued +//data from next_in/avail_in and copy it to a new buffer and pass that buffer into deflate/inflate on the next call. If zlib +//doesn't use all the input the only way to handle it is to grow the output buffer and call inflate/deflate again, so that it +//can write into the expanded buffer until it's used up all input. +// +//Finally, when you've supplied all the input you've got, you have to call deflate with 'Z_FINISH' so that it knows there's no +//more data coming. + +int zlibProcessorWrite(TProcessingModule *ProcMod, const char *InData, int InLen, char **OutData, int *OutLen, int Flush) +{ +int wrote=0, val=0; +#ifdef HAVE_LIBZ +zlibData *ZData; + +if (ProcMod->Flags & DPM_WRITE_FINAL) return(EOF); +ZData=(zlibData *) ProcMod->Data; + + + ZData->z_out.avail_in=InLen; + ZData->z_out.next_in=InData; + ZData->z_out.avail_out=*OutLen; + ZData->z_out.next_out=*OutData; + + while ((ZData->z_out.avail_in > 0) || Flush) + { + if (Flush) val=deflate(& ZData->z_out, Z_FINISH); + else val=deflate(& ZData->z_out, Z_NO_FLUSH); + + wrote=*OutLen-ZData->z_out.avail_out; + if (val==Z_STREAM_END) + { + ProcMod->Flags |= DPM_WRITE_FINAL; + break; + } + + if ((ZData->z_out.avail_in > 0) || Flush) + { + printf("Grow output buff!\n"); + *OutLen+=BUFSIZ; + *OutData=(char *) realloc(*OutData,*OutLen); + ZData->z_out.avail_out+=BUFSIZ; + } + + } + + + +#endif +return(wrote); +} + + +int zlibProcessorRead(TProcessingModule *ProcMod, const char *InData, int InLen, char **OutData, int *OutLen, int Flush) +{ +int wrote=0, result=0; +#ifdef HAVE_LIBZ +zlibData *ZData; + +if (ProcMod->Flags & DPM_READ_FINAL) return(EOF); +ZData=(zlibData *) ProcMod->Data; + + + ZData->z_in.avail_in=InLen; + ZData->z_in.next_in=InData; + ZData->z_in.avail_out=*OutLen; + ZData->z_in.next_out=*OutData; + + while ((ZData->z_in.avail_in > 0) || Flush) + { + if (Flush) result=inflate(& ZData->z_in, Z_FINISH); + else result=inflate(& ZData->z_in, Z_NO_FLUSH); + + wrote=(*OutLen)-ZData->z_in.avail_out; + + + if (result==Z_DATA_ERROR) inflateSync(&ZData->z_in); + if (result==Z_STREAM_END) + { + ProcMod->Flags |= DPM_READ_FINAL; + break; + } + + if ((ZData->z_in.avail_in > 0) || Flush) + { + (*OutLen)+=BUFSIZ; + *OutData=(char *) realloc(*OutData,*OutLen); + ZData->z_in.next_out=(*OutData) + wrote; + ZData->z_in.avail_out=(*OutLen) - wrote; + } + + } + + + +#endif +return(wrote); +} + + +/* +int zlibProcessorRead(TProcessingModule *ProcMod, const char *InData, int InLen, char **OutData, int *OutLen, int Flush) +{ +int wrote=0, result; +#ifdef HAVE_LIBZ +zlibData *ZData; +int len; + +ZData=(zlibData *) ProcMod->Data; + +if (InLen > 0) +{ +DataProcessorUpdateBuffer(&ProcMod->ReadBuff, &ProcMod->ReadUsed, &ProcMod->ReadSize, InData, InLen); + +ZData->z_in.next_in=ProcMod->ReadBuff; +ZData->z_in.avail_in=ProcMod->ReadUsed; + +ZData->z_in.avail_out=*OutLen; +ZData->z_in.next_out=*OutData; + +if (InLen==0) result=inflate(& ZData->z_in, Z_FINISH); +else result=inflate(& ZData->z_in, Z_NO_FLUSH); + +if (ZData->z_in.avail_in > 0) memmove(ProcMod->ReadBuff,ZData->z_in.next_in,ZData->z_in.avail_in); +ProcMod->ReadUsed=ZData->z_in.avail_in; + +wrote=OutLen-ZData->z_in.avail_out; +} + +#endif +return(wrote); +} +*/ + + +int zlibProcessorClose(TProcessingModule *ProcMod) +{ +#ifdef HAVE_LIBZ +zlibData *ZData; + +ZData=(zlibData *) ProcMod->Data; +if (ZData) +{ +inflateEnd(&ZData->z_in); +deflateEnd(&ZData->z_out); + +free(ZData); +ProcMod->Data=NULL; +} +#endif +return(TRUE); +} + + + +TProcessingModule *StandardDataProcessorCreate(const char *Class, const char *Name, const char *iArgs) +{ +TProcessingModule *Mod=NULL; +char *Args=NULL; + + +Args=CopyStr(Args,iArgs); + +#ifdef HAVE_LIBSSL +#ifdef HAVE_LIBCRYPTO +if (strcasecmp(Class,"crypto")==0) +{ + Mod=(TProcessingModule *) calloc(1,sizeof(TProcessingModule)); + Mod->Args=CopyStr(Mod->Args,Args); + Mod->Name=CopyStr(Mod->Name,Name); + Mod->Init=libCryptoProcessorInit; + Mod->Write=libCryptoProcessorWrite; + Mod->Read=libCryptoProcessorRead; + Mod->Close=libCryptoProcessorClose; + + +} +#endif +#endif + + + +if (strcasecmp(Class,"compress")==0) +{ + Mod=(TProcessingModule *) calloc(1,sizeof(TProcessingModule)); + Mod->Args=CopyStr(Mod->Args,Args); + Mod->Name=CopyStr(Mod->Name,Name); + + if (strcasecmp(Name,"zlib")==0) + { + #ifdef HAVE_LIBZ + Mod->Init=zlibProcessorInit; + Mod->Write=zlibProcessorWrite; + Mod->Close=zlibProcessorClose; + #endif + } + else if (strcasecmp(Name,"gzip")==0) + { + #ifdef HAVE_LIBZ + Mod->Init=gzipProcessorInit; + Mod->Write=zlibProcessorWrite; + Mod->Close=zlibProcessorClose; + #endif + } + else if (strcasecmp(Name,"bzip2")==0) + { + Args=MCopyStr(Args,"Command='bzip2 --stdout -' ",iArgs,NULL); + Mod->Init=PipeCommandProcessorInit; + Mod->Write=PipeCommandProcessorWrite; + Mod->Close=PipeCommandProcessorClose; + } + else if (strcasecmp(Name,"xz")==0) + { + Args=MCopyStr(Args,"Command='xz --stdout -' ",iArgs,NULL); + Mod->Init=PipeCommandProcessorInit; + Mod->Write=PipeCommandProcessorWrite; + Mod->Close=PipeCommandProcessorClose; + } + +} + + +if (strcasecmp(Class,"uncompress")==0) +{ + Mod=(TProcessingModule *) calloc(1,sizeof(TProcessingModule)); + Mod->Args=CopyStr(Mod->Args,Args); + Mod->Name=CopyStr(Mod->Name,Name); + + if (strcasecmp(Name,"zlib")==0) + { + #ifdef HAVE_LIBZ + Mod->Init=zlibProcessorInit; + Mod->Read=zlibProcessorRead; + Mod->Close=zlibProcessorClose; + #endif + } + else if (strcasecmp(Name,"gzip")==0) + { + #ifdef HAVE_LIBZ + Mod->Init=gzipProcessorInit; + Mod->Read=zlibProcessorRead; + Mod->Close=zlibProcessorClose; + #endif + } + else if (strcasecmp(Name,"bzip2")==0) + { + Args=MCopyStr(Args,"Command='bzip2 -d --stdout -' ",iArgs,NULL); + Mod->Init=PipeCommandProcessorInit; + Mod->Read=PipeCommandProcessorWrite; + Mod->Close=PipeCommandProcessorClose; + } + else if (strcasecmp(Name,"xz")==0) + { + Args=MCopyStr(Args,"Command='xz -d --stdout -' ",iArgs,NULL); + Mod->Init=PipeCommandProcessorInit; + Mod->Read=PipeCommandProcessorWrite; + Mod->Close=PipeCommandProcessorClose; + } + +} + + + +if (Mod && Mod->Init && Mod->Init(Mod, Args)) return(Mod); + +DestroyString(Args); + +DataProcessorDestroy(Mod); +return(NULL); +} + + + + + +int STREAMAddDataProcessor(STREAM *S, TProcessingModule *Mod, const char *Args) +{ +ListNode *Curr; +char *Tempstr=NULL; +int len; + +STREAMFlush(S); + +if (! S->ProcessingModules) S->ProcessingModules=ListCreate(); +Tempstr=MCopyStr(Tempstr,Mod->Name,NULL); +ListAddNamedItem(S->ProcessingModules,Tempstr,Mod); + +len=S->InEnd - S->InStart; +Tempstr=SetStrLen(Tempstr,len); +memcpy(Tempstr,S->InputBuff + S->InStart,len); +STREAMResetInputBuffers(S); + +Curr=ListGetNext(Mod->Values); +while (Curr) +{ + STREAMSetValue(S,Curr->Tag,(char *) Curr->Item); + Curr=ListGetNext(Curr); +} + +STREAMReadThroughProcessors(S, Tempstr, len); + +DestroyString(Tempstr); +return(TRUE); +} + + +int STREAMDeleteDataProcessor(STREAM *S, char *Class, char *Name) +{ +ListNode *Curr; +char *Tempstr=NULL; +int len; + +STREAMFlush(S); + +Tempstr=MCopyStr(Tempstr,Class,":",Name,NULL); +Curr=ListFindNamedItem(S->ProcessingModules,Tempstr); +ListDeleteNode(Curr); + +DestroyString(Tempstr); +return(TRUE); +} + + + +int DataProcessorAvailable(const char *Class, const char *Name) +{ +int result=FALSE; +TProcessingModule *Mod; + +Mod=StandardDataProcessorCreate(Class,Name,""); +if (Mod) result=TRUE; + +DataProcessorDestroy(Mod); +return(result); +} + + +int STREAMAddStandardDataProcessor(STREAM *S, const char *Class, const char *Name, const char *Args) +{ +TProcessingModule *Mod=NULL; + +Mod=StandardDataProcessorCreate(Class,Name,Args); +if (Mod) +{ +STREAMAddDataProcessor(S, Mod, Args); +return(TRUE); +} + +return(FALSE); +} + + +void STREAMClearDataProcessors(STREAM *S) +{ +TProcessingModule *Mod; + +STREAMFlush(S); +STREAMResetInputBuffers(S); +ListDestroy(S->ProcessingModules, DataProcessorDestroy); +} + diff --git a/libUseful-2.0/DataProcessing.h b/libUseful-2.0/DataProcessing.h new file mode 100644 index 0000000..52ab130 --- /dev/null +++ b/libUseful-2.0/DataProcessing.h @@ -0,0 +1,64 @@ +#ifndef LIBUSEFUL_DATA_PROCESSING_H +#define LIBUSEFUL_DATA_PROCESSING_H + +#include "includes.h" + + + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct t_dpmod TProcessingModule; + +typedef int (*DATA_PROCESS_INIT_FUNC)(TProcessingModule *Mod, const char *Args); +typedef int (*DATA_PROCESS_RW_FUNC)(TProcessingModule *, const char *Data, int len, char **OutBuff, int *OutBuffLen, int Flush); +typedef int (*DATA_PROCESS_CLOSE_FUNC)(TProcessingModule *Mod); + +#define DPM_READ_FINAL 1 +#define DPM_WRITE_FINAL 2 +#define DPM_NOPAD_DATA 4 + +struct t_dpmod +{ +char *Name; +char *Args; +int Flags; +char *ReadBuff, *WriteBuff; +int ReadSize, WriteSize; +int ReadUsed, WriteUsed; +int ReadMax, WriteMax; +ListNode *Values; +DATA_PROCESS_INIT_FUNC Init; +DATA_PROCESS_RW_FUNC Read; +DATA_PROCESS_RW_FUNC Write; +DATA_PROCESS_CLOSE_FUNC Close; +void *Data; +}; + + +TProcessingModule *StandardDataProcessorCreate(const char *Class, const char *Name, const char *Arg); +int DataProcessorInit(TProcessingModule *ProcMod, const char *Key, const char *InputVector); +void DataProcessorDestroy(void *ProcMod); +char *DataProcessorGetValue(TProcessingModule *M, const char *Name); +void DataProcessorSetValue(TProcessingModule *M, const char *Name, const char *Value); + + +void InitialiseEncryptionComponents(const char *Args, char **CipherName, char **InputVector, int *InputVectorLen, char **Key, int *KeyLen, int *Flags); + + +int STREAMAddDataProcessor(STREAM *S, TProcessingModule *Mod, const char *Args); +int DataProcessorAvailable(const char *Class, const char *Name); +int STREAMAddStandardDataProcessor(STREAM *S, const char *Class, const char *Name, const char *Args); +void STREAMClearDataProcessors(STREAM *S); +int STREAMDeleteDataProcessor(STREAM *S, char *Class, char *Name); + + +#ifdef __cplusplus +} +#endif + + + +#endif diff --git a/libUseful-2.0/Docs/ConnectManager.txt b/libUseful-2.0/Docs/ConnectManager.txt new file mode 100644 index 0000000..02f574c --- /dev/null +++ b/libUseful-2.0/Docs/ConnectManager.txt @@ -0,0 +1,50 @@ +#ifndef LIBUSEFUL_CONNECT_MANAGER_H +#define LIBUSEFUL_CONNECT_MANAGER_H + +#include "file.h" +#include "includes.h" + +#define RECONNECT 2 + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct t_con_man_item TConnectManagerItem; + + +typedef int (*CONNECT_FUNC)(TConnectManagerItem *Item); +typedef int (*ONDATA_FUNC)(STREAM *S, char *Name); +typedef int (*ONTIMER_FUNC)(void *Data, char *Name); + + + +typedef struct t_con_man_item +{ +char *Name; +void *Data; +int TimerVal; +int LastTimerFire; +char *Host; +int Port; +CONNECT_FUNC OnConnect; +ONDATA_FUNC OnData; +}; + + +int ConnectManagerAddServer(int sock, char *Name, CONNECT_FUNC OnConnect, ONDATA_FUNC OnData); +STREAM *ConnectManagerAddClient(char *Host, int Port, int Flags, char *Name, CONNECT_FUNC OnConnect, ONDATA_FUNC OnData); +TConnectManagerItem *ConnectManagerAddIncoming(STREAM *S, char *Name, ONDATA_FUNC OnData); +int ConnectManagerAddTimer(int Secs, char *Name, ONTIMER_FUNC OnTime, void *Data); +int ConnectManagerCountNamedConnections(char *Name); +STREAM *ConnectManagerGetStreamByName(char *Name); +ListNode *ConnectManagerGetConnectionList(); +void ConnectManagerMainLoop(); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/Docs/DataProcessing.txt b/libUseful-2.0/Docs/DataProcessing.txt new file mode 100644 index 0000000..be9944b --- /dev/null +++ b/libUseful-2.0/Docs/DataProcessing.txt @@ -0,0 +1,64 @@ +#ifndef LIBUSEFUL_DATA_PROCESSING_H +#define LIBUSEFUL_DATA_PROCESSING_H + +#include "includes.h" + + + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct t_dpmod TProcessingModule; + +typedef int (*DATA_PROCESS_INIT_FUNC)(TProcessingModule *Mod, const char *Args); +typedef int (*DATA_PROCESS_WRITE_FUNC)(TProcessingModule *, const char *Data, int len, char *OutBuff, int OutBuffLen); +typedef int (*DATA_PROCESS_CLOSE_FUNC)(TProcessingModule *Mod); + +#define DPM_READ_FINAL 1 +#define DPM_WRITE_FINAL 2 +#define DPM_NOPAD_DATA 4 + +struct t_dpmod +{ +char *Name; +char *Args; +int Flags; +char *Buffer; +int BuffSize; +ListNode *Values; +DATA_PROCESS_INIT_FUNC Init; +DATA_PROCESS_WRITE_FUNC Read; +DATA_PROCESS_WRITE_FUNC Write; +DATA_PROCESS_WRITE_FUNC Flush; +DATA_PROCESS_CLOSE_FUNC Close; +void *Data; +}; + + +TProcessingModule *StandardDataProcessorCreate(const char *Class, const char *Name, const char *Arg); +int DataProcessorInit(TProcessingModule *ProcMod, const char *Key, const char *InputVector); +int DataProcessorWrite(TProcessingModule *ProcMod, const char *InData, int InLen, char *OutData, int OutLen); +void DataProcessorDestroy(void *ProcMod); +char *DataProcessorGetValue(TProcessingModule *M, const char *Name); +void DataProcessorSetValue(TProcessingModule *M, const char *Name, const char *Value); + + +void InitialiseEncryptionComponents(const char *Args, char **CipherName, char **InputVector, int *InputVectorLen, char **Key, int *KeyLen, int *Flags); + + +int STREAMAddDataProcessor(STREAM *S, TProcessingModule *Mod, const char *Args); +int DataProcessorAvailable(const char *Class, const char *Name); +int STREAMAddStandardDataProcessor(STREAM *S, const char *Class, const char *Name, const char *Args); +void STREAMClearDataProcessors(STREAM *S); +int STREAMDeleteDataProcessor(STREAM *S, char *Class, char *Name); + + +#ifdef __cplusplus +} +#endif + + + +#endif diff --git a/libUseful-2.0/Docs/EncryptedFiles.txt b/libUseful-2.0/Docs/EncryptedFiles.txt new file mode 100644 index 0000000..2a2b360 --- /dev/null +++ b/libUseful-2.0/Docs/EncryptedFiles.txt @@ -0,0 +1,33 @@ +#ifndef LIBUSEFUL_ENCRYPTEDFILES_H +#define LIBUSEFUL_ENCRYPTEDFILES_H + +#include "DataProcessing.h" +#include "file.h" + +#define FLAG_ENCRYPT 1 +#define FLAG_DECRYPT 2 +#define FLAG_HEXKEY 4 +#define FLAG_HEXIV 8 +#define FLAG_HEXSALT 16 +#define FLAG_VERBOSE 32 +#define FLAG_SPEED 64 +#define FLAG_NOPAD_DATA 128 + + + +#ifdef __cplusplus +extern "C" { +#endif + +char *FormatEncryptArgs(char *RetBuff,int Flags, const char *Cipher, const char *Key, const char *InitVector, const char *Salt ); +int AddEncryptionHeader(STREAM *S, int Flags, const char *Cipher, const char *Key, const char *InitVector, const char *Salt); +void HandleDecryptionHeader(STREAM *S, const char *Header, const char *Key); + + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/Docs/GeneralFunctions.txt b/libUseful-2.0/Docs/GeneralFunctions.txt new file mode 100644 index 0000000..4adbace --- /dev/null +++ b/libUseful-2.0/Docs/GeneralFunctions.txt @@ -0,0 +1,73 @@ +#ifndef LIBUSEFUL_GENERAL_H +#define LIBUSEFUL_GENERAL_H + +#include +#include "defines.h" + + + +#ifdef __cplusplus +extern "C" { +#endif + +void WritePidFile(char *ProgName); +int HexStrToBytes(char **Buffer, char *HexStr); +char *BytesToHexStr(char *Buffer, char *Bytes, int len); +int demonize(); + +void SwitchProgram(char *CommandLine); +int Spawn(char *CommandLine); +int SpawnWithIO(char *CommandLine, int StdIn, int StdOut, int StdErr); +int ForkWithIO(int StdIn, int StdOut, int StdErr); +int PipeSpawnFunction(int *infd, int *outfd, int *errfd, BASIC_FUNC Func, void *Data); +int PipeSpawn(int *infd, int *outfd, int *errfd, char *CommandLine); +int FileExists(char *); +int LogToFile(char *,char *,...); +int LogFileSetValues(char *FileName, int Flags, int MaxSize, int FlushInterval); +void LogFileFlushAll(int ForceFlush); +void ColLibDefaultSignalHandler(int sig); +void SetTimeout(int timeout); +int CreateLockFile(char *FilePath,int Timeout); +char *GetDateStr(char *Format, char *Timezone); +char *GetDateStrFromSecs(char *Format, time_t Secs, char *Timezone); +time_t DateStrToSecs(char *Format, char *Str); +double EvaluateMathStr(char *String); +int MakeDirPath(char *Path, int DirMask); + +int SwitchUser(char *User); +int SwitchGroup(char *Group); +char *GetCurrUserHomeDir(); +char *GetNameValuePair(const char *Input, const char *PairDelim, const char *NameValueDelim, char **Name, char **Value); + +void SetVar(ListNode *Vars, char *Name, char *Data); +char *GetVar(ListNode *Vars, char *Name); +void UnsetVar(ListNode *Vars,char *VarName); +void ClearVars(ListNode *Vars); +void CopyVars(ListNode *Dest,ListNode *Source); + +char *SubstituteVarsInString(char *Buffer, char *Fmt, ListNode *Vars, int Flags); +int ExtractVarsFromString(char *Data, char *FormatStr, ListNode *Vars); +char *GetRandomData(char *RetBuff, int len, char *AllowedChars); +char *GetRandomHexStr(char *RetBuff, int len); +char *GetRandomAlphabetStr(char *RetBuff, int len); + +void CloseOpenFiles(); +int ChangeFileExtension(char *FilePath, char *NewExt); + +int BASIC_FUNC_EXEC_COMMAND(void *Data); + +char *XMLGetTag(char *Input, char **TagType, char **TagData); +char *XMLDeQuote(char *RetStr, char *Data); + + +double ParseHumanReadableDataQty(char *Data, int Type); +char *GetHumanReadableDataQty(double Size, int Type); +char *FindFileInPath(char *InBuff, char *File, char *Path); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/Docs/Hash.txt b/libUseful-2.0/Docs/Hash.txt new file mode 100644 index 0000000..145a5d1 --- /dev/null +++ b/libUseful-2.0/Docs/Hash.txt @@ -0,0 +1,56 @@ +Hashing functions. Call 'HashInit' + +THash *HashInit(char *Type); + +passing in a type (either "sha1", "md5" or "crc32". This will return a THash structure (or NULL on error). The Hash structure contains too functions, 'Update' and 'Finish', of the forms: + +Hash->Update(THash *Hash, char *Data, int DataLen); +Hash->Finish(THash *Hash, int Encoding, char **RetStr); + +The 'Encoding' argument to 'Finish' can be either of the #defined values ENCODE_HEX or ENCODE_BASE64. + +Example: + +THash *Hash; +STREAM *S; +char *Tempstr=NULL; +int result; + +Hash=InitHash("md5"); +S=STREAMOpenFile("testfile",O_RDONLY); + +if (S) +{ + Tempstr=SetStrLen(Tempstr,4096); + result=STREAMReadBytes(S,Tempstr,4096); + while (Tempstr) + { + Hash->Update(Hash,Tempstr,result); + result=STREAMReadBytes(S,Tempstr,4096); + } + + Hash->Finish(Hash,ENCODE_HEX,&Tempstr); + printf("MD5 Digest of file is: %s\n",Tempstr); +STREAMClose(S); +} +else printf("Couldn't open file\n"); + + + +char *HashBytes(char *Return, char *Type, char *text, int len, int Encoding); + +A simpler interface to the hashing functions, for when you just want to hash a string of bytes. + +Example + +char *Str="I wonder what the sha1 hash of this sentence is?"; +char *Digest=NULL; + +Digest=HashBytes(Digest,"sha1",Str,StrLen,ENCODE_HEX); + +printf("hash is: %s\n",Digest); + + +char *EncodeBase64(char *Return, char *Text, int len); +char *DecodeBase64(char *Return, int *len, char *Text); + diff --git a/libUseful-2.0/Docs/Log.txt b/libUseful-2.0/Docs/Log.txt new file mode 100644 index 0000000..e187382 --- /dev/null +++ b/libUseful-2.0/Docs/Log.txt @@ -0,0 +1,23 @@ +#ifndef LIBUSEFUL_LOG_H +#define LIBUSEFUL_LOG_H + +#include "includes.h" +#include "defines.h" +#include "file.h" + +#define LOGFILE_FLUSH 1 +#define LOGFILE_SYSLOG 2 +#define LOGFILE_LOGPID 4 +#define LOGFILE_LOGUSER 8 + +extern char *G_LogFilePath; + +int LogFileSetValues(char *FileName, int Flags, int MaxSize, int FlushInterval); +int LogToSTREAM(STREAM *S, int Flags, char *Str); +void LogFileFlushAll(int Force); +int LogToFile(char *FileName,char *fmt, ...); +void LogFileClose(char *Path); +int LogFileAppendTempLog(char *LogPath, char *TmpLogPath); + + +#endif diff --git a/libUseful-2.0/Docs/directory b/libUseful-2.0/Docs/directory new file mode 100644 index 0000000..8355d29 --- /dev/null +++ b/libUseful-2.0/Docs/directory @@ -0,0 +1 @@ +cat: /home/metacosm89/fileferry-1.0/libUseful-2.0/Docs/directory: No such file or directory diff --git a/libUseful-2.0/Docs/expect.txt b/libUseful-2.0/Docs/expect.txt new file mode 100644 index 0000000..92e3d3a --- /dev/null +++ b/libUseful-2.0/Docs/expect.txt @@ -0,0 +1,43 @@ +Functions that implement an 'expect'-style interface, in which strings are read from a stream, and when certain strings are seen certain responses are sent. + + +int STREAMExpectAndReply(STREAM *S, char *Expect, char *Reply); + +Simple interface, wait to see the string 'Expect' on a stream, and send 'Reply' when you see it. + +Example: + +int STREAMExpectAndReply(S, "assword:", "MyP@55W0rd"); + +The STREAM can be anything that can be represented by a file descriptor. Thus it can be a pipe, socket, file, pseudo-tty. Streams can be made from file descriptors using 'STREAMFromFD(int fd)' or 'STREAMFromDualFD(int fd)' + +void DialogAdd(ListNode *Dialogs, char *Expect, char *Reply, int Flags); + +Add 'Dialogs' to a list. A dialog is an expected string, and a reply that's sent to it. The list is of the type described in 'lists.txt'. + +Example: + +DialogAdd(Diags,"assword:","MyP@55W0rd",0); + + + + + + +#define FLAG_FINAL_DIALOG 1 +#define FLAG_DIALOG_FAIL 2 + +typedef struct +{ +int Flags; +int Match; +char *Expect; +char *Reply; +} TDialog; + + + +int STREAMExpectSilence(STREAM *S, int wait); +int STREAMDialog(STREAM *S, ListNode *Dialogs); + + diff --git a/libUseful-2.0/Docs/file.txt b/libUseful-2.0/Docs/file.txt new file mode 100644 index 0000000..75f4ca7 --- /dev/null +++ b/libUseful-2.0/Docs/file.txt @@ -0,0 +1,113 @@ +#ifndef LIBUSEFUL_FILE_H +#define LIBUSEFUL_FILE_H + +#include +#include "list.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#define STREAM_CLOSED -1 +#define STREAM_NODATA -2 +#define STREAM_TIMEOUT -3 +#define STREAM_DATA_ERROR -4 + +#define FLUSH_FULL 0 +#define FLUSH_LINE 1 +#define SF_AUTH 2 +#define SF_SYMLINK_OK 4 +#define SF_CONNECTING 8 +#define SF_CONNECTED 16 +#define SF_HANDSHAKE_DONE 32 +#define SF_WRONLY 64 +#define SF_RDONLY 128 +#define SF_RDWR 256 +#define SF_SSL 512 +#define SF_DATA_ERROR 1024 +#define SF_WRITE_ERROR 2048 +#define SF_NONBLOCK 4096 + +#define STREAM_TYPE_FILE 0 +#define STREAM_TYPE_UNIX 1 +#define STREAM_TYPE_UNIX_DGRAM 2 +#define STREAM_TYPE_TCP 3 +#define STREAM_TYPE_UDP 4 +#define STREAM_TYPE_SSL 5 +#define STREAM_TYPE_HTTP 6 +#define STREAM_TYPE_CHUNKED_HTTP 7 + +#define O_LOCK O_NOCTTY + +#define COMMS_BY_PIPE 0 +#define COMMS_BY_PTY 1 + +typedef struct +{ +char *InputBuff; +char *OutputBuff; +int Timeout; +int in_fd, out_fd; +int Type; +int Flags; +unsigned int BuffSize; +unsigned int InStart, InEnd; +unsigned int OutStart, OutEnd; +unsigned int BytesRead; +unsigned int BytesWritten; +char *Path; +void *Extra; +ListNode *Values; +ListNode *ProcessingModules; +ListNode *Index; +} STREAM; + + +STREAM *STREAMCreate(); +STREAM *STREAMOpenFile(char *Path, int Mode); +STREAM *STREAMClose(STREAM *Stream); +void STREAMSetNonBlock(STREAM *S, int val); +int STREAMLock(STREAM *S, int val); +int STREAMFlush(STREAM *Stream); +void STREAMClear(STREAM *Stream); +int STREAMTell(STREAM *Stream); +int STREAMSeek(STREAM *Stream, off_t offset, int whence); +void STREAMResizeBuffer(STREAM *, int); +void STREAMSetTimeout(STREAM *, int); +void STREAMSetFlushType(STREAM *Stream, int Type, int val); +int STREAMReadChar(STREAM *); +int STREAMWriteChar(STREAM *, char); +char* STREAMReadLine(char *Buffer, STREAM *); +int ReadBytesToTerm(STREAM *S, char *Buffer, int BuffSize, char Term); +char* STREAMReadToTerminator(char *Buffer, STREAM *, char Term); +char* STREAMReadToMultiTerminator(char *Buffer, STREAM *, char *Terms); +int STREAMWriteString(char *Buffer, STREAM *); +int STREAMWriteLine(char *Buffer, STREAM *); +STREAM *STREAMFromFD(int fd); +STREAM *STREAMFromDualFD(int in_fd, int out_fd); +STREAM *STREAMSpawnCommand(char *Command, int type); + + int STREAMDisassociateFromFD(STREAM *Stream); + int STREAMPeekChar(STREAM *); + +int STREAMReadBytes(STREAM *, char *Buffer, int Bytes); +int STREAMWriteBytes(STREAM *, char *Buffer, int Bytes); +int FDCheckForBytes(int); +int STREAMCheckForBytes(STREAM *); +int STREAMCheckForWaitingChar(STREAM *S, char check_char); +int STREAMCountWaitingBytes(STREAM *); + + +int IndexedFileLoad(STREAM *S); +int IndexedFileFind(STREAM *S, char *Key); +int IndexedFileWrite(STREAM *S, char *Line); + + +#ifdef __cplusplus +} +#endif + + + +#endif diff --git a/libUseful-2.0/Docs/http.txt b/libUseful-2.0/Docs/http.txt new file mode 100644 index 0000000..589b663 --- /dev/null +++ b/libUseful-2.0/Docs/http.txt @@ -0,0 +1,98 @@ +#ifndef LIBUSEFUL_HTTP_H +#define LIBUSEFUL_HTTP_H + +#include "includes.h" +#include "defines.h" +#include "file.h" + +#define HTTP_AUTH_BASIC 1 +#define HTTP_AUTH_DIGEST 2 +#define HTTP_SENT_AUTH 4 +#define HTTP_PROXY_AUTH 8 + + +#define HTTP_OKAY 0 +#define HTTP_NOCONNECT 1 +#define HTTP_NOTFOUND 2 +#define HTTP_REDIRECT 3 +#define HTTP_ERROR 4 +#define HTTP_CIRCULAR_REDIRECTS 5 +#define HTTP_NOTMODIFIED 6 + +#define HTTP_VER1_0 1 +#define HTTP_DEBUG 2 +#define HTTP_CHUNKED 4 +#define HTTP_HEADERS_SENT 8 +#define HTTP_NOCOMPRESS 16 +#define HTTP_NOREDIRECT 32 +#define HTTP_KEEPALIVE 128 +#define HTTP_PROXY 512 +#define HTTP_SSL 1024 +#define HTTP_SSL_REWRITE 2048 +#define HTTP_GZIP 8192 +#define HTTP_DEFLATE 16384 + + +typedef struct +{ +int Flags; +char *AuthRealm; +char *AuthQOP; +char *AuthNonce; +char *AuthOpaque; +char *Logon; +char *Password; +} HTTPAuthStruct; + + +typedef struct +{ +char *Host; +int Port; +char *Method; +char *Doc; +char *Destination; +char *ResponseCode; +int Flags; +char *RedirectPath; +char *PreviousRedirect; +char *ContentType; +char *Timestamp; +int ContentLength; +int Depth; +char *PostData; +char *PostContentType; +int PostContentLength; +char *Proxy; +time_t IfModifiedSince; +ListNode *CustomSendHeaders; +HTTPAuthStruct *Authorization; +HTTPAuthStruct *ProxyAuthorization; +STREAM *S; +} HTTPInfoStruct; + + + +char *HTTPQuote(char *, char*); +char *HTTPQuoteChars(char *RetBuff, char *Str, char *CharList); +char *HTTPUnQuote(char *, char*); + + +void HTTPInfoDestroy(void *p_Info); +void HTTPInfoSetValues(HTTPInfoStruct *Info, char *Host, int Port, char *Logon, char *Password, char *Method, char *Doc, char *ContentType, int ContentLength); +HTTPInfoStruct *HTTPInfoCreate(char *Host, int Port, char *Logon, char *Password, char *Method, char *Doc, char *ContentType, int ContentLength); +STREAM *HTTPConnect(HTTPInfoStruct *Info); +STREAM *HTTPTransact(HTTPInfoStruct *Info); +HTTPInfoStruct *HTTPInfoFromURL(char *Method, char *URL); +STREAM *HTTPMethod(char *Method, char *URL, char *Logon, char *Password); +STREAM *HTTPGet(char *URL, char *Logon, char *Password); +STREAM *HTTPPost(char *URL, char *Logon, char *Password, char *ContentType, char *Content); +int HTTPReadBytes(STREAM *Con, char **Buffer); +void HTTPCopyToSTREAM(STREAM *Con, STREAM *S); +int HTTPDownload(char *URL, char *Login, char *Password, STREAM *S); +void HTTPSetUserAgent(char *AgentName); +void HTTPSetProxy(char *Proxy); +void HTTPSetFlags(int Flags); +char *HTTPParseURL(char *URL, char **Proto, char **Host, int *Port, char **Login, char **Password); + +#endif diff --git a/libUseful-2.0/Docs/includes.txt b/libUseful-2.0/Docs/includes.txt new file mode 100644 index 0000000..477e25e --- /dev/null +++ b/libUseful-2.0/Docs/includes.txt @@ -0,0 +1,29 @@ +#ifndef LIBUSEFUL_INCLUDES_H +#define LIBUSEFUL_INCLUDES_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "defines.h" +#include "string.h" +#include "list.h" +#include "GeneralFunctions.h" +#include "file.h" +#include "socket.h" + + +#endif diff --git a/libUseful-2.0/Docs/inet.txt b/libUseful-2.0/Docs/inet.txt new file mode 100644 index 0000000..4921236 --- /dev/null +++ b/libUseful-2.0/Docs/inet.txt @@ -0,0 +1,29 @@ +inet.h contains functions that relates to utility services offered by sites on the web. + +At the moment this is just IP Geolocation and discovery of your External (out on the internet) IP address + + +char *GetExternalIP(char *RetStr); + +Pass a char * string into this function, and the function will print your external IP address into it, if it can determine it, and return the string (or null if IP cannot be determined). + +Look in the documentation for string.h (string.txt) to understand libUseful strings + + + +int IPGeoLocate(char *IP, ListNode *Vars); + +Pass in an quad-format IP address or a hostname, and this function will do geolocation and return the information as a list that holds strings. Look into list.txt to understand libUseful lists. + + + + +char *ExtractFromWebpage(char *RetStr, char *URL, char *ExtractStr, int MinLength); + +This is a function for screen-scraping data items from webpages. + +example: + + RetStr=ExtractFromWebpage(RetStr,"http://checkip.dyndns.org", "Current IP Address: $(extract_item)",4); + +pass in a blank string as the first argument, and the function will print it's results into it and return it. The second argument is the URL of the web-page to get. The third argument is a string to search for, and clip out that part of the string that is here represented by '$(extract_item)'. diff --git a/libUseful-2.0/Docs/list.txt b/libUseful-2.0/Docs/list.txt new file mode 100644 index 0000000..0663ab6 --- /dev/null +++ b/libUseful-2.0/Docs/list.txt @@ -0,0 +1,58 @@ +#ifndef LIB_USEFUL_LIST +#define LIB_USEFUL_LIST + + +#ifdef __cplusplus +extern "C" { +#endif + +#define LIST_FLAG_DELETE 1 + +typedef struct lnode +{ +int ItemType; +int Flags; +char *Tag; +void *Item; +struct lnode *Head; +struct lnode *Jump; +struct lnode *Prev; +struct lnode *Next; +} ListNode; + +typedef void (*LIST_ITEM_DESTROY_FUNC)(void *); +typedef void *(*LIST_ITEM_CLONE_FUNC)(void *); + +ListNode *ListCreate(); +void *IndexArrayOnList(ListNode *); +void *AddItemToArray(void *Array,int size, void *Item); +void *DeleteItemFromArray(void *Array,int size, int ItemNo); +void ListDestroy(ListNode *, LIST_ITEM_DESTROY_FUNC); +void ListClear(ListNode *, LIST_ITEM_DESTROY_FUNC); +ListNode *ListAddItemt(ListNode *,void *); +ListNode *ListAddNamedItem(ListNode *, const char *Name, void *); +ListNode *ListInsertItem(ListNode *,void *); +ListNode *ListInsertNamedItem(ListNode *,const char *,void *); +ListNode *OrderedListAddNamedItem(ListNode *Head, const char *Name, void *Item); +ListNode *SortedListInsertItem(ListNode *, void *, int (*LessThanFunc)(void *, void *, void *)); +ListNode *ListAddNamedItemAfter(ListNode *ListStart,const char *Name,void *Item); +void *ListDeleteNode(ListNode *); +ListNode *ListGetNext(ListNode *); +ListNode *ListGetPrev(ListNode *); +ListNode *ListGetHead(ListNode *); +ListNode *ListGetLast(ListNode *); +ListNode *ListGetNth(ListNode *Head, int n); +ListNode *ListFindNamedItem(ListNode *Head, const char *Name); +ListNode *ListFindItem(ListNode *Head, void *Item); +ListNode *ListJoin(ListNode *, ListNode *); +ListNode *ListClone(ListNode *, LIST_ITEM_CLONE_FUNC); +void ListSort(ListNode *, void *Data, int (*LessThanFunc)(void *, void *, void *)); +void ListSwapItems(ListNode *, ListNode *); +int ListSize(ListNode *); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/Docs/pty.txt b/libUseful-2.0/Docs/pty.txt new file mode 100644 index 0000000..b57e21b --- /dev/null +++ b/libUseful-2.0/Docs/pty.txt @@ -0,0 +1,48 @@ +Functions for tty lines and pty pseudo-terminals. + + +int OpenTTY(char *devname, int LineSpeed, int Flags); + +Opens a serial device. 'devname' is the path (like /dev/ttyS0) and LineSpeed is the baudrate. Flags can be: + +TTYFLAG_ECHO Turn on character echo. +TTYFLAG_CRLF Lines end with /r/n +TTYFLAG_LFCR Lines end with /n/r +TTYFLAG_NONBLOCK Nonblocking reads +TTYFLAG_CANON Canonical mode tty +TTYFLAG_HARDWARE_FLOW Hardwre flow control +TTYFLAG_SOFTWARE_FLOW Software flow control +TTYFLAG_CRLF_KEEP Don't set CRLF or LFCR, just stick with current setting + + +void HangUpLine(int tty); + +Hang up a tty previously opened with 'OpenTTY' + + +InitTTY(int tty, int LineSpeed, int Flags); + +Like 'OpenTTY', but tty device has already been opened with 'open' + + + +void ResetTTY(int tty); + +Reset tty + + + +int GrabPseudoTTY(int *pty, int *tty); + +Open a pseudo tty. The master end is returned as pty, the slave is returned as tty. + + + +int PseudoTTYSpawnFunction(int *pty, BASIC_FUNC Func, void *Data); + + +Fork a process running a function that will talk back to the main program via Pseudo tty (pty). The funtion's end of the pipe will appear as its stdin and stdout. + +int PseudoTTYSpawn(int *pty, const char *Command); + +Launch a Command that will think it's talking to a serial line on stdin/stdout, but is actually talking via Pseudo tty (pty) to the main program. diff --git a/libUseful-2.0/Docs/socket.txt b/libUseful-2.0/Docs/socket.txt new file mode 100644 index 0000000..8205a16 --- /dev/null +++ b/libUseful-2.0/Docs/socket.txt @@ -0,0 +1,91 @@ +#ifndef LIBUSEFUL_SOCK +#define LIBUSEFUL_SOCK + +#include +#include "file.h" + +#define CONNECT_NONBLOCK 1 +#define CONNECT_SSL 2 +#define CONNECT_HTTP_PROXY 4 +#define CONNECT_SOCKS_PROXY 8 + +#define CONNECT_HOP_TCP 1 +#define CONNECT_HOP_HTTP_PROXY 2 +#define CONNECT_HOP_SSH 3 +#define CONNECT_HOP_SHELL_CMD 4 +#define CONNECT_HOP_TELNET 5 + +#define SOCK_CONNECTED 1 +#define SOCK_CONNECTING -1 + +#ifdef __cplusplus +extern "C" { +#endif + + + +/* Server Socket Funcs*/ +int InitServerSock(char *Address, int Port); +int InitUnixServerSock(char *Path); +int TCPServerSockAccept(int ServerSock,int *Addr); +int UnixServerSockAccept(int ServerSock); + +int GetSockDetails(int fd, char **LocalAddress, int *LocalPort, char **RemoteAddress, int *RemotePort); + +/* Client Socket Funcs*/ +int IsSockConnected(int sock); +int ReconnectSock(int sock, char *Host, int Port, int Flags); +int ConnectToHost(char *Host, int Port, int Flags); +/* int CheckForData(int sock); */ +int SendText(int sock, char *Text); +int ReadText(int sock, char *Buffer, int MaxLen); +int ReadToCR(int fd, char *Buffer, int MaxLen); + + +STREAM *STREAMOpenUDP(int Port,int NonBlock); +int STREAMSendDgram(STREAM *S, char *Host, int Port, char *Bytes, int len); +int STREAMConnectToHost(STREAM *S, char *Host, int Port, int Flags); +int STREAMIsConnected(STREAM *S); +int DoPostConnect(STREAM *S, int Flags); +int DoSSLClientNegotiation(STREAM *S, int Flags); +int DoSSLServerNegotiation(STREAM *S, int Flags); +void STREAMSetValue(STREAM *S, char *Name, char *Value); +char *STREAMGetValue(STREAM *S, char *Name); +const char *STREAMQuerySSLCipher(STREAM *S); +int STREAMIsPeerAuth(STREAM *S); + +/* Stuff relating to standard inet download procedure (until \r\n.\r\n) */ +typedef struct +{ +STREAM *Input; +STREAM *Output; +char *TermStr; +int TermPos; +} DownloadContext; + +int ProcessIncommingBytes(DownloadContext *); +//int DownloadToDot(int sock, FILE *SaveFile); +int DownloadToDot(STREAM *Connection, STREAM *SaveFile); +int DownloadToTermStr(STREAM *Connection, STREAM *SaveFile, char *TermStr); +void ParseConnectDetails(char *Str, char **Type, char **Host, int *Port, char **User, char **Pass, char **InitDir); + + +/* IP Address and host lookup functions */ +char *LookupHostIP(char *Host); +char *GetRemoteIP(int sock); +char *IPStrToHostName(char *); +char *IPtoStr(unsigned long); +unsigned long StrtoIP(char *); +int IsIPAddress(char *); + + +int STREAMAddConnectionHop(STREAM *S, char *Value); +void STREAMAddConnectionHopList(STREAM *S, char *HopList); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/Docs/sound.txt b/libUseful-2.0/Docs/sound.txt new file mode 100644 index 0000000..d9470a3 --- /dev/null +++ b/libUseful-2.0/Docs/sound.txt @@ -0,0 +1,55 @@ +A few simple functions for playing and recording sound. Depending on how libUseful was compiled these will either work via Esound (esd) or Open Sound System. + +For systems with ALSA, playback, record and volume control can be enabled by loading the kernel modules snd-mixer-oss and snd-pcm-oss. These will create a 'fake' oss style device (/dev/dsp) which allows oss-style programs to talk to ALSA. + +int SoundPlayFile(char *Path, int Vol, int Flags); + +A very simple function to play .au or .wav files. + +'Path' is the path to the file. + +'Vol' is a value between 0 and 255. The #defined value 'VOLUME_LEAVEALONE' can be passed as 'Vol', this means don't alter the volume when playing the file. + +'Flags' currently only accepts the #defined value 'PLAYSOUND_NONBLOCK', which will cause a background process to be forked off so that the program isn't delayed while the sound plays. + + + +TAudioInfo *SoundReadAU(STREAM *S); +TAudioInfo *SoundReadWAV(STREAM *S); + +These functions read header info from .wav or .au files. The information is returned in a TAudioInfo structure: + + +typedef struct +{ +unsigned int Format; +unsigned int Channels; +unsigned int SampleRate; +unsigned int SampleSize; +unsigned int DataSize; +}TAudioInfo; + +The file is passed in as a STREAM. Look in file.txt for documentation on the STREAM class. + + + +int SoundOpenOutput(char *Dev, TAudioInfo *Info); + +This function opens an output device, with channels, audioformat, samplerate, etc, etc set using the TAudioInfo struct described above. + +If 'Dev' is set to 'esd:" followed by a hostname, e.g. "esd:localhost", "esd:192.168.1.5", then the ESPEAKER environment variable will be set to the hostname, and sound will be send to that host. If the 'Dev' argument is of non-zero length, but does not start with 'esd', then it will be taken to be an OSS device path. + +If 'Dev' is of zero length, then localhost esound will be tried first, falling back to OSS on /dev/dsp. + + +int SoundOpenInput(char *Dev, TAudioInfo *Info); + +As 'SoundOpenOutput', but for reading/recording sound. + + + +int SoundAlterVolume(char *Dev, char *Channel, int delta); + +Change the volume on the OSS sound device at 'Dev' (usually /dev/mixer). 'Channel' is the sound channel, one of: "master", "pcm", "cd", "mic", "line", "video", "phonein", "phoneout" or "all". + +'Delta' is the amount to increase by, +- in the range 0-255. diff --git a/libUseful-2.0/Docs/string.txt b/libUseful-2.0/Docs/string.txt new file mode 100644 index 0000000..162ccae --- /dev/null +++ b/libUseful-2.0/Docs/string.txt @@ -0,0 +1,59 @@ +#ifndef LIBUSEFUL_STRING +#define LIBUSEFUL_STRING + +#include +#include //for strlen, used below in StrLen + +#define GETTOKEN_QUOTES 1 +#define GETTOKEN_MULTI_SEPARATORS 2 + +#define MATCH_TOKEN_PART 1 +#define MATCH_TOKEN_CASE 2 + +#ifdef __cplusplus +extern "C" { +#endif + +//A few very simple and frequently used functions can be reduced +//down to macros using weird stuff like the ternary condition +//operator '?' and the dreaded comma operator ',' +#define StrLen(str) ( str ? strlen(str) : 0 ) + +//int StrLen(char *Str); +char *DestroyString(char *); +int CompareStr(const char *S1, const char *S2); +char *CopyStrLen(char *,const char *,int); +char *CopyStr(char *, const char *); +char *MCatStr(char *, const char *, ...); +char *MCopyStr(char *, const char *, ...); +char *CatStr(char *, const char *); +char *CatStrLen(char *,const char *,int); +char *VFormatStr(char *,const char *,va_list); +char *FormatStr(char *,const char *,...); +char *AddCharToStr(char *,char); +inline char *AddCharToBuffer(char *Buffer, int BuffLen, char Char); +inline char *AddBytesToBuffer(char *Buffer, int BuffLen, char *Bytes, int Len); +char *SetStrLen(char *,int); +char *strlwr(char *); +char *strrep(char *,char, char); +char *CloneString(const char *); +void StripTrailingWhitespace(char *); +void StripLeadingWhitespace(char *); +void StripCRLF(char *); +void StripQuotes(char *); +char *QuoteCharsInStr(char *Buffer, const char *String,const char *QuoteChars); +char *DeQuoteStr(char *Buffer, const char *Line); +char *EnquoteStr(char *Out, const char *In); +int MatchTokenFromList(const char *Token,char **List, int Flags); +int MatchLineStartFromList(const char *Token,char **List); +char *GetToken(const char *SearchStr, const char *Delim, char **Token, int Flags); + +#ifdef __cplusplus +} +#endif + + + + +#endif + diff --git a/libUseful-2.0/Docs/unix_socket.txt b/libUseful-2.0/Docs/unix_socket.txt new file mode 100644 index 0000000..aabed9a --- /dev/null +++ b/libUseful-2.0/Docs/unix_socket.txt @@ -0,0 +1,11 @@ +#ifndef LIBUSEFUL_UNIXSOCK_H +#define LIBUSEFUL_UNIXSOCK_H + +#include "file.h" +#include "defines.h" + +int InitUnixServerSocket(const char *Path, int SockType); +int OpenUnixSocket(const char *Path, int SockType); +int STREAMConnectUnixSocket(STREAM *S, const char *Path, int SockType); + +#endif diff --git a/libUseful-2.0/EncryptedFiles.c b/libUseful-2.0/EncryptedFiles.c new file mode 100644 index 0000000..b83db13 --- /dev/null +++ b/libUseful-2.0/EncryptedFiles.c @@ -0,0 +1,76 @@ +#include "EncryptedFiles.h" + +char *FormatEncryptArgs(char *RetBuff, int Flags, const char *Cipher, const char *Key, const char *InitVector, const char *Salt ) +{ +char *EncryptArgs=NULL, *Tempstr=NULL; + +EncryptArgs=CopyStr(RetBuff,""); + +EncryptArgs=CopyStr(EncryptArgs,"Cipher="); +EncryptArgs=CatStr(EncryptArgs,Cipher); + + +if (StrLen(Key)) +{ +if (Flags & FLAG_HEXKEY) Tempstr=FormatStr(Tempstr," hexkey='%s'",Key); +else Tempstr=FormatStr(Tempstr," key='%s'",Key); +EncryptArgs=CatStr(EncryptArgs,Tempstr); +} + +if (StrLen(InitVector)) +{ +if (Flags & FLAG_HEXIV) Tempstr=FormatStr(Tempstr," hexiv='%s'",InitVector); +else Tempstr=FormatStr(Tempstr," iv='%s'",InitVector); +EncryptArgs=CatStr(EncryptArgs,Tempstr); +} + +if (StrLen(Salt)) +{ +if (Flags & FLAG_HEXSALT) Tempstr=FormatStr(Tempstr," hexsalt='%s'",Salt); +else Tempstr=FormatStr(Tempstr," salt='%s'",Salt); +EncryptArgs=CatStr(EncryptArgs,Tempstr); +} + + +if (Flags & FLAG_NOPAD_DATA) EncryptArgs=CatStr(EncryptArgs," PadBlock=N"); + +return(EncryptArgs); +} + + + +int AddEncryptionHeader(STREAM *S, int Flags, const char *Cipher, const char *Key, const char *InitVector, const char *Salt) +{ +char *EncryptArgs=NULL; +char *Tempstr=NULL; + + + +EncryptArgs=FormatEncryptArgs(EncryptArgs,Flags, Cipher, "", InitVector,Salt); +Tempstr=FormatStr(Tempstr,"ENCR %s\n",EncryptArgs); +STREAMWriteLine(Tempstr,S); + +EncryptArgs=FormatEncryptArgs(EncryptArgs,Flags, Cipher, Key, InitVector,Salt); +if (! STREAMAddStandardDataProcessor(S,"Crypto",Cipher,EncryptArgs)) printf("Failed to initialise encryption!\n"); + +DestroyString(Tempstr); +DestroyString(EncryptArgs); +} + + + +void HandleDecryptionHeader(STREAM *S, const char *Header, const char *Key) +{ +const char *ptr; +char *Tempstr=NULL; + +ptr=Header; +if (strncmp(ptr,"ENCR ",5)==0) ptr+=5; +Tempstr=MCopyStr(Tempstr,ptr," key='",Key,"'",NULL); + +fprintf(stderr,"SASDP: [%s]\n",Tempstr); +STREAMAddStandardDataProcessor(S,"crypto","",Tempstr); +DestroyString(Tempstr); +} + + diff --git a/libUseful-2.0/EncryptedFiles.h b/libUseful-2.0/EncryptedFiles.h new file mode 100644 index 0000000..2a2b360 --- /dev/null +++ b/libUseful-2.0/EncryptedFiles.h @@ -0,0 +1,33 @@ +#ifndef LIBUSEFUL_ENCRYPTEDFILES_H +#define LIBUSEFUL_ENCRYPTEDFILES_H + +#include "DataProcessing.h" +#include "file.h" + +#define FLAG_ENCRYPT 1 +#define FLAG_DECRYPT 2 +#define FLAG_HEXKEY 4 +#define FLAG_HEXIV 8 +#define FLAG_HEXSALT 16 +#define FLAG_VERBOSE 32 +#define FLAG_SPEED 64 +#define FLAG_NOPAD_DATA 128 + + + +#ifdef __cplusplus +extern "C" { +#endif + +char *FormatEncryptArgs(char *RetBuff,int Flags, const char *Cipher, const char *Key, const char *InitVector, const char *Salt ); +int AddEncryptionHeader(STREAM *S, int Flags, const char *Cipher, const char *Key, const char *InitVector, const char *Salt); +void HandleDecryptionHeader(STREAM *S, const char *Header, const char *Key); + + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/FileSystem.c b/libUseful-2.0/FileSystem.c new file mode 100644 index 0000000..7e563f7 --- /dev/null +++ b/libUseful-2.0/FileSystem.c @@ -0,0 +1,173 @@ +#include "FileSystem.h" +#include + +char *GetBasename(char *Path) +{ +char *ptr; +int len; + +len=StrLen(Path); +if (len==0) return(""); +if (len==1) return(Path); + +ptr=Path+len-1; +while (ptr > Path) +{ + if ((*ptr=='/') && (*(ptr+1) != '\0')) break; + ptr--; +} + +if ((*ptr=='/') && (*(ptr+1) != '\0')) ptr++; + +return(ptr); +} + + +char *SlashTerminateDirectoryPath(char *DirPath) +{ +char *ptr, *RetStr=NULL; + +if (! DirPath) return(CopyStr(DirPath,"/")); +RetStr=DirPath; +ptr=RetStr+StrLen(RetStr)-1; +if (*ptr != '/') RetStr=AddCharToStr(RetStr,'/'); + +return(RetStr); +} + + +char *StripDirectorySlash(char *DirPath) +{ +char *ptr; + +//don't strip '/' (root dir) +if (StrLen(DirPath)==1) return(DirPath); +ptr=DirPath+StrLen(DirPath)-1; + +if (*ptr == '/') *ptr='\0'; + +return(DirPath); +} + + +int MakeDirPath(char *Path, int DirMask) +{ + char *ptr; + char *Tempstr=NULL; + int result; + + ptr=Path; + if (*ptr=='/') ptr++; + ptr=strchr(ptr, '/'); + while (ptr) + { + Tempstr=CopyStrLen(Tempstr,Path,ptr-Path); + result=mkdir(Tempstr, DirMask); + if ((result==-1) && (errno != EEXIST)) break; + ptr=strchr(++ptr, '/'); + } + DestroyString(Tempstr); + if (result==0) return(TRUE); + return(FALSE); +} + + + +int ChangeFileExtension(char *FilePath, char *NewExt) +{ +char *ptr; +char *Tempstr=NULL; +int result; + +Tempstr=CopyStr(Tempstr,FilePath); +ptr=strrchr(Tempstr,'/'); +if (!ptr) ptr=Tempstr; +ptr=strrchr(ptr,'.'); +if (! ptr) ptr=Tempstr+StrLen(Tempstr); +*ptr='\0'; + +if (*NewExt=='.') Tempstr=CatStr(Tempstr,NewExt); +else Tempstr=MCatStr(Tempstr,".",NewExt,NULL); +result=rename(FilePath,Tempstr); + +DestroyString(Tempstr); +if (result==0) return(TRUE); +else return(FALSE); +} + + +int FindFilesInPath(char *File, char *Path, ListNode *Files) +{ +char *Tempstr=NULL, *CurrPath=NULL, *RetStr=NULL, *ptr; +int i; +glob_t Glob; + +if (*File=='/') +{ + CurrPath=CopyStr(CurrPath,""); + ptr=""; //so we execute once below +} +else ptr=GetToken(Path,":",&CurrPath,0); +while (ptr) +{ +CurrPath=SlashTerminateDirectoryPath(CurrPath); +Tempstr=MCopyStr(Tempstr,CurrPath,File,NULL); + +glob(Tempstr,0,0,&Glob); +for (i=0; i < Glob.gl_pathc; i++) ListAddItem(Files,CopyStr(NULL,Glob.gl_pathv[i])); +globfree(&Glob); + +ptr=GetToken(ptr,":",&CurrPath,0); +} + +DestroyString(Tempstr); +DestroyString(CurrPath); + +return(ListSize(Files)); +} + + + +char *FindFileInPath(char *InBuff, char *File, char *Path) +{ +char *Tempstr=NULL, *CurrPath=NULL, *RetStr=NULL, *ptr; + +RetStr=CopyStr(InBuff,""); + +if (*File=='/') +{ + CurrPath=CopyStr(CurrPath,""); + ptr=""; //so we execute once below +} +else ptr=GetToken(Path,":",&CurrPath,0); + +while (ptr) +{ +CurrPath=SlashTerminateDirectoryPath(CurrPath); +Tempstr=MCopyStr(Tempstr,CurrPath,File,NULL); +if (access(Tempstr,F_OK)==0) +{ +RetStr=CopyStr(RetStr,Tempstr); +break; +} + +ptr=GetToken(ptr,":",&CurrPath,0); +} + +DestroyString(Tempstr); +DestroyString(CurrPath); + +return(RetStr); +} + + +/* This checks if a certain file exists (not if we can open it etc, just if */ +/* we can stat it, this is useful for checking pid files etc). */ +int FileExists(char *FileName) +{ +struct stat StatData; + +if (stat(FileName,&StatData) == 0) return(1); +else return(0); +} + diff --git a/libUseful-2.0/FileSystem.h b/libUseful-2.0/FileSystem.h new file mode 100644 index 0000000..6f3deda --- /dev/null +++ b/libUseful-2.0/FileSystem.h @@ -0,0 +1,26 @@ +#ifndef LIBUSEFUL_FILEPATH_H +#define LIBUSEFUL_FILEPATH_H + +#include "includes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +char *GetBasename(char *Path); +char *SlashTerminateDirectoryPath(char *DirPath); +char *StripDirectorySlash(char *DirPath); +int FileExists(char *); +int MakeDirPath(char *Path, int DirMask); +int FindFilesInPath(char *File, char *Path, ListNode *Files); +char *FindFileInPath(char *InBuff, char *File, char *Path); +int ChangeFileExtension(char *FilePath, char *NewExt); +int FindFilesInPath(char *File, char *Path, ListNode *Files); + +#ifdef __cplusplus +} +#endif + + + +#endif diff --git a/libUseful-2.0/GeneralFunctions.c b/libUseful-2.0/GeneralFunctions.c new file mode 100644 index 0000000..22f75b5 --- /dev/null +++ b/libUseful-2.0/GeneralFunctions.c @@ -0,0 +1,339 @@ +#include "includes.h" +#include "base64.h" + +int WritePidFile(char *ProgName) +{ +char *Tempstr=NULL; +STREAM *S; +int result=FALSE; + + +if (*ProgName=='/') Tempstr=CopyStr(Tempstr,ProgName); +else Tempstr=FormatStr(Tempstr,"/var/run/%s.pid",ProgName); + +S=STREAMOpenFile(Tempstr,O_CREAT | O_WRONLY); +if (S) +{ + fchmod(S->in_fd,0644); + if (flock(S->in_fd,LOCK_EX|LOCK_NB) !=0) + { + STREAMClose(S); + exit(1); + } + result=TRUE; + Tempstr=FormatStr(Tempstr,"%d\n",getpid()); + STREAMWriteLine(Tempstr,S); + STREAMFlush(S); +} + +//Don't close 'S'! + +DestroyString(Tempstr); + +return(result); +} + + +void CloseOpenFiles() +{ + int i; + + for (i=3; i < 1024; i++) close(i); +} + + +char *BytesToHexStr(char *Buffer, char *Bytes, int len) +{ +int i; +char *Str=NULL, *ptr; + + +Str=SetStrLen(Buffer,(len *2) +1); +ptr=Str; +for (i=0; i < len; i++) +{ + snprintf(ptr,2,"%02x",Bytes[i]); + ptr+=2; +} +*ptr='\0'; + +return(Str); +} + + +int HexStrToBytes(char **Buffer, char *HexStr) +{ +int i, len; +char *Str=NULL, *ptr; + +len=StrLen(HexStr); +*Buffer=SetStrLen(*Buffer,len / 2); +ptr=*Buffer; +for (i=0; i < len; i+=2) +{ + Str=CopyStrLen(Str,HexStr+i,2); + *ptr=strtol(Str,NULL,16); + ptr++; +} + +DestroyString(Str); +return(len / 2); +} + + +void SwitchProgram(char *CommandLine) +{ +char **argv, *ptr; +char *Token=NULL; +int i; + +argv=(char **) calloc(101,sizeof(char *)); +ptr=CommandLine; +for (i=0; i < 100; i++) +{ +ptr=GetToken(ptr,"\\S",&Token,GETTOKEN_QUOTES); +if (! ptr) break; +argv[i]=CopyStr(argv[i],Token); +} + +/* we are the child so we continue */ +execv(argv[0],argv); +//no point trying to free stuff here, we will no longer +//be the main program +} + + +#include +#include + +int SwitchUser(char *NewUser) +{ +struct passwd *pwent; + + pwent=getpwnam(NewUser); + if (! pwent) return(FALSE); + if (setreuid(pwent->pw_uid,pwent->pw_uid) !=0) return(FALSE); + return(TRUE); +} + + +int SwitchGroup(char *NewGroup) +{ +struct group *grent; + + grent=getgrnam(NewGroup); + if (! grent) return(FALSE); + if (setgid(grent->gr_gid) !=0) return(FALSE); + return(TRUE); +} + +char *GetCurrUserHomeDir() +{ +struct passwd *pwent; + + pwent=getpwuid(getuid()); + if (! pwent) return(NULL); + return(pwent->pw_dir); +} + + + +void ColLibDefaultSignalHandler(int sig) +{ + +} + + +int CreateLockFile(char *FilePath, int Timeout) +{ +int fd, result; + +SetTimeout(Timeout); +fd=open(FilePath, O_CREAT | O_RDWR, 0600); +if (fd <0) return(-1); +result=flock(fd,LOCK_EX); +alarm(0); + +if (result==-1) +{ + close(fd); + return(-1); +} +return(fd); +} + + + + +char *GetNameValuePair(const char *Input, const char *PairDelim, const char *NameValueDelim, char **Name, char **Value) +{ +char *ptr, *ptr2; +char *Token=NULL; + +ptr=GetToken(Input,PairDelim,&Token,GETTOKEN_QUOTES); +if (StrLen(Token) && strstr(Token,NameValueDelim)) +{ +ptr2=GetToken(Token,NameValueDelim,Name,GETTOKEN_QUOTES); +ptr2=GetToken(ptr2,PairDelim,Value,GETTOKEN_QUOTES); +} + +DestroyString(Token); +return(ptr); +} + + + + + +char *GetRandomData(char *RetBuff, int len, char *AllowedChars) +{ +int fd; +char *Tempstr=NULL, *RetStr=NULL; +int i; +uint8_t val, max_val; + +srand(time(NULL)); +max_val=StrLen(AllowedChars); + +RetStr=CopyStr(RetBuff,""); +fd=open("/dev/urandom",O_RDONLY); +for (i=0; i < len ; i++) +{ + if (fd > -1) read(fd,&val,1); + else val=rand(); + + RetStr=AddCharToStr(RetStr,AllowedChars[val % max_val]); +} + +if (fd) close(fd); + +DestroyString(Tempstr); +return(RetStr); +} + + +char *GetRandomHexStr(char *RetBuff, int len) +{ +return(GetRandomData(RetBuff,len,HEX_CHARS)); +} + + +char *GetRandomAlphabetStr(char *RetBuff, int len) +{ +return(GetRandomData(RetBuff,len,ALPHA_CHARS)); +} + + + + + +#define KILOBYTE 1000 +#define MEGABYTE 1000000 +#define GIGABYTE 1000000000 +#define TERABYTE 1000000000000 + +#define KIBIBYTE 1024 +#define MEGIBYTE 1024 * 1024 +#define GIGIBYTE 1024 * 1024 * 1024 +#define TERIBYTE 1024 * 1024 * 1024 *1024 + +double ParseHumanReadableDataQty(char *Data, int Type) +{ +double val; +char *ptr=NULL; +double KAY,MEG,GIG,TERA; + +if (Type) +{ +KAY=KILOBYTE; +MEG=MEGABYTE; +GIG=GIGABYTE; +//TERA=TERABYTE; +} +else +{ +KAY=KIBIBYTE; +MEG=MEGIBYTE; +GIG=GIGIBYTE; +//TERA=TERIBYTE; +} + + val=strtod(Data,&ptr); + while (isspace(*ptr)) ptr++; + if (*ptr=='k') val=val * KAY; + if (*ptr=='M') val=val * MEG; + if (*ptr=='G') val=val * GIG; +// if (*ptr=='T') val=val * TERA; + + +return(val); +} + + + +char *GetHumanReadableDataQty(double Size, int Type) +{ +static char *Str=NULL; +double val=0; +char kMGT=' '; +//Set to 0 to keep valgrind happy +double KAY=0,MEG=0,GIG=0,TERA=0; + +if (Type) +{ +KAY=KILOBYTE; +MEG=MEGABYTE; +GIG=GIGABYTE; +//TERA=TERABYTE; +} +else +{ +KAY=KIBIBYTE; +MEG=MEGIBYTE; +GIG=GIGIBYTE; +//TERA=TERIBYTE; +} + val=Size; + kMGT=' '; +/* if (val > (TERA)) + { + val=val / TERA; + kMGT='T'; + } + else*/ + if (val > (GIG)) + { + val=val / GIG; + kMGT='G'; + } + else if (val > (MEG)) + { + val=val / MEG; + kMGT='M'; + + } + else if (val > (KAY)) + { + val=val / KAY; + kMGT='k'; + } + +Str=FormatStr(Str,"%0.1f%c",(float) val,kMGT); +return(Str); +} + + +void EraseString(char *Buff, char *Target) +{ +char *ptr; +int len; + +len=StrLen(Target); +ptr=strstr(Buff,Target); +while (ptr) +{ +memset(ptr,' ',len); +ptr=strstr(ptr,Target); +} + +} diff --git a/libUseful-2.0/GeneralFunctions.h b/libUseful-2.0/GeneralFunctions.h new file mode 100644 index 0000000..839ab13 --- /dev/null +++ b/libUseful-2.0/GeneralFunctions.h @@ -0,0 +1,47 @@ +#ifndef LIBUSEFUL_GENERAL_H +#define LIBUSEFUL_GENERAL_H + +#include +#include "defines.h" + + + +#ifdef __cplusplus +extern "C" { +#endif + +int WritePidFile(char *ProgName); +int HexStrToBytes(char **Buffer, char *HexStr); +char *BytesToHexStr(char *Buffer, char *Bytes, int len); + +void SwitchProgram(char *CommandLine); +int SwitchUser(char *User); +int SwitchGroup(char *Group); +char *GetCurrUserHomeDir(); + + +void ColLibDefaultSignalHandler(int sig); +int CreateLockFile(char *FilePath,int Timeout); + +char *GetRandomData(char *RetBuff, int len, char *AllowedChars); +char *GetRandomHexStr(char *RetBuff, int len); +char *GetRandomAlphabetStr(char *RetBuff, int len); + +void CloseOpenFiles(); + +int BASIC_FUNC_EXEC_COMMAND(void *Data); + + +char *GetNameValuePair(const char *Input, const char *PairDelim, const char *NameValueDelim, char **Name, char **Value); +double ParseHumanReadableDataQty(char *Data, int Type); +char *GetHumanReadableDataQty(double Size, int Type); + +void EraseString(char *Buff, char *Target); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/Hash.c b/libUseful-2.0/Hash.c new file mode 100644 index 0000000..74f1f28 --- /dev/null +++ b/libUseful-2.0/Hash.c @@ -0,0 +1,395 @@ +#include "Hash.h" +#include "string.h" + +char *EncodeBase64(char *Return, char *Text, int len) +{ +char *RetStr; + +RetStr=SetStrLen(Return,len *2); +to64frombits(RetStr,Text,len); + +return(RetStr); +} + +char *DecodeBase64(char *Return, int *len, char *Text) +{ +char *RetStr; + +RetStr=SetStrLen(Return,StrLen(Text) *2); +*len=from64tobits(RetStr,Text); + +return(RetStr); +} + +int HMAC(char **Return, char *Algo, char *iKey, int iKeyLen, char *iText, int iTextLen) +{ +int blocksize=64, len, i; +char *Key=NULL, *Text=NULL; +int KeyLen, TextLen; +char *Tempstr=NULL, *Digest=NULL, *OpadKey=NULL, *IpadKey=NULL; + +len=StrLen(iKey); + +if (len > blocksize) KeyLen=HashBytes(&Key,Algo,iKey,iKeyLen,0); +else +{ +KeyLen=len; +Key=SetStrLen(Key,len); +memcpy(Key,iKey,len); +} + +Key=SetStrLen(Key,blocksize); +IpadKey=SetStrLen(IpadKey,blocksize); +OpadKey=SetStrLen(OpadKey,blocksize); + +for (i=0; i < blocksize; i++) +{ +IpadKey[i]=Key[i] ^ 0x5c; +OpadKey[i]=Key[i] ^ 0x36; +} + +len=StrLen(Text); +Tempstr=SetStrLen(Tempstr,blocksize+len); +memcpy(Tempstr,IpadKey,blocksize); +memcpy(Tempstr+blocksize,Text,len); +len=HashBytes(&Digest,Algo,Tempstr,blocksize+len,0); + +Tempstr=SetStrLen(Tempstr,blocksize+len); +memcpy(Tempstr,OpadKey,blocksize); +memcpy(Tempstr+blocksize,Digest,len); +len=HashBytes(Return,Algo,Tempstr,blocksize+len,0); + +DestroyString(Digest); +DestroyString(Tempstr); +DestroyString(IpadKey); +DestroyString(OpadKey); + +return(len); +} + + +char *EncodeHash(char *Buffer, char *Digest, int len, int Encoding) +{ +char *Tempstr=NULL, *RetStr=NULL; +int i; + +RetStr=SetStrLen(Buffer,128); +if (Encoding==ENCODE_BASE64) to64frombits(RetStr,Digest,len); +else +{ + for (i=0; i < len; i++) + { + Tempstr=FormatStr(Tempstr,"%02x",Digest[i] & 255); + RetStr=CatStr(RetStr,Tempstr); + } +} + +DestroyString(Tempstr); +return(RetStr); +} + + + + +#include "crc32.h" + +void HashUpdateCRC(THash *Hash, char *Data, int Len) +{ +crc32Update((unsigned long *) &Hash->Ctx, Data, Len); +} + + +int HashFinishCRC(THash *Hash, int Encoding, char **HashStr) +{ +unsigned long crc; +int len; + +len=sizeof(unsigned long); +crc32Finish((unsigned long *) Hash->Ctx); +//crc=htonl((unsigned long *) Hash->Ctx); + +free(Hash->Ctx); + +if (Encoding > 0) +{ +*HashStr=EncodeHash(*HashStr, (char *) &crc, len, Encoding); +return(StrLen(*HashStr)); +} +else +{ +*HashStr=SetStrLen(*HashStr,len); +memcpy(*HashStr,&crc,len); +return(len); +} +} + + +void HashInitCRC(THash *Hash) +{ +Hash->Ctx=(void *) calloc(1,sizeof(unsigned long)); +crc32Init((unsigned long *) Hash->Ctx); +Hash->Update=HashUpdateCRC; +Hash->Finish=HashFinishCRC; +} + + +#include "md5.h" +#define MD5LEN 16 + +void HashUpdateMD5(THash *Hash, char *Data, int Len) +{ +MD5Update((MD5_CTX *) Hash->Ctx, Data, Len); +} + + +int HashFinishMD5(THash *Hash, int Encoding, char **HashStr) +{ +int count, len; +char *Tempstr=NULL, *DigestBuff=NULL; + +DigestBuff=(char *) calloc(1,MD5LEN+1); +MD5Final(DigestBuff, (MD5_CTX *) Hash->Ctx); + +free(Hash->Ctx); + +if (Encoding > 0) +{ +*HashStr=EncodeHash(*HashStr, DigestBuff, MD5LEN, Encoding); +len=StrLen(*HashStr); +} +else +{ +len=MD5LEN; +*HashStr=SetStrLen(*HashStr,len); +memcpy(*HashStr,DigestBuff,len); +} + +DestroyString(DigestBuff); +DestroyString(Tempstr); + +return(len); +} + + +void HashInitMD5(THash *Hash) +{ +Hash->Ctx=(void *) calloc(1,sizeof(MD5_CTX)); +MD5Init((MD5_CTX *) Hash->Ctx); +Hash->Update=HashUpdateMD5; +Hash->Finish=HashFinishMD5; +} + +#include "sha1.h" +#define SHA1LEN 20 + +void HashUpdateSHA1(THash *Hash, char *Data, int Len) +{ +sha1_process_bytes(Data,Len,(struct sha1_ctx *) Hash->Ctx); +} + + +int HashFinishSHA1(THash *Hash, int Encoding, char **HashStr) +{ +int count, len; +char *Tempstr=NULL, *DigestBuff=NULL; + +DigestBuff=(char *) calloc(1,SHA1LEN+1); +sha1_finish_ctx((struct sha1_ctx *) Hash->Ctx, DigestBuff); +free(Hash->Ctx); + +if (Encoding > 0) +{ + *HashStr=EncodeHash(*HashStr, DigestBuff, SHA1LEN, Encoding); + len=StrLen(*HashStr); +} +else +{ +len=SHA1LEN; +*HashStr=SetStrLen(*HashStr,len); +memcpy(*HashStr,DigestBuff,len); +} + +DestroyString(DigestBuff); +DestroyString(Tempstr); + +return(len); +} + + +void HashInitSHA1(THash *Hash) +{ +Hash->Ctx=(void *) calloc(1,sizeof(struct sha1_ctx)); +sha1_init_ctx((struct sha1_ctx *) Hash->Ctx); +Hash->Update=HashUpdateSHA1; +Hash->Finish=HashFinishSHA1; +} + + +#include "sha2.h" + +int HashFinishSHA256(THash *Hash, int Encoding, char **HashStr) +{ +int count, len; +char *Tempstr=NULL; +uint8_t *DigestBuff=NULL; + +DigestBuff=(uint8_t *) calloc(1,SHA256_DIGEST_LENGTH+1); +SHA256_Final(DigestBuff, (SHA256_CTX *) Hash->Ctx); +free(Hash->Ctx); + +if (Encoding > 0) +{ + *HashStr=EncodeHash(*HashStr, DigestBuff, SHA256_DIGEST_LENGTH, Encoding); + len=StrLen(*HashStr); +} +else +{ +len=SHA256_DIGEST_LENGTH; +*HashStr=SetStrLen(*HashStr,len); +memcpy(*HashStr,DigestBuff,len); +} + +DestroyString(DigestBuff); +DestroyString(Tempstr); + +return(len); +} + + +void HashUpdateSHA256(THash *Hash, char *Data, int Len) +{ +SHA256_Update((SHA256_CTX *) Hash->Ctx, Data, Len); +} + +void HashInitSHA256(THash *Hash) +{ +Hash->Ctx=(void *) calloc(1,sizeof(SHA256_CTX)); +SHA256_Init((SHA256_CTX *) Hash->Ctx); +Hash->Update=HashUpdateSHA256; +Hash->Finish=HashFinishSHA256; +} + + +int HashFinishSHA512(THash *Hash, int Encoding, char **HashStr) +{ +int count, len; +char *Tempstr=NULL, *DigestBuff=NULL; + +DigestBuff=(char *) calloc(1,SHA512_DIGEST_LENGTH+1); +SHA512_Final(DigestBuff, (SHA512_CTX *) Hash->Ctx); +free(Hash->Ctx); + +if (Encoding > 0) +{ + *HashStr=EncodeHash(*HashStr, DigestBuff, SHA512_DIGEST_LENGTH, Encoding); + len=StrLen(*HashStr); +} +else +{ +len=SHA512_DIGEST_LENGTH; +*HashStr=SetStrLen(*HashStr,len); +memcpy(*HashStr,DigestBuff,len); +} + +DestroyString(DigestBuff); +DestroyString(Tempstr); + +return(len); +} + + +void HashUpdateSHA512(THash *Hash, char *Data, int Len) +{ +SHA512_Update((SHA512_CTX *) Hash->Ctx, Data, Len); +} + +void HashInitSHA512(THash *Hash) +{ +Hash->Ctx=(void *) calloc(1,sizeof(SHA512_CTX)); +SHA512_Init((SHA512_CTX *) Hash->Ctx); +Hash->Update=HashUpdateSHA512; +Hash->Finish=HashFinishSHA512; +} + + + + +THash *HashInit(char *Type) +{ +THash *Hash=NULL; + +Hash=(THash *) calloc(1,sizeof(THash)); +if (strcasecmp(Type,"md5")==0) HashInitMD5(Hash); +else if (strcasecmp(Type,"sha")==0) HashInitSHA1(Hash); +else if (strcasecmp(Type,"sha1")==0) HashInitSHA1(Hash); +else if (strcasecmp(Type,"sha256")==0) HashInitSHA256(Hash); +else if (strcasecmp(Type,"sha512")==0) HashInitSHA512(Hash); +else if (strcasecmp(Type,"crc32")==0) HashInitCRC(Hash); +else +{ + free(Hash); + Hash=NULL; +} + +return(Hash); +} + + +void HashDestroy(THash *Hash) +{ +//Hash->Ctx is destroyed in 'HashFinish' +DestroyString(Hash->Type); +free(Hash); +} + + +int HashBytes(char **Return, char *Type, char *text, int len, int Encoding) +{ +THash *Hash; +int result; + +Hash=HashInit(Type); +if (! Hash) return(0); +Hash->Update(Hash, text, len); +result=Hash->Finish(Hash, Encoding, Return); +HashDestroy(Hash); + +return(result); +} + + +int HashFile(char **Return, char *Type, char *Path, int Encoding) +{ +THash *Hash; +STREAM *S; +char *Tempstr=NULL; +int result; + +S=STREAMOpenFile(Path,O_RDONLY); +if (! S) return(FALSE); + +Hash=HashInit(Type); +if (! Hash) +{ + STREAMClose(S); + return(FALSE); +} + + +Tempstr=SetStrLen(Tempstr,4096); +result=STREAMReadBytes(S,Tempstr,4096); +while (result !=EOF) +{ + Hash->Update(Hash, Tempstr, result); +result=STREAMReadBytes(S,Tempstr,4096); +} + +DestroyString(Tempstr); +STREAMClose(S); + +result=Hash->Finish(Hash, Encoding, Return); +HashDestroy(Hash); + +return(result); +} + diff --git a/libUseful-2.0/Hash.h b/libUseful-2.0/Hash.h new file mode 100644 index 0000000..910e607 --- /dev/null +++ b/libUseful-2.0/Hash.h @@ -0,0 +1,42 @@ +#ifndef LIBUSEFUL_HASH_H +#define LIBUSEFUL_HASH_H + +#include "file.h" +#include "includes.h" + + +#define ENCODE_HEX 1 +#define ENCODE_BASE64 2 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct t_hash THash; + +typedef void (*HASH_UPDATE)(THash *Hash, char *Data, int DataLen); +typedef int (*HASH_FINISH)(THash *Hash, int Encoding, char **RetStr); + +struct t_hash +{ +char *Type; +void *Ctx; +HASH_UPDATE Update; +HASH_FINISH Finish; +}; + +THash *HashInit(char *Type); +void HashDestroy(THash *Hash); +char *EncodeBase64(char *Return, char *Text, int len); +char *DecodeBase64(char *Return, int *len, char *Text); +int HashBytes(char **Return, char *Type, char *text, int len, int Encoding); +int HashFile(char **Return, char *Type, char *Path, int Encoding); +int HMAC(char **Return, char *Algo, char *iKey, int iKeyLen, char *iText, int iTextLen); + +#ifdef __cplusplus +} +#endif + + + +#endif diff --git a/libUseful-2.0/LICENCE b/libUseful-2.0/LICENCE new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/libUseful-2.0/LICENCE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If 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 convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state 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 program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/libUseful-2.0/Log.c b/libUseful-2.0/Log.c new file mode 100644 index 0000000..18b10eb --- /dev/null +++ b/libUseful-2.0/Log.c @@ -0,0 +1,318 @@ +#include "Log.h" +#include + + +char *G_LogFilePath; + + +//When logs are used by 'child processes', it's only the 'parent' process that should be +//able to delete/reopen the log. Otherwise the child can delete a log that the parent +//keeps writing to, and keeps handing to child processes. Thus we record the parent pid +pid_t ParentPID=0; + + +typedef struct +{ + char *Path; + int Flags; + int MaxSize; + STREAM *S; + int LogFacility; + int LastFlushTime; + int FlushInterval; +} TLogFile; + + +ListNode *LogFiles=NULL; +TLogFile *LogFileDefaults=NULL; + + +void LogFileSetupDefaults() +{ + LogFileDefaults=(TLogFile *) calloc(1,sizeof(TLogFile)); + LogFileDefaults->MaxSize=100000000; + LogFileDefaults->Flags |= LOGFILE_FLUSH | LOGFILE_LOGPID | LOGFILE_LOGUSER; + LogFileDefaults->LogFacility=LOG_USER; + if (ParentPID==0) ParentPID=getpid(); +} + +TLogFile *LogFileGetEntry(char *FileName) +{ + ListNode *Node; + TLogFile *LogFile=NULL; + STREAM *S=NULL; + + if (! StrLen(FileName)) return(NULL); + if (! LogFiles) LogFiles=ListCreate(); + if (! LogFileDefaults) LogFileSetupDefaults(); + + Node=ListFindNamedItem(LogFiles,FileName); + if (Node) LogFile=(TLogFile *) Node->Item; + else + { + if (strcmp(FileName,"STDOUT")==0) S=STREAMFromFD(1); + else if (strcmp(FileName,"STDERR")==0) S=STREAMFromFD(2); + else if (strcmp(FileName,"SYSLOG")==0) S=STREAMCreate(); + else + { + S=STREAMOpenFile(FileName,O_CREAT | O_APPEND | O_WRONLY); + S->Flags &= ~FLUSH_ALWAYS; + } + + if (S) + { + LogFile=(TLogFile *) calloc(1,sizeof(TLogFile)); + LogFile->Path=CopyStr(LogFile->Path,FileName); + LogFile->LogFacility=LogFileDefaults->LogFacility; + LogFile->Flags=LogFileDefaults->Flags; + LogFile->MaxSize=LogFileDefaults->MaxSize; + LogFile->S=S; + if (strcmp(FileName,"SYSLOG")==0) LogFile->Flags |= LOGFILE_SYSLOG; + ListAddNamedItem(LogFiles,FileName,LogFile); + STREAMSetItem(S,"TLogFile",LogFile); + } + } + + return(LogFile); +} + +void LogFileClose(char *Path) +{ +ListNode *Node; +TLogFile *LogFile; + +Node=ListFindNamedItem(LogFiles,Path); +if (Node) +{ +LogFile=(TLogFile *) Node->Item; +ListDeleteNode(Node); +DestroyString(LogFile->Path); +STREAMClose(LogFile->S); +free(LogFile); +} +} + +void LogFileInternalDoRotate(TLogFile *LogFile) +{ + struct stat FStat; + char *Tempstr=NULL; + + if (! LogFile) return; + if (strcmp(LogFile->Path,"SYSLOG")==0) return; + if (strcmp(LogFile->Path,"STDOUT")==0) return; + if (strcmp(LogFile->Path,"STDERR")==0) return; + if (getpid() != ParentPID) return; + + if (LogFile->MaxSize > 0) + { + fstat(LogFile->S->out_fd,&FStat); + if (FStat.st_size > LogFile->MaxSize) + { + Tempstr=MCopyStr(Tempstr,LogFile->Path,"-",NULL); + rename(LogFile->Path,Tempstr); + STREAMClose(LogFile->S); + LogFile->S=STREAMOpenFile(LogFile->Path,O_CREAT | O_APPEND | O_WRONLY); + } + } + + DestroyString(Tempstr); +} + + + +int LogFileSetValues(char *FileName, int Flags, int MaxSize, int FlushInterval) +{ + TLogFile *LogFile; + + if (! LogFileDefaults) LogFileSetupDefaults(); + if (ParentPID==0) ParentPID=getpid(); + if (StrLen(FileName)==0) LogFile=LogFileDefaults; + else LogFile=LogFileGetEntry(FileName); + + if (LogFile) + { + LogFile->MaxSize=MaxSize; + LogFile->FlushInterval=FlushInterval; + LogFile->Flags=Flags; + if (strcmp(FileName,"SYSLOG")==0) LogFile->Flags |= LOGFILE_SYSLOG; + } + return(TRUE); +} + + +int LogFileInternalWrite(STREAM *S,int LogLevel, int Flags, char *Str) +{ + char *Tempstr=NULL, *LogStr=NULL; + struct timeval Now; + struct tm *TimeStruct; + int result=FALSE; + TLogFile *Log; + + + if (ParentPID==0) ParentPID=getpid(); + gettimeofday(&Now,NULL); + TimeStruct=localtime(&Now.tv_sec); + LogStr=SetStrLen(LogStr,40); + strftime(LogStr,20,"%Y/%m/%d %H:%M:%S",TimeStruct); + + if (Flags & LOGFILE_MILLISECS) + { + Tempstr=FormatStr(Tempstr,".%03d ",Now.tv_usec / 1000); + LogStr=CatStr(LogStr,Tempstr); + } + else LogStr=CatStr(LogStr," "); + + if (Flags & LOGFILE_LOGPID) + { + Tempstr=FormatStr(Tempstr,"[%d] ",getpid()); + LogStr=CatStr(LogStr,Tempstr); + } + + if (Flags & LOGFILE_LOGUSER) + { + Tempstr=FormatStr(Tempstr,"user=%d ",getuid()); + LogStr=CatStr(LogStr,Tempstr); + } + LogStr=MCatStr(LogStr,Str,"\n",NULL); + + if (S) + { + + Log=STREAMGetItem(S,"TLogFile"); + if (Log) + { + if (Log->Flags & LOGFILE_LOCK) S->Flags |= SF_WRLOCK; + else S->Flags &= ~SF_WRLOCK; + } + + STREAMWriteLine(LogStr,S); + + if ( + (! Log) || + ((Flags & LOGFILE_FLUSH) || ((Now.tv_sec-Log->LastFlushTime) > Log->FlushInterval)) + ) + { + STREAMFlush(S); + if (Log) Log->LastFlushTime=Now.tv_sec; + } + + result=TRUE; + } + + if (Flags & LOGFILE_SYSLOG) + { + syslog(LOG_INFO,"%s",LogStr); + result=TRUE; + } + + DestroyString(Tempstr); + DestroyString(LogStr); + + return(result); +} + + + + + + +int LogToSTREAM(STREAM *S, int Flags, char *Str) +{ +if (! S) return(FALSE); + +return(LogFileInternalWrite(S, 0, LOGFILE_FLUSH, Str)); +} + + + + +void LogFileFlushAll(int Force) +{ + time_t Now; + ListNode *Curr; + TLogFile *Log; + + time(&Now); + + Curr=ListGetNext(LogFiles); + while (Curr) + { + Log=(TLogFile *) Curr->Item; + + if (Force) + { + STREAMFlush(Log->S); + Log->LastFlushTime=Now; + } + else if ((Now - Log->LastFlushTime) > Log->FlushInterval) + { + STREAMFlush(Log->S); + Log->LastFlushTime=Now; + } + Curr=ListGetNext(Curr); + } +} + + +int LogToFile(char *FileName,char *fmt, ...) +{ + char *Tempstr=NULL; + va_list args; + int result=FALSE; + TLogFile *LogFile; + + LogFile=LogFileGetEntry(FileName); + if (LogFile) + { + LogFileInternalDoRotate(LogFile); + + va_start(args,fmt); + Tempstr=VFormatStr(Tempstr,fmt,args); + va_end(args); + StripTrailingWhitespace(Tempstr); + result=LogFileInternalWrite(LogFile->S,LOG_INFO, LogFile->Flags, Tempstr); + } + +DestroyString(Tempstr); +return(result); +} + +int LogFileAppendTempLog(char *LogPath, char *TmpLogPath) +{ +TLogFile *LogFile; +char *Tempstr=NULL; +STREAM *S; + + LogFile=LogFileGetEntry(LogPath); + LogFileClose(TmpLogPath); + S=STREAMOpenFile(TmpLogPath,O_RDONLY); + if (LogFile && S) + { + + STREAMLock(LogFile->S,LOCK_EX); + Tempstr=STREAMReadLine(Tempstr,S); + while(Tempstr) + { + STREAMWriteLine(Tempstr,LogFile->S); + Tempstr=STREAMReadLine(Tempstr,S); + } + if (LogFile->Flags & LOGFILE_FLUSH) STREAMFlush(LogFile->S); + STREAMLock(LogFile->S,LOCK_UN); + unlink(TmpLogPath); + } + if (S) STREAMClose(S); + +DestroyString(Tempstr); +} + + +void LogFileCheckRotate(char *FileName) +{ +TLogFile *LogFile; + + LogFile=LogFileGetEntry(FileName); + if (LogFile) + { + LogFileInternalDoRotate(LogFile); + } +} diff --git a/libUseful-2.0/Log.h b/libUseful-2.0/Log.h new file mode 100644 index 0000000..f6a8d0e --- /dev/null +++ b/libUseful-2.0/Log.h @@ -0,0 +1,35 @@ +#ifndef LIBUSEFUL_LOG_H +#define LIBUSEFUL_LOG_H + +#include "includes.h" +#include "defines.h" +#include "file.h" + +#define LOGFILE_FLUSH 1 +#define LOGFILE_SYSLOG 2 +#define LOGFILE_LOGPID 4 +#define LOGFILE_LOGUSER 8 +#define LOGFILE_LOCK 16 +#define LOGFILE_MILLISECS 32 + +extern char *G_LogFilePath; + +#ifdef __cplusplus +extern "C" { +#endif + +int LogFileSetValues(char *FileName, int Flags, int MaxSize, int FlushInterval); +int LogToSTREAM(STREAM *S, int Flags, char *Str); +void LogFileFlushAll(int Force); +int LogToFile(char *FileName,char *fmt, ...); +void LogFileClose(char *Path); +int LogFileAppendTempLog(char *LogPath, char *TmpLogPath); +void LogFileCheckRotate(char *FileName); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/Makefile b/libUseful-2.0/Makefile new file mode 100644 index 0000000..cb4e0ba --- /dev/null +++ b/libUseful-2.0/Makefile @@ -0,0 +1,124 @@ +CC = gcc +VERSION = 0.0.1 +CFLAGS = -g -O2 +LIBS = +FLAGS=$(CFLAGS) -fPIC -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_OSS=1 +prefix=/usr/local +OBJ=string.o list.o socket.o unix_socket.o file.o tar.o FileSystem.o GeneralFunctions.o DataProcessing.o EncryptedFiles.o ConnectManager.o sound.o pty.o Log.o http.o inet.o expect.o base64.o crc32.o md5c.o sha1.o sha2.o Hash.o Compression.o oauth.o libsettings.o Vars.o MathExpr.o Time.o Markup.o SpawnPrograms.o PatternMatch.o ParseURL.o ConnectionChain.o + + +all: $(OBJ) + $(CC) $(FLAGS) $(LIBS) -shared -o libUseful-2.0.so $(OBJ) + #ld -i -o libUseful-2.0.a $(OBJ) + ar rcs libUseful-2.0.a $(OBJ) + +string.o: string.h string.c + $(CC) $(FLAGS) -c string.c + +list.o: list.h list.c + $(CC) $(FLAGS) -c list.c + +socket.o: socket.h socket.c + $(CC) $(FLAGS) -c socket.c + +sound.o: sound.h sound.c + $(CC) $(FLAGS) -c sound.c + +pty.o: pty.h pty.c + $(CC) $(FLAGS) -c pty.c + +http.o: http.h http.c + $(CC) $(FLAGS) -c http.c + +file.o: file.h file.c + $(CC) $(FLAGS) -c file.c + +tar.o: tar.h tar.c + $(CC) $(FLAGS) -c tar.c + +Log.o: Log.h Log.c + $(CC) $(FLAGS) -c Log.c + +unix_socket.o: unix_socket.h unix_socket.c + $(CC) $(FLAGS) -c unix_socket.c + +PatternMatch.o: PatternMatch.h PatternMatch.c + $(CC) $(FLAGS) -c PatternMatch.c + +FileSystem.o: FileSystem.h FileSystem.c + $(CC) $(FLAGS) -c FileSystem.c + +MathExpr.o: MathExpr.h MathExpr.c + $(CC) $(FLAGS) -c MathExpr.c + +Time.o: Time.h Time.c + $(CC) $(FLAGS) -c Time.c + +Markup.o: Markup.h Markup.c + $(CC) $(FLAGS) -c Markup.c + +ParseURL.o: ParseURL.h ParseURL.c + $(CC) $(FLAGS) -c ParseURL.c + +inet.o: inet.h inet.c + $(CC) $(FLAGS) -c inet.c + +expect.o: expect.h expect.c + $(CC) $(FLAGS) -c expect.c + +GeneralFunctions.o: GeneralFunctions.h GeneralFunctions.c + $(CC) $(FLAGS) -c GeneralFunctions.c + +DataProcessing.o: DataProcessing.h DataProcessing.c + $(CC) $(FLAGS) -c DataProcessing.c + +EncryptedFiles.o: EncryptedFiles.h EncryptedFiles.c + $(CC) $(FLAGS) -c EncryptedFiles.c + +Hash.o: Hash.h Hash.c + $(CC) $(FLAGS) -c Hash.c + +Compression.o: Compression.h Compression.c + $(CC) $(FLAGS) -c Compression.c + +ConnectionChain.o: ConnectionChain.h ConnectionChain.c + $(CC) $(FLAGS) -c ConnectionChain.c + +ConnectManager.o: ConnectManager.h ConnectManager.c + $(CC) $(FLAGS) -c ConnectManager.c + +base64.o: base64.c base64.h + $(CC) $(FLAGS) -c base64.c + +crc32.o: crc32.c crc32.h + $(CC) $(FLAGS) -c crc32.c + +md5c.o: md5c.c md5-global.h md5.h + $(CC) $(FLAGS) -c md5c.c + +sha1.o: sha1.c sha1.h + $(CC) $(FLAGS) -c sha1.c + +sha2.o: sha2.c sha2.h + $(CC) $(FLAGS) -c sha2.c + +oauth.o: oauth.c oauth.h + $(CC) $(FLAGS) -c oauth.c + +Vars.o: Vars.c Vars.h + $(CC) $(FLAGS) -c Vars.c + +libsettings.o: libsettings.c libsettings.h + $(CC) $(FLAGS) -c libsettings.c + +SpawnPrograms.o: SpawnPrograms.c SpawnPrograms.h + $(CC) $(FLAGS) -c SpawnPrograms.c + + +clean: + @rm -f *.o *.so *.a + +install: + @ln -s libUseful-2.0.so libUseful.so + @ln -s libUseful-2.0.a libUseful.a + @cp *.so *.a $(prefix)/lib ; mkdir $(prefix)/include/libUseful-$(VERSION) ; cp *.h $(prefix)/include/libUseful-$(VERSION) diff --git a/libUseful-2.0/Makefile.in b/libUseful-2.0/Makefile.in new file mode 100644 index 0000000..912cbfd --- /dev/null +++ b/libUseful-2.0/Makefile.in @@ -0,0 +1,124 @@ +CC = @CC@ +VERSION = @VERSION@ +CFLAGS = @CFLAGS@ +LIBS = @LIBS@ +FLAGS=$(CFLAGS) -fPIC @DEFS@ +prefix=@prefix@ +OBJ=string.o list.o socket.o unix_socket.o file.o tar.o FileSystem.o GeneralFunctions.o DataProcessing.o EncryptedFiles.o ConnectManager.o sound.o pty.o Log.o http.o inet.o expect.o base64.o crc32.o md5c.o sha1.o sha2.o Hash.o Compression.o oauth.o libsettings.o Vars.o MathExpr.o Time.o Markup.o SpawnPrograms.o PatternMatch.o ParseURL.o ConnectionChain.o + + +all: $(OBJ) + $(CC) $(FLAGS) $(LIBS) -shared -o libUseful-2.0.so $(OBJ) + #ld -i -o libUseful-2.0.a $(OBJ) + ar rcs libUseful-2.0.a $(OBJ) + +string.o: string.h string.c + $(CC) $(FLAGS) -c string.c + +list.o: list.h list.c + $(CC) $(FLAGS) -c list.c + +socket.o: socket.h socket.c + $(CC) $(FLAGS) -c socket.c + +sound.o: sound.h sound.c + $(CC) $(FLAGS) -c sound.c + +pty.o: pty.h pty.c + $(CC) $(FLAGS) -c pty.c + +http.o: http.h http.c + $(CC) $(FLAGS) -c http.c + +file.o: file.h file.c + $(CC) $(FLAGS) -c file.c + +tar.o: tar.h tar.c + $(CC) $(FLAGS) -c tar.c + +Log.o: Log.h Log.c + $(CC) $(FLAGS) -c Log.c + +unix_socket.o: unix_socket.h unix_socket.c + $(CC) $(FLAGS) -c unix_socket.c + +PatternMatch.o: PatternMatch.h PatternMatch.c + $(CC) $(FLAGS) -c PatternMatch.c + +FileSystem.o: FileSystem.h FileSystem.c + $(CC) $(FLAGS) -c FileSystem.c + +MathExpr.o: MathExpr.h MathExpr.c + $(CC) $(FLAGS) -c MathExpr.c + +Time.o: Time.h Time.c + $(CC) $(FLAGS) -c Time.c + +Markup.o: Markup.h Markup.c + $(CC) $(FLAGS) -c Markup.c + +ParseURL.o: ParseURL.h ParseURL.c + $(CC) $(FLAGS) -c ParseURL.c + +inet.o: inet.h inet.c + $(CC) $(FLAGS) -c inet.c + +expect.o: expect.h expect.c + $(CC) $(FLAGS) -c expect.c + +GeneralFunctions.o: GeneralFunctions.h GeneralFunctions.c + $(CC) $(FLAGS) -c GeneralFunctions.c + +DataProcessing.o: DataProcessing.h DataProcessing.c + $(CC) $(FLAGS) -c DataProcessing.c + +EncryptedFiles.o: EncryptedFiles.h EncryptedFiles.c + $(CC) $(FLAGS) -c EncryptedFiles.c + +Hash.o: Hash.h Hash.c + $(CC) $(FLAGS) -c Hash.c + +Compression.o: Compression.h Compression.c + $(CC) $(FLAGS) -c Compression.c + +ConnectionChain.o: ConnectionChain.h ConnectionChain.c + $(CC) $(FLAGS) -c ConnectionChain.c + +ConnectManager.o: ConnectManager.h ConnectManager.c + $(CC) $(FLAGS) -c ConnectManager.c + +base64.o: base64.c base64.h + $(CC) $(FLAGS) -c base64.c + +crc32.o: crc32.c crc32.h + $(CC) $(FLAGS) -c crc32.c + +md5c.o: md5c.c md5-global.h md5.h + $(CC) $(FLAGS) -c md5c.c + +sha1.o: sha1.c sha1.h + $(CC) $(FLAGS) -c sha1.c + +sha2.o: sha2.c sha2.h + $(CC) $(FLAGS) -c sha2.c + +oauth.o: oauth.c oauth.h + $(CC) $(FLAGS) -c oauth.c + +Vars.o: Vars.c Vars.h + $(CC) $(FLAGS) -c Vars.c + +libsettings.o: libsettings.c libsettings.h + $(CC) $(FLAGS) -c libsettings.c + +SpawnPrograms.o: SpawnPrograms.c SpawnPrograms.h + $(CC) $(FLAGS) -c SpawnPrograms.c + + +clean: + @rm -f *.o *.so *.a + +install: + @ln -s libUseful-2.0.so libUseful.so + @ln -s libUseful-2.0.a libUseful.a + @cp *.so *.a $(prefix)/lib ; mkdir $(prefix)/include/libUseful-$(VERSION) ; cp *.h $(prefix)/include/libUseful-$(VERSION) diff --git a/libUseful-2.0/Markup.c b/libUseful-2.0/Markup.c new file mode 100644 index 0000000..dbf4e8d --- /dev/null +++ b/libUseful-2.0/Markup.c @@ -0,0 +1,242 @@ +#include "Markup.h" + +char *XMLGetTag(char *Input, char **Namespace, char **TagType, char **TagData) +{ +char *ptr, *tptr; +int len=0, InTag=FALSE, TagHasName=FALSE; + +if (! Input) return(NULL); +if (*Input=='\0') return(NULL); +ptr=Input; + +//This ensures we are never dealing with nulls +if (! *TagType) *TagType=CopyStr(*TagType,""); +if (! *TagData) *TagData=CopyStr(*TagData,""); + +if (*ptr=='<') +{ + ptr++; + while (isspace(*ptr)) ptr++; + + len=0; + InTag=TRUE; + TagHasName=TRUE; + + //if we start with a slash tag, then add that to the tag name + if (*ptr=='/') + { + *TagType=AddCharToBuffer(*TagType,len,*ptr); + len++; + ptr++; + } + + while (InTag) + { + switch (*ptr) + { + //These all cause us to end. NONE OF THEM REQUIRE ptr++ + //ptr++ will happen when we read tag data + case '>': + case '\0': + case ' ': + case ' ': + case '\n': + InTag=FALSE; + break; + + //If a namespace return value is supplied, break the name up into namespace and + //tag. Otherwise don't + case ':': + if (Namespace) + { + tptr=*TagType; + if (*tptr=='/') + { + tptr++; + len=1; + } + else len=0; + *Namespace=CopyStr(*Namespace,tptr); + } + else + { + *TagType=AddCharToBuffer(*TagType,len,*ptr); + len++; + } + ptr++; + + break; + + + + case '\r': + ptr++; + break; + + default: + *TagType=AddCharToBuffer(*TagType,len,*ptr); + len++; + ptr++; + break; + } + + } +} + +//End of Parse TagName. Strip any '/' +tptr=*TagType; +if ((len > 0) && (tptr[len-1]=='/')) tptr[len-1]='\0'; +tptr[len]='\0'; + +while (isspace(*ptr)) ptr++; + + +len=0; +InTag=TRUE; +while (InTag) +{ + switch (*ptr) + { + //End of tag, skip '>' and fall through + case '>': + ptr++; + + //Start of next tag or end of text + case '<': + case '\0': + InTag=FALSE; + break; + + //Quotes! + case '\'': + case '\"': + + //Somewhat ugly code. If we're dealing with an actual tag, then TagHasName + //will be set. This means we're dealing with data within a tag and quotes mean something. + //Otherwise we are dealing with text outside of tags and we just add the char to + //TagData and continue + if (TagHasName) + { + tptr=ptr; + while (*tptr != *ptr) + { + *TagData=AddCharToBuffer(*TagData,len,*ptr); + len++; + ptr++; + } + } + *TagData=AddCharToBuffer(*TagData,len,*ptr); + len++; + ptr++; + break; + + default: + *TagData=AddCharToBuffer(*TagData,len,*ptr); + len++; + ptr++; + break; + } + +} + +//End of Parse TagData. Strip any '/' +tptr=*TagData; +if ((len > 0) && (tptr[len-1]=='/')) tptr[len-1]='\0'; +tptr[len]='\0'; + +strlwr(*TagType); +while (isspace(*ptr)) ptr++; + +return(ptr); +} + + + + +char *HtmlGetTag(char *Input, char **TagType, char **TagData) +{ +char *ptr; +int len=0; + +if (! Input) return(NULL); +if (*Input=='\0') return(NULL); + +return(XMLGetTag(Input, NULL, TagType, TagData)); +} + + + +char *HtmlDeQuote(char *RetStr, char *Data) +{ +char *Output=NULL, *Token=NULL, *ptr; +int len=0; + +Output=CopyStr(RetStr,Output); +ptr=Data; + +while (ptr && (*ptr != '\0')) +{ + if (*ptr=='&') + { + ptr++; + ptr=GetToken(ptr,";",&Token,0); + + if (*Token=='#') + { + Output=AddCharToBuffer(Output,len,strtol(Token+1,NULL,16)); + len++; + } + else if (strcmp(Token,"amp")==0) + { + Output=AddCharToBuffer(Output,len,'&'); + len++; + } + else if (strcmp(Token,"lt")==0) + { + Output=AddCharToBuffer(Output,len,'<'); + len++; + } + else if (strcmp(Token,"gt")==0) + { + Output=AddCharToBuffer(Output,len,'>'); + len++; + } + else if (strcmp(Token,"quot")==0) + { + Output=AddCharToBuffer(Output,len,'"'); + len++; + } + else if (strcmp(Token,"apos")==0) + { + Output=AddCharToBuffer(Output,len,'\''); + len++; + } + else if (strcmp(Token,"tilde")==0) + { + Output=AddCharToBuffer(Output,len,'~'); + len++; + } + else if (strcmp(Token,"circ")==0) + { + Output=AddCharToBuffer(Output,len,'^'); + len++; + } + + + + + } + else + { + Output=AddCharToBuffer(Output,len,*ptr); + len++; + ptr++; + } +} + +DestroyString(Token); + +return(Output); +} + + diff --git a/libUseful-2.0/Markup.h b/libUseful-2.0/Markup.h new file mode 100644 index 0000000..76a1e53 --- /dev/null +++ b/libUseful-2.0/Markup.h @@ -0,0 +1,24 @@ +#ifndef LIBUSEFUL_MARKUP_H +#define LIBUSEFUL_MARKUP_H + +#include "includes.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +char *XMLGetTag(char *Input, char **Namespace, char **TagType, char **TagData); +char *HtmlGetTag(char *Input, char **TagType, char **TagData); +char *HtmlDeQuote(char *RetStr, char *Data); + + + + +#ifdef __cplusplus +} +#endif + + + +#endif diff --git a/libUseful-2.0/MathExpr.c b/libUseful-2.0/MathExpr.c new file mode 100644 index 0000000..1d8f5e2 --- /dev/null +++ b/libUseful-2.0/MathExpr.c @@ -0,0 +1,257 @@ +#include "MathExpr.h" + +typedef struct +{ +int operator; +double value; +} ExprToken; + +char *OpStrings[]={"0","+","-","*","/","(",")","%","^",NULL}; +typedef enum Ops {OP_VAL,OP_PLUS,OP_MINUS,OP_TIMES,OP_DIVIDE,OP_OPEN,OP_CLOSE,OP_MOD,OP_POW} LIBUSEFUL_TMATHOPS; + +char *GetMathExprToken(char *String, char **Token) +{ +char *ptr, *start; +int count, found=FALSE; + +ptr=String; +if (! ptr) return(NULL); +if (*ptr=='\0') return(NULL); + +while (isspace(*ptr)) ptr++; +start=ptr; + +while (ptr) +{ + if (*ptr=='\0') + { + + *Token=CopyStr(*Token,start); + break; + } + + for (count=1; OpStrings[count] !=NULL; count++) + { + if (strncmp(ptr,OpStrings[count],StrLen(OpStrings[count]))==0) + { + // we have come to an Operator at the start, so + // that is our token + if (start==ptr) + { + *Token=CopyStr(*Token,OpStrings[count]); ptr+=StrLen(OpStrings[count]); + } + else + { + *Token=CopyStrLen(*Token,start,ptr-start); + } + found=TRUE; + break; + } + } + if (found) break; + ptr++; +} + +return(ptr); +} + + +double ProcessMathExpression(ListNode *Tokens); + +double ProcessSumExpression(ListNode *Tokens) +{ +ListNode *Curr; +ExprToken *Tok, *NextTok; +double val=0; + +Curr=ListGetNext(Tokens); +Tok=(ExprToken *) Curr->Item; +val=Tok->value; +Curr=ListGetNext(Curr); +while (Curr) +{ + Tok=(ExprToken *) Curr->Item; + Curr=ListGetNext(Curr); + NextTok=(ExprToken *) Curr->Item; + + + if (Tok->operator==OP_PLUS) val+=NextTok->value; + else if (Tok->operator==OP_MINUS) val-=NextTok->value; + else if (Tok->operator==OP_VAL) val=Tok->value; + Curr=ListGetNext(Curr); +} +ListClear(Tokens,free); +Tokens->Next=NULL; +Tokens->Head=NULL; +Tok=(ExprToken *) calloc(1,sizeof(ExprToken)); +Tok->operator=OP_VAL; +Tok->value=val; +ListAddItem(Tokens,Tok); +return(val); +} + + +double ProcessMultDiv(ListNode *Tokens) +{ +ListNode *Curr; +ExprToken *Tok, *PrevTok, *NextTok; +double val=0; +int count; + +Curr=ListGetNext(Tokens); +while (Curr) +{ + Tok=Curr->Item; + if ( + (Tok->operator==OP_TIMES) || + (Tok->operator==OP_DIVIDE) + ) + { + PrevTok=(ExprToken *) Curr->Prev->Item; + NextTok=(ExprToken *) Curr->Next->Item; + if (Tok->operator==OP_TIMES) val=PrevTok->value * NextTok->value; + if (Tok->operator==OP_DIVIDE) val=PrevTok->value / NextTok->value; + ListDeleteNode(Curr->Prev); + ListDeleteNode(Curr->Next); + free(PrevTok); + free(NextTok); + Tok->operator=OP_VAL; + Tok->value=val; + } + + Curr=ListGetNext(Curr); +} + +return(val); +} + +double ProcessExpn(ListNode *Tokens) +{ +ListNode *Curr; +ExprToken *Tok, *PrevTok, *NextTok; +double val=0; +int count; + +Curr=ListGetNext(Tokens); +while (Curr) +{ + Tok=Curr->Item; + if ( + (Tok->operator==OP_MOD) || + (Tok->operator==OP_POW) + ) + { + PrevTok=(ExprToken *) Curr->Prev->Item; + NextTok=(ExprToken *) Curr->Next->Item; + if (Tok->operator==OP_MOD) val=(int) PrevTok->value % (int) NextTok->value; + if (Tok->operator==OP_POW) + { + val=1.0; + for (count=0; count < NextTok->value; count++) + { + val=val * PrevTok->value; + } + } + ListDeleteNode(Curr->Prev); + ListDeleteNode(Curr->Next); + free(PrevTok); + free(NextTok); + Tok->operator=OP_VAL; + Tok->value=val; + } + + Curr=ListGetNext(Curr); +} + +return(val); +} + + +void ProcessBrackets(ListNode *Tokens) +{ +ListNode *Start=NULL, *Curr, *SubExpr=NULL, *SubCurr=NULL; +ExprToken *Tok; + +Curr=ListGetNext(Tokens); +while (Curr) +{ + Tok=(ExprToken *) Curr->Item; + if (Start) + { + if (Tok->operator==OP_CLOSE) + { + SubCurr->Next=NULL; + //replace end brace with val + Tok->operator=OP_VAL; + Tok->value=ProcessMathExpression(SubExpr); + Start->Next=Curr; + Curr->Prev=Start; + Start=NULL; + } + else + { + SubCurr->Next=Curr; + Curr->Prev=SubCurr; + SubCurr=SubCurr->Next; + } + } + else if (Tok->operator==OP_OPEN) + { + Start=Curr->Prev; + //get rid of pesky leading brace + ListDeleteNode(Curr); + free(Tok); + Curr=Start; + SubExpr=ListCreate(); + SubCurr=SubExpr; + } + Curr=ListGetNext(Curr); +} + +if (SubExpr) ListDestroy(SubExpr,free); +} + +double ProcessMathExpression(ListNode *Tokens) +{ +double val; + +ProcessBrackets(Tokens); +ProcessExpn(Tokens); +ProcessMultDiv(Tokens); +val=ProcessSumExpression(Tokens); +return(val); +} + + +double EvaluateMathStr(char *String) +{ +double val; +char *ptr, *Token=NULL; +int operator; +ListNode *Tokens, *Curr; +ExprToken *Tok; + +Tokens=ListCreate(); +ptr=GetMathExprToken(String,&Token); +while (ptr) +{ + operator=MatchTokenFromList(Token,OpStrings,0); + if (operator==-1) operator=OP_VAL; + Tok=(ExprToken *) calloc(1,sizeof(ExprToken)); + Tok->operator=operator; + if (operator==OP_VAL) + { + Tok->value=atof(Token); + } + ListAddItem(Tokens,Tok); + ptr=GetMathExprToken(ptr,&Token); +} + +val=ProcessMathExpression(Tokens); + +ListDestroy(Tokens,free); +DestroyString(Token); + +return(val); +} + diff --git a/libUseful-2.0/MathExpr.h b/libUseful-2.0/MathExpr.h new file mode 100644 index 0000000..5614937 --- /dev/null +++ b/libUseful-2.0/MathExpr.h @@ -0,0 +1,19 @@ +#ifndef LIBUSEFUL_MATHEXPR_H +#define LIBUSEFUL_MATHEXPR_H + +#include "includes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +double EvaluateMathStr(char *String); + + +#ifdef __cplusplus +} +#endif + + + +#endif diff --git a/libUseful-2.0/ParseURL.c b/libUseful-2.0/ParseURL.c new file mode 100644 index 0000000..2b5ac71 --- /dev/null +++ b/libUseful-2.0/ParseURL.c @@ -0,0 +1,132 @@ +#include "ParseURL.h" + + +void ParseHostDetails(char *Data,char **Host,char **Port,char **User, char **Password) +{ +char *Token=NULL, *ptr, *tptr; + +if (Port) *Port=CopyStr(*Port,""); +if (Host) *Host=CopyStr(*Host,""); +if (User) *User=CopyStr(*User,""); +if (Password) *Password=CopyStr(*Password,""); + +ptr=strrchr(Data,'@'); +if (ptr) +{ + ptr=GetToken(Data,"@",&Token,0); + if (User) + { + tptr=GetToken(Token,":",User,0); + if (StrLen(tptr)) *Password=CopyStr(*Password,tptr); + } +} +else ptr=Data; + +if (Host) ptr=GetToken(ptr,":",Host,0); +if (Port && StrLen(ptr)) *Port=CopyStr(*Port,ptr); + +DestroyString(Token); +} + + + + + +void ParseURL(char *URL, char **Proto, char **Host, char **Port, char **User, char **Password, char **Path, char **Args) +{ +char *ptr, *aptr; +char *Token=NULL, *tProto=NULL; + + +//Even if they pass NULL for protocol, we need to take a copy for use in +//the 'guess the port' section below +ptr=strchr(URL,':'); +if (ptr) +{ + tProto=CopyStrLen(tProto,URL,ptr-URL); + strlwr(tProto); + if (Proto) *Proto=CopyStr(*Proto,tProto); + + ptr++; + //some number of '//' follow protocol + while (*ptr=='/') ptr++; + + ptr=GetToken(ptr,"/",&Token,0); + ParseHostDetails(Token,Host,Port,User,Password); +} +else ptr=URL; + +while (*ptr=='/') ptr++; + +if (ptr) +{ +if (Path) +{ + *Path=MCopyStr(*Path,"/",ptr,NULL); + + //Only split the HTTP CGI arguments from the document path if we were + //asked to return the args seperately + if (Args) + { + aptr=strrchr(*Path,'?'); + if (aptr) + { + *aptr='\0'; + aptr++; + *Args=CopyStr(*Args,aptr); + } + } +} +} + +//the 'GetToken' call will have thrown away the '/' at the start of the path +//add it back in + +if (Port && (! StrLen(*Port)) && StrLen(tProto)) +{ + if (strcmp(tProto,"http")==0) *Port=CopyStr(*Port,"80"); + else if (strcmp(tProto,"https")==0) *Port=CopyStr(*Port,"443"); + else if (strcmp(tProto,"ssh")==0) *Port=CopyStr(*Port,"22"); + else if (strcmp(tProto,"ftp")==0) *Port=CopyStr(*Port,"21"); + else if (strcmp(tProto,"telnet")==0) *Port=CopyStr(*Port,"23"); + else if (strcmp(tProto,"smtp")==0) *Port=CopyStr(*Port,"25"); + else if (strcmp(tProto,"mailto")==0) *Port=CopyStr(*Port,"25"); + +} + + +DestroyString(Token); +DestroyString(tProto); +} + + + + + + +void ParseConnectDetails(char *Str, char **Type, char **Host, char **Port, char **User, char **Pass, char **Path) +{ +char *ptr, *Token=NULL, *Args=NULL; + +ptr=GetToken(Str," ",&Token,0); +ParseURL(Token, Type, Host, Port, User, Pass, Path, &Args); + +if (Path && StrLen(Args)) *Path=MCatStr(*Path,"?",Args,NULL); + +while (ptr) +{ + if (strcmp(Token,"-password")==0) ptr=GetToken(ptr," ",Pass,0); + else if (strcmp(Token,"-keyfile")==0) + { + ptr=GetToken(ptr," ",&Token,0); + *Pass=MCopyStr(*Pass,"keyfile:",Token,NULL); + } +ptr=GetToken(ptr," ",&Token,0); +} + +DestroyString(Token); +DestroyString(Args); +} + + + diff --git a/libUseful-2.0/ParseURL.h b/libUseful-2.0/ParseURL.h new file mode 100644 index 0000000..4c390d7 --- /dev/null +++ b/libUseful-2.0/ParseURL.h @@ -0,0 +1,18 @@ +#ifndef LIBUSEFUL_PARSEURL +#define LIBUSEFUL_PARSEURL + +#include "includes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void ParseURL(char *URL, char **Proto, char **Host, char **Port, char **User, char **Password, char **Path, char **Args); +void ParseConnectDetails(char *Str, char **Type, char **Host, char **Port, char **User, char **Pass, char **InitDir); +void ParseConnectHop(char *Line, int *Type, char **Host, char **User, char **Password, char **KeyFile, int *Port); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libUseful-2.0/PatternMatch.c b/libUseful-2.0/PatternMatch.c new file mode 100644 index 0000000..0ad6699 --- /dev/null +++ b/libUseful-2.0/PatternMatch.c @@ -0,0 +1,528 @@ +#include "PatternMatch.h" + +typedef enum {MATCH_FAIL, MATCH_FOUND, MATCH_ONE, MATCH_MANY, MATCH_REPEAT, MATCH_CONT, MATCH_QUOT, MATCH_START, MATCH_CHARLIST, MATCH_HEX, MATCH_OCTAL, MATCH_SWITCH_ON, MATCH_SWITCH_OFF} TPMatchElements; + +//Gets Called recursively +int pmatch_char(char **P_PtrPtr, char **S_PtrPtr, int *Flags); +int pmatch_search(char *Pattern, char **S_PtrPtr, char *S_End, char **Start, char **End, int *Flags); + + +int pmatch_ascii(char *P_Ptr,char S_Char,int Type) +{ +char ValStr[4]; +int P_Char=-1; + +if (Type==MATCH_HEX) +{ + strncpy(ValStr,P_Ptr,2); + P_Char=strtol(P_Ptr,NULL,16); +} + +if (Type==MATCH_OCTAL) +{ + strncpy(ValStr,P_Ptr,3); + P_Char=strtol(P_Ptr,NULL,8); +} + +if (P_Char==-1) return(FALSE); + +if (P_Char==S_Char) return(TRUE); + +return(FALSE); +} + + +void pmatch_switch(char SwitchType, char SwitchOnOrOff, int *Flags) +{ +int NewFlag=0, OnOrOff=FALSE; + +if (SwitchOnOrOff==MATCH_SWITCH_ON) OnOrOff=TRUE; +else if (SwitchOnOrOff==MATCH_SWITCH_OFF) OnOrOff=FALSE; +else return; + +switch (SwitchType) +{ +//These switches have the opposite meaning to the flags they control. +//+C turns case sensitivity on, but the flag is 'PMATCH_NOCASE' that +//turns it off, so we need to invert the sense of 'OnOrOff' +case 'C': NewFlag=PMATCH_NOCASE; OnOrOff= !OnOrOff; break; +case 'W': NewFlag=PMATCH_NOWILDCARDS; OnOrOff= !OnOrOff; break; +case 'X': NewFlag=PMATCH_NOEXTRACT; OnOrOff= !OnOrOff; break; + +case 'N': NewFlag=PMATCH_NEWLINEEND; break; +} + +if (OnOrOff) *Flags |= NewFlag; +else *Flags &= ~NewFlag; + +} + + + +int pmatch_quot(char **P_PtrPtr, char **S_PtrPtr, int *Flags) +{ +int result=MATCH_FAIL, OldFlags; +char P_Char, S_Char, *OldPos; + +P_Char=**P_PtrPtr; +S_Char=**S_PtrPtr; + +switch (P_Char) +{ + case 'b': if (S_Char=='\b') result=MATCH_ONE; break; + case 'e': if (S_Char==27) result=MATCH_ONE; break; //escape + case 'n': if (S_Char=='\n') result=MATCH_ONE; break; + case 'r': if (S_Char=='\r') result=MATCH_ONE; break; + case 't': if (S_Char==' ') result=MATCH_ONE; break; + case 'l': if (islower(S_Char)) result=MATCH_ONE; break; + case 'x': result=MATCH_HEX; break; + case 'A': if (isalpha(S_Char)) result=MATCH_ONE; break; + case 'B': if (isalnum(S_Char)) result=MATCH_ONE; break; + case 'D': if (isdigit(S_Char)) result=MATCH_ONE; break; + case 'S': + /* + if ((S_Char=='\x1b') && (*((*S_PtrPtr)+1)=='[')) + { + //treat vt escape seqences as space + while ((S_Char !='m') && (S_Char != '\0')) + { + (*S_PtrPtr)++; + S_Char=**S_PtrPtr; + } + result=MATCH_ONE; + } + */ + if (isspace(S_Char)) result=MATCH_ONE; + break; + case 'P': if (ispunct(S_Char)) result=MATCH_ONE; break; + case 'X': if (isxdigit(S_Char)) result=MATCH_ONE; break; + case 'U': if (isupper(S_Char)) result=MATCH_ONE; break; + case '+': result=MATCH_SWITCH_ON; break; + case '-': result=MATCH_SWITCH_OFF; break; + + default: if (S_Char==P_Char) result=MATCH_ONE; break; +} + +switch (result) +{ + case MATCH_ONE: + (*P_PtrPtr)++; + break; + + case MATCH_HEX: + if (! pmatch_ascii((*P_PtrPtr)+1,S_Char,MATCH_HEX)) return(MATCH_FAIL); + (*P_PtrPtr)+=2; + break; + + case MATCH_OCTAL: + if (! pmatch_ascii((*P_PtrPtr)+1,S_Char,MATCH_OCTAL)) return(MATCH_FAIL); + (*P_PtrPtr)+=3; + break; + + case MATCH_SWITCH_ON: + case MATCH_SWITCH_OFF: + + + //some switches need to be applied in order for a pattern to match + //(like the case-insensitive switch) others should only be applied if + //it matches. So we apply the switch, but if the subsequent pmatch_char fails + //we unapply it + OldFlags=*Flags; + OldPos=*P_PtrPtr; + (*P_PtrPtr)++; //go past the + or - to the actual type + pmatch_switch(**P_PtrPtr, result, Flags); + (*P_PtrPtr)++; + result=pmatch_char(P_PtrPtr, S_PtrPtr, Flags); + + if ((result==MATCH_FAIL) || (result==MATCH_CONT)) + { + *P_PtrPtr=OldPos; + *Flags=OldFlags; + } + return(result); + break; + + case MATCH_FAIL: + if (*Flags & PMATCH_SUBSTR) return(MATCH_CONT); + return(MATCH_FAIL); + break; +} + +return(MATCH_ONE); +} + + +#define CHARLIST_NOT 1 + +int pmatch_charlist(char **P_PtrPtr,char S_Char, int Flags) +{ +char P_Char, Prev_Char; +int result=MATCH_CONT; +int mode=0; + + +while (**P_PtrPtr != '\0') +{ + if (Flags & PMATCH_NOCASE) P_Char=tolower(**P_PtrPtr); + else P_Char=**P_PtrPtr; + + if (P_Char==']') break; + + switch (P_Char) + { + case '\\': + (*P_PtrPtr)++; + if (Flags & PMATCH_NOCASE) P_Char=tolower(**P_PtrPtr); + else P_Char=**P_PtrPtr; + break; + + case '-': + (*P_PtrPtr)++; + if (Flags & PMATCH_NOCASE) P_Char=tolower(**P_PtrPtr); + else P_Char=**P_PtrPtr; + + if ((S_Char >= Prev_Char) && (S_Char <= P_Char)) result=MATCH_ONE; + break; + + case '!': + mode |= CHARLIST_NOT; + break; + + default: + if (P_Char == S_Char) result=MATCH_ONE; + break; + } + + Prev_Char=P_Char; + (*P_PtrPtr)++; +} + +//go beyond ']' +(*P_PtrPtr)++; + +if (mode & CHARLIST_NOT) +{ + if (result==MATCH_ONE) result=MATCH_CONT; + else result=MATCH_ONE; +} + +return(result); +} + + + +int pmatch_repeat(char **P_PtrPtr, char **S_PtrPtr, char *S_End, int *Flags) +{ +char *SubPattern=NULL, *sp_ptr, *ptr; +int count=0, i, val=0, result=MATCH_FAIL; + +ptr=*P_PtrPtr; +while ( ((**P_PtrPtr) != '}') && ((**P_PtrPtr) != '\0') ) (*P_PtrPtr)++; +if ((**P_PtrPtr)=='\0') return(MATCH_FAIL); + +SubPattern=CopyStrLen(SubPattern,ptr,*P_PtrPtr - ptr); + +sp_ptr=strchr(SubPattern,'|'); +if (sp_ptr) +{ + *sp_ptr='\0'; + sp_ptr++; + count=atoi(SubPattern); + for (i=0; i < count; i++) + { + val=0; + result=pmatch_search(sp_ptr, S_PtrPtr, S_End, NULL, NULL, &val); + if (result==MATCH_CONT) result=MATCH_FAIL; + if (result==MATCH_FAIL) break; + } +} + +(*S_PtrPtr)--; +(*P_PtrPtr)++; +DestroyString(SubPattern); +return(result); +} + + + + +int pmatch_char(char **P_PtrPtr, char **S_PtrPtr, int *Flags) +{ +char P_Char, S_Char, *P_Start; +int result=MATCH_FAIL; + +P_Start=*P_PtrPtr; +if (*Flags & PMATCH_NOCASE) +{ + P_Char=tolower(**P_PtrPtr); + S_Char=tolower(**S_PtrPtr); +} +else +{ + P_Char=**P_PtrPtr; + S_Char=**S_PtrPtr; +} + + + +//we must still honor switches even if 'nowildcards' is set, as we may want to turn +//'nowildcards' off, or turn case or extraction features on or off +if (*Flags & PMATCH_NOWILDCARDS) +{ + if ( + (P_Char=='\\') && + ((*(*P_PtrPtr+1)=='+') || (*(*P_PtrPtr+1)=='-')) + ) /*This is a switch, fall through and process it */ ; + else if (P_Char==S_Char) return(MATCH_ONE); + else return(MATCH_FAIL); +} + +switch (P_Char) +{ + case '\0': result=MATCH_FOUND; break; + case '|': result=MATCH_FOUND; break; + case '*': result=MATCH_MANY;break; + case '?': (*P_PtrPtr)++; result=MATCH_ONE;break; + case '^': (*P_PtrPtr)++; result=MATCH_START; break; + case '$': + if (S_Char=='\0') result=MATCH_FOUND; + else if ((*Flags & PMATCH_NEWLINEEND) && (S_Char=='\n')) result=MATCH_FOUND; + break; + case '[': (*P_PtrPtr)++; result=pmatch_charlist(P_PtrPtr,S_Char,*Flags); break; + + case '{': (*P_PtrPtr)++; result=MATCH_REPEAT; break; + + case '\\': + //results here can either be MATCH_FAIL, MATCH_CONT, MATCH_ONE + (*P_PtrPtr)++; + result=pmatch_quot(P_PtrPtr, S_PtrPtr, Flags); + break; + + default: + (*P_PtrPtr)++; + if (P_Char==S_Char) result=MATCH_ONE; + else if (*Flags & PMATCH_SUBSTR) result=MATCH_CONT; + else result=MATCH_FAIL; + break; +} + +if ((result==MATCH_CONT) || (result==MATCH_FAIL)) *(P_PtrPtr)=P_Start; + +return(result); +} + + + +//Somewhat ugly, as we need to iterate through the string, so we need it passed as a ** +int pmatch_search(char *Pattern, char **S_PtrPtr, char *S_End, char **MatchStart, char **MatchEnd, int *Flags) +{ +int result; +char *P_Ptr, *ptr, *S_Start; + + if (MatchStart) *MatchStart=NULL; + if (MatchEnd) *MatchEnd=NULL; + + P_Ptr=Pattern; + S_Start=*S_PtrPtr; + result=pmatch_char(&P_Ptr, S_PtrPtr, Flags); + while (*S_PtrPtr <= S_End) + { + switch (result) + { + case MATCH_FAIL: + if (*Flags & PMATCH_SUBSTR) return(MATCH_CONT); + return(MATCH_FAIL); + break; + + //Match failed, but we're looking for a substring of 'String' so continue searching for match + case MATCH_CONT: + if (! (*Flags & PMATCH_SUBSTR)) return(MATCH_FAIL); + //if we were some ways through a pattern before hitting the character + //that failed the match, then we must rewind to reconsider that character + //as a fresh match + //if ((*P_Ptr != *Pattern) && (*Pattern != '^')) (*S_PtrPtr)--; + if ((*P_Ptr != *Pattern) ) (*S_PtrPtr)--; + P_Ptr=Pattern; + break; + + case MATCH_START: + if (*Flags & PMATCH_NOTSTART) return(MATCH_FAIL); + (*S_PtrPtr)--; //naughty, were are now pointing before String, but the + //S_Ptr++ below will correct this + break; + + + case MATCH_FOUND: + if (*Flags & PMATCH_NOEXTRACT) + { + //This is to prevent returning NULL strings in 'MatchStart' and 'MatchEnd' + if (MatchStart && (! *MatchStart)) *MatchStart=S_Start; + if (MatchEnd && (! *MatchEnd)) *MatchEnd=*MatchStart; + } + //else if (MatchEnd) *MatchEnd=*S_PtrPtr; + return(MATCH_ONE); + break; + + //Match many is a special case. We have too look ahead to see if the next char + //Matches, and thus takes us out of 'match many' howerver, If the call to pmatch_char + //fails then we have to rewind the pattern pointer to match many's '*' and go round again + case MATCH_MANY: + ptr=P_Ptr; + P_Ptr++; + + //pmatch_char will think that if we've reached the end of the pattern, then we've got + //a match, regardless of where we are in the string. However, this is the one case where + //'*' needs to be a little 'greedy'. If the last item in the pattern was '*' (match many) + //then we need to continue until we read the end of the string + if (*P_Ptr=='\0') + { + if (*S_PtrPtr == S_End) result=MATCH_FOUND; + else result=MATCH_FAIL; + } + else + { + if (*S_PtrPtr == S_End) result=MATCH_FAIL; + else result=pmatch_char(&P_Ptr, S_PtrPtr, Flags); + } + + if ((result==MATCH_FAIL) || (result==MATCH_CONT)) P_Ptr=ptr; + break; + + case MATCH_REPEAT: + result=pmatch_repeat(&P_Ptr, S_PtrPtr, S_End, Flags); + if (result==MATCH_FAIL) + { + if (*Flags & PMATCH_SUBSTR) return(MATCH_CONT); + return(MATCH_FAIL); + } + break; + } + + if ((result==MATCH_CONT) ) + { + if (MatchStart) *MatchStart=NULL; + if (MatchEnd) *MatchEnd=NULL; + } + else if (! (*Flags & PMATCH_NOEXTRACT)) + { + if (MatchStart && (*S_PtrPtr >= S_Start) && (! *MatchStart)) *MatchStart=*S_PtrPtr; + if (MatchEnd && ((*(S_PtrPtr)+1) < S_End)) *MatchEnd=(*S_PtrPtr)+1; + } + + //Handle 'MATCH_FOUND' in the switch statement, don't iterate further through Pattern or String + if (result==MATCH_FOUND) continue; + + (*S_PtrPtr)++; + //if (*S_PtrPtr > S_End) break; + + result=pmatch_char(&P_Ptr, S_PtrPtr, Flags); + } + +//if pattern not exhausted then we didn't get a match +if (*P_Ptr !='\0') return(MATCH_CONT); + +return(MATCH_ONE); +} + + + + +//Wrapper around pmatch_search to make it more user friendly +int pmatch_process_one(char *Pattern, char *String, int len, char **Start, char **End, int Flags) +{ +char *S_Ptr, *S_End; + + S_Ptr=String; + S_End=String+len; + if (Start) *Start=NULL; + if (End) *End=NULL; + + return(pmatch_search(Pattern, &S_Ptr, S_End, Start, End, &Flags)); +} + + + + +int pmatch_process(char **Compiled, char *String, int len, ListNode *Matches, int iFlags) +{ +//p_ptr points to the pattern from 'Compiled' that's currently being +//tested. s_ptr holds our progress through the string +char **p_ptr; +char *s_ptr, *s_end, *tp_ptr, *ts_ptr; +char *Start=NULL, *End=NULL; +int result, Flags; +TPMatch *Match; +int NoOfItems=0; + +Flags=iFlags &= ~PMATCH_SUBSTR; +s_end=String+len; +//We handle PMATCH substr in this function +for (s_ptr=String; s_ptr < s_end; s_ptr++) +{ + for (p_ptr=Compiled; *p_ptr != NULL; p_ptr++) + { + result=pmatch_process_one(*p_ptr, s_ptr, s_end-s_ptr, &Start, &End, Flags); + if (result==MATCH_ONE) + { + NoOfItems++; + if (Matches) + { + Match=(TPMatch *) calloc(1, sizeof(TPMatch)); + Match->Start=Start; + Match->End=End; + ListAddItem(Matches,Match); + } + } + } + Flags |= PMATCH_NOTSTART; +} + +return(NoOfItems); +} + + + +void pmatch_compile(char *Pattern, char ***Compiled) +{ +int NoOfRecords=0, NoOfItems=0;; +char *ptr; + +ptr=Pattern; + +while (ptr && (*ptr != '\0')) +{ + //while ((*ptr=='?') || (*ptr=='*')) ptr++; + NoOfItems++; + if (NoOfItems >= NoOfRecords) + { + NoOfRecords+=10; + *Compiled=(char **) realloc(*Compiled,NoOfRecords*sizeof(char *)); + + } + (*Compiled)[NoOfItems-1]=ptr; + while ((*ptr !='\0') && (*ptr != '|')) ptr++; + if (*ptr=='|') ptr++; +} + +*Compiled=(char **) realloc(*Compiled,(NoOfRecords+1)*sizeof(char *)); +(*Compiled)[NoOfItems]=NULL; +} + + + +int pmatch(char *Pattern, char *String, int Len, ListNode *Matches, int Flags) +{ +char *ptr, *end, **Compiled=NULL; +int result, len; + + pmatch_compile(Pattern,&Compiled); + + ptr=String; + len=Len; + end=String+len; + + result=pmatch_process(Compiled, ptr, len, Matches, Flags); + + if (Compiled) free(Compiled); + return(result); +} diff --git a/libUseful-2.0/PatternMatch.h b/libUseful-2.0/PatternMatch.h new file mode 100644 index 0000000..594cd84 --- /dev/null +++ b/libUseful-2.0/PatternMatch.h @@ -0,0 +1,31 @@ +#ifndef LIBUSEFUL_MATCHPATTERN +#define LIBUSEFUL_MATCHPATTERN + +#define PMATCH_SUBSTR 1 +#define PMATCH_NOWILDCARDS 2 +#define PMATCH_NOCASE 4 +#define PMATCH_NOEXTRACT 8 +#define PMATCH_NEWLINEEND 16 +#define PMATCH_NOTSTART 32 +#define PMATCH_NOTEND 64 + +#include "includes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ +char *Start; +char *End; +} TPMatch; + +int pmatch(char *Pattern, char *String, int Len, ListNode *Matches, int Flags); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libUseful-2.0/SpawnPrograms.c b/libUseful-2.0/SpawnPrograms.c new file mode 100644 index 0000000..a33c247 --- /dev/null +++ b/libUseful-2.0/SpawnPrograms.c @@ -0,0 +1,325 @@ +#include "SpawnPrograms.h" +#include "libsettings.h" +#include "pty.h" +#include "file.h" +#include "string.h" +#include + +char *MakeShellSafeString(char *RetStr, const char *String, int SafeLevel) +{ +char *Tempstr=NULL; +char *BadChars=";|$`"; + +if (SafeLevel==SHELLSAFE_BLANK) +{ + Tempstr=CopyStr(RetStr,String); + strmrep(Tempstr,BadChars,' '); +} +else Tempstr=QuoteCharsInStr(RetStr,String,BadChars); + +if (strcmp(Tempstr,String) !=0) +{ + //if (EventCallback) EventCallback(String); +} +return(Tempstr); +} + + +pid_t ForkWithContext() +{ +char *ptr; +pid_t pid; + +LogFileFlushAll(TRUE); +pid=fork(); +if (pid==0) +{ + ptr=LibUsefulGetValue("FORK:Dir"); + if (StrLen(ptr)) chdir(ptr); + ptr=LibUsefulGetValue("FORK:User"); + if (StrLen(ptr)) SwitchUser(ptr); + ptr=LibUsefulGetValue("FORK:Group"); + if (StrLen(ptr)) SwitchGroup(ptr); +} +return(pid); +} + + +/* This function turns our process into a demon */ +int demonize() +{ +int result, i=0; + +LogFileFlushAll(TRUE); +//Don't fork with context here, as a demonize involves two forks, so +//it's wasted work here. +result=fork(); +if (result != 0) exit(0); + +/*we can only get to here if result= 0 i.e. we are the child process*/ +setsid(); + +result=ForkWithContext(); +if (result !=0) exit(0); +umask(0); + +/* close stdin, stdout and std error, but only if they are a tty. In some */ +/* situations (like working out of cron) we may not have been given in/out/err */ +/* and thus the first files we open will be 0,1,2. If we close them, we will have */ +/* closed files that we need! Alternatively, the user may have used shell redirection */ +/* to send output for a file, and I'm sure they don't want us to close that file */ + +//for (i=0; i < 3; i++) +{ + if (isatty(i)) + { + close(i); + /* reopen to /dev/null so that any output gets thrown away */ + /* but the program still has somewhere to write to */ + open("/dev/null",O_RDWR); + } +} + + +return(1); +} + + + +int ForkWithIO(int StdIn, int StdOut, int StdErr) +{ +pid_t pid; +int fd; + +pid=ForkWithContext(); +if (pid==0) +{ + if (StdIn > -1) + { + if (StdIn !=0) + { + close(0); + dup(StdIn); + } + } + else + { + fd=open("/dev/null",O_RDONLY); + dup(fd); + close(fd); + } + + if (StdOut > -1) + { + if (StdOut !=1) + { + close(1); + dup(StdOut); + } + } + else + { + fd=open("/dev/null",O_WRONLY); + dup(fd); + close(fd); + } + + if (StdErr > -1) + { + if (StdErr !=2) + { + close(2); + dup(StdErr); + } + } +} +else +{ + fd=open("/dev/null",O_WRONLY); + dup(fd); + close(fd); +} + +return(pid); +} + + + +pid_t SpawnWithIO(char *CommandLine, int StdIn, int StdOut, int StdErr) +{ +pid_t pid; +int fd, i; + +pid=ForkWithIO(StdIn,StdOut,StdErr); +if (pid==0) +{ +SwitchProgram(CommandLine); +_exit(pid); +} + +return(pid); +} + + +int Spawn(char *ProgName) +{ +return(SpawnWithIO(ProgName, 0,1,2)); +} + + +/* This creates a child process that we can talk to using a couple of pipes*/ +pid_t PipeSpawnFunction(int *infd,int *outfd,int *errfd, BASIC_FUNC Func, void *Data ) +{ +pid_t pid; +int channel1[2], channel2[2], channel3[2], DevNull=-1; +int count; + +if (infd) pipe(channel1); +if (outfd) pipe(channel2); +if (errfd) pipe(channel3); + +pid=ForkWithContext(); +if (pid==0) +{ +/* we are the child */ +if (infd) close(channel1[1]); +else if (DevNull==-1) DevNull=open("/dev/null",O_RDWR); +if (outfd) close(channel2[0]); +else if (DevNull==-1) DevNull=open("/dev/null",O_RDWR); +if (errfd) close(channel3[0]); +else if (DevNull==-1) DevNull=open("/dev/null",O_RDWR); + +/*close stdin, stdout and stderr*/ +close(0); +close(1); +close(2); +/*channel 1 is going to be our stdin, so we close the writing side of it*/ +if (infd) dup(channel1[0]); +else dup(DevNull); +/* channel 2 is stdout */ +if (outfd) dup(channel2[1]); +else dup(DevNull); +/* channel 3 is stderr */ +if (errfd) +{ + if (errfd==COMMS_COMBINE_STDERR) dup(channel2[1]); + else dup(channel3[1]); +} +else dup(DevNull); + +Func(Data); +exit(0); +} +else +{ +/* we close the appropriate halves of the link */ +if (infd) +{ + close(channel1[0]); + *infd=channel1[1]; +} +if (outfd) +{ + close(channel2[1]); + *outfd=channel2[0]; +} +if (errfd) +{ + close(channel3[1]); + *errfd=channel3[0]; +} + +} + +return(pid); +} + + +int BASIC_FUNC_EXEC_COMMAND(void *Data) +{ +return(execl("/bin/sh","/bin/sh","-c",(char *) Data,NULL)); +} + + +pid_t PipeSpawn(int *infd,int *outfd,int *errfd, const char *Command) +{ +return(PipeSpawnFunction(infd,outfd,errfd, BASIC_FUNC_EXEC_COMMAND, (void *) Command)); +} + + + + +pid_t PseudoTTYSpawnFunction(int *ret_pty, BASIC_FUNC Func, void *Data, int TTYFlags) +{ +pid_t pid; +int tty, pty, i; +STREAM *S; +char *Tempstr=NULL; + +if (GrabPseudoTTY(&pty, &tty, TTYFlags)) +{ +pid=ForkWithContext(); +if (pid==0) +{ +for (i=0; i < 4; i++) close(i); +close(pty); + +setsid(); +dup(tty); +dup(tty); +dup(tty); +ioctl(tty,TIOCSCTTY,0); +Func((char *) Data); +_exit(0); +} + +close(tty); +} + +*ret_pty=pty; +return(pid); +} + + +pid_t PseudoTTYSpawn(int *pty, const char *Command, int TTYFlags) +{ +return(PseudoTTYSpawnFunction(pty, BASIC_FUNC_EXEC_COMMAND, (void *) Command,TTYFlags)); +} + + +STREAM *STREAMSpawnCommand(const char *Command, int Flags) +{ +int to_fd, from_fd; +pid_t pid; +STREAM *S=NULL; +char *Tempstr=NULL; + + +if (Flags & SPAWN_TRUST_COMMAND) Tempstr=CopyStr(Tempstr,Command); +else Tempstr=MakeShellSafeString(Tempstr, Command, 0); + +if (Flags & COMMS_BY_PTY) +{ + pid=PseudoTTYSpawn(&to_fd,Tempstr,Flags); + if (pid > 0) S=STREAMFromFD(to_fd); +} +else +{ + if (Flags & COMMS_COMBINE_STDERR) + { + pid=PipeSpawn(&to_fd, &from_fd, COMMS_COMBINE_STDERR, Tempstr); + } + else pid=PipeSpawn(&to_fd, &from_fd, NULL, Tempstr); + if (pid > 0) S=STREAMFromDualFD(from_fd, to_fd); +} + +if (S) +{ + STREAMSetFlushType(S,FLUSH_LINE,0); + Tempstr=FormatStr(Tempstr,"%d",pid); + STREAMSetValue(S,"PeerPID",Tempstr); +} + +DestroyString(Tempstr); +return(S); +} diff --git a/libUseful-2.0/SpawnPrograms.h b/libUseful-2.0/SpawnPrograms.h new file mode 100644 index 0000000..cf5fb4c --- /dev/null +++ b/libUseful-2.0/SpawnPrograms.h @@ -0,0 +1,37 @@ +#ifndef LIBUSEFUL_SPAWN_H +#define LIBUSEFUL_SPAWN_H + +#include "includes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define COMMS_BY_PIPE 0 +#define COMMS_BY_PTY 1 +#define SPAWN_TRUST_COMMAND 2 +#define COMMS_COMBINE_STDERR 4 + +//up to 128, beyond that is TTYFLAG_ + +#define SHELLSAFE_BLANK 1 + +char *MakeShellSafeString(char *RetStr, const char *String, int SafeLevel); +int ForkWithContext(); +/* This function turns our process into a demon */ +int demonize(); +int ForkWithIO(int StdIn, int StdOut, int StdErr); +int SpawnWithIO(char *CommandLine, int StdIn, int StdOut, int StdErr); +int Spawn(char *ProgName); +/* This creates a child process that we can talk to using a couple of pipes*/ +int PipeSpawnFunction(int *infd,int *outfd,int *errfd, BASIC_FUNC Func, void *Data ); +int PipeSpawn(int *infd,int *outfd,int *errfd, const char *Command); +int PseudoTTYSpawn(int *pty, const char *Command, int Flags); +STREAM *STREAMSpawnCommand(const char *Command, int Type); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/Time.c b/libUseful-2.0/Time.c new file mode 100644 index 0000000..0633d96 --- /dev/null +++ b/libUseful-2.0/Time.c @@ -0,0 +1,89 @@ +#include "Time.h" + +char *GetDateStrFromSecs(char *DateFormat, time_t Secs, char *TimeZone) +{ +time_t val; +struct tm *TMS; +static char *Buffer=NULL; +char *Tempstr=NULL; +#define DATE_BUFF_LEN 255 + +val=Secs; + +if (StrLen(TimeZone)) +{ +if (getenv("TZ")) Tempstr=CopyStr(Tempstr,getenv("TZ")); +setenv("TZ",TimeZone,TRUE); +tzset(); +} +TMS=localtime(&val); +if (StrLen(TimeZone)) +{ +if (! Tempstr) unsetenv("TZ"); +else setenv("TZ",Tempstr,TRUE); +tzset(); +} + +val=StrLen(DateFormat)+ DATE_BUFF_LEN; +Buffer=SetStrLen(Buffer,val); +strftime(Buffer,val,DateFormat,TMS); + +DestroyString(Tempstr); +return(Buffer); +} + + + +char *GetDateStr(char *DateFormat, char *TimeZone) +{ +time_t Now; + +time(&Now); +return(GetDateStrFromSecs(DateFormat, Now, TimeZone)); +} + + +time_t DateStrToSecs(char *DateFormat, char *Str, char *TimeZone) +{ +time_t Secs=0; +struct tm TMS; +char *Tempstr=NULL; +int val; + +if (StrLen(DateFormat)==0) return(0); +if (StrLen(Str)==0) return(0); + +if (StrLen(TimeZone)) +{ + if (getenv("TZ")) Tempstr=CopyStr(Tempstr,getenv("TZ")); + setenv("TZ",TimeZone,TRUE); + tzset(); +} + +strptime(Str,DateFormat,&TMS); +TMS.tm_isdst=-1; +Secs=mktime(&TMS); + +if (StrLen(TimeZone)) +{ + if (! Tempstr) unsetenv("TZ"); + else setenv("TZ",Tempstr,TRUE); + tzset(); +} +return(Secs); +} +/* A general 'Set Timer' function, Useful for timing out */ +/* socket connections etc */ + +void SetTimeout(int timeout) +{ +struct sigaction SigAct; + +SigAct.sa_handler=&ColLibDefaultSignalHandler; +SigAct.sa_flags=SA_RESETHAND; +//SigAct.sa_restorer=NULL; + +sigaction(SIGALRM,&SigAct,NULL); +alarm(timeout); +} + diff --git a/libUseful-2.0/Time.h b/libUseful-2.0/Time.h new file mode 100644 index 0000000..5635789 --- /dev/null +++ b/libUseful-2.0/Time.h @@ -0,0 +1,23 @@ +#ifndef LIBUSEFUL_TIME_H +#define LIBUSEFUL_TIME_H + +#include "includes.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +char *GetDateStrFromSecs(char *DateFormat, time_t Secs, char *TimeZone); +char *GetDateStr(char *DateFormat, char *TimeZone); +time_t DateStrToSecs(char *DateFormat, char *Str, char *TimeZone); +void SetTimeout(int timeout); + + +#ifdef __cplusplus +} +#endif + + + +#endif diff --git a/libUseful-2.0/Vars.c b/libUseful-2.0/Vars.c new file mode 100644 index 0000000..d070463 --- /dev/null +++ b/libUseful-2.0/Vars.c @@ -0,0 +1,338 @@ +#include "includes.h" +#include "defines.h" +#include "list.h" + +void SetVar(ListNode *Vars, const char *Name, const char *Data) +{ +ListNode *Node; +char *Tempstr=NULL; + +Tempstr=CopyStr(Tempstr,Name); +//strlwr(Tempstr); +Node=ListFindNamedItem(Vars,Tempstr); +if (Node) Node->Item=(void *) CopyStr((char *) Node->Item,Data); +else ListAddNamedItem(Vars,Tempstr,CopyStr(NULL,Data)); + +DestroyString(Tempstr); +} + +char *GetVar(ListNode *Vars, const char *Name) +{ +ListNode *Node; +char *Tempstr=NULL; + +Tempstr=CopyStr(Tempstr,Name); +//strlwr(Tempstr); +Node=ListFindNamedItem(Vars,Tempstr); +DestroyString(Tempstr); +if (Node) return((char *) Node->Item); +return(NULL); +} + + +void UnsetVar(ListNode *Vars,const char *Name) +{ +ListNode *Curr; +char *Str=NULL; +char *Tempstr=NULL; + +if (Vars) return; +Tempstr=CopyStr(Tempstr,Name); +strlwr(Tempstr); +Curr=ListFindNamedItem(Vars,Tempstr); +if (Curr) +{ + Str=ListDeleteNode(Curr); + DestroyString(Str); +} +DestroyString(Tempstr); +} + + +void ClearVars(ListNode *Vars) +{ +ListNode *Curr; +char *Str; + +if (! Vars) return; +Curr=ListGetNext(Vars); +while (Curr) +{ + Str=ListDeleteNode(Curr); + DestroyString(Str); +Curr=ListGetNext(Curr); +} + + +} + + + +void CopyVars(ListNode *Dest, ListNode *Source) +{ +ListNode *Curr; +char *Str; + +if (! Dest) return; +if (! Source) return; +Curr=ListGetNext(Source); +while (Curr) +{ +SetVar(Dest,Curr->Tag,Curr->Item); +Curr=ListGetNext(Curr); +} + +} + + + +char *ParseVar(char *Buff, const char **Line, ListNode *LocalVars, int Flags) +{ +char *VarName=NULL, *OutStr=NULL, *Tempstr=NULL; +const char *ptr, *vptr; + +OutStr=Buff; +ptr=*Line; + +if (*ptr=='(') ptr++; + + while ((*ptr !=')') && (*ptr !='\0')) + { + if (*ptr=='$') + { + ptr++; + Tempstr=ParseVar(Tempstr,&ptr,LocalVars,Flags); + VarName=CatStr(VarName,Tempstr); + } + else VarName=AddCharToStr(VarName,*ptr); + ptr++; + } + +*Line=ptr; //very important! Otherwise the calling process will not + //know we have consumed some of the text! + + //Now lookup var/format/append to output + if (! (Flags & SUBS_CASE_VARNAMES)) strlwr(VarName); + + vptr=GetVar(LocalVars,VarName); + + if (Flags & SUBS_QUOTE_VARS) OutStr=CatStr(OutStr,"'"); + + if (Flags & SUBS_STRIP_VARS_WHITESPACE) + { + Tempstr=CopyStr(Tempstr,vptr); + StripTrailingWhitespace(Tempstr); + StripLeadingWhitespace(Tempstr); + OutStr=CatStr(OutStr,Tempstr); + } + else OutStr=CatStr(OutStr, vptr); + + if (Flags & SUBS_QUOTE_VARS) OutStr=CatStr(OutStr,"'"); + +DestroyString(VarName); +DestroyString(Tempstr); + +return(OutStr); +} + + + +char *SubstituteVarsInString(char *Buffer, const char *Fmt, ListNode *Vars, int Flags) +{ +char *ReturnStr=NULL, *VarName=NULL, *Tempstr=NULL; +const char *FmtPtr; +int count, VarIsPointer=FALSE; +ListNode *Curr; +int len=0, i; + +ReturnStr=CopyStr(Buffer,""); + +if (! Fmt) return(ReturnStr); + + +FmtPtr=Fmt; +while (*FmtPtr !=0) +{ + switch (*FmtPtr) + { + + case '\\': + FmtPtr++; + switch (*FmtPtr) + { + case 't': + ReturnStr=AddCharToStr(ReturnStr,' '); + len=StrLen(ReturnStr); + while ((len % 4) !=0) + { + ReturnStr=AddCharToStr(ReturnStr,' '); + len++; + } + break; + + case 'r': + ReturnStr=AddCharToStr(ReturnStr,'\r'); + len++; + break; + + case 'n': + ReturnStr=AddCharToStr(ReturnStr,'\n'); + len++; + break; + + default: + ReturnStr=AddCharToStr(ReturnStr,*FmtPtr); + len++; + } + break; + + case '$': + FmtPtr++; + /* + if (*FmtPtr=='$') + { + VarIsPointer=TRUE; + FmtPtr++; + } + if (*FmtPtr=='(') FmtPtr++; + */ + + ReturnStr=ParseVar(ReturnStr, &FmtPtr, Vars, Flags); + break; + + case '"': + FmtPtr++; + while (*FmtPtr && (*FmtPtr !='"')) + { + ReturnStr=AddCharToStr(ReturnStr,*FmtPtr); + len++; + FmtPtr++; + } + break; + + default: + ReturnStr=AddCharToStr(ReturnStr,*FmtPtr); + len++; + } + +FmtPtr++; +} + + +DestroyString(Tempstr); +DestroyString(VarName); +return(ReturnStr); +} + + + + + + +void ExtractVarsReadVar(const char **Fmt, const char **Msg, ListNode *Vars) +{ +const char *FmtPtr, *MsgPtr; +char *VarName=NULL; +int len=0; +ListNode *Node; + +FmtPtr=*Fmt; + + if (*FmtPtr=='(') FmtPtr++; + while (*FmtPtr != ')') + { + VarName=AddCharToBuffer(VarName,len,*FmtPtr); + len++; + FmtPtr++; + } + if (*FmtPtr==')') FmtPtr++; + +MsgPtr=*Msg; +while ((*MsgPtr !=0) && (*MsgPtr != *FmtPtr)) +{ + if (*MsgPtr=='"') + { + do + { + MsgPtr++; + } while ((*MsgPtr != '"') && (*MsgPtr != 0)); + } + MsgPtr++; +} + +Node=ListFindNamedItem(Vars,VarName); + +if (Node) Node->Item=(void *) CopyStrLen((char *) Node->Item, *Msg, MsgPtr-*Msg); +else Node=ListAddNamedItem(Vars,VarName,CopyStrLen(NULL, *Msg, MsgPtr-*Msg)); + +*Fmt=FmtPtr; +*Msg=MsgPtr; + +DestroyString(VarName); +} + +char *ExtractVarsGetLiteralString(char *Buffer, const char *InStr) +{ +char *RetStr; +const char *ptr; + +RetStr=Buffer; + +ptr=InStr; +while ((*ptr !=0) && (*ptr !='$') && (*ptr !='?') && (*ptr !='*')) ptr++; + +RetStr=CopyStrLen(Buffer,InStr,ptr-InStr); +return(RetStr); +} + +int ExtractVarsFromString(char *Data, const char *FormatStr, ListNode *Vars) +{ +const char *FmtPtr, *MsgPtr; +char *Token=NULL; +int Match=TRUE, len; + +FmtPtr=FormatStr; +MsgPtr=Data; + +while ( (*FmtPtr !=0) && (Match)) +{ + switch (*FmtPtr) + { + case '?': + FmtPtr++; + MsgPtr++; + break; + + case '*': + FmtPtr++; + Token=ExtractVarsGetLiteralString(Token,FmtPtr); + len=StrLen(Token); + while ( + (*MsgPtr !=0) && + (strncmp(MsgPtr,Token,len) !=0) + ) MsgPtr++; + + break; + + case '$': + FmtPtr++; + ExtractVarsReadVar(&FmtPtr, &MsgPtr, Vars); + break; + + default: + if (*FmtPtr != *MsgPtr) + { + Match=FALSE; + } + FmtPtr++; + MsgPtr++; + break; + } + +} +DestroyString(Token); + +return(Match); +} + + diff --git a/libUseful-2.0/Vars.h b/libUseful-2.0/Vars.h new file mode 100644 index 0000000..5ebfde9 --- /dev/null +++ b/libUseful-2.0/Vars.h @@ -0,0 +1,23 @@ +#ifndef LIBUSEFUL_VARS_H +#define LIBUSEFUL_VARS_H + +#include "list.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void SetVar(ListNode *Vars, const char *Name, const char *Data); +char *GetVar(ListNode *Vars, const char *Name); +void UnsetVar(ListNode *Vars,const char *Name); +void ClearVars(ListNode *Vars); +void CopyVars(ListNode *Dest, ListNode *Source); +char *SubstituteVarsInString(char *Buffer, const char *Fmt, ListNode *Vars, int Flags); +int ExtractVarsFromString(char *Data, const char *FormatStr, ListNode *Vars); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libUseful-2.0/autom4te.cache/directory b/libUseful-2.0/autom4te.cache/directory new file mode 100644 index 0000000..a446e19 --- /dev/null +++ b/libUseful-2.0/autom4te.cache/directory @@ -0,0 +1 @@ +cat: /home/metacosm89/fileferry-1.0/libUseful-2.0/autom4te.cache/directory: No such file or directory diff --git a/libUseful-2.0/autom4te.cache/output.0 b/libUseful-2.0/autom4te.cache/output.0 new file mode 100644 index 0000000..69c1164 --- /dev/null +++ b/libUseful-2.0/autom4te.cache/output.0 @@ -0,0 +1,4779 @@ +@%:@! /bin/sh +@%:@ Guess values for system-dependent variables and create Makefiles. +@%:@ Generated by GNU Autoconf 2.69. +@%:@ +@%:@ +@%:@ Copyright (C) 1992-1996, 1998-2012 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 + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # 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 +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+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +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 +test -x / || 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 : + export CONFIG_SHELL + # 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 +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+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +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 about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +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 @S|@? 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 "@S|@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_executable_p FILE +@%:@ ----------------------- +@%:@ Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} @%:@ as_fn_executable_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 @S|@as_val. Take advantage of shells that can avoid forks. The arguments +@%:@ must be portable across @S|@(()) 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 @S|@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; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # 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 -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +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 + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# 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'" + + +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=. +LIB@&t@OBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= +PACKAGE_URL= + +ac_unique_file="defines.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='LTLIBOBJS +LIB@&t@OBJS +EGREP +GREP +CPP +SET_MAKE +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +VERSION +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_largefiles +enable_ssl +enable_z +enable_oss +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) 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 + 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 this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + @<:@@S|@ac_default_prefix@:>@ + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + @<:@PREFIX@:>@ + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root @<:@DATAROOTDIR/doc/PACKAGE@:>@ + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-largefiles enable largefile support + --enable-ssl use Secure Sockets Layer + --enable-zlib use ZLib Compression + --enable-oss use Open Sound System + +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 the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +configure +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 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.@S|@ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} @%:@ ac_fn_c_try_compile + +@%:@ ac_fn_c_try_cpp LINENO +@%:@ ---------------------- +@%:@ Try to preprocess conftest.@S|@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.@S|@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_try_link LINENO +@%:@ ----------------------- +@%:@ Try to link conftest.@S|@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 || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} @%:@ ac_fn_c_try_link + +@%:@ ac_fn_c_check_func LINENO FUNC VAR +@%:@ ---------------------------------- +@%:@ Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case 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_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;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} @%:@ ac_fn_c_check_header_mongrel + +@%:@ ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +@%:@ ------------------------------------------------------- +@%:@ Tests whether HEADER exists and can be compiled using the include files in +@%:@ INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +@%:@include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} @%:@ ac_fn_c_check_header_compile +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.69. 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 + +# 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 + + + +VERSION="0.0.1" + + +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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $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 as_fn_executable_p "$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 as_fn_executable_p "$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 +struct stat; +/* 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 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 eval \${ac_cv_prog_make_${ac_make}_set+:} false; 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 + + +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 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" + as_fn_executable_p "$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" + as_fn_executable_p "$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 ${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 + + +cf_have_libssl=no +cf_have_libcrypto=no +cf_have_libz=no +cf_have_oss=no +cf_have_libesd=no + + +@%:@ Check whether --enable-largefiles was given. +if test "${enable_largefiles+set}" = set; then : + enableval=$enable_largefiles; cf_use_largefiles=$enableval +fi + + +if test "$cf_use_largefiles" = "yes" +then +$as_echo "@%:@define _LARGEFILE64_SOURCE 1" >>confdefs.h + +$as_echo "@%:@define _FILE_OFFSET_BITS 64" >>confdefs.h + +fi + +@%:@ Check whether --enable-ssl was given. +if test "${enable_ssl+set}" = set; then : + enableval=$enable_ssl; cf_use_ssl=$enableval +fi + + +if test "$cf_use_ssl" = "yes" +then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5 +$as_echo_n "checking for SSL_library_init in -lssl... " >&6; } +if ${ac_cv_lib_ssl_SSL_library_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lssl $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 SSL_library_init (); +int +main () +{ +return SSL_library_init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ssl_SSL_library_init=yes +else + ac_cv_lib_ssl_SSL_library_init=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_ssl_SSL_library_init" >&5 +$as_echo "$ac_cv_lib_ssl_SSL_library_init" >&6; } +if test "x$ac_cv_lib_ssl_SSL_library_init" = xyes; then : + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_LIBSSL 1 +_ACEOF + + LIBS="-lssl $LIBS" + +fi + +cf_have_libssl=$ac_cv_lib_ssl_SSL_library_init + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EVP_CIPHER_CTX_init in -lcrypto" >&5 +$as_echo_n "checking for EVP_CIPHER_CTX_init in -lcrypto... " >&6; } +if ${ac_cv_lib_crypto_EVP_CIPHER_CTX_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcrypto $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 EVP_CIPHER_CTX_init (); +int +main () +{ +return EVP_CIPHER_CTX_init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_crypto_EVP_CIPHER_CTX_init=yes +else + ac_cv_lib_crypto_EVP_CIPHER_CTX_init=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_crypto_EVP_CIPHER_CTX_init" >&5 +$as_echo "$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&6; } +if test "x$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" = xyes; then : + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_LIBCRYPTO 1 +_ACEOF + + LIBS="-lcrypto $LIBS" + +fi + +cf_have_libcrypto=$ac_cv_lib_crypto_EVP_CIPHER_CTX_init + +for ac_func in OpenSSL_add_all_algorithms EVP_bf_cbc EVP_rc2_cbc EVP_rc4 EVP_rc5_32_12_16_cbc EVP_des_cbc EVP_desx_cbc EVP_cast5_cbc EVP_idea_cbc EVP_aes_128_cbc EVP_aes_256_cbc +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +@%:@define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking that OpenSSL Library is at least version 0.9.7" >&5 +$as_echo_n "checking that OpenSSL Library is at least version 0.9.7... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #if SSLEAY_VERSION_NUMBER >= 0x00907000L + yes + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "@%:@define USE_OPENSSL_ADD_ALL_ALGORITHMS 1" >>confdefs.h + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f conftest* + +fi + +if test "cf_have_libssl" = "yes" +then +cf_use_zlib=yes +fi + + +@%:@ Check whether --enable-z was given. +if test "${enable_z+set}" = set; then : + enableval=$enable_z; cf_use_zlib=$enableval +fi + + +if test "$cf_use_zlib" = "yes" +then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for deflate in -lz" >&5 +$as_echo_n "checking for deflate in -lz... " >&6; } +if ${ac_cv_lib_z_deflate+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz $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 deflate (); +int +main () +{ +return deflate (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_z_deflate=yes +else + ac_cv_lib_z_deflate=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_z_deflate" >&5 +$as_echo "$ac_cv_lib_z_deflate" >&6; } +if test "x$ac_cv_lib_z_deflate" = xyes; then : + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_LIBZ 1 +_ACEOF + + LIBS="-lz $LIBS" + +fi + +cf_have_libz=$ac_cv_lib_z_deflate +fi + + +@%:@ Check whether --enable-oss was given. +if test "${enable_oss+set}" = set; then : + enableval=$enable_oss; cf_use_oss=$enableval +fi + + +cf_use_oss=yes + +if test "$cf_use_oss" = "yes" +then +# 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 + + +ac_fn_c_check_header_mongrel "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_soundcard_h" = xyes; then : + $as_echo "@%:@define HAVE_OSS 1" >>confdefs.h + +else + cf_have_oss=no +fi + + +fi + + +#AC_ARG_ENABLE(esd, [ --enable-esd use ESound], cf_use_esd=$enableval ) + +if test "$cf_use_esd" = "yes" +then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for esd_open_sound in -lesd" >&5 +$as_echo_n "checking for esd_open_sound in -lesd... " >&6; } +if ${ac_cv_lib_esd_esd_open_sound+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lesd $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 esd_open_sound (); +int +main () +{ +return esd_open_sound (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_esd_esd_open_sound=yes +else + ac_cv_lib_esd_esd_open_sound=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_esd_esd_open_sound" >&5 +$as_echo "$ac_cv_lib_esd_esd_open_sound" >&6; } +if test "x$ac_cv_lib_esd_esd_open_sound" = xyes; then : + cat >>confdefs.h <<_ACEOF +@%:@define HAVE_LIBESD 1 +_ACEOF + + LIBS="-lesd $LIBS" + +fi + +cf_have_libesd=$ac_cv_lib_esd_esd_open_sound +fi + + +ac_config_files="$ac_config_files 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 + 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}' + +# 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= +U= +for ac_i in : $LIB@&t@OBJS; 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 +LIB@&t@OBJS=$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 @S|@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 @S|@? 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 @S|@as_val. Take advantage of shells that can avoid forks. The arguments +@%:@ must be portable across @S|@(()) 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 -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +@%:@ as_fn_mkdir_p +@%:@ ------------- +@%:@ Create "@S|@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 + + +@%:@ as_fn_executable_p FILE +@%:@ ----------------------- +@%:@ Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} @%:@ as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# 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 $as_me, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files 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 + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 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' +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;; + --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 +_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 + "Makefile") CONFIG_FILES="$CONFIG_FILES 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 +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" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_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 + # + +_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 +$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 + ;; + + + + 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 + diff --git a/libUseful-2.0/autom4te.cache/requests b/libUseful-2.0/autom4te.cache/requests new file mode 100644 index 0000000..3fc6822 --- /dev/null +++ b/libUseful-2.0/autom4te.cache/requests @@ -0,0 +1,145 @@ +# This file was generated. +# It contains the lists of macros which have been traced. +# It can be safely removed. + +@request = ( + bless( [ + '0', + 1, + [ + '/usr/share/autoconf' + ], + [ + '/usr/share/autoconf/autoconf/autoconf.m4f', + 'configure.in' + ], + { + '_LT_AC_TAGCONFIG' => 1, + 'AM_PROG_F77_C_O' => 1, + 'm4_pattern_forbid' => 1, + 'AC_CANONICAL_TARGET' => 1, + 'AC_CONFIG_LIBOBJ_DIR' => 1, + 'AC_TYPE_OFF_T' => 1, + 'AC_C_VOLATILE' => 1, + 'AC_FUNC_CLOSEDIR_VOID' => 1, + 'AC_REPLACE_FNMATCH' => 1, + 'AC_PROG_LIBTOOL' => 1, + 'AC_FUNC_STAT' => 1, + 'AC_HEADER_TIME' => 1, + 'AC_FUNC_WAIT3' => 1, + 'AM_AUTOMAKE_VERSION' => 1, + 'AC_STRUCT_TM' => 1, + 'AC_FUNC_LSTAT' => 1, + 'AC_TYPE_MODE_T' => 1, + 'AC_FUNC_GETMNTENT' => 1, + 'AC_FUNC_STRTOD' => 1, + 'AC_CHECK_HEADERS' => 1, + 'LT_CONFIG_LTDL_DIR' => 1, + 'AC_FUNC_STRNLEN' => 1, + 'm4_sinclude' => 1, + 'AC_PROG_CXX' => 1, + 'AC_PATH_X' => 1, + 'AM_NLS' => 1, + 'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1, + 'AC_PROG_AWK' => 1, + '_m4_warn' => 1, + 'AC_HEADER_STDC' => 1, + 'AC_HEADER_MAJOR' => 1, + 'AM_PROG_CXX_C_O' => 1, + '_AM_MAKEFILE_INCLUDE' => 1, + 'AM_PROG_MOC' => 1, + 'LT_INIT' => 1, + 'AC_FUNC_ERROR_AT_LINE' => 1, + 'AC_PROG_GCC_TRADITIONAL' => 1, + 'AC_LIBSOURCE' => 1, + 'AC_FUNC_MBRTOWC' => 1, + 'AC_STRUCT_ST_BLOCKS' => 1, + 'AM_PROG_FC_C_O' => 1, + 'AC_CANONICAL_BUILD' => 1, + 'AC_TYPE_SIGNAL' => 1, + 'AC_TYPE_UID_T' => 1, + '_AM_SUBST_NOTMAKE' => 1, + 'AC_CONFIG_AUX_DIR' => 1, + 'AC_PROG_MAKE_SET' => 1, + 'sinclude' => 1, + 'm4_pattern_allow' => 1, + 'AC_DEFINE_TRACE_LITERAL' => 1, + 'AC_FUNC_STRERROR_R' => 1, + 'AC_PROG_CC' => 1, + 'AC_FUNC_FORK' => 1, + 'AC_DECL_SYS_SIGLIST' => 1, + '_AM_COND_ELSE' => 1, + 'AC_FUNC_VPRINTF' => 1, + 'AC_FUNC_STRCOLL' => 1, + 'AC_PROG_YACC' => 1, + 'AC_SUBST_TRACE' => 1, + 'AC_INIT' => 1, + 'AC_STRUCT_TIMEZONE' => 1, + '_AM_COND_IF' => 1, + 'AC_FUNC_CHOWN' => 1, + 'AC_FUNC_ALLOCA' => 1, + 'AC_SUBST' => 1, + 'AC_FUNC_GETPGRP' => 1, + 'AC_CANONICAL_HOST' => 1, + 'AC_FC_SRCEXT' => 1, + 'AC_PROG_RANLIB' => 1, + 'AM_INIT_AUTOMAKE' => 1, + 'AC_FUNC_SETPGRP' => 1, + 'AC_CONFIG_SUBDIRS' => 1, + 'AM_PATH_GUILE' => 1, + 'AC_FUNC_MMAP' => 1, + 'AC_FUNC_REALLOC' => 1, + 'AC_TYPE_SIZE_T' => 1, + 'AC_REQUIRE_AUX_FILE' => 1, + 'AC_CONFIG_LINKS' => 1, + 'AC_CHECK_TYPES' => 1, + 'LT_SUPPORTED_TAG' => 1, + 'AC_CHECK_MEMBERS' => 1, + 'AM_MAINTAINER_MODE' => 1, + 'AC_FUNC_UTIME_NULL' => 1, + 'AC_FUNC_SELECT_ARGTYPES' => 1, + 'AC_FC_PP_DEFINE' => 1, + 'AM_GNU_GETTEXT_INTL_SUBDIR' => 1, + 'AM_MAKEFILE_INCLUDE' => 1, + 'AC_FUNC_STRFTIME' => 1, + 'AC_HEADER_STAT' => 1, + 'AC_C_INLINE' => 1, + 'AC_PROG_CPP' => 1, + '_AM_COND_ENDIF' => 1, + 'AC_TYPE_PID_T' => 1, + 'AC_C_CONST' => 1, + 'AC_PROG_LEX' => 1, + 'AM_ENABLE_MULTILIB' => 1, + 'AM_SILENT_RULES' => 1, + 'AC_CONFIG_FILES' => 1, + 'include' => 1, + 'AC_FUNC_SETVBUF_REVERSED' => 1, + 'AC_PROG_INSTALL' => 1, + 'AM_GNU_GETTEXT' => 1, + 'AM_PROG_AR' => 1, + 'AC_FUNC_OBSTACK' => 1, + 'AC_CHECK_LIB' => 1, + 'AC_FUNC_MALLOC' => 1, + 'AC_FUNC_GETGROUPS' => 1, + 'AC_FC_FREEFORM' => 1, + 'AC_FUNC_GETLOADAVG' => 1, + 'AH_OUTPUT' => 1, + 'AC_FC_PP_SRCEXT' => 1, + 'AC_FUNC_FSEEKO' => 1, + 'AM_PROG_CC_C_O' => 1, + 'AM_CONDITIONAL' => 1, + 'AC_CANONICAL_SYSTEM' => 1, + 'AC_FUNC_MKTIME' => 1, + 'AM_XGETTEXT_OPTION' => 1, + 'AC_CONFIG_HEADERS' => 1, + 'AC_HEADER_SYS_WAIT' => 1, + 'AM_POT_TOOLS' => 1, + 'AC_FUNC_MEMCMP' => 1, + 'AC_PROG_LN_S' => 1, + 'm4_include' => 1, + 'AC_HEADER_DIRENT' => 1, + 'AC_CHECK_FUNCS' => 1 + } + ], 'Autom4te::Request' ) + ); + diff --git a/libUseful-2.0/autom4te.cache/traces.0 b/libUseful-2.0/autom4te.cache/traces.0 new file mode 100644 index 0000000..91edc18 --- /dev/null +++ b/libUseful-2.0/autom4te.cache/traces.0 @@ -0,0 +1,307 @@ +m4trace:configure.in:2: -1- AC_INIT([defines.h]) +m4trace:configure.in:2: -1- m4_pattern_forbid([^_?A[CHUM]_]) +m4trace:configure.in:2: -1- m4_pattern_forbid([_AC_]) +m4trace:configure.in:2: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) +m4trace:configure.in:2: -1- m4_pattern_allow([^AS_FLAGS$]) +m4trace:configure.in:2: -1- m4_pattern_forbid([^_?m4_]) +m4trace:configure.in:2: -1- m4_pattern_forbid([^dnl$]) +m4trace:configure.in:2: -1- m4_pattern_forbid([^_?AS_]) +m4trace:configure.in:2: -1- AC_SUBST([SHELL]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([SHELL]) +m4trace:configure.in:2: -1- m4_pattern_allow([^SHELL$]) +m4trace:configure.in:2: -1- AC_SUBST([PATH_SEPARATOR]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([PATH_SEPARATOR]) +m4trace:configure.in:2: -1- m4_pattern_allow([^PATH_SEPARATOR$]) +m4trace:configure.in:2: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([PACKAGE_NAME]) +m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_NAME$]) +m4trace:configure.in:2: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([PACKAGE_TARNAME]) +m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) +m4trace:configure.in:2: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([PACKAGE_VERSION]) +m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_VERSION$]) +m4trace:configure.in:2: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([PACKAGE_STRING]) +m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_STRING$]) +m4trace:configure.in:2: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([PACKAGE_BUGREPORT]) +m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) +m4trace:configure.in:2: -1- AC_SUBST([PACKAGE_URL], [m4_ifdef([AC_PACKAGE_URL], ['AC_PACKAGE_URL'])]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([PACKAGE_URL]) +m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_URL$]) +m4trace:configure.in:2: -1- AC_SUBST([exec_prefix], [NONE]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([exec_prefix]) +m4trace:configure.in:2: -1- m4_pattern_allow([^exec_prefix$]) +m4trace:configure.in:2: -1- AC_SUBST([prefix], [NONE]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([prefix]) +m4trace:configure.in:2: -1- m4_pattern_allow([^prefix$]) +m4trace:configure.in:2: -1- AC_SUBST([program_transform_name], [s,x,x,]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([program_transform_name]) +m4trace:configure.in:2: -1- m4_pattern_allow([^program_transform_name$]) +m4trace:configure.in:2: -1- AC_SUBST([bindir], ['${exec_prefix}/bin']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([bindir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^bindir$]) +m4trace:configure.in:2: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([sbindir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^sbindir$]) +m4trace:configure.in:2: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([libexecdir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^libexecdir$]) +m4trace:configure.in:2: -1- AC_SUBST([datarootdir], ['${prefix}/share']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([datarootdir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^datarootdir$]) +m4trace:configure.in:2: -1- AC_SUBST([datadir], ['${datarootdir}']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([datadir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^datadir$]) +m4trace:configure.in:2: -1- AC_SUBST([sysconfdir], ['${prefix}/etc']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([sysconfdir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^sysconfdir$]) +m4trace:configure.in:2: -1- AC_SUBST([sharedstatedir], ['${prefix}/com']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([sharedstatedir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^sharedstatedir$]) +m4trace:configure.in:2: -1- AC_SUBST([localstatedir], ['${prefix}/var']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([localstatedir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^localstatedir$]) +m4trace:configure.in:2: -1- AC_SUBST([includedir], ['${prefix}/include']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([includedir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^includedir$]) +m4trace:configure.in:2: -1- AC_SUBST([oldincludedir], ['/usr/include']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([oldincludedir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^oldincludedir$]) +m4trace:configure.in:2: -1- AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], + ['${datarootdir}/doc/${PACKAGE_TARNAME}'], + ['${datarootdir}/doc/${PACKAGE}'])]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([docdir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^docdir$]) +m4trace:configure.in:2: -1- AC_SUBST([infodir], ['${datarootdir}/info']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([infodir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^infodir$]) +m4trace:configure.in:2: -1- AC_SUBST([htmldir], ['${docdir}']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([htmldir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^htmldir$]) +m4trace:configure.in:2: -1- AC_SUBST([dvidir], ['${docdir}']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([dvidir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^dvidir$]) +m4trace:configure.in:2: -1- AC_SUBST([pdfdir], ['${docdir}']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([pdfdir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^pdfdir$]) +m4trace:configure.in:2: -1- AC_SUBST([psdir], ['${docdir}']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([psdir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^psdir$]) +m4trace:configure.in:2: -1- AC_SUBST([libdir], ['${exec_prefix}/lib']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([libdir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^libdir$]) +m4trace:configure.in:2: -1- AC_SUBST([localedir], ['${datarootdir}/locale']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([localedir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^localedir$]) +m4trace:configure.in:2: -1- AC_SUBST([mandir], ['${datarootdir}/man']) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([mandir]) +m4trace:configure.in:2: -1- m4_pattern_allow([^mandir$]) +m4trace:configure.in:2: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME]) +m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_NAME$]) +m4trace:configure.in:2: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */ +@%:@undef PACKAGE_NAME]) +m4trace:configure.in:2: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME]) +m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_TARNAME$]) +m4trace:configure.in:2: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */ +@%:@undef PACKAGE_TARNAME]) +m4trace:configure.in:2: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION]) +m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_VERSION$]) +m4trace:configure.in:2: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */ +@%:@undef PACKAGE_VERSION]) +m4trace:configure.in:2: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING]) +m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_STRING$]) +m4trace:configure.in:2: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */ +@%:@undef PACKAGE_STRING]) +m4trace:configure.in:2: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT]) +m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$]) +m4trace:configure.in:2: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */ +@%:@undef PACKAGE_BUGREPORT]) +m4trace:configure.in:2: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_URL]) +m4trace:configure.in:2: -1- m4_pattern_allow([^PACKAGE_URL$]) +m4trace:configure.in:2: -1- AH_OUTPUT([PACKAGE_URL], [/* Define to the home page for this package. */ +@%:@undef PACKAGE_URL]) +m4trace:configure.in:2: -1- AC_SUBST([DEFS]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([DEFS]) +m4trace:configure.in:2: -1- m4_pattern_allow([^DEFS$]) +m4trace:configure.in:2: -1- AC_SUBST([ECHO_C]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([ECHO_C]) +m4trace:configure.in:2: -1- m4_pattern_allow([^ECHO_C$]) +m4trace:configure.in:2: -1- AC_SUBST([ECHO_N]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([ECHO_N]) +m4trace:configure.in:2: -1- m4_pattern_allow([^ECHO_N$]) +m4trace:configure.in:2: -1- AC_SUBST([ECHO_T]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([ECHO_T]) +m4trace:configure.in:2: -1- m4_pattern_allow([^ECHO_T$]) +m4trace:configure.in:2: -1- AC_SUBST([LIBS]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.in:2: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.in:2: -1- AC_SUBST([build_alias]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([build_alias]) +m4trace:configure.in:2: -1- m4_pattern_allow([^build_alias$]) +m4trace:configure.in:2: -1- AC_SUBST([host_alias]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([host_alias]) +m4trace:configure.in:2: -1- m4_pattern_allow([^host_alias$]) +m4trace:configure.in:2: -1- AC_SUBST([target_alias]) +m4trace:configure.in:2: -1- AC_SUBST_TRACE([target_alias]) +m4trace:configure.in:2: -1- m4_pattern_allow([^target_alias$]) +m4trace:configure.in:5: -1- AC_SUBST([VERSION]) +m4trace:configure.in:5: -1- AC_SUBST_TRACE([VERSION]) +m4trace:configure.in:5: -1- m4_pattern_allow([^VERSION$]) +m4trace:configure.in:7: -1- AC_PROG_CC +m4trace:configure.in:7: -1- AC_SUBST([CC]) +m4trace:configure.in:7: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:7: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:7: -1- AC_SUBST([CFLAGS]) +m4trace:configure.in:7: -1- AC_SUBST_TRACE([CFLAGS]) +m4trace:configure.in:7: -1- m4_pattern_allow([^CFLAGS$]) +m4trace:configure.in:7: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.in:7: -1- AC_SUBST_TRACE([LDFLAGS]) +m4trace:configure.in:7: -1- m4_pattern_allow([^LDFLAGS$]) +m4trace:configure.in:7: -1- AC_SUBST([LIBS]) +m4trace:configure.in:7: -1- AC_SUBST_TRACE([LIBS]) +m4trace:configure.in:7: -1- m4_pattern_allow([^LIBS$]) +m4trace:configure.in:7: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:7: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.in:7: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.in:7: -1- AC_SUBST([CC]) +m4trace:configure.in:7: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:7: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:7: -1- AC_SUBST([CC]) +m4trace:configure.in:7: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:7: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:7: -1- AC_SUBST([CC]) +m4trace:configure.in:7: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:7: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:7: -1- AC_SUBST([CC]) +m4trace:configure.in:7: -1- AC_SUBST_TRACE([CC]) +m4trace:configure.in:7: -1- m4_pattern_allow([^CC$]) +m4trace:configure.in:7: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.in:7: -1- AC_SUBST_TRACE([ac_ct_CC]) +m4trace:configure.in:7: -1- m4_pattern_allow([^ac_ct_CC$]) +m4trace:configure.in:7: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext]) +m4trace:configure.in:7: -1- AC_SUBST_TRACE([EXEEXT]) +m4trace:configure.in:7: -1- m4_pattern_allow([^EXEEXT$]) +m4trace:configure.in:7: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) +m4trace:configure.in:7: -1- AC_SUBST_TRACE([OBJEXT]) +m4trace:configure.in:7: -1- m4_pattern_allow([^OBJEXT$]) +m4trace:configure.in:8: -1- _m4_warn([obsolete], [The macro `AC_LANG_C' is obsolete. +You should run autoupdate.], [../../lib/autoconf/c.m4:72: AC_LANG_C is expanded from... +configure.in:8: the top level]) +m4trace:configure.in:9: -1- AC_PROG_MAKE_SET +m4trace:configure.in:9: -1- AC_SUBST([SET_MAKE]) +m4trace:configure.in:9: -1- AC_SUBST_TRACE([SET_MAKE]) +m4trace:configure.in:9: -1- m4_pattern_allow([^SET_MAKE$]) +m4trace:configure.in:10: -1- AC_HEADER_STDC +m4trace:configure.in:10: -1- AC_PROG_CPP +m4trace:configure.in:10: -1- AC_SUBST([CPP]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([CPP]) +m4trace:configure.in:10: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.in:10: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([CPPFLAGS]) +m4trace:configure.in:10: -1- m4_pattern_allow([^CPPFLAGS$]) +m4trace:configure.in:10: -1- AC_SUBST([CPP]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([CPP]) +m4trace:configure.in:10: -1- m4_pattern_allow([^CPP$]) +m4trace:configure.in:10: -1- AC_SUBST([GREP]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([GREP]) +m4trace:configure.in:10: -1- m4_pattern_allow([^GREP$]) +m4trace:configure.in:10: -1- AC_SUBST([EGREP]) +m4trace:configure.in:10: -1- AC_SUBST_TRACE([EGREP]) +m4trace:configure.in:10: -1- m4_pattern_allow([^EGREP$]) +m4trace:configure.in:10: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS]) +m4trace:configure.in:10: -1- m4_pattern_allow([^STDC_HEADERS$]) +m4trace:configure.in:10: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */ +@%:@undef STDC_HEADERS]) +m4trace:configure.in:23: -1- AC_DEFINE_TRACE_LITERAL([_LARGEFILE64_SOURCE]) +m4trace:configure.in:23: -1- m4_pattern_allow([^_LARGEFILE64_SOURCE$]) +m4trace:configure.in:24: -1- AC_DEFINE_TRACE_LITERAL([_FILE_OFFSET_BITS]) +m4trace:configure.in:24: -1- m4_pattern_allow([^_FILE_OFFSET_BITS$]) +m4trace:configure.in:31: -1- AC_CHECK_LIB([ssl], [SSL_library_init], [], []) +m4trace:configure.in:31: -1- AH_OUTPUT([HAVE_LIBSSL], [/* Define to 1 if you have the `ssl\' library (-lssl). */ +@%:@undef HAVE_LIBSSL]) +m4trace:configure.in:31: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBSSL]) +m4trace:configure.in:31: -1- m4_pattern_allow([^HAVE_LIBSSL$]) +m4trace:configure.in:34: -1- AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_init], [], []) +m4trace:configure.in:34: -1- AH_OUTPUT([HAVE_LIBCRYPTO], [/* Define to 1 if you have the `crypto\' library (-lcrypto). */ +@%:@undef HAVE_LIBCRYPTO]) +m4trace:configure.in:34: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBCRYPTO]) +m4trace:configure.in:34: -1- m4_pattern_allow([^HAVE_LIBCRYPTO$]) +m4trace:configure.in:37: -1- AC_CHECK_FUNCS([OpenSSL_add_all_algorithms EVP_bf_cbc EVP_rc2_cbc EVP_rc4 EVP_rc5_32_12_16_cbc EVP_des_cbc EVP_desx_cbc EVP_cast5_cbc EVP_idea_cbc EVP_aes_128_cbc EVP_aes_256_cbc]) +m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_OPENSSL_ADD_ALL_ALGORITHMS], [/* Define to 1 if you have the `OpenSSL_add_all_algorithms\' function. */ +@%:@undef HAVE_OPENSSL_ADD_ALL_ALGORITHMS]) +m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_BF_CBC], [/* Define to 1 if you have the `EVP_bf_cbc\' function. */ +@%:@undef HAVE_EVP_BF_CBC]) +m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_RC2_CBC], [/* Define to 1 if you have the `EVP_rc2_cbc\' function. */ +@%:@undef HAVE_EVP_RC2_CBC]) +m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_RC4], [/* Define to 1 if you have the `EVP_rc4\' function. */ +@%:@undef HAVE_EVP_RC4]) +m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_RC5_32_12_16_CBC], [/* Define to 1 if you have the `EVP_rc5_32_12_16_cbc\' function. */ +@%:@undef HAVE_EVP_RC5_32_12_16_CBC]) +m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_DES_CBC], [/* Define to 1 if you have the `EVP_des_cbc\' function. */ +@%:@undef HAVE_EVP_DES_CBC]) +m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_DESX_CBC], [/* Define to 1 if you have the `EVP_desx_cbc\' function. */ +@%:@undef HAVE_EVP_DESX_CBC]) +m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_CAST5_CBC], [/* Define to 1 if you have the `EVP_cast5_cbc\' function. */ +@%:@undef HAVE_EVP_CAST5_CBC]) +m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_IDEA_CBC], [/* Define to 1 if you have the `EVP_idea_cbc\' function. */ +@%:@undef HAVE_EVP_IDEA_CBC]) +m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_AES_128_CBC], [/* Define to 1 if you have the `EVP_aes_128_cbc\' function. */ +@%:@undef HAVE_EVP_AES_128_CBC]) +m4trace:configure.in:37: -1- AH_OUTPUT([HAVE_EVP_AES_256_CBC], [/* Define to 1 if you have the `EVP_aes_256_cbc\' function. */ +@%:@undef HAVE_EVP_AES_256_CBC]) +m4trace:configure.in:40: -1- AC_DEFINE_TRACE_LITERAL([USE_OPENSSL_ADD_ALL_ALGORITHMS]) +m4trace:configure.in:40: -1- m4_pattern_allow([^USE_OPENSSL_ADD_ALL_ALGORITHMS$]) +m4trace:configure.in:40: -1- AH_OUTPUT([USE_OPENSSL_ADD_ALL_ALGORITHMS], [/* Use OpenSSL_add_all_algorithms */ +@%:@undef USE_OPENSSL_ADD_ALL_ALGORITHMS]) +m4trace:configure.in:62: -1- AC_CHECK_LIB([z], [deflate], [], []) +m4trace:configure.in:62: -1- AH_OUTPUT([HAVE_LIBZ], [/* Define to 1 if you have the `z\' library (-lz). */ +@%:@undef HAVE_LIBZ]) +m4trace:configure.in:62: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBZ]) +m4trace:configure.in:62: -1- m4_pattern_allow([^HAVE_LIBZ$]) +m4trace:configure.in:74: -2- AC_DEFINE_TRACE_LITERAL([HAVE_OSS]) +m4trace:configure.in:74: -2- m4_pattern_allow([^HAVE_OSS$]) +m4trace:configure.in:74: -1- AC_CHECK_HEADERS([sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h], [], [], [$ac_includes_default]) +m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the header file. */ +@%:@undef HAVE_SYS_TYPES_H]) +m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the header file. */ +@%:@undef HAVE_SYS_STAT_H]) +m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ +@%:@undef HAVE_STDLIB_H]) +m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ +@%:@undef HAVE_STRING_H]) +m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the header file. */ +@%:@undef HAVE_MEMORY_H]) +m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the header file. */ +@%:@undef HAVE_STRINGS_H]) +m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the header file. */ +@%:@undef HAVE_INTTYPES_H]) +m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the header file. */ +@%:@undef HAVE_STDINT_H]) +m4trace:configure.in:74: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ +@%:@undef HAVE_UNISTD_H]) +m4trace:configure.in:82: -1- AC_CHECK_LIB([esd], [esd_open_sound], [], []) +m4trace:configure.in:82: -1- AH_OUTPUT([HAVE_LIBESD], [/* Define to 1 if you have the `esd\' library (-lesd). */ +@%:@undef HAVE_LIBESD]) +m4trace:configure.in:82: -1- AC_DEFINE_TRACE_LITERAL([HAVE_LIBESD]) +m4trace:configure.in:82: -1- m4_pattern_allow([^HAVE_LIBESD$]) +m4trace:configure.in:88: -1- AC_CONFIG_FILES([Makefile]) +m4trace:configure.in:88: -1- _m4_warn([obsolete], [AC_OUTPUT should be used without arguments. +You should run autoupdate.], []) +m4trace:configure.in:88: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) +m4trace:configure.in:88: -1- AC_SUBST_TRACE([LIB@&t@OBJS]) +m4trace:configure.in:88: -1- m4_pattern_allow([^LIB@&t@OBJS$]) +m4trace:configure.in:88: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) +m4trace:configure.in:88: -1- AC_SUBST_TRACE([LTLIBOBJS]) +m4trace:configure.in:88: -1- m4_pattern_allow([^LTLIBOBJS$]) +m4trace:configure.in:88: -1- AC_SUBST_TRACE([top_builddir]) +m4trace:configure.in:88: -1- AC_SUBST_TRACE([top_build_prefix]) +m4trace:configure.in:88: -1- AC_SUBST_TRACE([srcdir]) +m4trace:configure.in:88: -1- AC_SUBST_TRACE([abs_srcdir]) +m4trace:configure.in:88: -1- AC_SUBST_TRACE([top_srcdir]) +m4trace:configure.in:88: -1- AC_SUBST_TRACE([abs_top_srcdir]) +m4trace:configure.in:88: -1- AC_SUBST_TRACE([builddir]) +m4trace:configure.in:88: -1- AC_SUBST_TRACE([abs_builddir]) +m4trace:configure.in:88: -1- AC_SUBST_TRACE([abs_top_builddir]) diff --git a/libUseful-2.0/base64.c b/libUseful-2.0/base64.c new file mode 100644 index 0000000..867c5a5 --- /dev/null +++ b/libUseful-2.0/base64.c @@ -0,0 +1,97 @@ +/* + * base64.c -- base-64 conversion routines. + * + * For license terms, see the file COPYING in this directory. + * + * This base 64 encoding is defined in RFC2045 section 6.8, + * "Base64 Content-Transfer-Encoding", but lines must not be broken in the + * scheme used here. + */ +#include + +static const char base64digits[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +#define BAD -1 +static const char base64val[] = { + BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, + BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, + BAD,BAD,BAD,BAD, BAD,BAD,BAD,BAD, BAD,BAD,BAD, 62, BAD,BAD,BAD, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,BAD,BAD, BAD,BAD,BAD,BAD, + BAD, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,BAD, BAD,BAD,BAD,BAD, + BAD, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,BAD, BAD,BAD,BAD,BAD +}; +#define DECODE64(c) (isascii(c) ? base64val[c] : BAD) + +void to64frombits(unsigned char *out, const unsigned char *in, int inlen) +/* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */ +{ + for (; inlen >= 3; inlen -= 3) + { + *out++ = base64digits[in[0] >> 2]; + *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)]; + *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; + *out++ = base64digits[in[2] & 0x3f]; + in += 3; + } + if (inlen > 0) + { + unsigned char fragment; + + *out++ = base64digits[in[0] >> 2]; + fragment = (in[0] << 4) & 0x30; + if (inlen > 1) + fragment |= in[1] >> 4; + *out++ = base64digits[fragment]; + *out++ = (inlen < 2) ? '=' : base64digits[(in[1] << 2) & 0x3c]; + *out++ = '='; + } + *out = '\0'; +} + +int from64tobits(char *out, const char *in) +/* base 64 to raw bytes in quasi-big-endian order, returning count of bytes */ +{ + int len = 0; + register unsigned char digit1, digit2, digit3, digit4; + + if (in[0] == '+' && in[1] == ' ') + in += 2; + if (*in == '\r') + return(0); + + do { + digit1 = in[0]; + if (DECODE64(digit1) == BAD) + return(-1); + digit2 = in[1]; + if (DECODE64(digit2) == BAD) + return(-1); + digit3 = in[2]; + if (digit3 != '=' && DECODE64(digit3) == BAD) + return(-1); + digit4 = in[3]; + if (digit4 != '=' && DECODE64(digit4) == BAD) + return(-1); + in += 4; + *out++ = (DECODE64(digit1) << 2) | (DECODE64(digit2) >> 4); + ++len; + if (digit3 != '=') + { + *out++ = ((DECODE64(digit2) << 4) & 0xf0) | (DECODE64(digit3) >> 2); + ++len; + if (digit4 != '=') + { + *out++ = ((DECODE64(digit3) << 6) & 0xc0) | DECODE64(digit4); + ++len; + } + } + } while + (*in && *in != '\r' && digit4 != '='); + + return (len); +} + +/* base64.c ends here */ diff --git a/libUseful-2.0/base64.h b/libUseful-2.0/base64.h new file mode 100644 index 0000000..e6a10d4 --- /dev/null +++ b/libUseful-2.0/base64.h @@ -0,0 +1,16 @@ +#ifndef BASE_64_H +#define BASE_64_H + +#ifdef __cplusplus +extern "C" { +#endif + +void to64frombits(unsigned char *out, const unsigned char *in, int inlen); +int from64tobits(char *out, const char *in); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/config.cache b/libUseful-2.0/config.cache new file mode 100644 index 0000000..e53afc7 --- /dev/null +++ b/libUseful-2.0/config.cache @@ -0,0 +1,38 @@ +# 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. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +ac_cv_func_EVP_aes_128_cbc=${ac_cv_func_EVP_aes_128_cbc=yes} +ac_cv_func_EVP_aes_256_cbc=${ac_cv_func_EVP_aes_256_cbc=yes} +ac_cv_func_EVP_bf_cbc=${ac_cv_func_EVP_bf_cbc=yes} +ac_cv_func_EVP_cast5_cbc=${ac_cv_func_EVP_cast5_cbc=yes} +ac_cv_func_EVP_des_cbc=${ac_cv_func_EVP_des_cbc=yes} +ac_cv_func_EVP_desx_cbc=${ac_cv_func_EVP_desx_cbc=yes} +ac_cv_func_EVP_idea_cbc=${ac_cv_func_EVP_idea_cbc=yes} +ac_cv_func_EVP_rc2_cbc=${ac_cv_func_EVP_rc2_cbc=yes} +ac_cv_func_EVP_rc4=${ac_cv_func_EVP_rc4=yes} +ac_cv_func_EVP_rc5_32_12_16_cbc=${ac_cv_func_EVP_rc5_32_12_16_cbc=no} +ac_cv_func_OpenSSL_add_all_algorithms=${ac_cv_func_OpenSSL_add_all_algorithms=no} +ac_cv_func_SSL_library_init=${ac_cv_func_SSL_library_init=yes} +ac_cv_header_stdc=${ac_cv_header_stdc=yes} +ac_cv_header_sys_soundcard_h=${ac_cv_header_sys_soundcard_h=yes} +ac_cv_lib_crypto_EVP_CIPHER_CTX_init=${ac_cv_lib_crypto_EVP_CIPHER_CTX_init=yes} +ac_cv_lib_ssl_SSL_library_init=${ac_cv_lib_ssl_SSL_library_init=yes} +ac_cv_lib_z_deflate=${ac_cv_lib_z_deflate=yes} +ac_cv_prog_CC=${ac_cv_prog_CC=gcc} +ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'} +ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross=no} +ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes} +ac_cv_prog_cc_works=${ac_cv_prog_cc_works=yes} +ac_cv_prog_gcc=${ac_cv_prog_gcc=yes} +ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set=yes} diff --git a/libUseful-2.0/config.log b/libUseful-2.0/config.log new file mode 100644 index 0000000..7816945 --- /dev/null +++ b/libUseful-2.0/config.log @@ -0,0 +1,341 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by configure, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ ./configure --prefix=/usr/local --cache-file=/dev/null --srcdir=. + +## --------- ## +## Platform. ## +## --------- ## + +hostname = lifebook +uname -m = i686 +uname -r = 3.13.1-p4-smp +uname -s = Linux +uname -v = #1 SMP PREEMPT Wed Feb 5 00:08:02 UTC 2014 + +/usr/bin/uname -p = unknown +/bin/uname -X = unknown + +/bin/arch = unknown +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +/usr/bin/hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH: /usr/prebin +PATH: /usr/local/bin +PATH: /usr/bin +PATH: /usr/X11R7/bin +PATH: /bin +PATH: /usr/games/bin +PATH: /opt/git-1.9.rc0/bin + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:2144: checking for gcc +configure:2160: found /usr/bin/gcc +configure:2171: result: gcc +configure:2400: checking for C compiler version +configure:2409: gcc --version >&5 +gcc (GCC) 4.7.3 +Copyright (C) 2012 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. + +configure:2420: $? = 0 +configure:2409: gcc -v >&5 +Using built-in specs. +COLLECT_GCC=gcc +COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i486-pc-linux-gnu/4.7.3/lto-wrapper +Target: i486-pc-linux-gnu +Configured with: ../gcc-4.7.3-src/configure --prefix=/usr --sysconfdir=/etc --includedir=/usr/include --localstatedir=/var --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,c++ --host=i486-pc-linux-gnu --build=i486-pc-linux-gnu --target=i486-pc-linux-gnu --enable-bootstrap +Thread model: posix +gcc version 4.7.3 (GCC) +configure:2420: $? = 0 +configure:2409: gcc -V >&5 +gcc: error: unrecognized command line option '-V' +gcc: fatal error: no input files +compilation terminated. +configure:2420: $? = 1 +configure:2409: gcc -qversion >&5 +gcc: error: unrecognized command line option '-qversion' +gcc: fatal error: no input files +compilation terminated. +configure:2420: $? = 1 +configure:2440: checking whether the C compiler works +configure:2462: gcc conftest.c >&5 +configure:2466: $? = 0 +configure:2514: result: yes +configure:2517: checking for C compiler default output file name +configure:2519: result: a.out +configure:2525: checking for suffix of executables +configure:2532: gcc -o conftest conftest.c >&5 +configure:2536: $? = 0 +configure:2558: result: +configure:2580: checking whether we are cross compiling +configure:2588: gcc -o conftest conftest.c >&5 +configure:2592: $? = 0 +configure:2599: ./conftest +configure:2603: $? = 0 +configure:2618: result: no +configure:2623: checking for suffix of object files +configure:2645: gcc -c conftest.c >&5 +configure:2649: $? = 0 +configure:2670: result: o +configure:2674: checking whether we are using the GNU C compiler +configure:2693: gcc -c conftest.c >&5 +configure:2693: $? = 0 +configure:2702: result: yes +configure:2711: checking whether gcc accepts -g +configure:2731: gcc -c -g conftest.c >&5 +configure:2731: $? = 0 +configure:2772: result: yes +configure:2789: checking for gcc option to accept ISO C89 +configure:2852: gcc -c -g -O2 conftest.c >&5 +configure:2852: $? = 0 +configure:2865: result: none needed +configure:2891: checking whether make sets $(MAKE) +configure:2913: result: yes +configure:2928: checking how to run the C preprocessor +configure:2959: gcc -E conftest.c +configure:2959: $? = 0 +configure:2973: gcc -E conftest.c +conftest.c:9:28: fatal error: ac_nonexistent.h: No such file or directory +compilation terminated. +configure:2973: $? = 1 +configure: failed program was: +| /* confdefs.h */ +| #define PACKAGE_NAME "" +| #define PACKAGE_TARNAME "" +| #define PACKAGE_VERSION "" +| #define PACKAGE_STRING "" +| #define PACKAGE_BUGREPORT "" +| #define PACKAGE_URL "" +| /* end confdefs.h. */ +| #include +configure:2998: result: gcc -E +configure:3018: gcc -E conftest.c +configure:3018: $? = 0 +configure:3032: gcc -E conftest.c +conftest.c:9:28: fatal error: ac_nonexistent.h: No such file or directory +compilation terminated. +configure:3032: $? = 1 +configure: failed program was: +| /* confdefs.h */ +| #define PACKAGE_NAME "" +| #define PACKAGE_TARNAME "" +| #define PACKAGE_VERSION "" +| #define PACKAGE_STRING "" +| #define PACKAGE_BUGREPORT "" +| #define PACKAGE_URL "" +| /* end confdefs.h. */ +| #include +configure:3061: checking for grep that handles long lines and -e +configure:3119: result: /bin/grep +configure:3124: checking for egrep +configure:3186: result: /bin/grep -E +configure:3191: checking for ANSI C header files +configure:3211: gcc -c -g -O2 conftest.c >&5 +configure:3211: $? = 0 +configure:3284: gcc -o conftest -g -O2 conftest.c >&5 +configure:3284: $? = 0 +configure:3284: ./conftest +configure:3284: $? = 0 +configure:3295: result: yes +configure:3546: checking for sys/types.h +configure:3546: gcc -c -g -O2 conftest.c >&5 +configure:3546: $? = 0 +configure:3546: result: yes +configure:3546: checking for sys/stat.h +configure:3546: gcc -c -g -O2 conftest.c >&5 +configure:3546: $? = 0 +configure:3546: result: yes +configure:3546: checking for stdlib.h +configure:3546: gcc -c -g -O2 conftest.c >&5 +configure:3546: $? = 0 +configure:3546: result: yes +configure:3546: checking for string.h +configure:3546: gcc -c -g -O2 conftest.c >&5 +configure:3546: $? = 0 +configure:3546: result: yes +configure:3546: checking for memory.h +configure:3546: gcc -c -g -O2 conftest.c >&5 +configure:3546: $? = 0 +configure:3546: result: yes +configure:3546: checking for strings.h +configure:3546: gcc -c -g -O2 conftest.c >&5 +configure:3546: $? = 0 +configure:3546: result: yes +configure:3546: checking for inttypes.h +configure:3546: gcc -c -g -O2 conftest.c >&5 +configure:3546: $? = 0 +configure:3546: result: yes +configure:3546: checking for stdint.h +configure:3546: gcc -c -g -O2 conftest.c >&5 +configure:3546: $? = 0 +configure:3546: result: yes +configure:3546: checking for unistd.h +configure:3546: gcc -c -g -O2 conftest.c >&5 +configure:3546: $? = 0 +configure:3546: result: yes +configure:3558: checking sys/soundcard.h usability +configure:3558: gcc -c -g -O2 conftest.c >&5 +configure:3558: $? = 0 +configure:3558: result: yes +configure:3558: checking sys/soundcard.h presence +configure:3558: gcc -E conftest.c +configure:3558: $? = 0 +configure:3558: result: yes +configure:3558: checking for sys/soundcard.h +configure:3558: result: yes +configure:3775: creating ./config.status + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by config.status, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on lifebook + +config.status:725: creating Makefile + +## ---------------- ## +## Cache variables. ## +## ---------------- ## + +ac_cv_c_compiler_gnu=yes +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_set= +ac_cv_env_CFLAGS_value= +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_CPP_set= +ac_cv_env_CPP_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_LIBS_set= +ac_cv_env_LIBS_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_header_inttypes_h=yes +ac_cv_header_memory_h=yes +ac_cv_header_stdc=yes +ac_cv_header_stdint_h=yes +ac_cv_header_stdlib_h=yes +ac_cv_header_string_h=yes +ac_cv_header_strings_h=yes +ac_cv_header_sys_soundcard_h=yes +ac_cv_header_sys_stat_h=yes +ac_cv_header_sys_types_h=yes +ac_cv_header_unistd_h=yes +ac_cv_objext=o +ac_cv_path_EGREP='/bin/grep -E' +ac_cv_path_GREP=/bin/grep +ac_cv_prog_CPP='gcc -E' +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_cc_c89= +ac_cv_prog_cc_g=yes +ac_cv_prog_make_make_set=yes + +## ----------------- ## +## Output variables. ## +## ----------------- ## + +CC='gcc' +CFLAGS='-g -O2' +CPP='gcc -E' +CPPFLAGS='' +DEFS='-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_OSS=1' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EGREP='/bin/grep -E' +EXEEXT='' +GREP='/bin/grep' +LDFLAGS='' +LIBOBJS='' +LIBS='' +LTLIBOBJS='' +OBJEXT='o' +PACKAGE_BUGREPORT='' +PACKAGE_NAME='' +PACKAGE_STRING='' +PACKAGE_TARNAME='' +PACKAGE_URL='' +PACKAGE_VERSION='' +PATH_SEPARATOR=':' +SET_MAKE='' +SHELL='/bin/sh' +VERSION='0.0.1' +ac_ct_CC='gcc' +bindir='${exec_prefix}/bin' +build_alias='' +datadir='${datarootdir}' +datarootdir='${prefix}/share' +docdir='${datarootdir}/doc/${PACKAGE}' +dvidir='${docdir}' +exec_prefix='${prefix}' +host_alias='' +htmldir='${docdir}' +includedir='${prefix}/include' +infodir='${datarootdir}/info' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' +localedir='${datarootdir}/locale' +localstatedir='${prefix}/var' +mandir='${datarootdir}/man' +oldincludedir='/usr/include' +pdfdir='${docdir}' +prefix='/usr/local' +program_transform_name='s,x,x,' +psdir='${docdir}' +sbindir='${exec_prefix}/sbin' +sharedstatedir='${prefix}/com' +sysconfdir='${prefix}/etc' +target_alias='' + +## ----------- ## +## confdefs.h. ## +## ----------- ## + +/* confdefs.h */ +#define PACKAGE_NAME "" +#define PACKAGE_TARNAME "" +#define PACKAGE_VERSION "" +#define PACKAGE_STRING "" +#define PACKAGE_BUGREPORT "" +#define PACKAGE_URL "" +#define STDC_HEADERS 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_OSS 1 + +configure: exit 0 diff --git a/libUseful-2.0/config.status b/libUseful-2.0/config.status new file mode 100755 index 0000000..64a1b96 --- /dev/null +++ b/libUseful-2.0/config.status @@ -0,0 +1,892 @@ +#! /bin/sh +# Generated by configure. +# 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-/bin/sh} +export SHELL +## -------------------- ## +## 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 -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +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 + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# 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. ## +## ----------------------------------- ## +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by $as_me, which was +generated by GNU Autoconf 2.69. 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` +" + +# Files that config.status was made for. +config_files=" Makefile" + +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 + +Report bugs to the package provider." + +ac_cs_config="'--prefix=/usr/local' '--cache-file=/dev/null' '--srcdir=.'" +ac_cs_version="\ +config.status +configured by ./configure, generated by GNU Autoconf 2.69, + with options \"$ac_cs_config\" + +Copyright (C) 2012 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='/home/meta/movgrab-1.2.1/libUseful-2.0' +srcdir='.' +test -n "$AWK" || AWK=awk +# 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;; + --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 + +if $ac_cs_recheck; then + set X /bin/sh './configure' '--prefix=/usr/local' '--cache-file=/dev/null' '--srcdir=.' $ac_configure_extra_args --no-create --no-recursion + shift + $as_echo "running CONFIG_SHELL=/bin/sh $*" >&6 + CONFIG_SHELL='/bin/sh' + export CONFIG_SHELL + exec "$@" +fi + +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 + + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES 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 +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" && +cat >>"$ac_tmp/subs1.awk" <<\_ACAWK && +S["LTLIBOBJS"]="" +S["LIBOBJS"]="" +S["EGREP"]="/bin/grep -E" +S["GREP"]="/bin/grep" +S["CPP"]="gcc -E" +S["SET_MAKE"]="" +S["OBJEXT"]="o" +S["EXEEXT"]="" +S["ac_ct_CC"]="gcc" +S["CPPFLAGS"]="" +S["LDFLAGS"]="" +S["CFLAGS"]="-g -O2" +S["CC"]="gcc" +S["VERSION"]="0.0.1" +S["target_alias"]="" +S["host_alias"]="" +S["build_alias"]="" +S["LIBS"]="" +S["ECHO_T"]="" +S["ECHO_N"]="-n" +S["ECHO_C"]="" +S["DEFS"]="-DPACKAGE_NAME=\\\"\\\" -DPACKAGE_TARNAME=\\\"\\\" -DPACKAGE_VERSION=\\\"\\\" -DPACKAGE_STRING=\\\"\\\" -DPACKAGE_BUGREPORT=\\\"\\\" -DPACKAGE_URL=\\\"\\\" -DSTDC_HEADERS=1"\ +" -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT"\ +"_H=1 -DHAVE_UNISTD_H=1 -DHAVE_OSS=1" +S["mandir"]="${datarootdir}/man" +S["localedir"]="${datarootdir}/locale" +S["libdir"]="${exec_prefix}/lib" +S["psdir"]="${docdir}" +S["pdfdir"]="${docdir}" +S["dvidir"]="${docdir}" +S["htmldir"]="${docdir}" +S["infodir"]="${datarootdir}/info" +S["docdir"]="${datarootdir}/doc/${PACKAGE}" +S["oldincludedir"]="/usr/include" +S["includedir"]="${prefix}/include" +S["localstatedir"]="${prefix}/var" +S["sharedstatedir"]="${prefix}/com" +S["sysconfdir"]="${prefix}/etc" +S["datadir"]="${datarootdir}" +S["datarootdir"]="${prefix}/share" +S["libexecdir"]="${exec_prefix}/libexec" +S["sbindir"]="${exec_prefix}/sbin" +S["bindir"]="${exec_prefix}/bin" +S["program_transform_name"]="s,x,x," +S["prefix"]="/usr/local" +S["exec_prefix"]="${prefix}" +S["PACKAGE_URL"]="" +S["PACKAGE_BUGREPORT"]="" +S["PACKAGE_STRING"]="" +S["PACKAGE_VERSION"]="" +S["PACKAGE_TARNAME"]="" +S["PACKAGE_NAME"]="" +S["PATH_SEPARATOR"]=":" +S["SHELL"]="/bin/sh" +_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 +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 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_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 + # + +# 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;} + ac_datarootdir_hack=' + s&@datadir@&${datarootdir}&g + s&@docdir@&${datarootdir}/doc/${PACKAGE}&g + s&@infodir@&${datarootdir}/info&g + s&@localedir@&${datarootdir}/locale&g + s&@mandir@&${datarootdir}/man&g + s&\${datarootdir}&${prefix}/share&g' ;; +esac +ac_sed_extra="/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +} + +: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 +$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 + ;; + + + + esac + +done # for ac_tag + + +as_fn_exit 0 diff --git a/libUseful-2.0/configure b/libUseful-2.0/configure new file mode 100755 index 0000000..162cc96 --- /dev/null +++ b/libUseful-2.0/configure @@ -0,0 +1,4779 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69. +# +# +# Copyright (C) 1992-1996, 1998-2012 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 + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # 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 +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+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +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 +test -x / || 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 : + export CONFIG_SHELL + # 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 +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+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +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 about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +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_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_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; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # 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 -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +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 + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# 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'" + + +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= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= +PACKAGE_URL= + +ac_unique_file="defines.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='LTLIBOBJS +LIBOBJS +EGREP +GREP +CPP +SET_MAKE +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +VERSION +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_largefiles +enable_ssl +enable_z +enable_oss +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) 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 + 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 this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-largefiles enable largefile support + --enable-ssl use Secure Sockets Layer + --enable-zlib use ZLib Compression + --enable-oss use Open Sound System + +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 the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +configure +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_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 || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case 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_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;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.69. 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 + +# 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 + + + +VERSION="0.0.1" + + +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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $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 as_fn_executable_p "$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 as_fn_executable_p "$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 +struct stat; +/* 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 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 eval \${ac_cv_prog_make_${ac_make}_set+:} false; 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 + + +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 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" + as_fn_executable_p "$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" + as_fn_executable_p "$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 ${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 + + +cf_have_libssl=no +cf_have_libcrypto=no +cf_have_libz=no +cf_have_oss=no +cf_have_libesd=no + + +# Check whether --enable-largefiles was given. +if test "${enable_largefiles+set}" = set; then : + enableval=$enable_largefiles; cf_use_largefiles=$enableval +fi + + +if test "$cf_use_largefiles" = "yes" +then +$as_echo "#define _LARGEFILE64_SOURCE 1" >>confdefs.h + +$as_echo "#define _FILE_OFFSET_BITS 64" >>confdefs.h + +fi + +# Check whether --enable-ssl was given. +if test "${enable_ssl+set}" = set; then : + enableval=$enable_ssl; cf_use_ssl=$enableval +fi + + +if test "$cf_use_ssl" = "yes" +then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5 +$as_echo_n "checking for SSL_library_init in -lssl... " >&6; } +if ${ac_cv_lib_ssl_SSL_library_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lssl $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 SSL_library_init (); +int +main () +{ +return SSL_library_init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ssl_SSL_library_init=yes +else + ac_cv_lib_ssl_SSL_library_init=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_ssl_SSL_library_init" >&5 +$as_echo "$ac_cv_lib_ssl_SSL_library_init" >&6; } +if test "x$ac_cv_lib_ssl_SSL_library_init" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSSL 1 +_ACEOF + + LIBS="-lssl $LIBS" + +fi + +cf_have_libssl=$ac_cv_lib_ssl_SSL_library_init + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EVP_CIPHER_CTX_init in -lcrypto" >&5 +$as_echo_n "checking for EVP_CIPHER_CTX_init in -lcrypto... " >&6; } +if ${ac_cv_lib_crypto_EVP_CIPHER_CTX_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcrypto $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 EVP_CIPHER_CTX_init (); +int +main () +{ +return EVP_CIPHER_CTX_init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_crypto_EVP_CIPHER_CTX_init=yes +else + ac_cv_lib_crypto_EVP_CIPHER_CTX_init=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_crypto_EVP_CIPHER_CTX_init" >&5 +$as_echo "$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" >&6; } +if test "x$ac_cv_lib_crypto_EVP_CIPHER_CTX_init" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBCRYPTO 1 +_ACEOF + + LIBS="-lcrypto $LIBS" + +fi + +cf_have_libcrypto=$ac_cv_lib_crypto_EVP_CIPHER_CTX_init + +for ac_func in OpenSSL_add_all_algorithms EVP_bf_cbc EVP_rc2_cbc EVP_rc4 EVP_rc5_32_12_16_cbc EVP_des_cbc EVP_desx_cbc EVP_cast5_cbc EVP_idea_cbc EVP_aes_128_cbc EVP_aes_256_cbc +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking that OpenSSL Library is at least version 0.9.7" >&5 +$as_echo_n "checking that OpenSSL Library is at least version 0.9.7... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #if SSLEAY_VERSION_NUMBER >= 0x00907000L + yes + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define USE_OPENSSL_ADD_ALL_ALGORITHMS 1" >>confdefs.h + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f conftest* + +fi + +if test "cf_have_libssl" = "yes" +then +cf_use_zlib=yes +fi + + +# Check whether --enable-z was given. +if test "${enable_z+set}" = set; then : + enableval=$enable_z; cf_use_zlib=$enableval +fi + + +if test "$cf_use_zlib" = "yes" +then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for deflate in -lz" >&5 +$as_echo_n "checking for deflate in -lz... " >&6; } +if ${ac_cv_lib_z_deflate+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lz $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 deflate (); +int +main () +{ +return deflate (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_z_deflate=yes +else + ac_cv_lib_z_deflate=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_z_deflate" >&5 +$as_echo "$ac_cv_lib_z_deflate" >&6; } +if test "x$ac_cv_lib_z_deflate" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBZ 1 +_ACEOF + + LIBS="-lz $LIBS" + +fi + +cf_have_libz=$ac_cv_lib_z_deflate +fi + + +# Check whether --enable-oss was given. +if test "${enable_oss+set}" = set; then : + enableval=$enable_oss; cf_use_oss=$enableval +fi + + +cf_use_oss=yes + +if test "$cf_use_oss" = "yes" +then +# 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 + + +ac_fn_c_check_header_mongrel "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_soundcard_h" = xyes; then : + $as_echo "#define HAVE_OSS 1" >>confdefs.h + +else + cf_have_oss=no +fi + + +fi + + +#AC_ARG_ENABLE(esd, [ --enable-esd use ESound], cf_use_esd=$enableval ) + +if test "$cf_use_esd" = "yes" +then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for esd_open_sound in -lesd" >&5 +$as_echo_n "checking for esd_open_sound in -lesd... " >&6; } +if ${ac_cv_lib_esd_esd_open_sound+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lesd $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 esd_open_sound (); +int +main () +{ +return esd_open_sound (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_esd_esd_open_sound=yes +else + ac_cv_lib_esd_esd_open_sound=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_esd_esd_open_sound" >&5 +$as_echo "$ac_cv_lib_esd_esd_open_sound" >&6; } +if test "x$ac_cv_lib_esd_esd_open_sound" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBESD 1 +_ACEOF + + LIBS="-lesd $LIBS" + +fi + +cf_have_libesd=$ac_cv_lib_esd_esd_open_sound +fi + + +ac_config_files="$ac_config_files 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 + 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}' + +# 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= +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 -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +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 + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# 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 $as_me, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files 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 + +Report bugs to the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 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' +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;; + --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 +_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 + "Makefile") CONFIG_FILES="$CONFIG_FILES 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 +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" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_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 + # + +_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 +$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 + ;; + + + + 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 + diff --git a/libUseful-2.0/configure.in b/libUseful-2.0/configure.in new file mode 100644 index 0000000..75a048a --- /dev/null +++ b/libUseful-2.0/configure.in @@ -0,0 +1,88 @@ +#AC_INIT(libUseful,colums.projects@googlemail.com,,http://sites.google.com/site/columscode) +AC_INIT(defines.h) + +VERSION="0.0.1" +AC_SUBST(VERSION) + +AC_PROG_CC +AC_LANG_C +AC_PROG_MAKE_SET +AC_HEADER_STDC + +cf_have_libssl=no +cf_have_libcrypto=no +cf_have_libz=no +cf_have_oss=no +cf_have_libesd=no + + +AC_ARG_ENABLE(largefiles, [ --enable-largefiles enable largefile support], cf_use_largefiles=$enableval ) + +if test "$cf_use_largefiles" = "yes" +then +AC_DEFINE([_LARGEFILE64_SOURCE]) +AC_DEFINE([_FILE_OFFSET_BITS],[64]) +fi + +AC_ARG_ENABLE(ssl, [ --enable-ssl use Secure Sockets Layer], cf_use_ssl=$enableval ) + +if test "$cf_use_ssl" = "yes" +then +AC_CHECK_LIB(ssl,SSL_library_init,,) +cf_have_libssl=$ac_cv_lib_ssl_SSL_library_init + +AC_CHECK_LIB(crypto,EVP_CIPHER_CTX_init,,) +cf_have_libcrypto=$ac_cv_lib_crypto_EVP_CIPHER_CTX_init + +AC_CHECK_FUNCS(OpenSSL_add_all_algorithms EVP_bf_cbc EVP_rc2_cbc EVP_rc4 EVP_rc5_32_12_16_cbc EVP_des_cbc EVP_desx_cbc EVP_cast5_cbc EVP_idea_cbc EVP_aes_128_cbc EVP_aes_256_cbc) + + AC_MSG_CHECKING([that OpenSSL Library is at least version 0.9.7]) + AC_EGREP_CPP(yes, [ + #include + #if SSLEAY_VERSION_NUMBER >= 0x00907000L + yes + #endif + ], + [ + AC_MSG_RESULT([yes]) + AC_DEFINE(USE_OPENSSL_ADD_ALL_ALGORITHMS, 1, [Use OpenSSL_add_all_algorithms]) + ],[AC_MSG_RESULT([no])]) +fi + +if test "cf_have_libssl" = "yes" +then +cf_use_zlib=yes +fi + + +AC_ARG_ENABLE(z, [ --enable-zlib use ZLib Compression], cf_use_zlib=$enableval ) + +if test "$cf_use_zlib" = "yes" +then +AC_CHECK_LIB(z,deflate,,) +cf_have_libz=$ac_cv_lib_z_deflate +fi + + +AC_ARG_ENABLE(oss, [ --enable-oss use Open Sound System], cf_use_oss=$enableval ) + +dnl Always use oss if available +cf_use_oss=yes + +if test "$cf_use_oss" = "yes" +then +AC_CHECK_HEADER(sys/soundcard.h,AC_DEFINE([HAVE_OSS]),cf_have_oss=no,) +fi + + +#AC_ARG_ENABLE(esd, [ --enable-esd use ESound], cf_use_esd=$enableval ) + +if test "$cf_use_esd" = "yes" +then +AC_CHECK_LIB(esd,esd_open_sound,,) +cf_have_libesd=$ac_cv_lib_esd_esd_open_sound +fi + + +dnl read Makefile.in and write Makefile +AC_OUTPUT(Makefile) diff --git a/libUseful-2.0/crc32.c b/libUseful-2.0/crc32.c new file mode 100644 index 0000000..dba57b8 --- /dev/null +++ b/libUseful-2.0/crc32.c @@ -0,0 +1,103 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 2003, Dominik Reichl , Germany. + All rights reserved. + + Distributed under the terms of the GNU General Public License v2. + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- +*/ + +#include "crc32.h" + +// CRC-32 polynominal: +// X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X+1 + +static unsigned long crc32tab[] = { + 0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL, + 0x076DC419L, 0x706AF48FL, 0xE963A535L, 0x9E6495A3L, + 0x0EDB8832L, 0x79DCB8A4L, 0xE0D5E91EL, 0x97D2D988L, + 0x09B64C2BL, 0x7EB17CBDL, 0xE7B82D07L, 0x90BF1D91L, + 0x1DB71064L, 0x6AB020F2L, 0xF3B97148L, 0x84BE41DEL, + 0x1ADAD47DL, 0x6DDDE4EBL, 0xF4D4B551L, 0x83D385C7L, + 0x136C9856L, 0x646BA8C0L, 0xFD62F97AL, 0x8A65C9ECL, + 0x14015C4FL, 0x63066CD9L, 0xFA0F3D63L, 0x8D080DF5L, + 0x3B6E20C8L, 0x4C69105EL, 0xD56041E4L, 0xA2677172L, + 0x3C03E4D1L, 0x4B04D447L, 0xD20D85FDL, 0xA50AB56BL, + 0x35B5A8FAL, 0x42B2986CL, 0xDBBBC9D6L, 0xACBCF940L, + 0x32D86CE3L, 0x45DF5C75L, 0xDCD60DCFL, 0xABD13D59L, + 0x26D930ACL, 0x51DE003AL, 0xC8D75180L, 0xBFD06116L, + 0x21B4F4B5L, 0x56B3C423L, 0xCFBA9599L, 0xB8BDA50FL, + 0x2802B89EL, 0x5F058808L, 0xC60CD9B2L, 0xB10BE924L, + 0x2F6F7C87L, 0x58684C11L, 0xC1611DABL, 0xB6662D3DL, + 0x76DC4190L, 0x01DB7106L, 0x98D220BCL, 0xEFD5102AL, + 0x71B18589L, 0x06B6B51FL, 0x9FBFE4A5L, 0xE8B8D433L, + 0x7807C9A2L, 0x0F00F934L, 0x9609A88EL, 0xE10E9818L, + 0x7F6A0DBBL, 0x086D3D2DL, 0x91646C97L, 0xE6635C01L, + 0x6B6B51F4L, 0x1C6C6162L, 0x856530D8L, 0xF262004EL, + 0x6C0695EDL, 0x1B01A57BL, 0x8208F4C1L, 0xF50FC457L, + 0x65B0D9C6L, 0x12B7E950L, 0x8BBEB8EAL, 0xFCB9887CL, + 0x62DD1DDFL, 0x15DA2D49L, 0x8CD37CF3L, 0xFBD44C65L, + 0x4DB26158L, 0x3AB551CEL, 0xA3BC0074L, 0xD4BB30E2L, + 0x4ADFA541L, 0x3DD895D7L, 0xA4D1C46DL, 0xD3D6F4FBL, + 0x4369E96AL, 0x346ED9FCL, 0xAD678846L, 0xDA60B8D0L, + 0x44042D73L, 0x33031DE5L, 0xAA0A4C5FL, 0xDD0D7CC9L, + 0x5005713CL, 0x270241AAL, 0xBE0B1010L, 0xC90C2086L, + 0x5768B525L, 0x206F85B3L, 0xB966D409L, 0xCE61E49FL, + 0x5EDEF90EL, 0x29D9C998L, 0xB0D09822L, 0xC7D7A8B4L, + 0x59B33D17L, 0x2EB40D81L, 0xB7BD5C3BL, 0xC0BA6CADL, + 0xEDB88320L, 0x9ABFB3B6L, 0x03B6E20CL, 0x74B1D29AL, + 0xEAD54739L, 0x9DD277AFL, 0x04DB2615L, 0x73DC1683L, + 0xE3630B12L, 0x94643B84L, 0x0D6D6A3EL, 0x7A6A5AA8L, + 0xE40ECF0BL, 0x9309FF9DL, 0x0A00AE27L, 0x7D079EB1L, + 0xF00F9344L, 0x8708A3D2L, 0x1E01F268L, 0x6906C2FEL, + 0xF762575DL, 0x806567CBL, 0x196C3671L, 0x6E6B06E7L, + 0xFED41B76L, 0x89D32BE0L, 0x10DA7A5AL, 0x67DD4ACCL, + 0xF9B9DF6FL, 0x8EBEEFF9L, 0x17B7BE43L, 0x60B08ED5L, + 0xD6D6A3E8L, 0xA1D1937EL, 0x38D8C2C4L, 0x4FDFF252L, + 0xD1BB67F1L, 0xA6BC5767L, 0x3FB506DDL, 0x48B2364BL, + 0xD80D2BDAL, 0xAF0A1B4CL, 0x36034AF6L, 0x41047A60L, + 0xDF60EFC3L, 0xA867DF55L, 0x316E8EEFL, 0x4669BE79L, + 0xCB61B38CL, 0xBC66831AL, 0x256FD2A0L, 0x5268E236L, + 0xCC0C7795L, 0xBB0B4703L, 0x220216B9L, 0x5505262FL, + 0xC5BA3BBEL, 0xB2BD0B28L, 0x2BB45A92L, 0x5CB36A04L, + 0xC2D7FFA7L, 0xB5D0CF31L, 0x2CD99E8BL, 0x5BDEAE1DL, + 0x9B64C2B0L, 0xEC63F226L, 0x756AA39CL, 0x026D930AL, + 0x9C0906A9L, 0xEB0E363FL, 0x72076785L, 0x05005713L, + 0x95BF4A82L, 0xE2B87A14L, 0x7BB12BAEL, 0x0CB61B38L, + 0x92D28E9BL, 0xE5D5BE0DL, 0x7CDCEFB7L, 0x0BDBDF21L, + 0x86D3D2D4L, 0xF1D4E242L, 0x68DDB3F8L, 0x1FDA836EL, + 0x81BE16CDL, 0xF6B9265BL, 0x6FB077E1L, 0x18B74777L, + 0x88085AE6L, 0xFF0F6A70L, 0x66063BCAL, 0x11010B5CL, + 0x8F659EFFL, 0xF862AE69L, 0x616BFFD3L, 0x166CCF45L, + 0xA00AE278L, 0xD70DD2EEL, 0x4E048354L, 0x3903B3C2L, + 0xA7672661L, 0xD06016F7L, 0x4969474DL, 0x3E6E77DBL, + 0xAED16A4AL, 0xD9D65ADCL, 0x40DF0B66L, 0x37D83BF0L, + 0xA9BCAE53L, 0xDEBB9EC5L, 0x47B2CF7FL, 0x30B5FFE9L, + 0xBDBDF21CL, 0xCABAC28AL, 0x53B39330L, 0x24B4A3A6L, + 0xBAD03605L, 0xCDD70693L, 0x54DE5729L, 0x23D967BFL, + 0xB3667A2EL, 0xC4614AB8L, 0x5D681B02L, 0x2A6F2B94L, + 0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL, 0x2D02EF8DL +}; + +void crc32Init(unsigned long *pCrc32) +{ + *pCrc32 = 0xFFFFFFFF; +} + +void crc32Update(unsigned long *pCrc32, unsigned char *pData, unsigned long uSize) +{ + unsigned long i = 0; + + for(i = 0; i < uSize; i++) + *pCrc32 = ((*pCrc32) >> 8) ^ crc32tab[(pData[i]) ^ ((*pCrc32) & 0x000000FF)]; +} + +// Make the final adjustment +void crc32Finish(unsigned long *pCrc32) +{ + *pCrc32 = ~(*pCrc32); +} diff --git a/libUseful-2.0/crc32.h b/libUseful-2.0/crc32.h new file mode 100644 index 0000000..d947c91 --- /dev/null +++ b/libUseful-2.0/crc32.h @@ -0,0 +1,30 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 2003, Dominik Reichl , Germany. + All rights reserved. + + Distributed under the terms of the GNU General Public License v2. + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- +*/ + +#ifndef ___CRC32_H___ +#define ___CRC32_H___ + + +#ifdef __cplusplus +extern "C" { +#endif + +void crc32Init(unsigned long *pCrc32); +void crc32Update(unsigned long *pCrc32, unsigned char *pData, unsigned long uSize); +void crc32Finish(unsigned long *pCrc32); + +#ifdef __cplusplus +} +#endif + +#endif /* ___CRC32_H___ */ diff --git a/libUseful-2.0/defines.h b/libUseful-2.0/defines.h new file mode 100644 index 0000000..88de467 --- /dev/null +++ b/libUseful-2.0/defines.h @@ -0,0 +1,29 @@ +#ifndef LIBUSEFUL_DEFINES_H +#define LIBUSEFUL_DEFINES_H + +#define FALSE 0 +#define TRUE 1 + +#define FTIMEOUT -2 + + +#define SUBS_QUOTE_VARS 1 +#define SUBS_CASE_VARNAMES 2 +#define SUBS_STRIP_VARS_WHITESPACE 4 + +#define HEX_CHARS "0123456789ABCDEF" +#define ALPHA_CHARS "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int (*BASIC_FUNC)(void *Data); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libUseful-2.0/expect.c b/libUseful-2.0/expect.c new file mode 100644 index 0000000..34494d1 --- /dev/null +++ b/libUseful-2.0/expect.c @@ -0,0 +1,133 @@ +#include "includes.h" +#include "expect.h" + + +//Values for 'flags' that are not visible to the user +//These must not clash with any visible values +#define DIALOG_DONE 67108864 + + +void ExpectDialogAdd(ListNode *ExpectDialogs, char *Expect, char *Reply, int Flags) +{ +TExpectDialog *ExpectDialog; + +ExpectDialog=(TExpectDialog *) calloc(1,sizeof(TExpectDialog)); +ExpectDialog->Expect=CopyStr(ExpectDialog->Expect,Expect); +ExpectDialog->Reply=CopyStr(ExpectDialog->Reply,Reply); +ExpectDialog->Flags=Flags; + +ListAddItem(ExpectDialogs,ExpectDialog); +} + +void ExpectDialogDestroy(void *p_Item) +{ +TExpectDialog *ExpectDialog; + +ExpectDialog=(TExpectDialog *) p_Item; +DestroyString(ExpectDialog->Expect); +DestroyString(ExpectDialog->Reply); +free(ExpectDialog); +} + + + +int STREAMExpectDialog(STREAM *S, ListNode *ExpectDialogs) +{ +int len=0, inchar; +ListNode *Curr; +TExpectDialog *ExpectDialog; + +inchar=STREAMReadChar(S); +while (inchar !=EOF) +{ + if (inchar > 0) + { + Curr=ListGetNext(ExpectDialogs); + while (Curr) + { + ExpectDialog=(TExpectDialog *) Curr->Item; + if (! (ExpectDialog->Flags & DIALOG_DONE)) + { + //if the current value does not equal where we are in the string + //we have to consider whether it is the first character in the string + if (ExpectDialog->Expect[ExpectDialog->Match]!=inchar) ExpectDialog->Match=0; + + if (ExpectDialog->Expect[ExpectDialog->Match]==inchar) + { + ExpectDialog->Match++; + if (ExpectDialog->Expect[ExpectDialog->Match]=='\0') + { + ExpectDialog->Match=0; + ExpectDialog->Flags |= DIALOG_DONE; + if (ExpectDialog->Reply) STREAMWriteLine(ExpectDialog->Reply,S); + if (ExpectDialog->Flags & DIALOG_END) return(TRUE); + if (ExpectDialog->Flags & DIALOG_FAIL) return(FALSE); + } + } + + if (! (ExpectDialog->Flags & DIALOG_OPTIONAL)) break; + } + Curr=ListGetNext(Curr); + } + } +inchar=STREAMReadChar(S); +} + +return(FALSE); +} + + +int STREAMExpectAndReply(STREAM *S, char *Expect, char *Reply) +{ +int match=0, len=0, inchar; + +len=StrLen(Expect); +inchar=STREAMReadChar(S); +while (inchar !=EOF) +{ + if (inchar > 0) + { + //if the current value does not equal where we are in the string + //we have to consider whether it is the first character in the string + if (Expect[match]!=inchar) match=0; + + if (Expect[match]==inchar) + { + match++; + if (match==len) + { + if (Reply) STREAMWriteLine(Reply,S); + return(TRUE); + } + } + + } +inchar=STREAMReadChar(S); +} + +return(FALSE); +} + + +int STREAMExpectSilence(STREAM *S, int wait) +{ +int inchar; +char *Tempstr=NULL; +int len=0, Timeout; + +Timeout=S->Timeout; +S->Timeout=wait; +inchar=STREAMReadChar(S); +while (inchar > 0) +{ + Tempstr=AddCharToBuffer(Tempstr,len,inchar); + len++; + inchar=STREAMReadChar(S); +} + +S->Timeout=Timeout; + +DestroyString(Tempstr); + +return(FALSE); +} diff --git a/libUseful-2.0/expect.h b/libUseful-2.0/expect.h new file mode 100644 index 0000000..d8de924 --- /dev/null +++ b/libUseful-2.0/expect.h @@ -0,0 +1,37 @@ + +#ifndef LIBUSEFUL_EXPECT_H +#define LIBUSEFUL_EXPECT_H + +#include "file.h" + +#define DIALOG_END 1 +#define DIALOG_FAIL 2 +#define DIALOG_OPTIONAL 4 + +typedef struct +{ +int Flags; +int Match; +char *Expect; +char *Reply; +} TExpectDialog; + + +#ifdef __cplusplus +extern "C" { +#endif + +int STREAMExpectAndReply(STREAM *S, char *Expect, char *Reply); +int STREAMExpectSilence(STREAM *S, int wait); + +void ExpectDialogAdd(ListNode *Dialogs, char *Expect, char *Reply, int Flags); +int STREAMExpectDialog(STREAM *S, ListNode *Dialogs); + +void ExpectDialogDestroy(void *Item); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/file.c b/libUseful-2.0/file.c new file mode 100644 index 0000000..ee981b6 --- /dev/null +++ b/libUseful-2.0/file.c @@ -0,0 +1,1112 @@ +#include "includes.h" +#include "DataProcessing.h" +#include "pty.h" +#include "expect.h" + +#ifdef HAVE_LIBSSL +#include +#include +#include +#include +#include +#endif + + +int FDSelect(int fd, int Flags, struct timeval *tv) +{ +fd_set *readset=NULL, *writeset=NULL; +int result, RetVal=0; + + +if (Flags & SELECT_READ) +{ + readset=(fd_set *) calloc(1,sizeof(fd_set)); + FD_ZERO(readset); + FD_SET(fd, readset); +} + +if (Flags & SELECT_WRITE) +{ + writeset=(fd_set *) calloc(1,sizeof(fd_set)); + FD_ZERO(writeset); + FD_SET(fd, writeset); +} + + +result=select(fd+1,readset,writeset,NULL,tv); +if ((result==-1) && (errno==EBADF)) RetVal=0; +else if (result > 0) +{ + if (readset && FD_ISSET(fd, readset)) RetVal |= SELECT_READ; + if (writeset && FD_ISSET(fd, writeset)) RetVal |= SELECT_WRITE; +} + +if (readset) free(readset); +if (writeset) free(writeset); + +return(RetVal); +} + + +int FDIsWritable(int fd) +{ +struct timeval tv; + +tv.tv_sec=0; +tv.tv_usec=0; +if (FDSelect(fd, SELECT_WRITE, &tv) & SELECT_WRITE) return(TRUE); +return(FALSE); +} + + + +int FDCheckForBytes(int fd) +{ +struct timeval tv; + +tv.tv_sec=0; +tv.tv_usec=0; +if (FDSelect(fd, SELECT_READ, &tv) & SELECT_READ) return(TRUE); +return(FALSE); +} + + + +/*STREAM Functions */ + +/*Set non blocking IO on a stream*/ +void STREAMSetNonBlock(STREAM *S, int val) +{ +int flags=0; + + if (val) S->Flags |= SF_NONBLOCK; + else S->Flags &= (~SF_NONBLOCK); + + + fcntl(S->in_fd,F_GETFL,&flags); + if (val) flags |= O_NONBLOCK; + else flags &= (~O_NONBLOCK); + + fcntl(S->in_fd, F_SETFL, flags); +} + + +/*Set timeout for select calls within STREAM*/ +void STREAMSetTimeout(STREAM *S, int val) +{ +S->Timeout=val; +} + + +/*Set flush type for STREAM*/ +void STREAMSetFlushType(STREAM *S, int Type, int val) +{ +S->Flags &= ~(FLUSH_ALWAYS | FLUSH_LINE | FLUSH_BLOCK); +S->Flags |= Type; +S->BlockSize=val; +} + +/* This reads chunks from a file and when if finds a newline it resets */ +/* the file pointer to that position */ +void STREAMResizeBuffer(STREAM *Stream, int size) +{ + Stream->InputBuff=(char *) realloc(Stream->InputBuff,size); + Stream->OutputBuff=(char *) realloc(Stream->OutputBuff,size); + Stream->BuffSize=size; + if (Stream->InStart > Stream->BuffSize) Stream->InStart=0; + if (Stream->InEnd > Stream->BuffSize) Stream->InEnd=0; + if (Stream->OutEnd > Stream->BuffSize) Stream->OutEnd=0; +} + + + + +int STREAMCheckForBytes(STREAM *S) +{ + if (! S) return(0); + if (S->State & SS_EMBARGOED) return(0); + if (S->InEnd > S->InStart) return(1); + if (S->in_fd==-1) return(0); + return(FDCheckForBytes(S->in_fd)); +} + + + +int STREAMCountWaitingBytes(STREAM *S) +{ +int read_result=0, result; + + if (! S) return(0); + if (S->State & SS_EMBARGOED) return(0); + + result=FDCheckForBytes(S->in_fd); + if (result > 0) read_result=STREAMReadCharsToBuffer(S); + else if (result < 0) read_result=STREAM_CLOSED; + result=S->InEnd - S->InStart; + + if (result > 0) return(result); + if (read_result==STREAM_CLOSED) return(EOF); + if (read_result==STREAM_DATA_ERROR) return(EOF); + return(0); +} + +STREAM *STREAMSelect(ListNode *Streams, struct timeval *tv) +{ + fd_set SelectSet; + STREAM *S; + ListNode *Curr; + int highfd=0, result; + + FD_ZERO(&SelectSet); + + Curr=ListGetNext(Streams); + while (Curr) + { + S=(STREAM *) Curr->Item; + if (! (S->State & SS_EMBARGOED)) + { + //Pump any data in the stream + STREAMFlush(S); + if (S->InEnd > S->InStart) return(S); + FD_SET(S->in_fd,&SelectSet); + if (S->in_fd > highfd) highfd=S->in_fd; + } + + Curr=ListGetNext(Curr); + } + + result=select(highfd+1,&SelectSet,NULL,NULL,tv); + + if (result > 0) + { + Curr=ListGetNext(Streams); + while (Curr) + { + S=(STREAM *) Curr->Item; + if (FD_ISSET(S->in_fd,&SelectSet)) return(S); + Curr=ListGetNext(Curr); + } + } + + return(NULL); +} + + +int STREAMCheckForWaitingChar(STREAM *S,unsigned char check_char) +{ +int read_result=0, result, trash; +char *found_char; + +if (! S) return(0); +if (S->State & SS_EMBARGOED) return(0); + +result=FDCheckForBytes(S->in_fd); +if (result > 0) read_result=STREAMReadCharsToBuffer(S); +else if (result < 0) read_result=STREAM_CLOSED; + +if (S->InStart < S->InEnd) +{ + found_char=memchr(S->InputBuff + S->InStart,check_char,S->InEnd - S->InStart); + if (found_char > 0) return(TRUE); +} + +if (read_result==STREAM_CLOSED) return(EOF); +if (read_result==STREAM_DATA_ERROR) return(EOF); +return(FALSE); +} + + + +int STREAMInternalFinalWriteBytes(STREAM *S, const char *Data, int DataLen) +{ +fd_set selectset; +int result, count=0; +struct timeval tv; + +if (! S) return(STREAM_CLOSED); +if (S->out_fd==-1) return(STREAM_CLOSED); + + +while (count < DataLen) +{ +if (S->Flags & SF_SSL) +{ +#ifdef HAVE_LIBSSL + +result=SSL_write((SSL *) STREAMGetItem(S,"LIBUSEFUL-SSL-CTX"), Data + count, DataLen - count); +#endif +} +else +{ + if (S->Timeout > 0) + { + FD_ZERO(&selectset); + FD_SET(S->out_fd, &selectset); + tv.tv_sec=S->Timeout; + tv.tv_usec=0; + result=select(S->out_fd+1,NULL,&selectset,NULL,&tv); + + if (result==-1) return(STREAM_CLOSED); + if ((result == 0) || (! FD_ISSET(S->out_fd, &selectset))) return(STREAM_TIMEOUT); + } + + if (S->Flags & SF_WRLOCK) flock(S->out_fd,LOCK_EX); + result=write(S->out_fd, Data + count, DataLen - count); + if (S->Flags & SF_WRLOCK) flock(S->out_fd,LOCK_UN); +} + + if (result < 1 && ((errno !=EINTR) && (errno !=EAGAIN)) ) break; + if (result < 0) result=0; + count+=result; + S->BytesWritten+=result; +} + + +//memmove any remaining data so that we add onto the end of it +S->OutEnd -= count; +if (S->OutEnd > 0) memmove(S->OutputBuff,S->OutputBuff+count, S->OutEnd); + + +return(count); +} + + + + +int STREAMFlush(STREAM *S) +{ + STREAMWriteBytes(S,NULL,0); +} + +void STREAMClear(STREAM *S) +{ + STREAMFlush(S); + S->InStart=0; +} + + +/*A stream can have a series of 'processor modules' associated with it' */ +/*which do things to the data before it is read/written. This function */ +/*pumps the data through the processor list, and eventually writes it out */ +int STREAMReadThroughProcessors(STREAM *S, char *Bytes, int InLen) +{ +TProcessingModule *Mod; +ListNode *Curr; +char *InBuff=NULL, *OutputBuff=NULL; +int len=0, olen=0, state=STREAM_CLOSED; + + +len=InLen; + +if (InLen > 0) +{ +InBuff=SetStrLen(InBuff,len+1); +memcpy(InBuff,Bytes ,len); +} + +Curr=ListGetNext(S->ProcessingModules); +while (Curr) +{ + Mod=(TProcessingModule *) Curr->Item; + if (len < BUFSIZ) olen=BUFSIZ; + else olen=len * 8; + + OutputBuff=SetStrLen(OutputBuff,olen); + + if (Mod->Read) + { + len=Mod->Read(Mod,InBuff,len,&OutputBuff,&olen,FALSE); + if (len != EOF) state=0; + + if (len > 0) + { + InBuff=SetStrLen(InBuff,len); + memcpy(InBuff,OutputBuff,len); + } + } + + Curr=ListGetNext(Curr); +} + +if ( + (! (S->State & SS_DATA_ERROR)) && + (len > 0) + ) +{ +//Whatever happened above, InBuff should now contain the data to be written! +//note that we resize buff to S->InEnd + len, where len is length of the new +//data. Even if S->InStart > 0 (meaning there are 'sent' bytes in the buffer) +//we consider S->InStart to be 0 as regards sizeing the buffer, because those +//sent bytes are still there. +S->InputBuff=SetStrLen(S->InputBuff,len + S->InEnd ); +memcpy(S->InputBuff + S->InEnd, InBuff, len); +S->InEnd+=len; +} + +DestroyString(OutputBuff); +DestroyString(InBuff); + +len=S->InEnd - S->InStart; + +if (len==0) +{ + if (state ==STREAM_CLOSED) return(STREAM_CLOSED); + if (S->State & SS_DATA_ERROR) return(STREAM_DATA_ERROR); +} +return(len); +} + + + + +int STREAMLock(STREAM *S, int val) +{ +int result; + +result=flock(S->in_fd,val); + +if (result==0) return(TRUE); +return(FALSE); +} + + +STREAM *STREAMCreate() +{ +STREAM *S; + +S=(STREAM *) calloc(1,sizeof(STREAM)); +STREAMResizeBuffer(S,4096); +S->in_fd=-1; +S->out_fd=-1; +S->Timeout=30; +S->Flags |= FLUSH_ALWAYS; + +return(S); +} + +STREAM *STREAMFromFD(int fd) +{ +STREAM *Stream; + +if (fd==-1) return(NULL); + +Stream=STREAMCreate(); +Stream->in_fd=fd; +Stream->out_fd=fd; +return(Stream); +} + +STREAM *STREAMFromDualFD(int in_fd, int out_fd) +{ +STREAM *Stream; + +if (in_fd==-1) return(NULL); +if (out_fd==-1) return(NULL); + +Stream=STREAMCreate(); +Stream->in_fd=in_fd; +Stream->out_fd=out_fd; +return(Stream); +} + + +STREAM *STREAMOpenFile(const char *FilePath, int Flags) +{ +int fd, Mode=FALSE; +STREAM *Stream; +struct stat myStat; + +Mode = Flags & ~(O_LOCK|O_TRUNC); + +if (strcmp(FilePath,"-")==0) +{ +Stream=STREAMFromDualFD(0,1); +Stream->Path=CopyStr(Stream->Path,FilePath); +return(Stream); +} + +fd=open(FilePath, Mode, 0600); +if (fd==-1) return(NULL); + +if (Flags & O_LOCK) +{ + if (flock(fd,LOCK_EX | LOCK_NB)==-1) + { + close(fd); + return(NULL); + } + +} + +// check for symlink naughtyness. Basically a malicious user can +// try to guess the name of the file we are going to open in order +// to get us to write somewhere other than intended. + + +if (lstat(FilePath, &myStat) !=0) +{ + close(fd); + return(NULL); +} + +if (S_ISLNK(myStat.st_mode)) +{ + syslog(LOG_USER | LOG_WARNING, "STREAMOpenFile Opened symlink when trying to open %s. Possible DOS attack?",FilePath); + close(fd); + return(NULL); +} + +if (Flags & O_TRUNC) ftruncate(fd,0); + +Stream=STREAMFromFD(fd); +Stream->Path=CopyStr(Stream->Path,FilePath); +STREAMSetTimeout(Stream,0); +STREAMSetFlushType(Stream,FLUSH_FULL,0); + +return(Stream); +} + + +STREAM *STREAMClose(STREAM *S) +{ +ListNode *Curr; +int len; + +if (! S) return(NULL); +len=S->OutEnd; + +STREAMReadThroughProcessors(S, NULL, 0); +STREAMFlush(S); + +if ( + (StrLen(S->Path)==0) || + (strcmp(S->Path,"-") !=0) + ) +{ +if ((S->out_fd != -1) && (S->out_fd != S->in_fd)) close(S->out_fd); +if (S->in_fd != -1) close(S->in_fd); +} + +Curr=ListGetNext(S->Values); +while (Curr) +{ +if (strncmp(Curr->Tag,"HelperPID",9)==0) kill(atoi(Curr->Item),SIGKILL); +Curr=ListGetNext(Curr); +} + + +ListDestroy(S->Values,(LIST_ITEM_DESTROY_FUNC)DestroyString); +ListDestroy(S->ProcessingModules,DataProcessorDestroy); +DestroyString(S->InputBuff); +DestroyString(S->OutputBuff); +DestroyString(S->Path); +free(S); + +return(NULL); +} + + +int STREAMDisassociateFromFD(STREAM *Stream) +{ +int fd; + +if (! Stream) return(-1); +fd=Stream->in_fd; +STREAMFlush(Stream); +DestroyString(Stream->InputBuff); +DestroyString(Stream->OutputBuff); +DestroyString(Stream->Path); +free(Stream); +return(fd); +} + + + + +int STREAMReadCharsToBuffer(STREAM *S) +{ +fd_set selectset; +int result=0, diff, read_result=0, WaitForBytes=TRUE; +struct timeval tv; +char *tmpBuff=NULL; +int v1, v2,v3; +void *SSL_CTX=NULL; + +if (! S) return(0); + +if (S->State & SS_EMBARGOED) return(0); + +SSL_CTX=STREAMGetItem(S,"LIBUSEFUL-SSL-CTX"); + +if (S->InStart >= S->InEnd) +{ +S->InEnd=0; +S->InStart=0; +} +diff=S->InEnd-S->InStart; + +if (S->InStart > (S->BuffSize / 2)) +{ + memmove(S->InputBuff,S->InputBuff + S->InStart,diff); + S->InStart=0; + S->InEnd=diff; +} + +v1=S->InStart; v2=S->InEnd; v3=S->BuffSize; + +//if no room in buffer, we can't read in more bytes +if (S->InEnd >= S->BuffSize) return(1); + + +//if there are bytes available in the internal OpenSSL buffers, when we don't have to +//wait on a select, we can just go straight through to SSL_read +#ifdef HAVE_LIBSSL +if (S->Flags & SF_SSL) +{ +if (SSL_pending((SSL *) SSL_CTX) > 0) WaitForBytes=FALSE; +} +//else +#endif + + +//if ((S->Timeout > 0) && (! (S->Flags & SF_NONBLOCK)) && WaitForBytes) +if ((S->Timeout > 0) && WaitForBytes) +{ + FD_ZERO(&selectset); + FD_SET(S->in_fd, &selectset); + tv.tv_sec=S->Timeout; + tv.tv_usec=0; + result=select(S->in_fd+1,&selectset,NULL,NULL,&tv); + + + switch (result) + { + //we are only checking one FD, so should be 1 + case 1: + read_result=0; + break; + + case 0: + errno=ETIMEDOUT; + read_result=STREAM_TIMEOUT; + break; + + default: + if (errno==EINTR) read_result=STREAM_TIMEOUT; + else read_result=STREAM_CLOSED; + break; + + } + +} + +//must do this, as we need it to be 0 if we don't do the reads +result=0; + +if (read_result==0) +{ + tmpBuff=SetStrLen(tmpBuff,S->BuffSize-S->InEnd); + + #ifdef HAVE_LIBSSL + if (S->Flags & SF_SSL) + { + read_result=SSL_read((SSL *) SSL_CTX, tmpBuff, S->BuffSize-S->InEnd); + } + else + #endif + { + if (S->Flags & SF_RDLOCK) flock(S->in_fd,LOCK_SH); + read_result=read(S->in_fd, tmpBuff, S->BuffSize-S->InEnd); + if (S->Flags & SF_RDLOCK) flock(S->in_fd,LOCK_UN); + } + + if (read_result > 0) + { + result=read_result; + S->BytesRead+=read_result; + } + else + { + if ((read_result == -1) && (errno==EAGAIN)) read_result=STREAM_NODATA; + else read_result=STREAM_CLOSED; + result=0; + } +} + +if (result !=0) read_result=result; +if (result < 0) result=0; +read_result=STREAMReadThroughProcessors(S, tmpBuff, result); +//if (result==STREAM_DATA_ERROR) read_result=STREAM_DATA_ERROR; + +//We are not returning number of bytes read. We only return something if +//there is a condition (like socket close) where the thing we are waiting for +//may not appear + +DestroyString(tmpBuff); +return(read_result); +} + + + + + + +int STREAMReadBytes(STREAM *S, char *Buffer, int Buffsize) +{ +char *ptr=NULL; +int bytes=0, result=0, total=0; + +ptr=Buffer; + +if (S->InStart >= S->InEnd) +{ + result=STREAMReadCharsToBuffer(S); + if (S->InStart >= S->InEnd) + { + if (result==STREAM_CLOSED) return(EOF); + if (result==STREAM_TIMEOUT) return(STREAM_TIMEOUT); + if (result==STREAM_DATA_ERROR) return(STREAM_DATA_ERROR); + } +} + +while (total < Buffsize) +{ + + bytes=S->InEnd - S->InStart; + + + if (bytes > (Buffsize-total)) bytes=(Buffsize-total); + + memcpy(ptr+total,S->InputBuff+S->InStart,bytes); + S->InStart+=bytes; + total+=bytes; + + bytes=S->InEnd - S->InStart; + + + if (bytes < 1) + { + //in testing, the best way to prevent doing constant checking for new bytes, + //and so filling up the buffer, was to only check for new bytes if + //we didn't have enough to satisfy another read like the one we just had + + //We must check for '< 1' rather than '-1' because + result=FDCheckForBytes(S->in_fd); + + if (result ==-1) + { + if (total==0) total=EOF; + break; + } + if (result < 1) break; + + result=STREAMReadCharsToBuffer(S); + if (result < 1) + { + if (total > 0) return(total); + else return(result); + } + } + + +} +return(total); +} + + + +double STREAMTell(STREAM *S) +{ +double pos; + +if (S->OutEnd > 0) STREAMFlush(S); + +#ifdef _LARGEFILE64_SOURCE +pos=(double) lseek64(S->in_fd,0,SEEK_CUR); +#else +pos=(double) lseek(S->in_fd,0,SEEK_CUR); +#endif +pos-=(S->InEnd-S->InStart); + +return(pos); +} + + +double STREAMSeek(STREAM *S, double offset, int whence) +{ +double pos; +int wherefrom; + +if (S->OutEnd > 0) STREAMFlush(S); + +if (whence==SEEK_CUR) +{ + pos=STREAMTell(S); + pos+=offset; + wherefrom=SEEK_SET; +} +else +{ + pos=offset; + wherefrom=whence; +} +S->InStart=0; +S->InEnd=0; + +#ifdef _LARGEFILE64_SOURCE +pos=(double) lseek64(S->in_fd,(off64_t) pos, wherefrom); +#else +pos=(double) lseek(S->in_fd,(off_t) pos, wherefrom); +#endif + + +return(pos); +} + +/*A stream can have a series of 'processor modules' associated with it' */ +/*which do things to the data before it is read/written. This function */ +/*pumps the data through the processor list, and eventually writes it out */ +int STREAMWriteBytes(STREAM *S,const char *Data, int DataLen) +{ +TProcessingModule *Mod; +ListNode *Curr; +const char *i_data; +char *TempBuff=NULL, *ptr; +int TempLen=BUFSIZ; +int len, i_len, o_len, written=0, result=0; +int AllDataWritten=FALSE, Flush=FALSE; + + +if (! S) return(STREAM_CLOSED); +if (S->out_fd==-1) return(STREAM_CLOSED); +if (S->State & SS_WRITE_ERROR) return(STREAM_CLOSED); + +if (DataLen==0) Flush=TRUE; + +i_data=Data; +i_len=DataLen; + +//if there are no processing modules, then this will be untouched, and will be our output +if (DataLen > TempLen) TempLen=DataLen; +TempBuff=SetStrLen(TempBuff,TempLen); +if (DataLen > 0) memcpy(TempBuff,Data,DataLen); +o_len=DataLen; + + +while (! AllDataWritten) +{ + AllDataWritten=TRUE; + + //Go through processing modules feeding the data from the previous one into them + Curr=ListGetNext(S->ProcessingModules); + while (Curr) + { + Mod=(TProcessingModule *) Curr->Item; + + + if (Mod->Write && ((i_len > 0) || Flush)) + { + o_len=Mod->Write(Mod,i_data,i_len,&TempBuff,&TempLen,Flush); + if (Flush && (o_len !=EOF)) AllDataWritten=FALSE; + } + i_data=TempBuff; + i_len=o_len; + + Curr=ListGetNext(Curr); + } + + + //Whatever happened above, o_data/o_len should hold data to be written + ptr=TempBuff; + + while (o_len > 0) + { + len=S->BuffSize - S->OutEnd; + if (len > o_len) len =o_len; + + memcpy(S->OutputBuff+S->OutEnd,ptr,len); + ptr+=len; + o_len-=len; + S->OutEnd+=len; + + //Buffer Full, Write some bytes!!! + if ((S->OutEnd >= S->BuffSize) || (S->BlockSize && (S->OutEnd > S->BlockSize))) + { + if (S->BlockSize) len=(S->OutEnd / S->BlockSize) * S->BlockSize; + else len=S->OutEnd; + + if (len > 0) result=STREAMInternalFinalWriteBytes(S, S->OutputBuff, len); + if (result==0) written=STREAM_TIMEOUT; + if (result < 1) + { + S->State |= SS_WRITE_ERROR; + written=STREAM_CLOSED; + break; + } + + written+=result; + } + } + + //Must do this to avoid sending data into the queue multiple times! + i_len=0; + +} + + +//We always claim to have written the data that we've accepted +//Though this can be overridden below +written=DataLen; + + + +//if we are told to write zero bytes, that's a flush +if ((S->OutEnd > 0) && ((DataLen==0) || (S->Flags & FLUSH_ALWAYS))) +{ + //if we are flushing blocks, then pad out to the blocksize + if (S->Flags & FLUSH_BLOCK) + { + len=(S->OutEnd / S->BlockSize) * S->BlockSize; + if (S->OutEnd > len) len+=S->BlockSize; + memset(S->OutputBuff+S->OutEnd,0,len - S->OutEnd); + S->OutEnd=len; + } + + result=STREAMInternalFinalWriteBytes(S, S->OutputBuff, S->OutEnd); + if (result < 0) written=result; +} + + +DestroyString(TempBuff); + + +return(written); +} + + + + +int STREAMWriteString(const char *Buffer, STREAM *S) +{ +int result; + +if (StrLen(Buffer) < 1) return(FALSE); +result=STREAMWriteBytes(S,Buffer,strlen(Buffer)); +return(result); +} + +int STREAMWriteLine(const char *Buffer, STREAM *S) +{ +int result; + +if (StrLen(Buffer) < 1) return(FALSE); +result=STREAMWriteBytes(S,Buffer,strlen(Buffer)); +if (result < 0) return(result); +if (S->Flags & FLUSH_LINE) result=STREAMFlush(S); +return(result); +} + + +int STREAMReadChar(STREAM *S) +{ +unsigned char inchar; +int result; + +result=STREAMReadBytes(S, &inchar,1); +if (result < 0) return(result); +if (result==0) return(STREAM_NODATA); +return((int) inchar); +} + + + +int STREAMPeekChar(STREAM *S) +{ +int result; + +if (S->InStart >= S->InEnd) +{ + result=STREAMReadCharsToBuffer(S); + if (result < 1) return(result); +} + +return(* (S->InputBuff + S->InStart)); +} + + +int STREAMWriteChar(STREAM *S,unsigned char inchar) +{ +char tmpchar; + +tmpchar=inchar; +return(STREAMWriteBytes(S,&tmpchar,1)); +} + + + +int STREAMReadBytesToTerm(STREAM *S, char *Buffer, int BuffSize,unsigned char Term) +{ +int inchar, pos=0; + +inchar=STREAMReadChar(S); +while (inchar != EOF) +{ +if (inchar > -1) +{ +Buffer[pos]=inchar; +pos++; +if (inchar==Term) break; +if (pos==BuffSize) break; +} +inchar=STREAMReadChar(S); +} + +if ((pos==0) && (inchar==EOF)) return(EOF); +return(pos); +} + + +char *STREAMReadToTerminator(char *Buffer, STREAM *S,unsigned char Term) +{ +int inchar, len=0; +char *Tempptr; + +Tempptr=CopyStr(Buffer,""); + +inchar=STREAMReadChar(S); +while (inchar != EOF) +{ + //if ((len % 100)== 0) Tempptr=realloc(Tempptr,(len/100 +1) *100 +2); + //*(Tempptr+len)=inchar; + + if (inchar >= 0) + { + Tempptr=AddCharToBuffer(Tempptr,len,(char) inchar); + len++; + } + else if (inchar !=STREAM_NODATA) break; + if (inchar==Term) break; + inchar=STREAMReadChar(S); +} + + +*(Tempptr+len)='\0'; +//if ((inchar==EOF) && (errno==ECONNREFUSED)) return(Tempptr); +if ( + ((inchar==EOF) || (inchar==STREAM_DATA_ERROR)) + && + (StrLen(Tempptr)==0) + ) +{ + free(Tempptr); + return(NULL); +} + +return(Tempptr); +} + + + +char *STREAMReadToMultiTerminator(char *Buffer, STREAM *S, char *Terms) +{ +int inchar, len=0; +char *Tempptr; + +Tempptr=CopyStr(Buffer,""); + +inchar=STREAMReadChar(S); + + +//All error conditions are negative, but '0' can just mean +//no more data to read +while (inchar > -1) +{ + //if ((len % 100)== 0) Tempptr=realloc(Tempptr,(len/100 +1) *100 +2); + //*(Tempptr+len)=inchar; + + if (inchar > 0) + { + Tempptr=AddCharToBuffer(Tempptr,len,(char) inchar); + len++; + + if (strchr(Terms,inchar)) break; + } + inchar=STREAMReadChar(S); +} + + +*(Tempptr+len)='\0'; + +//if ((inchar==EOF) && (errno==ECONNREFUSED)) return(Tempptr); +if ( + ((inchar==EOF) || (inchar==STREAM_DATA_ERROR)) + && + (StrLen(Tempptr)==0) + ) +{ + free(Tempptr); + return(NULL); +} + +return(Tempptr); +} + + + + +char *STREAMReadLine(char *Buffer, STREAM *S) +{ +return(STREAMReadToTerminator(Buffer,S,'\n')); +} + + +void STREAMResetInputBuffers(STREAM *S) +{ +double pos; + +pos=STREAMTell(S); +S->InStart=0; +S->InEnd=0; +STREAMSeek(S,pos,SEEK_SET); +} + + + +char *STREAMGetValue(STREAM *S, const char *Name) +{ +ListNode *Curr; + +if (! S->Values) return(NULL); +Curr=ListFindNamedItem(S->Values,Name); +if (Curr) return(Curr->Item); +return(NULL); +} + + +void STREAMSetValue(STREAM *S, const char *Name, const char *Value) +{ + +if (! S->Values) S->Values=ListCreate(); +SetVar(S->Values,Name,Value); +} + +void *STREAMGetItem(STREAM *S, const char *Name) +{ +ListNode *Curr; + +if (! S->Items) return(NULL); +Curr=ListFindNamedItem(S->Items,Name); +if (Curr) return(Curr->Item); +return(NULL); +} + + +void STREAMSetItem(STREAM *S, const char *Name, void *Value) +{ +ListNode *Curr; + +if (! S->Items) S->Items=ListCreate(); +Curr=ListFindNamedItem(S->Items,Name); +if (Curr) Curr->Item=Value; +else ListAddNamedItem(S->Items,Name,Value); +} diff --git a/libUseful-2.0/file.h b/libUseful-2.0/file.h new file mode 100644 index 0000000..9f1feec --- /dev/null +++ b/libUseful-2.0/file.h @@ -0,0 +1,155 @@ +#ifndef LIBUSEFUL_FILE_H +#define LIBUSEFUL_FILE_H + +#include +#include //for 'struct timeval' +#include "list.h" + + +#define STREAM_CLOSED -1 +#define STREAM_NODATA -2 +#define STREAM_TIMEOUT -3 +#define STREAM_DATA_ERROR -4 + + +/* +#define O_ACCMODE 00000003 +#define O_RDONLY 00000000 +#define O_WRONLY 00000001 +#define O_RDWR 00000002 +#define O_CREAT 00000100 +#define O_EXCL 00000200 +#define O_NOCTTY 00000400 +#define O_TRUNC 00001000 +#define O_APPEND 00002000 +#define O_NONBLOCK 00004000 +#define O_DSYNC 00010000 +#define O_DIRECT 00040000 +#define O_LARGEFILE 00100000 +#define O_DIRECTORY 00200000 +#define O_NOFOLLOW 00400000 +#define O_NOATIME 01000000 +#define O_CLOEXEC 02000000 +*/ + +//Flags that alter stream behavior +#define FLUSH_FULL 0 +#define FLUSH_LINE 1 +#define FLUSH_BLOCK 2 +#define FLUSH_ALWAYS 4 +#define SF_RDONLY 8 +#define SF_WRONLY 16 +#define SF_RDWR 32 +#define SF_NONBLOCK 65 +#define SF_SYMLINK_OK 128 +#define SF_SSL 256 +#define SF_AUTH 512 +#define SF_WRLOCK 1024 +#define SF_RDLOCK 2048 + +//Stream state values +#define SS_CONNECTING 1 +#define SS_CONNECTED 2 +#define SS_HANDSHAKE_DONE 4 +#define SS_DATA_ERROR 8 +#define SS_WRITE_ERROR 16 +#define SS_EMBARGOED 32 +#define SS_AUTH 8192 + +#define STREAM_TYPE_FILE 0 +#define STREAM_TYPE_UNIX 1 +#define STREAM_TYPE_UNIX_DGRAM 2 +#define STREAM_TYPE_TCP 3 +#define STREAM_TYPE_UDP 4 +#define STREAM_TYPE_SSL 5 +#define STREAM_TYPE_HTTP 6 +#define STREAM_TYPE_CHUNKED_HTTP 7 + +#define O_LOCK O_NOCTTY + + +#define SELECT_READ 1 +#define SELECT_WRITE 2 + +typedef struct +{ +int Type; +int in_fd, out_fd; +unsigned int Flags; +unsigned int State; +unsigned int Timeout; +unsigned int BlockSize; +unsigned int BuffSize; + +unsigned int InStart, InEnd; +unsigned int OutEnd; +char *InputBuff; +char *OutputBuff; + +unsigned int BytesRead; +unsigned int BytesWritten; +char *Path; +ListNode *ProcessingModules; +ListNode *Values; +ListNode *Items; +} STREAM; + + +#ifdef __cplusplus +extern "C" { +#endif + + +int FDSelect(int fd, int Flags, struct timeval *tv); +int FDIsWritable(int); +int FDCheckForBytes(int); + +void STREAMSetNonBlock(STREAM *S, int val); +void STREAMSetTimeout(STREAM *, int); +void STREAMSetFlushType(STREAM *Stream, int Type, int val); + + +STREAM *STREAMCreate(); +STREAM *STREAMOpenFile(const char *Path, int Mode); +STREAM *STREAMClose(STREAM *Stream); +int STREAMLock(STREAM *S, int val); +int STREAMFlush(STREAM *Stream); +void STREAMClear(STREAM *Stream); +double STREAMTell(STREAM *Stream); +double STREAMSeek(STREAM *Stream, double, int whence); +void STREAMResizeBuffer(STREAM *, int); +int STREAMReadChar(STREAM *); +int STREAMWriteChar(STREAM *,unsigned char); +char* STREAMReadLine(char *Buffer, STREAM *); +int ReadBytesToTerm(STREAM *S, char *Buffer, int BuffSize,unsigned char Term); +char* STREAMReadToTerminator(char *Buffer, STREAM *,unsigned char Term); +char* STREAMReadToMultiTerminator(char *Buffer, STREAM *, char *Terms); +int STREAMWriteString(const char *Buffer, STREAM *); +int STREAMWriteLine(const char *Buffer, STREAM *); +STREAM *STREAMFromFD(int fd); +STREAM *STREAMFromDualFD(int in_fd, int out_fd); +STREAM *STREAMSpawnCommand(const char *Command, int type); + +int STREAMDisassociateFromFD(STREAM *Stream); +int STREAMPeekChar(STREAM *); + +int STREAMReadBytes(STREAM *, char *Buffer, int Bytes); +int STREAMWriteBytes(STREAM *, const char *Buffer, int Bytes); +int STREAMCheckForBytes(STREAM *); +int STREAMCheckForWaitingChar(STREAM *S,unsigned char check_char); +int STREAMCountWaitingBytes(STREAM *); +STREAM *STREAMSelect(ListNode *Streams, struct timeval *timeout); + +void STREAMSetValue(STREAM *S, const char *Name, const char *Value); +char *STREAMGetValue(STREAM *S, const char *Name); +void STREAMSetItem(STREAM *S, const char *Name, void *Item); +void *STREAMGetItem(STREAM *S, const char *Name); + + +#ifdef __cplusplus +} +#endif + + + +#endif diff --git a/libUseful-2.0/formattest.c b/libUseful-2.0/formattest.c new file mode 100644 index 0000000..0315c0a --- /dev/null +++ b/libUseful-2.0/formattest.c @@ -0,0 +1,10 @@ +#include "libUseful.h" + +main() +{ +char *Tempstr=NULL; + +Tempstr=FormatStr(Tempstr,"%s %n","test",100); +printf("%s\n",Tempstr); + +} diff --git a/libUseful-2.0/http.c b/libUseful-2.0/http.c new file mode 100644 index 0000000..a8787a1 --- /dev/null +++ b/libUseful-2.0/http.c @@ -0,0 +1,1222 @@ +#include "http.h" +#include "DataProcessing.h" +#include "Hash.h" +#include "ParseURL.h" + +ListNode *Cookies=NULL; +int g_Flags=0; + +void HTTPAuthSet(HTTPAuthStruct *Auth, char *Logon, char *Password, int Type) +{ + Auth->Logon=CopyStr(Auth->Logon,Logon); + Auth->Password=CopyStr(Auth->Password,Password); + Auth->Flags |= Type; +} + + + +void HTTPAuthDestroy(void *p_Auth) +{ +HTTPAuthStruct *Auth; + +if (! p_Auth) return; +Auth=(HTTPAuthStruct *) p_Auth; + +DestroyString(Auth->AuthRealm); +DestroyString(Auth->AuthQOP); +DestroyString(Auth->AuthNonce); +DestroyString(Auth->AuthOpaque); +DestroyString(Auth->Logon); +DestroyString(Auth->Password); + +free(Auth); +} + +void HTTPInfoDestroy(void *p_Info) +{ +HTTPInfoStruct *Info; + +if (! p_Info) return; +Info=(HTTPInfoStruct *) p_Info; +DestroyString(Info->Host); +DestroyString(Info->Method); +DestroyString(Info->Doc); +DestroyString(Info->Destination); +DestroyString(Info->ResponseCode); +DestroyString(Info->PreviousRedirect); +DestroyString(Info->RedirectPath); +DestroyString(Info->ContentType); +DestroyString(Info->Timestamp); +DestroyString(Info->PostData); +DestroyString(Info->PostContentType); +DestroyString(Info->Proxy); + +ListDestroy(Info->ServerHeaders,DestroyString); +ListDestroy(Info->CustomSendHeaders,DestroyString); +if (Info->Authorization) HTTPAuthDestroy(Info->Authorization); +if (Info->ProxyAuthorization) HTTPAuthDestroy(Info->ProxyAuthorization); +free(Info); +} + + + +//These functions relate to adding a 'Data processor' to the stream that +//will decode chunked HTTP transfers + +typedef struct +{ +char *Buffer; +int ChunkSize; +int BuffLen; +} THTTPChunk; + +int HTTPChunkedInit(TProcessingModule *Mod, const char *Args) +{ + +Mod->Data=(THTTPChunk *) calloc(1, sizeof(THTTPChunk)); + +return(TRUE); +} + +int HTTPChunkedRead(TProcessingModule *Mod, const char *InBuff, int InLen, char **OutBuff, int *OutLen) +{ +int len=0, val=0; +THTTPChunk *Chunk; +char *ptr, *vptr; + +Chunk=(THTTPChunk *) Mod->Data; +len=Chunk->BuffLen+InLen; +Chunk->Buffer=SetStrLen(Chunk->Buffer,len); +memcpy(Chunk->Buffer+Chunk->BuffLen,InBuff,InLen); +Chunk->BuffLen=len; +Chunk->Buffer[len]='\0'; +ptr=Chunk->Buffer; + + +if (Chunk->ChunkSize==0) +{ + //if chunksize == 0 then read the size of the next chunk + + //if there's nothing in our buffer, and nothing being added, then + //we've already finished! + if (InLen==0) return(EOF); + + vptr=ptr; + //skip past any leading '\r' or '\n' + if (*vptr=='\r') vptr++; + if (*vptr=='\n') vptr++; + + ptr=strchr(vptr,'\n'); + + //sometimes people seem to miss off the final '\n', so if we get told there's no more data + //we should use a '\r' if we've got one + if ((! ptr) && (InLen==0)) ptr=strchr(vptr,'\r'); + if (ptr) + { + *ptr='\0'; + ptr++; + } + else return(0); + Chunk->ChunkSize=strtol(vptr,NULL,16); + + Chunk->BuffLen=Chunk->Buffer+len-ptr; + + + if (Chunk->BuffLen > 0) memmove(Chunk->Buffer,ptr,Chunk->BuffLen); + + //if we got chunksize of 0 then we're done, return EOF + if (Chunk->ChunkSize==0) return(EOF); +} +else if (len >= Chunk->ChunkSize) +{ + val=Chunk->ChunkSize; + + //We should really grow OutBuff to take all the data + //but for the sake of simplicity we'll just use the space + //supplied + if (val > *OutLen) val=*OutLen; + memcpy(*OutBuff,Chunk->Buffer,val); + + ptr=Chunk->Buffer+val; + Chunk->BuffLen-=val; + Chunk->ChunkSize-=val; + memmove(Chunk->Buffer, ptr, Chunk->BuffLen); +} + +if (Chunk->ChunkSize < 0) Chunk->ChunkSize=0; + +return(val); +} + + + +int HTTPChunkedClose(TProcessingModule *Mod) +{ +THTTPChunk *Chunk; + +Chunk=(THTTPChunk *) Mod->Data; +DestroyString(Chunk->Buffer); +free(Chunk); + +return(TRUE); +} + + +void HTTPAddChunkedProcessor(STREAM *S) +{ +TProcessingModule *Mod=NULL; + + Mod=(TProcessingModule *) calloc(1,sizeof(TProcessingModule)); + Mod->Name=CopyStr(Mod->Name,"HTTP:Chunked"); + Mod->Init=HTTPChunkedInit; + Mod->Read=HTTPChunkedRead; + Mod->Close=HTTPChunkedClose; + + Mod->Init(Mod, ""); + STREAMAddDataProcessor(S,Mod,""); +} + + + +char *HTTPUnQuote(char *RetBuff, char *Str) +{ +char *RetStr=NULL, *Token=NULL, *ptr; +int olen=0, ilen; + +RetStr=CopyStr(RetStr,""); +ilen=StrLen(Str); + +for (ptr=Str; ptr < (Str+ilen); ptr++) +{ +switch (*ptr) +{ + case '+': + RetStr=AddCharToBuffer(RetStr,olen,' '); + olen++; + break; + + case '%': + ptr++; + Token=CopyStrLen(Token,ptr,2); + ptr++; //not +=2, as we will increment again + RetStr=AddCharToBuffer(RetStr,olen,strtol(Token,NULL,16) & 0xFF); + olen++; + break; + + default: + RetStr=AddCharToBuffer(RetStr,olen,*ptr); + olen++; + break; +} + +} + +DestroyString(Token); +return(RetStr); +} + + +char *HTTPQuoteChars(char *RetBuff, char *Str, char *CharList) +{ +char *RetStr=NULL, *Token=NULL, *ptr; +int olen=0, ilen; + +RetStr=CopyStr(RetStr,""); +ilen=StrLen(Str); + +for (ptr=Str; ptr < (Str+ilen); ptr++) +{ +if (strchr(CharList,*ptr)) +{ + Token=FormatStr(Token,"%%%02X",*ptr); + RetStr=CatStr(RetStr,Token); + olen+=StrLen(Token); +} +else +{ + RetStr=AddCharToBuffer(RetStr,olen,*ptr); + olen++; +} +} + + +RetStr[olen]='\0'; +DestroyString(Token); +return(RetStr); +} + + + +char *HTTPQuote(char *RetBuff, char *Str) +{ +char *RetStr=NULL, *Token=NULL, *ptr; +int olen=0, ilen; + +RetStr=CopyStr(RetStr,""); +ilen=StrLen(Str); + +for (ptr=Str; ptr < (Str+ilen); ptr++) +{ +switch (*ptr) +{ + case ' ': + RetStr=AddCharToStr(RetStr,'+'); + break; + + case '(': + case ')': + case '[': + case ']': + case '{': + case '}': + case '\t': + case '?': + case '&': + case '!': + case ',': + case '+': + case '\'': + case ':': + case ';': + case '/': + case '\r': + case '\n': + Token=FormatStr(Token,"%%%02X",*ptr); + RetStr=CatStr(RetStr,Token); + olen+=StrLen(Token); + break; + + default: + // RetStr=AddCharToBuffer(RetStr,olen,*ptr); + RetStr=AddCharToStr(RetStr,*ptr); + olen++; + break; +} + +} + +DestroyString(Token); +return(RetStr); +} + + +void HTTPInfoSetAuth(HTTPInfoStruct *Info, char *Logon, char *Password, int Type) +{ +if (! Info->Authorization) Info->Authorization=(HTTPAuthStruct *) calloc(1,sizeof(HTTPAuthStruct)); +HTTPAuthSet(Info->Authorization,Logon, Password, Type); +} + + +void HTTPInfoSetValues(HTTPInfoStruct *Info, char *Host, int Port, char *Logon, char *Password, char *Method, char *Doc, char *ContentType, int ContentLength) +{ +Info->State=0; +Info->PostData=CopyStr(Info->PostData,""); +Info->Host=CopyStr(Info->Host,Host); +if (Port > 0) Info->Port=Port; +else Info->Port=0; +Info->Method=CopyStr(Info->Method,Method); +Info->Doc=CopyStr(Info->Doc,Doc); +Info->PostContentType=CopyStr(Info->PostContentType,ContentType); +Info->PostContentLength=ContentLength; + +if (StrLen(Logon) || StrLen(Password)) HTTPInfoSetAuth(Info, Logon, Password, HTTP_AUTH_BASIC); +} + + + + +HTTPInfoStruct *HTTPInfoCreate(char *Host, int Port, char *Logon, char *Password, char *Method, char *Doc, char *ContentType, int ContentLength) +{ +HTTPInfoStruct *Info; +char *ptr; + +Info=(HTTPInfoStruct *) calloc(1,sizeof(HTTPInfoStruct)); +HTTPInfoSetValues(Info, Host, Port, Logon, Password, Method, Doc, ContentType, ContentLength); + +Info->ServerHeaders=ListCreate(); +Info->CustomSendHeaders=ListCreate(); +//SetVar(Info->CustomSendHeaders,"Accept","*/*"); + +if (g_Flags) Info->Flags=g_Flags; + +ptr=LibUsefulGetValue("HTTP:Proxy"); +if (StrLen(ptr)) +{ + Info->Proxy=CopyStr(Info->Proxy,ptr); + strlwr(Info->Proxy); + if (strncmp(Info->Proxy,"http:",5)==0) Info->Flags |= HTTP_PROXY; + else if (strncmp(Info->Proxy,"https:",6)==0) Info->Flags |= HTTP_PROXY; + else Info->Flags=HTTP_TUNNEL; +} + +return(Info); +} + +char *HTTPInfoToURL(char *RetBuff, HTTPInfoStruct *Info) +{ +char *p_proto; +char *Doc=NULL, *RetStr=NULL; + +if (Info->Flags & HTTP_SSL) p_proto="https"; +else p_proto="http"; + +Doc=HTTPQuoteChars(Doc,Info->Doc," "); +RetStr=FormatStr(RetBuff,"%s://%s:%d%s",p_proto,Info->Host,Info->Port,Info->Doc); + +DestroyString(Doc); +return(RetStr); +} + + +HTTPInfoStruct *HTTPInfoFromURL(char *Method, char *URL) +{ +HTTPInfoStruct *Info; +char *Proto=NULL, *User=NULL, *Pass=NULL, *Token=NULL; +char *ptr=NULL; +int Port=0; + + +Info=HTTPInfoCreate("", 80, "", "", Method, "", "",0); +if (strcasecmp(Method,"POST")==0) ParseURL(URL, &Proto, &Info->Host, &Token, &User, &Pass,&Info->Doc,&Info->PostData); +else ParseURL(URL, &Proto, &Info->Host, &Token, &User, &Pass,&Info->Doc, NULL); +if (StrLen(Token)) Info->Port=atoi(Token); + +if (StrLen(User) || StrLen(Pass)) +{ + Info->Authorization=(HTTPAuthStruct *) calloc(1,sizeof(HTTPAuthStruct)); + HTTPAuthSet(Info->Authorization,User, Pass, HTTP_AUTH_BASIC); +} + +if (StrLen(Proto) && (strcmp(Proto,"https")==0)) Info->Flags |= HTTP_SSL; + +if (StrLen(Info->PostData)) +{ + Info->PostContentType=CopyStr(Info->PostContentType,"application/x-www-form-urlencoded"); + Info->PostContentLength=StrLen(Info->PostData); +} + +DestroyString(User); +DestroyString(Pass); +DestroyString(Token); +DestroyString(Proto); + +return(Info); +} + + + + +void HTTPParseCookie(HTTPInfoStruct *Info, char *Str) +{ + char *startptr, *endptr; + char *Tempstr=NULL; + ListNode *Curr; + int len; + + startptr=Str; + while (*startptr==' ') startptr++; + + endptr=strchr(startptr,';'); + if (endptr==NULL) endptr=startptr+strlen(Str); +// if (( *endptr==';') || (*endptr=='\r') ) endptr--; + + Tempstr=CopyStrLen(Tempstr,startptr,endptr-startptr); + + Curr=ListGetNext(Cookies); + endptr=strchr(Tempstr,'='); + len=endptr-Tempstr; + len--; + + while (Curr !=NULL) + { + if (strncmp(Curr->Item,Tempstr,len)==0) + { + Curr->Item=CopyStr(Curr->Item,Tempstr); + DestroyString(Tempstr); + return; + } + Curr=ListGetNext(Curr); + } + + if (! Cookies) Cookies=ListCreate(); + ListAddItem(Cookies,(void *)CopyStr(NULL,Tempstr)); + +DestroyString(Tempstr); +} + + + +char *AppendCookies(char *InStr, ListNode *CookieList) +{ + ListNode *Curr; + int count=0; + char *Tempstr=NULL; + + Tempstr=InStr; + Curr=ListGetNext(CookieList); + + if (Curr) + { + Tempstr=CatStr(Tempstr,"Cookie: "); + while ( Curr ) + { + Tempstr=CatStr(Tempstr,(char *)Curr->Item); + Curr=ListGetNext(Curr); + if (Curr) Tempstr=CatStr(Tempstr, "; "); + } + Tempstr=CatStr(Tempstr,"\r\n"); + } + +return(Tempstr); +} + + +void HTTPHandleWWWAuthenticate(HTTPInfoStruct *Info, char *Line) +{ +char *ptr, *ptr2, *Token=NULL, *Name=NULL, *Value=NULL; +char *AuthTypeStrings[]={"Basic","Digest",NULL}; +typedef enum {AUTH_BASIC, AUTH_DIGEST} TAuthTypes; +int result; + +if (! Info->Authorization) Info->Authorization=(HTTPAuthStruct *) calloc(1,sizeof(HTTPAuthStruct)); +ptr=Line; +while (isspace(*ptr)) ptr++; +ptr=GetToken(ptr," ",&Token,0); + +result=MatchTokenFromList(Token,AuthTypeStrings,0); +if (result==AUTH_BASIC) Info->Authorization->Flags |=HTTP_AUTH_BASIC; +if (result==AUTH_DIGEST) Info->Authorization->Flags |=HTTP_AUTH_DIGEST; + +while (ptr) +{ +ptr=GetToken(ptr,",",&Token,GETTOKEN_QUOTES); +StripLeadingWhitespace(Token); +StripTrailingWhitespace(Token); +ptr2=GetToken(Token,"=",&Name,GETTOKEN_QUOTES); +ptr2=GetToken(ptr2,"=",&Value,GETTOKEN_QUOTES); + + +if (strcasecmp(Name,"realm")==0) Info->Authorization->AuthRealm=CopyStr(Info->Authorization->AuthRealm,Value); +if (strcasecmp(Name,"qop")==0) Info->Authorization->AuthQOP=CopyStr(Info->Authorization->AuthQOP,Value); +if (strcasecmp(Name,"nonce")==0) Info->Authorization->AuthNonce=CopyStr(Info->Authorization->AuthNonce,Value); +if (strcasecmp(Name,"opaque")==0) Info->Authorization->AuthOpaque=CopyStr(Info->Authorization->AuthOpaque,Value); +} + +DestroyString(Token); +DestroyString(Name); +DestroyString(Value); +} + + + + +void HTTPParseHeader(STREAM *S, HTTPInfoStruct *Info, char *Header) +{ +char *Token=NULL, *Tempstr=NULL; +int count=0; +int result; +char *ptr; + +if (Info->Flags & HTTP_DEBUG) fprintf(stderr,"HEADER: %s\n",Header); +ptr=GetToken(Header,":",&Token,0); +while (isspace(*ptr)) ptr++; + +Tempstr=MCopyStr(Tempstr,"HTTP:",Token,NULL); +STREAMSetValue(S,Tempstr,ptr); +ListAddNamedItem(Info->ServerHeaders,Token,CopyStr(NULL,ptr)); + +if (StrLen(Token) && StrLen(ptr)) +{ + switch (*Token) + { + case 'C': + case 'c': + if (strcasecmp(Token,"Content-length")==0) + { + Info->ContentLength=atoi(ptr); + } + else if (strcasecmp(Token,"Content-type")==0) + { + Info->ContentType=CopyStr(Info->ContentType,ptr); + } + else if (strcasecmp(Token,"Connection")==0) + { + if (strcasecmp(ptr,"Close")==0) Info->Flags &= ~HTTP_KEEPALIVE; + } + else if ((strcasecmp(Token,"Content-Encoding")==0) ) + { + if (! (Info->Flags & HTTP_NODECODE)) + { + strlwr(ptr); + if ( + (strcmp(ptr,"gzip")==0) || + (strcmp(ptr,"x-gzip")==0) + ) + { + Info->Flags |= HTTP_GZIP; + } + if ( + (strcmp(ptr,"deflate")==0) + ) + { + Info->Flags |= HTTP_DEFLATE; + } + } + + } + break; + + case 'D': + case 'd': + if (strcasecmp(Token,"Date")==0) Info->Timestamp=CopyStr(Info->Timestamp,ptr); + break; + + case 'L': + case 'l': + if (strcasecmp(Token,"Location")==0) + { + if ( + (strncasecmp(ptr,"http:",5)==0) || + (strncasecmp(ptr,"https:",6)==0) + ) + { + Info->RedirectPath=CopyStr(Info->RedirectPath,ptr); + } + else Info->RedirectPath=FormatStr(Info->RedirectPath,"http://%s:%d%s",Info->Host,Info->Port,ptr); + } + break; + + case 'W': + case 'w': + if (strcasecmp(Token,"WWW-Authenticate")==0) HTTPHandleWWWAuthenticate(Info,ptr); + break; + + case 'S': + case 's': + if (strcasecmp(Token,"Set-Cookie")==0) HTTPParseCookie(Info,ptr); + else if (strcasecmp(Token,"Status")==0) + { + //'Status' overrides the response + Info->ResponseCode=CopyStrLen(Info->ResponseCode,ptr,3); + STREAMSetValue(S,"HTTP:ResponseCode",Info->ResponseCode); + } + break; + + + case 'T': + case 't': + if ( + (strcasecmp(Token,"Transfer-Encoding")==0) + ) + { + if (! (Info->Flags & HTTP_NODECODE)) + { + strlwr(ptr); + if (strstr(ptr,"chunked")) + { + Info->Flags |= HTTP_CHUNKED; + } + } + } + break; + } +} + +DestroyString(Token); +DestroyString(Tempstr); +} + + + +char *HTTPHeadersAppendAuth(char *RetStr, char *AuthHeader, HTTPInfoStruct *Info, HTTPAuthStruct *AuthInfo) +{ +char *SendStr=NULL, *Tempstr=NULL; +char *HA1=NULL, *HA2=NULL, *ClientNonce=NULL, *Digest=NULL; +int i, AuthCounter; + +if (! AuthInfo) return(RetStr); + +SendStr=CatStr(RetStr,""); + + if (AuthInfo->Flags & HTTP_AUTH_DIGEST) + { + AuthCounter++; + Tempstr=FormatStr(Tempstr,"%s:%s:%s",AuthInfo->Logon,AuthInfo->AuthRealm,AuthInfo->Password); + HashBytes(&HA1,"md5",Tempstr,StrLen(Tempstr),0); + Tempstr=FormatStr(Tempstr,"%s:%s",Info->Method,Info->Doc); + HashBytes(&HA2,"md5",Tempstr,StrLen(Tempstr),0); + + for (i=0; i < 10; i++) + { + Tempstr=FormatStr(Tempstr,"%x",rand() % 255); + ClientNonce=CatStr(ClientNonce,Tempstr); + } + + Tempstr=FormatStr(Tempstr,"%s:%s:%08d:%s:auth:%s",HA1,AuthInfo->AuthNonce,AuthCounter,ClientNonce,HA2); + HashBytes(&Digest,"md5",Tempstr,StrLen(Tempstr),0); + Tempstr=FormatStr(Tempstr,"%s: Digest username=\"%s\",realm=\"%s\",nonce=\"%s\",uri=\"%s\",qop=auth,nc=%08d,cnonce=\"%s\",response=\"%s\"\r\n",AuthHeader,AuthInfo->Logon,AuthInfo->AuthRealm,AuthInfo->AuthNonce,Info->Doc,AuthCounter,ClientNonce,Digest); + SendStr=CatStr(SendStr,Tempstr); + AuthInfo->Flags |= HTTP_SENT_AUTH; + } + else + { + Tempstr=CopyStr(Tempstr,AuthInfo->Logon); + Tempstr=CatStr(Tempstr,":"); + Tempstr=CatStr(Tempstr,AuthInfo->Password); + Digest=SetStrLen(Digest,StrLen(Tempstr) *2); + to64frombits(Digest,Tempstr,strlen(Tempstr)); + Tempstr=FormatStr(Tempstr,"%s: %s %s\r\n",AuthHeader,"Basic",Digest); + SendStr=CatStr(SendStr,Tempstr); + AuthInfo->Flags |= HTTP_SENT_AUTH; + } + +DestroyString(HA1); +DestroyString(HA2); +DestroyString(ClientNonce); +DestroyString(Digest); +DestroyString(Tempstr); + +return(SendStr); +} + + +void HTTPSendHeaders(STREAM *S, HTTPInfoStruct *Info) +{ +char *SendStr=NULL, *Tempstr=NULL, *ptr; +ListNode *Curr; +int count; +int i; +static int AuthCounter=0; + +STREAMClearDataProcessors(S); +SendStr=CopyStr(SendStr,Info->Method); +SendStr=CatStr(SendStr," "); + +if (Info->Flags & HTTP_PROXY) Tempstr=HTTPInfoToURL(Tempstr, Info); +else Tempstr=HTTPQuoteChars(Tempstr,Info->Doc," "); +SendStr=CatStr(SendStr,Tempstr); + +if (Info->Flags & HTTP_VER1_0) SendStr=CatStr(SendStr," HTTP/1.0\r\n"); +else SendStr=MCatStr(SendStr," HTTP/1.1\r\n","Host: ",Info->Host,"\r\n",NULL); + +if (StrLen(Info->PostContentType) >0) +{ + Tempstr=FormatStr(Tempstr,"Content-type: %s\r\n",Info->PostContentType); + SendStr=CatStr(SendStr,Tempstr); +} + +if (Info->PostContentLength > 0) +{ + Tempstr=FormatStr(Tempstr,"Content-Length: %d\r\n",Info->PostContentLength); + SendStr=CatStr(SendStr,Tempstr); +} + +if (StrLen(Info->Destination)) +{ + Tempstr=FormatStr(Tempstr,"Destination: %s\r\n",Info->Destination); + SendStr=CatStr(SendStr,Tempstr); +} + +/* If we have authorisation details then send them */ +if (Info->Authorization) SendStr=HTTPHeadersAppendAuth(SendStr, "Authorization", Info, Info->Authorization); +if (Info->ProxyAuthorization) SendStr=HTTPHeadersAppendAuth(SendStr, "Proxy-Authorization", Info, Info->ProxyAuthorization); + +if (Info->Flags & HTTP_NOCACHE) SendStr=CatStr(SendStr,"Pragma: no-cache\r\nCache-control: no-cache\r\n"); + + +if (Info->Depth > 0) +{ +Tempstr=FormatStr(Tempstr,"Depth: %d\r\n",Info->Depth); +SendStr=CatStr(SendStr,Tempstr); +} + +/* +if ((PathData->Options.Restart) && (PathData->offset >0)) +{ +snprintf(Buffer,sizeof(Buffer),"Range: bytes=%d-\r\n",PathData->offset); +SendStr=CatStr(SendStr,Buffer); + +} +*/ + + if (Info->IfModifiedSince > 0) + { + Tempstr=CopyStr(Tempstr,GetDateStrFromSecs("%a, %d %b %Y %H:%M:%S GMT",Info->IfModifiedSince,NULL)); + SendStr=MCatStr(SendStr,"If-Modified-Since: ",Tempstr, "\r\n",NULL); + } + +if ( + (strcasecmp(Info->Method,"DELETE") !=0) && + (strcasecmp(Info->Method,"HEAD") !=0) && + (strcasecmp(Info->Method,"PUT") !=0) + ) +{ + + Tempstr=CopyStr(Tempstr,""); + + if (! (Info->Flags & HTTP_NOCOMPRESS)) + { + if (DataProcessorAvailable("Compression","gzip")) Tempstr=CatStr(Tempstr,"gzip"); + if (DataProcessorAvailable("Compression","zlib")) + { + if (StrLen(Tempstr)) Tempstr=CatStr(Tempstr,", deflate"); + else Tempstr=CatStr(Tempstr,"deflate"); + } + } + + if (StrLen(Tempstr)) SendStr=MCatStr(SendStr,"Accept-Encoding: ",Tempstr,"\r\n",NULL); + else SendStr=CatStr(SendStr,"Accept-Encoding: *.*\r\n"); +} + +if (Info->Flags & HTTP_KEEPALIVE) +{ + //if (Info->Flags & HTTP_VER1_0) + SendStr=CatStr(SendStr,"Connection: Keep-Alive\r\n"); + //SendStr=CatStr(SendStr,"Content-Length: 0\r\n"); +} +else +{ + SendStr=CatStr(SendStr,"Connection: close\r\n"); +} + +ptr=LibUsefulGetValue("HTTP:User-Agent"); +if (StrLen(ptr)) SendStr=MCatStr(SendStr,"User-Agent: ",ptr, "\r\n",NULL); + +Curr=ListGetNext(Info->CustomSendHeaders); +while (Curr) +{ +SendStr=MCatStr(SendStr,Curr->Tag, ": ", (char *) Curr->Item, "\r\n",NULL); +Curr=ListGetNext(Curr); +} + +if (! (Info->Flags & HTTP_NOCOOKIES)) +{ +SendStr=AppendCookies(SendStr,Cookies); +} + +SendStr=CatStr(SendStr,"\r\n"); + +Info->State |= HTTP_HEADERS_SENT; +if (Info->Flags & HTTP_DEBUG) fprintf(stderr,"HTTPSEND: ------\n%s------\n\n",SendStr); +STREAMWriteLine(SendStr,S); +STREAMFlush(S); + +DestroyString(Tempstr); +DestroyString(SendStr); +} + + + + +void HTTPReadHeaders(STREAM *S, HTTPInfoStruct *Info) +{ +char *Tempstr=NULL, *ptr; + + +ListClear(Info->ServerHeaders,DestroyString); +Info->ContentLength=0; + +//Not needed +//Info->RedirectPath=CopyStr(Info->RedirectPath,""); +Info->Flags &= ~(HTTP_CHUNKED | HTTP_GZIP | HTTP_DEFLATE); +Tempstr=STREAMReadLine(Tempstr,S); +if (Tempstr) +{ + if (Info->Flags & HTTP_DEBUG) fprintf(stderr,"RESPONSE: %s\n",Tempstr); + if (strncmp(Tempstr,"HTTP/",5)==0) + { + ptr=strchr(Tempstr,' '); + ptr++; + + Info->ResponseCode=CopyStrLen(Info->ResponseCode,ptr,3); + STREAMSetValue(S,"HTTP:ResponseCode",Info->ResponseCode); + + } +Tempstr=STREAMReadLine(Tempstr,S); +} + +while (Tempstr) +{ +StripTrailingWhitespace(Tempstr); +if (StrLen(Tempstr)==0) break; +HTTPParseHeader(S, Info,Tempstr); +Tempstr=STREAMReadLine(Tempstr,S); +} + +//Handle Response Codes +if (StrLen(Info->ResponseCode)) +{ + if (*Info->ResponseCode=='3') + { + //No longer a flag, HTTP Redirect is now just a response code + //Info->Flags |= HTTP_REDIRECT; + } + + if (strcmp(Info->ResponseCode,"401")==0) + { + if (Info->Authorization) Info->Authorization->Flags |= HTTP_AUTH_BASIC; + } + + if (strcmp(Info->ResponseCode,"407")==0) + { + if (Info->ProxyAuthorization) Info->ProxyAuthorization->Flags |= HTTP_PROXY_AUTH; + } + +} + +S->BytesRead=0; +DestroyString(Tempstr); +} + + + +int HTTPProcessResponse(HTTPInfoStruct *HTTPInfo) +{ +char *ptr, *login_ptr, *pass_ptr; +int result=HTTP_ERROR; +char *Proto=NULL, *PortStr=NULL; +int RCode; + +if (HTTPInfo->ResponseCode) +{ +RCode=atoi(HTTPInfo->ResponseCode); +switch (RCode) +{ + case 304: + result=HTTP_NOTMODIFIED; + break; + + case 200: + case 201: + case 202: + case 203: + case 204: + case 205: + case 206: + case 207: + case 400: + result=HTTP_OKAY; + break; + + case 301: + case 302: + case 303: + case 307: + case 308: + if (HTTPInfo->PreviousRedirect && (strcmp(HTTPInfo->RedirectPath,HTTPInfo->PreviousRedirect)==0)) result=HTTP_CIRCULAR_REDIRECTS; + else + { + if (HTTPInfo->Flags & HTTP_DEBUG) fprintf(stderr,"HTTP: Redirected to %s\n",HTTPInfo->RedirectPath); + + //As redirect check has been done, we can copy redirect path to previous + HTTPInfo->PreviousRedirect=CopyStr(HTTPInfo->PreviousRedirect,HTTPInfo->RedirectPath); + ParseURL(HTTPInfo->RedirectPath, &Proto, &HTTPInfo->Host, &PortStr,NULL, NULL,&HTTPInfo->Doc,NULL); + HTTPInfo->Port=atoi(PortStr); + + //if HTTP_SSL_REWRITE is set, then all redirects get forced to https + if (HTTPInfo->Flags & HTTP_SSL_REWRITE) Proto=CopyStr(Proto,"https"); + if (strcmp(Proto,"https")==0) HTTPInfo->Flags |= HTTP_SSL; + else HTTPInfo->Flags &= ~HTTP_SSL; + + //303 Redirects must be get! + if (RCode==303) + { + HTTPInfo->Method=CopyStr(HTTPInfo->Method,"GET"); + HTTPInfo->PostData=CopyStr(HTTPInfo->PostData,""); + HTTPInfo->PostContentType=CopyStr(HTTPInfo->PostContentType,""); + HTTPInfo->PostContentLength=0; + } + + if (! (HTTPInfo->Flags & HTTP_NOREDIRECT)) result=HTTP_REDIRECT; + else result=HTTP_OKAY; + } + break; + + //401 Means authenticate, so it's not a pure error + case 401: + //407 Means authenticate with a proxy + result=HTTP_AUTH_BASIC; + break; + + case 407: + result=HTTP_PROXY_AUTH; + break; + + default: + result=HTTP_NOTFOUND; + break; + +} +} + +DestroyString(Proto); +DestroyString(PortStr); + +return(result); +} + +STREAM *HTTPSetupConnection(HTTPInfoStruct *Info, int ForceHTTPS) +{ +char *Proto=NULL, *Host=NULL, *Token=NULL; +int Port=0, Flags=0; +STREAM *S; + +S=STREAMCreate(); + +if (Info->Flags & HTTP_PROXY) +{ + if (! Info->ProxyAuthorization) + { + Info->ProxyAuthorization=(HTTPAuthStruct *) calloc(1,sizeof(HTTPAuthStruct)); + } + ParseURL(Info->Proxy, &Proto, &Host, &Token, &Info->ProxyAuthorization->Logon, &Info->ProxyAuthorization->Password,NULL,NULL); + Port=atoi(Token); + + + if (ForceHTTPS) Proto=CopyStr(Proto,"https"); + + if (strcasecmp(Proto,"https")==0) Flags |= CONNECT_SSL; +} +else +{ + Host=CopyStr(Host,Info->Host); + Port=Info->Port; + + if (Info->Flags & HTTP_SSL) Flags |= CONNECT_SSL; + if (ForceHTTPS) + { + Flags |= CONNECT_SSL; + } + + if (Port==0) + { + if (Flags & CONNECT_SSL) Port=443; + else Port=80; + } +} + +if (Info->Flags & HTTP_TUNNEL) STREAMAddConnectionHop(S,Info->Proxy); +if (STREAMConnectToHost(S,Host,Port,Flags)) +{ + HTTPSendHeaders(S,Info); +} +else +{ + STREAMClose(S); + S=NULL; +} + +Info->S=S; + +DestroyString(Token); +DestroyString(Proto); +DestroyString(Host); + +return(S); +} + + + +STREAM *HTTPConnect(HTTPInfoStruct *Info) +{ +STREAM *S=NULL; + +if ( + (g_Flags & HTTP_REQ_HTTPS) || + (g_Flags & HTTP_TRY_HTTPS) + ) +{ +S=HTTPSetupConnection(Info, TRUE); +if (g_Flags & HTTP_REQ_HTTPS) return(S); +} + +if (!S) S=HTTPSetupConnection(Info, FALSE); + +return(S); +} + + +STREAM *HTTPTransact(HTTPInfoStruct *Info) +{ +int result=HTTP_NOCONNECT; + +while (1) +{ + if (! Info->S) Info->S=HTTPConnect(Info); + else if (! (Info->State & HTTP_HEADERS_SENT)) HTTPSendHeaders(Info->S,Info); + + if (Info->S && STREAMIsConnected(Info->S)) + { + Info->ResponseCode=CopyStr(Info->ResponseCode,""); + + if (! (Info->State & HTTP_CLIENTDATA_SENT)) + { + //Set this even if no client data to send, so we no we've been + //through here once + Info->State |= HTTP_CLIENTDATA_SENT; + + if (StrLen(Info->PostData)) + { + STREAMWriteLine(Info->PostData,Info->S); + if (Info->Flags & HTTP_DEBUG) fprintf(stderr,"\n%s\n",Info->PostData); + } + else + { + if (strcasecmp(Info->Method,"POST")==0) break; + if (strcasecmp(Info->Method,"PUT")==0) break; + } + } + + + //Must clear this once the headers and clientdata sent + Info->State=0; + + HTTPReadHeaders(Info->S,Info); + result=HTTPProcessResponse(Info); + STREAMSetValue(Info->S,"HTTP:URL",Info->Doc); + if (Info->Flags & HTTP_CHUNKED) HTTPAddChunkedProcessor(Info->S); + + if (Info->Flags & HTTP_GZIP) + { + STREAMAddStandardDataProcessor(Info->S,"compression","gzip",""); + } + else if (Info->Flags & HTTP_DEFLATE) STREAMAddStandardDataProcessor(Info->S,"compression","zlib",""); + + if (result == HTTP_OKAY) break; + if (result == HTTP_NOTFOUND) break; + if (result == HTTP_NOTMODIFIED) break; + if (result == HTTP_ERROR) break; + if (result == HTTP_CIRCULAR_REDIRECTS) break; + + + if (result == HTTP_AUTH_BASIC) + { + if ( + (! Info->Authorization) || + ( + (Info->Authorization->Flags & HTTP_SENT_AUTH) || + (! Info->Authorization->Logon) || + (StrLen(Info->Authorization->Logon)==0) + ) + ) + { + if (result == HTTP_AUTH_BASIC) break; + if (result == HTTP_AUTH_DIGEST) break; + } + } + + if ( + (result == HTTP_PROXY_AUTH) && + ( + (Info->ProxyAuthorization->Flags & HTTP_SENT_AUTH) || + (! Info->ProxyAuthorization->Logon) || + (StrLen(Info->ProxyAuthorization->Logon)==0) + ) + ) + { + break; + } + + STREAMClose(Info->S); + Info->S=NULL; + } + else break; +} + + +return(Info->S); +} + + + +STREAM *HTTPMethod(char *Method, char *URL, char *Logon, char *Password) +{ +HTTPInfoStruct *Info; +STREAM *S; + + +Info=HTTPInfoFromURL(Method, URL); +if (StrLen(Logon) || StrLen(Password)) +{ + if (! Info->Authorization) Info->Authorization=(HTTPAuthStruct *) calloc(1,sizeof(HTTPAuthStruct)); + HTTPAuthSet(Info->Authorization,Logon, Password, HTTP_AUTH_BASIC); +} +S=HTTPTransact(Info); + +HTTPInfoDestroy(Info); +return(S); +} + + +STREAM *HTTPGet(char *URL, char *Logon, char *Password) +{ +return(HTTPMethod("GET", URL, Logon, Password)); +} + + +STREAM *HTTPPost(char *URL, char *Logon, char *Password, char *ContentType, char *Content) +{ +HTTPInfoStruct *Info; +STREAM *S; + + +Info=HTTPInfoFromURL("POST", URL); +Info->PostContentType=CopyStr(Info->PostContentType,ContentType); +Info->PostData=CopyStr(Info->PostData,Content); +Info->PostContentLength=StrLen(Content); +if (StrLen(Logon) || StrLen(Password)) +{ + if (! Info->Authorization) Info->Authorization=(HTTPAuthStruct *) calloc(1,sizeof(HTTPAuthStruct)); + HTTPAuthSet(Info->Authorization,Logon, Password, HTTP_AUTH_BASIC); +} +S=HTTPTransact(Info); + +HTTPInfoDestroy(Info); +return(S); +} + + +void HTTPCopyToSTREAM(STREAM *Con, STREAM *S) +{ +char *Tempstr=NULL; +int result; + +Tempstr=SetStrLen(Tempstr,BUFSIZ); +result=STREAMReadBytes(Con, Tempstr,BUFSIZ); +while (result > 0) +{ + STREAMWriteBytes(S,Tempstr,result); + result=STREAMReadBytes(Con, Tempstr,BUFSIZ); +} + +} + + +int HTTPDownload(char *URL,char *Login,char *Password, STREAM *S) +{ +STREAM *Con; +Con=HTTPGet(URL,Login,Password); +if (! Con) return(FALSE); +HTTPCopyToSTREAM(Con, S); +return(TRUE); +} + +void HTTPSetUserAgent(char *AgentName) +{ +LibUsefulSetValue("HTTP:User-Agent",AgentName); +} + +void HTTPSetProxy(char *Proxy) +{ +LibUsefulSetValue("HTTP:Proxy",Proxy); +} + +void HTTPSetFlags(int Flags) +{ +g_Flags=Flags; +} + +int HTTPGetFlags() +{ +return(g_Flags); +} diff --git a/libUseful-2.0/http.h b/libUseful-2.0/http.h new file mode 100644 index 0000000..b7e9470 --- /dev/null +++ b/libUseful-2.0/http.h @@ -0,0 +1,121 @@ +#ifndef LIBUSEFUL_HTTP_H +#define LIBUSEFUL_HTTP_H + +#include "includes.h" +#include "defines.h" +#include "file.h" + +#define HTTP_AUTH_BASIC 1 +#define HTTP_AUTH_DIGEST 2 +#define HTTP_SENT_AUTH 4 +#define HTTP_PROXY_AUTH 8 + + +#define HTTP_OKAY 0 +#define HTTP_NOCONNECT 1 +#define HTTP_NOTFOUND 2 +#define HTTP_REDIRECT 3 +#define HTTP_ERROR 4 +#define HTTP_CIRCULAR_REDIRECTS 5 +#define HTTP_NOTMODIFIED 6 + +#define HTTP_VER1_0 1 +#define HTTP_DEBUG 2 +#define HTTP_CHUNKED 4 +#define HTTP_NOCACHE 8 +#define HTTP_NOCOMPRESS 16 +#define HTTP_NOREDIRECT 32 +#define HTTP_TRY_HTTPS 64 +#define HTTP_REQ_HTTPS 128 +#define HTTP_KEEPALIVE 256 +#define HTTP_SSL 1024 +#define HTTP_SSL_REWRITE 2048 +#define HTTP_PROXY 4096 +#define HTTP_TUNNEL 8192 +#define HTTP_NODECODE 32768 +#define HTTP_NOCOOKIES 65536 +#define HTTP_GZIP 1048576 +#define HTTP_DEFLATE 2097152 +#define HTTP_BZIP2 4194304 +#define HTTP_XZ 8388608 + + +#define HTTP_HEADERS_SENT 1 +#define HTTP_CLIENTDATA_SENT 2 +#define HTTP_HEADERS_READ 4 + +typedef struct +{ +int Flags; +char *AuthRealm; +char *AuthQOP; +char *AuthNonce; +char *AuthOpaque; +char *Logon; +char *Password; +} HTTPAuthStruct; + + +typedef struct +{ +char *Host; +int Port; +char *Method; +char *Doc; +char *Destination; +char *ResponseCode; +int Flags; +int State; +char *RedirectPath; +char *PreviousRedirect; +char *ContentType; +char *Timestamp; +int ContentLength; +int Depth; +char *PostData; +char *PostContentType; +int PostContentLength; +char *Proxy; +time_t IfModifiedSince; +ListNode *ServerHeaders; +ListNode *CustomSendHeaders; +HTTPAuthStruct *Authorization; +HTTPAuthStruct *ProxyAuthorization; +STREAM *S; +} HTTPInfoStruct; + +#ifdef __cplusplus +extern "C" { +#endif + +char *HTTPQuote(char *, char*); +char *HTTPQuoteChars(char *RetBuff, char *Str, char *CharList); +char *HTTPUnQuote(char *, char*); + + +void HTTPInfoDestroy(void *p_Info); +void HTTPInfoSetValues(HTTPInfoStruct *Info, char *Host, int Port, char *Logon, char *Password, char *Method, char *Doc, char *ContentType, int ContentLength); +void HTTPInfoSetAuth(HTTPInfoStruct *Auth, char *Logon, char *Password, int Type); +HTTPInfoStruct *HTTPInfoCreate(char *Host, int Port, char *Logon, char *Password, char *Method, char *Doc, char *ContentType, int ContentLength); +STREAM *HTTPConnect(HTTPInfoStruct *Info); +STREAM *HTTPTransact(HTTPInfoStruct *Info); +HTTPInfoStruct *HTTPInfoFromURL(char *Method, char *URL); +STREAM *HTTPMethod(char *Method, char *URL, char *Logon, char *Password); +STREAM *HTTPGet(char *URL, char *Logon, char *Password); +STREAM *HTTPPost(char *URL, char *Logon, char *Password, char *ContentType, char *Content); +int HTTPReadBytes(STREAM *Con, char **Buffer); +void HTTPCopyToSTREAM(STREAM *Con, STREAM *S); +int HTTPDownload(char *URL, char *Login, char *Password, STREAM *S); +void HTTPSetUserAgent(char *AgentName); +void HTTPSetProxy(char *Proxy); +void HTTPSetFlags(int Flags); +int HTTPGetFlags(); +char *HTTPParseURL(char *URL, char **Proto, char **Host, int *Port, char **Login, char **Password); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/httptest.c b/libUseful-2.0/httptest.c new file mode 100644 index 0000000..580cee9 --- /dev/null +++ b/libUseful-2.0/httptest.c @@ -0,0 +1,18 @@ +#include "libUseful.h" + +main() +{ +STREAM *S; + +/* +S=STREAMCreate(); +if (STREAMConnectToHost(S,"icanhazip.com",80,0)) +{ +printf("Connected!\n"); +} +else printf("No connection\n"); +*/ + +HTTPSetFlags(HTTP_DEBUG); +printf("IP: %s\n",GetExternalIP(NULL)); +} diff --git a/libUseful-2.0/includes.h b/libUseful-2.0/includes.h new file mode 100644 index 0000000..50a57df --- /dev/null +++ b/libUseful-2.0/includes.h @@ -0,0 +1,30 @@ +#ifndef LIBUSEFUL_INCLUDES_H +#define LIBUSEFUL_INCLUDES_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "defines.h" +#include "string.h" +#include "list.h" +#include "GeneralFunctions.h" +#include "file.h" +#include "socket.h" +#include "Vars.h" +#include "libsettings.h" + +#endif diff --git a/libUseful-2.0/inet.c b/libUseful-2.0/inet.c new file mode 100644 index 0000000..e58da36 --- /dev/null +++ b/libUseful-2.0/inet.c @@ -0,0 +1,100 @@ +#include "inet.h" +#include "http.h" +#include "GeneralFunctions.h" +#include "Markup.h" + +char *ExtractFromWebpage(char *RetStr, char *URL, char *ExtractStr, int MinLength) +{ +STREAM *S; +char *Tempstr=NULL, *ptr; +ListNode *Vars; + +Vars=ListCreate(); + +S=HTTPGet(URL,"",""); +if (S) +{ +Tempstr=STREAMReadLine(Tempstr,S); +while (Tempstr) +{ +StripTrailingWhitespace(Tempstr); +StripLeadingWhitespace(Tempstr); + +if (StrLen(Tempstr) >=MinLength) +{ + if (! StrLen(ExtractStr)) RetStr=CopyStr(RetStr,Tempstr); + else + { + ExtractVarsFromString(Tempstr,ExtractStr,Vars); + ptr=GetVar(Vars,"extract_item"); + if (StrLen(ptr)) RetStr=CopyStr(RetStr,ptr); + } +} +Tempstr=STREAMReadLine(Tempstr,S); +} +STREAMClose(S); +} + +ListDestroy(Vars,(LIST_ITEM_DESTROY_FUNC) DestroyString); +DestroyString(Tempstr); + +StripTrailingWhitespace(RetStr); +StripLeadingWhitespace(RetStr); + +return(RetStr); +} + + +char *GetExternalIP(char *RetStr) +{ +STREAM *S; + +RetStr=CopyStr(RetStr,""); +if (! StrLen(RetStr)) RetStr=ExtractFromWebpage(RetStr,"http://checkip.dyndns.org", "Current IP Address: $(extract_item)",4); +if (! StrLen(RetStr)) RetStr=ExtractFromWebpage(RetStr,"http://ip.appspot.com/", "",4); + +return(RetStr); +} + +#define IPInfo_API_KEY "1261fcbf647ea02c165aa3bfa66810f0be453d8a1c2e7f653c0666d4e7e205f0" + +int IPGeoLocate(char *IP, ListNode *Vars) +{ +STREAM *S=NULL; +char *ptr, *TagType=NULL, *TagData=NULL, *Tempstr=NULL, *Token=NULL; +char *DesiredTags[]={"CountryCode","CountryName","City","RegionName","Latitude","Longitude","TimeZone",NULL}; + +if (! IsIPAddress(IP)) Token=CopyStr(Token,LookupHostIP(IP)); +else Token=CopyStr(Token,IP); + +Tempstr=MCopyStr(Tempstr,"http://api.ipinfodb.com/v2/ip_query.php?key=",IPInfo_API_KEY,"&ip=",Token,"&timezone=true",NULL); + +S=HTTPGet(Tempstr, "", ""); +if (S) +{ + Tempstr=STREAMReadLine(Tempstr,S); + while (Tempstr) + { + ptr=XMLGetTag(Tempstr,NULL,&TagType,&TagData); + while (ptr) + { + if (MatchTokenFromList(TagType,DesiredTags,0) > -1) + { + //we can't re-use 'TagType', we still need it + ptr=XMLGetTag(ptr,NULL,&Token,&TagData); + SetVar(Vars,TagType,TagData); + } + ptr=XMLGetTag(ptr,NULL,&TagType,&TagData); + } + Tempstr=STREAMReadLine(Tempstr,S); + } +} + +STREAMClose(S); + +DestroyString(Tempstr); +DestroyString(Token); +DestroyString(TagType); +DestroyString(TagData); +} + diff --git a/libUseful-2.0/inet.h b/libUseful-2.0/inet.h new file mode 100644 index 0000000..f30ef78 --- /dev/null +++ b/libUseful-2.0/inet.h @@ -0,0 +1,20 @@ +#ifndef LIBUSEFUL_INET_H +#define LIBUSEFUL_INET_H + +#include "includes.h" +#include "defines.h" + +#ifdef __cplusplus +extern "C" { +#endif + +char *ExtractFromWebpage(char *RetStr, char *URL, char *ExtractStr, int MinLength); +char *GetExternalIP(char *RetStr); +int IPGeoLocate(char *IP, ListNode *Vars); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/install-sh b/libUseful-2.0/install-sh new file mode 100644 index 0000000..e9de238 --- /dev/null +++ b/libUseful-2.0/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/libUseful-2.0/libUseful.h b/libUseful-2.0/libUseful.h new file mode 100644 index 0000000..473f5e8 --- /dev/null +++ b/libUseful-2.0/libUseful.h @@ -0,0 +1,42 @@ +#ifndef LIB_USEFUL_H +#define LIB_USEFUL_H + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#include +#include +#include +#include +#include "socket.h" +#include "unix_socket.h" +#include "string.h" +#include "expect.h" +#include "list.h" +#include "file.h" +#include "base64.h" +#include "FileSystem.h" +#include "GeneralFunctions.h" +#include "DataProcessing.h" +#include "EncryptedFiles.h" +#include "ConnectManager.h" +#include "Hash.h" +#include "Compression.h" +#include "sound.h" +#include "pty.h" +#include "Log.h" +#include "http.h" +#include "oauth.h" +#include "Time.h" +#include "Vars.h" +#include "Markup.h" +#include "MathExpr.h" +#include "PatternMatch.h" +#include "SpawnPrograms.h" + +#endif diff --git a/libUseful-2.0/libsettings.c b/libUseful-2.0/libsettings.c new file mode 100644 index 0000000..c1f1abd --- /dev/null +++ b/libUseful-2.0/libsettings.c @@ -0,0 +1,28 @@ +#ifndef LIBUSEFUL_SETTINGS + +#include "defines.h" +#include "includes.h" +#include "Vars.h" + +/* These functions provide an interface for setting variables that */ +/* are used by libUseful itself */ + +ListNode *LibUsefulSettings=NULL; + +ListNode *LibUsefulValuesGetHead() +{ +return(LibUsefulSettings); +} + +void LibUsefulSetValue(char *Name, char *Value) +{ + if (! LibUsefulSettings) LibUsefulSettings=ListCreate(); + SetVar(LibUsefulSettings,Name,Value); +} + +char *LibUsefulGetValue(char *Name) +{ +return(GetVar(LibUsefulSettings,Name)); +} + +#endif diff --git a/libUseful-2.0/libsettings.h b/libUseful-2.0/libsettings.h new file mode 100644 index 0000000..55a4ec0 --- /dev/null +++ b/libUseful-2.0/libsettings.h @@ -0,0 +1,22 @@ +#ifndef LIBUSEFUL_SETTINGS +#define LIBUSEFUL_SETTINGS + +#include "Vars.h" + +/* These functions provide an interface for setting variables that */ +/* are used by libUseful itself */ + +#ifdef __cplusplus +extern "C" { +#endif + +ListNode *LibUsefulValuesGetHead(); +void LibUsefulSetValue(char *Name, char *Value); +char *LibUsefulGetValue(char *Name); + +#ifdef __cplusplus +}; +#endif + + +#endif diff --git a/libUseful-2.0/list.c b/libUseful-2.0/list.c new file mode 100644 index 0000000..e622c4c --- /dev/null +++ b/libUseful-2.0/list.c @@ -0,0 +1,639 @@ +#include "includes.h" + + +ListNode *ListGetHead(ListNode *Node) +{ +if (! Node) return(NULL); +return(Node->Head); +} + + + +int ListSize(ListNode *List) +{ +ListNode *Head; +int *intptr; + +if (! List) return(0); +Head=ListGetHead(List); +intptr=(int *) Head->Item; + +return(*intptr); + +} + + + + +int ListSetNoOfItems(ListNode *LastItem, int val) +{ +ListNode *Head; +int *intptr; + +Head=ListGetHead(LastItem); +if (LastItem->Next==NULL) + Head->Prev=LastItem; /* The head Item has its Prev as being the last item! */ +intptr=(int *) Head->Item; +(*intptr)=val; + +return(*intptr); +} + + + +int ListIncrNoOfItems(ListNode *LastItem) +{ +ListNode *Head; +int *intptr; + +Head=ListGetHead(LastItem); +if (LastItem->Next==NULL) + Head->Prev=LastItem; /* The head Item has its Prev as being the last item! */ +intptr=(int *) Head->Item; +(*intptr)++; + +return(*intptr); +} + +int ListDecrNoOfItems(ListNode *LastItem) +{ +ListNode *Head; +int *intptr; + +Head=ListGetHead(LastItem); +if (LastItem->Next==NULL) Head->Prev=LastItem->Prev; /* The head Item has its Prev as being the last item! */ +intptr=(int *) Head->Item; +(*intptr)--; +return(*intptr); +} + + +ListNode *ListCreate() +{ +ListNode *TempPtr; + +TempPtr=(ListNode *)calloc(1,sizeof(ListNode)); +TempPtr->Head=TempPtr; +TempPtr->Prev=TempPtr; +TempPtr->Next=NULL; +TempPtr->Item=calloc(1,sizeof(int)); + +(*(int *)TempPtr->Item)=0; +return(TempPtr); +} + +void ListClear(ListNode *ListStart, LIST_ITEM_DESTROY_FUNC ItemDestroyer) +{ + ListNode *Curr,*Next; + + if (! ListStart) return; + Curr=ListGetNext(ListStart); + while (Curr !=NULL) + { + Next=Curr->Next; + if (ItemDestroyer && Curr->Item) ItemDestroyer(Curr->Item); + DestroyString(Curr->Tag); + free(Curr); + Curr=Next; + } +ListStart->Next=NULL; +ListStart->Head=ListStart; +ListStart->Prev=ListStart; +ListSetNoOfItems(ListStart,0); +} + +void ListDestroy(ListNode *ListStart, LIST_ITEM_DESTROY_FUNC ItemDestroyer) +{ + ListNode *Curr,*Next; + + if (! ListStart) return; + ListClear(ListStart, ItemDestroyer); + free(ListStart->Item); + free(ListStart); +} + + +ListNode *ListClone(ListNode *ListStart, LIST_ITEM_CLONE_FUNC ItemCloner) +{ + ListNode *Curr,*NewList; + void *Item; + + if (! ItemCloner) return(NULL); + NewList=ListCreate(); + + Curr=ListGetNext(ListStart); + while (Curr !=NULL) + { + if (ItemCloner) + { + Item=ItemCloner(Curr->Item); + ListAddNamedItem(NewList,Curr->Tag,Item); + } + Curr=ListGetNext(Curr); + } + return(NewList); +} + +ListNode *ListAddNamedItemAfter(ListNode *ListStart,const char *Name,void *Item) +{ +ListNode *Curr; + +if (ListStart==NULL) return(NULL); + +Curr=ListStart; +Curr->Next=(ListNode *) calloc(1,sizeof(ListNode)); +Curr->Next->Prev=Curr; +Curr=Curr->Next; +Curr->Item=Item; +Curr->Head=ListGetHead(ListStart); +Curr->Next=NULL; +if (Name) Curr->Tag=CopyStr(NULL,Name); + +ListIncrNoOfItems(Curr); +return(Curr); +} + + + +ListNode *ListAddNamedItem(ListNode *ListStart,const char *Name,void *Item) +{ +ListNode *Head, *Curr; + +Curr=ListGetLast(ListStart); +if (Curr==NULL) return(Curr); +return(ListAddNamedItemAfter(Curr,Name,Item)); +} + + + +ListNode *ListAddItem(ListNode *ListStart,void *Item) +{ +return(ListAddNamedItem(ListStart,NULL,Item)); +} + +void ListUnthreadNode(ListNode *Node) +{ +ListNode *Prev, *Next; + +Prev=Node->Prev; +Next=Node->Next; +if (Prev) Prev->Next=Next; +if (Next) Next->Prev=Prev; +} + +void ListThreadNode(ListNode *Prev, ListNode *Node) +{ +ListNode *NewItem, *Next; + +//Never thread something to itself! +if (Prev==Node) return; + +Next=Prev->Next; +Node->Prev=Prev; +Prev->Next=Node; +Node->Next=Next; +if (Next) Next->Prev=Node; /* Next might be NULL! */ +} + + +ListNode *ListInsertNamedItem(ListNode *InsertNode, const char *Name, void *Item) +{ +ListNode *NewItem, *Next; + +Next=InsertNode->Next; +NewItem=(ListNode *) calloc(1,sizeof(ListNode)); +NewItem->Item=Item; +NewItem->Prev=InsertNode; +NewItem->Next=Next; +InsertNode->Next=NewItem; +NewItem->Head=InsertNode->Head; +if (Next) Next->Prev=NewItem; /* Next might be NULL! */ +ListIncrNoOfItems(NewItem); +if (StrLen(Name)) NewItem->Tag=CopyStr(NewItem->Tag,Name); +return(NewItem); +} + + +void OrderedListAddJump(ListNode *From, ListNode *To) +{ +int result; + +if (! From) return; +if (! To) return; + +if (From->Jump) +{ + result=strcmp(From->Jump->Tag, To->Tag); + if (result > 0) OrderedListAddJump(From->Next,To); + else if (result==0) + { + return; + } + else + { + OrderedListAddJump(From->Next,From->Jump); + From->Jump=To; + } +} +else From->Jump=To; +} + + +ListNode *OrderedListAddNamedItem(ListNode *Head, const char *Name, void *Item) +{ +ListNode *NewItem, *Prev, *Curr, *Start; +int count=0, jcount=0, result=-1; + + +if (! Head) return(NULL); +Prev=Head; +Curr=Head->Next; +Start=Curr; + +while (Curr) +{ +if (Curr->Jump) +{ + count=0; + result=strcmp(Curr->Jump->Tag,Name); + if (result < 0) + { + Curr=Curr->Jump; + Prev=Curr->Prev; + jcount++; + if (jcount > 5) + { + OrderedListAddJump(Head->Next, Curr); + jcount=0; + } + Start=Curr->Next; + } +} + +if (Curr->Tag) result=strcmp(Curr->Tag,Name); +if (result > -1) break; + +count++; +if (count > 100) +{ + OrderedListAddJump(Start, Curr); + count=0; + Start=Curr->Next; +} + +Prev=Curr; +Curr=Curr->Next; +} + +NewItem=(ListNode *) calloc(1,sizeof(ListNode)); +NewItem->Item=Item; +NewItem->Prev=Prev; +NewItem->Next=Prev->Next; +Prev->Next=NewItem; +NewItem->Head=Prev->Head; +if (NewItem->Next) NewItem->Next->Prev=NewItem; /* Next might be NULL! */ +ListIncrNoOfItems(NewItem); +if (StrLen(Name)) NewItem->Tag=CopyStr(NewItem->Tag,Name); + + +result=ListSize(NewItem); + +if ((result % 2000)==0) +{ +Curr=ListGetNth(Head,result / 2); +OrderedListAddJump(Head->Next, Curr); +} + + +return(NewItem); +} + + + +ListNode *ListInsertItem(ListNode *InsertNode, void *Item) +{ +return(ListInsertNamedItem(InsertNode, NULL, Item)); +} + + +ListNode *InsertItemIntoSortedList(ListNode *List, void *Item, int (*LessThanFunc)(void *, void *, void *)) +{ +ListNode *Curr, *Prev; + +Prev=List; +Curr=ListGetNext(Prev); +while (Curr && (LessThanFunc(NULL, Curr->Item,Item)) ) +{ +Prev=Curr; +Curr=ListGetNext(Prev); +} + +return(ListInsertItem(Prev,Item)); +} + + +ListNode *ListGetNext(ListNode *CurrItem) +{ +if (CurrItem !=NULL) return(CurrItem->Next); +else return(NULL); +} + +ListNode *ListGetPrev(ListNode *CurrItem) +{ +ListNode *Prev; +if (CurrItem !=NULL) +{ +Prev=CurrItem->Prev; +/* Don't return the dummy header! */ +if (Prev && (Prev->Prev !=NULL) && (Prev != Prev->Head)) return(Prev); +else return(NULL); +} +else return(NULL); +} + + +ListNode *ListGetLast(ListNode *CurrItem) +{ +ListNode *Head; + + +Head=ListGetHead(CurrItem); +if (! Head) return(NULL); +/* the dummy header has a 'Prev' entry that points to the last item! */ +return(Head->Prev); +} + +ListNode *ListGetNth(ListNode *Head, int n) +{ +ListNode *Curr; +int count=0; + +if (! Head) return(NULL); + +Curr=ListGetNext(Head); +while (Curr && (count < n)) +{ + count++; + Curr=ListGetNext(Curr); +} +if (count < n) return(NULL); +return(Curr); +} + + + +void *IndexArrayOnList(ListNode *ListHead) +{ +ListNode *Curr; +int count, list_size; +void **PtrArray; + +Curr=ListGetNext(ListHead); /* Skip past empty list 'header' item */ +list_size=0; +while (Curr !=NULL) +{ +Curr=ListGetNext(Curr); +list_size++; +} +PtrArray=calloc(list_size+1,sizeof(void *)); + +Curr=ListGetNext(ListHead); /* All lists have a dummy header, remember? */ +for (count=0;count < list_size; count++) +{ +PtrArray[count]=Curr->Item; +Curr=ListGetNext(Curr); + +} +PtrArray[count]=NULL; +return(PtrArray); + +} + + +void *AddItemToArray(void *Array,int size, void *Item) +{ +void **PtrArray; + + +/* two more than number of items in array, one is the new item, and*/ +/* one is the terminating null */ +PtrArray=Array; +PtrArray=realloc(PtrArray, (size+2) *sizeof(void *)); + +PtrArray[size]=Item; +PtrArray[size+1]=NULL; +return(PtrArray); +} + +void *DeleteItemFromArray(void *Array,int size, int ItemNo) +{ +int count; +void **PtrArray; + + +/* two more than number of items in array, one is the new item, and*/ +/* one is the terminating null */ +PtrArray=Array; + +/* size is actually number of items in array, hence size+1 is the */ +/* terminating null. So we include that in the copy */ +for (count=ItemNo; count < (size+1); count++) +{ +PtrArray[count]=PtrArray[count+1]; +} + +PtrArray=realloc(PtrArray, (size+1) *sizeof(void *)); +return(PtrArray); +} + + + + +ListNode *ListJoin(ListNode *List1, ListNode *List2) +{ +ListNode *Curr, *StartOfList2; + +Curr=List1; +/*Lists all have a dummy header!*/ +StartOfList2=List2->Next; + +while (Curr->Next !=NULL) Curr=Curr->Next; +Curr->Next=StartOfList2; +StartOfList2->Prev=Curr; + +while (Curr->Next !=NULL) Curr=Curr->Next; +return(Curr); +} + + +//Item1 is before Item2! +void ListSwapItems(ListNode *Item1, ListNode *Item2) +{ +ListNode *Head, *Prev, *Next; + +if (! Item1) return; +if (! Item2) return; +Prev=Item1->Prev; +Next=Item2->Next; +Head=ListGetHead(Item1); + +if (Head->Next==Item1) Head->Next=Item2; +if (Prev) Prev->Next=Item2; +Item1->Prev=Item2; +Item1->Next=Next; + +if (Next) Next->Prev=Item1; +Item2->Prev=Prev; +Item2->Next=Item1; + +} + + +void ListSort(ListNode *List, void *Data, int (*LessThanFunc)(void *, void *, void *)) +{ +ListNode *Curr=NULL, *Prev=NULL; +int sorted=0; + +while (! sorted) +{ + sorted=1; + Prev=NULL; + Curr=ListGetNext(List); + while (Curr) + { + if (Prev !=NULL) + { + if ( (*LessThanFunc)(Data,Curr->Item,Prev->Item) ) + { + sorted=0; + ListSwapItems(Prev,Curr); + } + } + Prev=Curr; + Curr=ListGetNext(Curr); + } +} + +} + +void ListSortNamedItems(ListNode *List) +{ +ListNode *Curr=NULL, *Prev=NULL; +int sorted=0; + +while (! sorted) +{ + sorted=1; + Prev=NULL; + Curr=ListGetNext(List); + while (Curr) + { + if (Prev !=NULL) + { + if (strcmp(Prev->Tag,Curr->Tag) < 0) + { + sorted=0; + ListSwapItems(Prev,Curr); + } + } + + Prev=Curr; + Curr=ListGetNext(Curr); + } +} + +} + + +ListNode *ListFindNamedItem(ListNode *Head, const char *Name) +{ +ListNode *Curr; +int result; + +if (! StrLen(Name)) return(NULL); +Curr=ListGetNext(Head); +while (Curr) +{ + if (Curr->Jump) + { + result=strcasecmp(Curr->Jump->Tag,Name); + if (result < 0) Curr=Curr->Jump; + } + if (Curr->Tag && (strcasecmp(Curr->Tag,Name)==0)) return(Curr); + Curr=ListGetNext(Curr); +} +return(Curr); +} + + + + +ListNode *ListFindItem(ListNode *Head, void *Item) +{ +ListNode *Curr; + +if (! Item) return(NULL); +Curr=ListGetNext(Head); +while (Curr) +{ + if (Curr->Item==Item) return(Curr); + Curr=ListGetNext(Curr); +} +return(Curr); +} + + +void *ListDeleteNode(ListNode *Node) +{ +ListNode *Prev, *Next, *Curr; +void *Contents; +int result; + +if (Node==NULL) +{ + return(NULL); +} + +Curr=Node->Head; +if (Curr) Curr=Curr->Next; +while (Curr) +{ +if (Curr->Jump) +{ + if (Curr->Jump==Node) Curr->Jump=NULL; + /* + if (strcmp(Curr->Jump->Tag,Node->Tag) > -1) + { + Curr=Curr->Jump; + continue; + } + */ +} + +Curr=ListGetNext(Curr); +} + +Prev=Node->Prev; +Next=Node->Next; +if (Prev !=NULL) Prev->Next=Next; +if (Next !=NULL) Next->Prev=Prev; + + +Contents=Node->Item; + +ListDecrNoOfItems(Node); +DestroyString(Node->Tag); +free(Node); +return(Contents); +} + + +void *ListDeleteItem(ListNode *Head, void *Item) +{ +ListNode *Node; + +Node=ListFindItem(Head, Item); +if (Node) ListDeleteNode(Node); +} + + diff --git a/libUseful-2.0/list.h b/libUseful-2.0/list.h new file mode 100644 index 0000000..975b470 --- /dev/null +++ b/libUseful-2.0/list.h @@ -0,0 +1,62 @@ +#ifndef LIB_USEFUL_LIST +#define LIB_USEFUL_LIST + +#define LIST_FLAG_DELETE 1 + +typedef struct lnode +{ +int ItemType; +int Flags; +char *Tag; +void *Item; +struct lnode *Head; +struct lnode *Jump; +struct lnode *Prev; +struct lnode *Next; +} ListNode; + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*LIST_ITEM_DESTROY_FUNC)(void *); +typedef void *(*LIST_ITEM_CLONE_FUNC)(void *); + +ListNode *ListCreate(); +void *IndexArrayOnList(ListNode *); +void *AddItemToArray(void *Array,int size, void *Item); +void *DeleteItemFromArray(void *Array,int size, int ItemNo); +void ListDestroy(ListNode *, LIST_ITEM_DESTROY_FUNC); +void ListClear(ListNode *, LIST_ITEM_DESTROY_FUNC); +ListNode *ListAddItem(ListNode *,void *); +ListNode *ListAddNamedItem(ListNode *, const char *Name, void *); +ListNode *ListInsertItem(ListNode *,void *); +ListNode *ListInsertNamedItem(ListNode *,const char *,void *); +ListNode *OrderedListAddNamedItem(ListNode *Head, const char *Name, void *Item); +ListNode *SortedListInsertItem(ListNode *, void *, int (*LessThanFunc)(void *, void *, void *)); +ListNode *ListAddNamedItemAfter(ListNode *ListStart,const char *Name,void *Item); +ListNode *ListGetNext(ListNode *); +ListNode *ListGetPrev(ListNode *); +ListNode *ListGetHead(ListNode *); +ListNode *ListGetLast(ListNode *); +ListNode *ListGetNth(ListNode *Head, int n); +ListNode *ListFindNamedItem(ListNode *Head, const char *Name); +ListNode *ListFindItem(ListNode *Head, void *Item); +ListNode *ListJoin(ListNode *, ListNode *); +ListNode *ListClone(ListNode *, LIST_ITEM_CLONE_FUNC); +void ListSort(ListNode *, void *Data, int (*LessThanFunc)(void *, void *, void *)); +void ListSortNamedItems(ListNode *List); + +void *ListDeleteNode(ListNode *); +void *ListDeleteItem(ListNode *Head, void *Item); + +void ListSwapItems(ListNode *, ListNode *); +int ListSize(ListNode *); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/md5-global.h b/libUseful-2.0/md5-global.h new file mode 100644 index 0000000..22c5684 --- /dev/null +++ b/libUseful-2.0/md5-global.h @@ -0,0 +1,32 @@ +/* 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/libUseful-2.0/md5.h b/libUseful-2.0/md5.h new file mode 100644 index 0000000..a94c698 --- /dev/null +++ b/libUseful-2.0/md5.h @@ -0,0 +1,49 @@ +/* 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. + */ + +#include "md5-global.h" + +/* MD5 context. */ +typedef struct { + UINT4 state[4]; /* state (ABCD) */ + UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} MD5_CTX; + + +#ifdef __cplusplus +extern "C" { +#endif + +void MD5Init PROTO_LIST ((MD5_CTX *)); +void MD5Update PROTO_LIST + ((MD5_CTX *, unsigned char *, unsigned int)); +void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); + +#ifdef __cplusplus +} +#endif + + diff --git a/libUseful-2.0/md5c.c b/libUseful-2.0/md5c.c new file mode 100644 index 0000000..b01289e --- /dev/null +++ b/libUseful-2.0/md5c.c @@ -0,0 +1,339 @@ + +/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm + */ + +/* 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. + */ + +#include "md5.h" + +/* Constants for MD5Transform routine. + */ + +#define S11 7 +#define S12 12 +#define S13 17 +#define S14 22 +#define S21 5 +#define S22 9 +#define S23 14 +#define S24 20 +#define S31 4 +#define S32 11 +#define S33 16 +#define S34 23 +#define S41 6 +#define S42 10 +#define S43 15 +#define S44 21 + +static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64])); +static void Encode PROTO_LIST + ((unsigned char *, UINT4 *, unsigned int)); +static void Decode PROTO_LIST + ((UINT4 *, unsigned char *, unsigned int)); +static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int)); +static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int)); + +static unsigned char PADDING[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* F, G, H and I are basic MD5 functions. + */ +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | (~z))) + +/* ROTATE_LEFT rotates x left n bits. + */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. +Rotation is separate from addition to prevent recomputation. + */ +#define FF(a, b, c, d, x, s, ac) { \ + (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define GG(a, b, c, d, x, s, ac) { \ + (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define HH(a, b, c, d, x, s, ac) { \ + (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) { \ + (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } + +/* MD5 initialization. Begins an MD5 operation, writing a new context. + */ +void MD5Init (MD5_CTX *context) +{ + context->count[0] = context->count[1] = 0; + /* Load magic initialization constants. +*/ + context->state[0] = 0x67452301; + context->state[1] = 0xefcdab89; + context->state[2] = 0x98badcfe; + context->state[3] = 0x10325476; +} + +/* MD5 block update operation. Continues an MD5 message-digest + operation, processing another message block, and updating the + context. + */ +void MD5Update (context, input, inputLen) +MD5_CTX *context; /* context */ +unsigned char *input; /* input block */ +unsigned int inputLen; /* length of input block */ +{ + unsigned int i, index, partLen; + + /* Compute number of bytes mod 64 */ + index = (unsigned int)((context->count[0] >> 3) & 0x3F); + + /* Update number of bits */ + if ((context->count[0] += ((UINT4)inputLen << 3)) + + < ((UINT4)inputLen << 3)) + context->count[1]++; + context->count[1] += ((UINT4)inputLen >> 29); + + partLen = 64 - index; + + /* Transform as many times as possible. +*/ + if (inputLen >= partLen) { + MD5_memcpy + ((POINTER)&context->buffer[index], (POINTER)input, partLen); + MD5Transform (context->state, context->buffer); + + for (i = partLen; i + 63 < inputLen; i += 64) + MD5Transform (context->state, &input[i]); + + index = 0; + } + else + i = 0; + + /* Buffer remaining input */ + MD5_memcpy + ((POINTER)&context->buffer[index], (POINTER)&input[i], + inputLen-i); +} + +/* MD5 finalization. Ends an MD5 message-digest operation, writing the + the message digest and zeroizing the context. + */ +void MD5Final (digest, context) +unsigned char digest[16]; /* message digest */ +MD5_CTX *context; /* context */ +{ + unsigned char bits[8]; + unsigned int index, padLen; + + /* Save number of bits */ + Encode (bits, context->count, 8); + + /* Pad out to 56 mod 64. +*/ + index = (unsigned int)((context->count[0] >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + MD5Update (context, PADDING, padLen); + + /* Append length (before padding) */ + MD5Update (context, bits, 8); + + /* Store state in digest */ + Encode (digest, context->state, 16); + + /* Zeroize sensitive information. +*/ + MD5_memset ((POINTER)context, 0, sizeof (*context)); +} + +/* MD5 basic transformation. Transforms state based on block. + */ +static void MD5Transform (state, block) +UINT4 state[4]; +unsigned char block[64]; +{ + UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + Decode (x, block, 64); + + /* Round 1 */ + FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ + FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ + FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ + FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ + FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ + FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ + FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ + FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ + FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ + FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ + FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ + FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ + FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ + FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ + FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ + FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ + + /* Round 2 */ + GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ + GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ + GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ + GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ + GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ + GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ + GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ + GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ + GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ + GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ + + GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ + GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ + GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ + GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ + GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ + + /* Round 3 */ + HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ + HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ + HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ + HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ + HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ + HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ + HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ + HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ + HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ + HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ + HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ + HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ + HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ + HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ + HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ + HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ + + /* Round 4 */ + II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ + II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ + II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ + II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ + II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ + II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ + II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ + II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ + II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ + II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ + II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ + II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ + II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ + II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ + II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ + II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + /* Zeroize sensitive information. + +*/ + MD5_memset ((POINTER)x, 0, sizeof (x)); +} + +/* Encodes input (UINT4) into output (unsigned char). Assumes len is + a multiple of 4. + */ +static void Encode (output, input, len) +unsigned char *output; +UINT4 *input; +unsigned int len; +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) { + output[j] = (unsigned char)(input[i] & 0xff); + output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); + output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); + output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); + } +} + +/* Decodes input (unsigned char) into output (UINT4). Assumes len is + a multiple of 4. + */ +static void Decode (output, input, len) +UINT4 *output; +unsigned char *input; +unsigned int len; +{ + unsigned int i, j; + + for (i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | + (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); +} + +/* Note: Replace "for loop" with standard memcpy if possible. + */ + +static void MD5_memcpy (output, input, len) +POINTER output; +POINTER input; +unsigned int len; +{ + unsigned int i; + + for (i = 0; i < len; i++) + + output[i] = input[i]; +} + +/* Note: Replace "for loop" with standard memset if possible. + */ +static void MD5_memset (output, value, len) +POINTER output; +int value; +unsigned int len; +{ + unsigned int i; + + for (i = 0; i < len; i++) + ((char *)output)[i] = (char)value; +} + diff --git a/libUseful-2.0/oauth.c b/libUseful-2.0/oauth.c new file mode 100644 index 0000000..86421cd --- /dev/null +++ b/libUseful-2.0/oauth.c @@ -0,0 +1,261 @@ +#include "oauth.h" +#include "http.h" + +void ParseTagData(char *TagName,char *TagData,char **RType,char **RName,char **RValue) +{ +char *Name=NULL, *Value=NULL, *ptr; + +ptr=GetNameValuePair(TagData," ","=",&Name,&Value); +while (ptr) +{ +if (strcasecmp(Name,"type")==0) *RType=HtmlDeQuote(*RType,Value); +if (strcasecmp(Name,"name")==0) *RName=HtmlDeQuote(*RName,Value); +if (strcasecmp(Name,"value")==0) *RValue=HtmlDeQuote(*RValue,Value); +if (strcasecmp(Name,"method")==0) *RType=HtmlDeQuote(*RType,Value); +if (strcasecmp(Name,"action")==0) *RValue=HtmlDeQuote(*RValue,Value); + +ptr=GetNameValuePair(ptr," ","=",&Name,&Value); +} + +DestroyString(Name); +DestroyString(Value); +} + + +void OAuthParseForm(char *HTML, char *SubmitType, char **SubmitURL, ListNode *HiddenVals, ListNode *QueryVals) +{ +char *TagName=NULL, *TagData=NULL, *Type=NULL, *Name=NULL, *Value=NULL, *ptr; + +ptr=XMLGetTag(HTML,NULL,&TagName,&TagData); +while (ptr) +{ +if (strcmp(TagName,"input")==0) +{ + ParseTagData(TagName,TagData,&Type,&Name,&Value); + + if (strcasecmp(Type,"hidden")==0) SetVar(HiddenVals,Name,Value); + if (strcasecmp(Type,"submit")==0) SetVar(HiddenVals,Name,Value); + if (strcasecmp(Type,"text")==0) SetVar(QueryVals,Name,Value); + if (strcasecmp(Type,"password")==0) SetVar(QueryVals,Name,Value); +} + +if (strcmp(TagName,"form")==0) +{ + ParseTagData(TagName,TagData,&Type,&Name,SubmitURL); +} + + +ptr=XMLGetTag(ptr,NULL,&TagName,&TagData); +} + +DestroyString(TagName); +DestroyString(TagData); +DestroyString(Type); +DestroyString(Name); +DestroyString(Value); +} + + + + +void OAuthParseJSON(char *JSON, ListNode *Vars) +{ +char *ptr, *ptr2, *Token=NULL, *Name=NULL, *Value=NULL; + +StripLeadingWhitespace(JSON); +StripTrailingWhitespace(JSON); +ptr=JSON+StrLen(JSON)-1; +if (*ptr=='}') *ptr='\0'; +ptr=JSON; +if (*ptr=='{') ptr++; +ptr=GetToken(ptr,",",&Token,0); +while (ptr) +{ +printf("TOK: %s\n",Token); +ptr2=GetToken(Token,":",&Name,0); +StripTrailingWhitespace(Name); +StripQuotes(Name); +ptr2=GetToken(ptr2,":",&Value,GETTOKEN_QUOTES); +StripLeadingWhitespace(Value); +StripTrailingWhitespace(Value); +StripQuotes(Value); +printf("JSON: %s=%s\n",Name,Value); +SetVar(Vars,Name,Value); +ptr=GetToken(ptr,",",&Token,0); +} + + +DestroyString(Name); +DestroyString(Value); +DestroyString(Token); +} + + + +void OAuthDeviceLogin(char *LoginURL, char *ClientID, char *Scope, char **DeviceCode, char **UserCode, char **NextURL) +{ +char *Tempstr=NULL, *Encode=NULL; +ListNode *Vars=NULL; +STREAM *S; + +Vars=ListCreate(); + +Encode=HTTPQuote(Encode,ClientID); +Tempstr=MCopyStr(Tempstr,LoginURL,"?client_id=",Encode,NULL); +Encode=HTTPQuote(Encode,Scope); +Tempstr=MCatStr(Tempstr,"&scope=",Encode,NULL); + +S=HTTPMethod("POST",Tempstr,"",""); + +if (S) +{ +Encode=CopyStr(Encode,""); +Tempstr=STREAMReadLine(Tempstr,S); +while (Tempstr) +{ +StripTrailingWhitespace(Tempstr); +Encode=CatStr(Encode,Tempstr); +Tempstr=STREAMReadLine(Tempstr,S); +} + +OAuthParseJSON(Encode, Vars); + +*NextURL=CopyStr(*NextURL,GetVar(Vars,"verification_url")); +*DeviceCode=CopyStr(*DeviceCode,GetVar(Vars,"device_code")); +*UserCode=CopyStr(*UserCode,GetVar(Vars,"user_code")); +} + + +ListDestroy(Vars,DestroyString); +DestroyString(Tempstr); +DestroyString(Encode); +STREAMClose(S); +} + + + +void OAuthDeviceGetAccessToken(char *TokenURL, char *ClientID, char *ClientSecret, char *DeviceCode, char **AccessToken, char **RefreshToken) +{ +char *Tempstr=NULL, *Encode=NULL; +ListNode *Vars=NULL; +STREAM *S; + +Vars=ListCreate(); + +Encode=HTTPQuote(Encode,ClientID); +Tempstr=MCopyStr(Tempstr,TokenURL,"?client_id=",Encode,NULL); +Encode=HTTPQuote(Encode,ClientSecret); +Tempstr=MCatStr(Tempstr,"&client_secret=",Encode,NULL); +Tempstr=MCatStr(Tempstr,"&code=",DeviceCode,NULL); +Tempstr=MCatStr(Tempstr,"&grant_type=","http://oauth.net/grant_type/device/1.0",NULL); + +S=HTTPMethod("POST",Tempstr,"",""); +if (S) +{ +Tempstr=STREAMReadLine(Tempstr,S); +while (Tempstr) +{ +StripTrailingWhitespace(Tempstr); +printf("OA: %s\n",Tempstr); +OAuthParseJSON(Tempstr, Vars); +Tempstr=STREAMReadLine(Tempstr,S); +} +} + +*AccessToken=CopyStr(*AccessToken,GetVar(Vars,"access_token")); +*RefreshToken=CopyStr(*RefreshToken,GetVar(Vars,"refresh_token")); + +ListDestroy(Vars,DestroyString); +DestroyString(Tempstr); +DestroyString(Encode); +} + + + +void OAuthDeviceRefreshToken(char *TokenURL, char *ClientID, char *ClientSecret, char *RefreshToken, char **AccessToken) +{ +char *Tempstr=NULL, *Encode=NULL; +ListNode *Vars=NULL; +STREAM *S; + +Vars=ListCreate(); + +Tempstr=MCopyStr(Tempstr,TokenURL,"?client_id=",ClientID,NULL); +Tempstr=MCatStr(Tempstr,"&client_secret=",ClientSecret,NULL); +Tempstr=MCatStr(Tempstr,"&refresh_token=",RefreshToken,NULL); +Tempstr=MCatStr(Tempstr,"&grant_type=","refresh_token",NULL); + +S=HTTPMethod("POST",Tempstr,"",""); +if (S) +{ +Tempstr=STREAMReadLine(Tempstr,S); +while (Tempstr) +{ +StripTrailingWhitespace(Tempstr); +OAuthParseJSON(Tempstr, Vars); + +Tempstr=STREAMReadLine(Tempstr,S); +} +} + +*AccessToken=CopyStr(*AccessToken,GetVar(Vars,"access_token")); +//*RefreshToken=CopyStr(*RefreshToken,GetVar(Vars,"refresh_token")); + +ListDestroy(Vars,DestroyString); +DestroyString(Tempstr); +DestroyString(Encode); +} + + + + +void OAuthInstalledAppURL(char *LoginURL, char *ClientID, char *Scope, char *RedirectURL, char **NextURL) +{ +char *Encode=NULL; + +Encode=HTTPQuote(Encode,ClientID); +*NextURL=MCopyStr(*NextURL,LoginURL,"?response_type=code&redirect_uri=",RedirectURL,"&client_id=",Encode,NULL); +Encode=HTTPQuote(Encode,Scope); +*NextURL=MCatStr(*NextURL,"&scope=",Encode,NULL); + + +DestroyString(Encode); +} + + +void OAuthInstalledAppGetAccessToken(char *TokenURL, char *ClientID, char *ClientSecret, char *AuthCode, char *RedirectURL, char **AccessToken, char **RefreshToken) +{ +char *Tempstr=NULL, *Encode=NULL; +ListNode *Vars=NULL; +STREAM *S; + +Vars=ListCreate(); + +Tempstr=MCopyStr(Tempstr,TokenURL,"?client_id=",ClientID,NULL); +Tempstr=MCatStr(Tempstr,"&client_secret=",ClientSecret,NULL); +Tempstr=MCatStr(Tempstr,"&code=",AuthCode,NULL); +Tempstr=MCatStr(Tempstr,"&redirect_uri=",RedirectURL,NULL); +Tempstr=MCatStr(Tempstr,"&grant_type=","authorization_code",NULL); + +S=HTTPMethod("POST",Tempstr,"",""); +if (S) +{ +Tempstr=STREAMReadLine(Tempstr,S); +while (Tempstr) +{ +StripTrailingWhitespace(Tempstr); +printf("OA: %s\n",Tempstr); +OAuthParseJSON(Tempstr, Vars); +Tempstr=STREAMReadLine(Tempstr,S); +} +} + +*AccessToken=CopyStr(*AccessToken,GetVar(Vars,"access_token")); +*RefreshToken=CopyStr(*RefreshToken,GetVar(Vars,"refresh_token")); + +ListDestroy(Vars,DestroyString); +DestroyString(Tempstr); +DestroyString(Encode); +} + + diff --git a/libUseful-2.0/oauth.h b/libUseful-2.0/oauth.h new file mode 100644 index 0000000..652a3f4 --- /dev/null +++ b/libUseful-2.0/oauth.h @@ -0,0 +1,19 @@ +#ifndef LIBUSEFUL_OAUTH_H +#define LIBUSEFUL_OAUTH_H + +#ifdef __cplusplus +extern "C" { +#endif + +void OAuthDeviceLogin(char *LoginURL, char *ClientID, char *Scope, char **DeviceCode, char **UserCode, char **NextURL); +void OAuthDeviceGetAccessToken(char *TokenURL, char *ClientID, char *ClientSecret, char *DeviceCode, char **AccessToken, char **RefreshToken); +void OAuthDeviceRefreshToken(char *TokenURL, char *ClientID, char *ClientSecret, char *RefreshToken, char **AccessToken); +void OAuthInstalledAppURL(char *LoginURL, char *ClientID, char *Scope, char *RedirectURL, char **NextURL); +void OAuthInstalledAppGetAccessToken(char *TokenURL, char *ClientID, char *ClientSecret, char *AuthCode, char *RedirectURL, char **AccessToken, char **RefreshToken); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/libUseful-2.0/pty.c b/libUseful-2.0/pty.c new file mode 100644 index 0000000..b7f2002 --- /dev/null +++ b/libUseful-2.0/pty.c @@ -0,0 +1,235 @@ +#include +#include +#include +#include +#include "file.h" +#include "GeneralFunctions.h" +#include "string.h" +#include "pty.h" + +ListNode *TTYAttribs=NULL; + +void HangUpLine(int tty) +{ +int result; +struct termios tty_data, oldtty_data; + + +result=tcgetattr(tty,&oldtty_data); +result=tcgetattr(tty,&tty_data); +result=cfsetispeed(&tty_data,B0); +result=cfsetospeed(&tty_data,B0); + +result=tcsetattr(tty,TCSANOW,&tty_data); + +sleep(5); +tcsetattr(tty,TCSANOW,&oldtty_data); +} + +void ResetTTY(int tty) +{ +struct termios *tty_data; +char *Tempstr=NULL; +ListNode *Curr; + +Tempstr=FormatStr(Tempstr,"%d",tty); +Curr=ListFindNamedItem(TTYAttribs,Tempstr); +if (Curr) +{ + tty_data=(struct termios *) Curr->Item; + tcsetattr(tty,TCSANOW,tty_data); + ListDeleteNode(Curr); + free(tty_data); +} + +DestroyString(Tempstr); +} + +void InitTTY(int tty, int LineSpeed, int Flags) +{ +struct termios tty_data, *old_tty_data; +int result, val; +char *Tempstr=NULL; +ListNode *Curr; + +Tempstr=FormatStr(Tempstr,"%d",tty); +if (! TTYAttribs) TTYAttribs=ListCreate(); +Curr=ListFindNamedItem(TTYAttribs,Tempstr); + +if (! Curr) +{ + old_tty_data=(struct termios *) calloc(1,sizeof(struct termios)); + ListAddNamedItem(TTYAttribs,Tempstr,old_tty_data); +} +else old_tty_data=(struct termios *) Curr->Item; + +tcgetattr(tty,old_tty_data); +//tcgetattr(tty,&tty_data); +memset(&tty_data,0,sizeof(tty_data)); + +//ignore break characters and parity errors +tty_data.c_iflag=IGNBRK | IGNPAR; + + +if (! (Flags & TTYFLAG_CRLF_KEEP)) +{ + //translate carriage-return to newline + if (Flags & TTYFLAG_CRLF) tty_data.c_iflag |= ICRNL; + else tty_data.c_iflag &= ~ICRNL; + + //translate newline to carriage return + if (Flags & TTYFLAG_LFCR) + { + tty_data.c_iflag |= INLCR; + } + else tty_data.c_iflag &= ~INLCR; + + //postprocess and translate newline to cr-nl + if (Flags & TTYFLAG_LFCR) + { + tty_data.c_oflag |= ONLCR | OPOST; + } +} + +tty_data.c_cflag=CREAD | CS8 | HUPCL | CLOCAL; + + +if (Flags & TTYFLAG_SOFTWARE_FLOW) +{ +tty_data.c_iflag |= IXON | IXOFF; +tty_data.c_cc[VSTART]=old_tty_data->c_cc[VSTART]; +tty_data.c_cc[VSTOP]=old_tty_data->c_cc[VSTOP]; +} +if (Flags & TTYFLAG_HARDWARE_FLOW) tty_data.c_cflag |=CRTSCTS; + +// 'local' input flags +tty_data.c_lflag=0; + +if (! (Flags & TTYFLAG_IGNSIG)) +{ + tty_data.c_lflag=ISIG; + tty_data.c_cc[VQUIT]=old_tty_data->c_cc[VQUIT]; + tty_data.c_cc[VSUSP]=old_tty_data->c_cc[VSUSP]; + tty_data.c_cc[VINTR]=old_tty_data->c_cc[VINTR]; +} +if (Flags & TTYFLAG_ECHO) tty_data.c_lflag |= ECHO; + +if (Flags & TTYFLAG_CANON) +{ + tty_data.c_lflag|= ICANON; + tty_data.c_cc[VEOF]=old_tty_data->c_cc[VEOF]; + tty_data.c_cc[VEOL]=old_tty_data->c_cc[VEOL]; + tty_data.c_cc[VKILL]=old_tty_data->c_cc[VKILL]; + tty_data.c_cc[VERASE]=old_tty_data->c_cc[VERASE]; +} +else +{ + tty_data.c_cc[VMIN]=1; + tty_data.c_cc[VTIME]=0; +} + +if (LineSpeed > 0) +{ +switch (LineSpeed) +{ +case 2400: val=B2400; break; +case 4800: val=B4800; break; +case 9600: val=B9600; break; +case 19200: val=B19200; break; +case 38400: val=B38400; break; +case 57600: val=B57600; break; +case 115200: val=B115200; break; +case 230400: val=B230400; break; +#ifdef B460800 +case 460800: val=B460800; break; +#endif +#ifdef B500000 +case 500000: val=B500000; break; +#endif +#ifdef B1000000 +case 10000000: val=B1000000; break; +#endif +#ifdef B1152000 +case 1152000: val=B1152000; break; +#endif +#ifdef B2000000 +case 2000000: val=B2000000; break; +#endif +#ifdef B4000000 +case 4000000: val=B4000000; break; +#endif +default: val=B115200; break; +} +cfsetispeed(&tty_data,val); +cfsetospeed(&tty_data,val); +} + +tcflush(tty,TCIFLUSH); +result=tcsetattr(tty,TCSANOW,&tty_data); + +DestroyString(Tempstr); +} + + + + +int OpenTTY(char *devname, int LineSpeed, int Flags) +{ +int tty; + +if (Flags & TTYFLAG_NONBLOCK) tty=open(devname,O_RDWR | O_NOCTTY | O_NDELAY); +else tty=open(devname,O_RDWR | O_NOCTTY); + +if ( tty <0) return(-1); +InitTTY(tty, LineSpeed, Flags); +return(tty); +} + + + +int GrabPseudoTTY(int *pty, int *tty, int TermFlags) +{ +char c1,c2; +char *Buffer=NULL; + +//first try unix98 style +*pty=open("/dev/ptmx",O_RDWR); +if (*pty > -1) +{ + grantpt(*pty); + unlockpt(*pty); + if ( (*tty=open((char *) ptsname(*pty),O_RDWR)) >-1) + { + InitTTY(*tty,0,TermFlags); + return(1); + } + +} + +//if unix98 fails, try old BSD style + +for (c1='p'; c1 < 's'; c1++) +{ + for (c2='5'; c2 <='9'; c2++) + { + Buffer=FormatStr(Buffer,"/dev/pty%c%c",c1,c2); + if ( (*pty=open(Buffer,O_RDWR)) >-1) + { + Buffer=FormatStr(Buffer,"/dev/tty%c%c",c1,c2); + if ( (*tty=OpenTTY(Buffer,0,TermFlags)) >-1) + { + DestroyString(Buffer); + return(1); + } + else close(*pty); + } + + } + +} + +DestroyString(Buffer); +return(0); +} + + diff --git a/libUseful-2.0/pty.h b/libUseful-2.0/pty.h new file mode 100644 index 0000000..409be8e --- /dev/null +++ b/libUseful-2.0/pty.h @@ -0,0 +1,31 @@ +#ifndef LIBUSEFUL_PTY_H +#define LIBUSEFUL_PTY_H + +#include "defines.h" + +#define TTYFLAG_ECHO 256 +#define TTYFLAG_CRLF 512 +#define TTYFLAG_LFCR 1024 +#define TTYFLAG_NONBLOCK 2048 +#define TTYFLAG_CANON 4096 +#define TTYFLAG_HARDWARE_FLOW 8192 +#define TTYFLAG_SOFTWARE_FLOW 16324 +#define TTYFLAG_CRLF_KEEP 32768 +#define TTYFLAG_IGNSIG 65536 + +#ifdef __cplusplus +extern "C" { +#endif + +void HangUpLine(int tty); +int OpenTTY(char *devname, int LineSpeed, int Flags); +void InitTTY(int tty, int LineSpeed, int Flags); +void ResetTTY(int tty); +int GrabPseudoTTY(int *pty, int *tty, int Flags); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/sha1.c b/libUseful-2.0/sha1.c new file mode 100644 index 0000000..b0acc13 --- /dev/null +++ b/libUseful-2.0/sha1.c @@ -0,0 +1,331 @@ +/* sha1.c - Functions to compute SHA1 message digest of files or + memory blocks according to the NIST specification FIPS-180-1. + + Copyright (C) 2000-2001, 2003-2006, 2008-2011 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Scott G. Miller + Credits: + Robert Klep -- Expansion function fix +*/ + +//#include + +#include "sha1.h" + +#include +#include +#include + +#ifdef WORDS_BIGENDIAN +# define SWAP(n) (n) +#else +# define SWAP(n) \ + (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) +#endif + +#define BLOCKSIZE 32768 +#if BLOCKSIZE % 64 != 0 +# error "invalid BLOCKSIZE" +#endif + +/* This array contains the bytes used to pad the buffer to the next + 64-byte boundary. (RFC 1321, 3.1: Step 1) */ +static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; + + +/* Take a pointer to a 160 bit block of data (five 32 bit ints) and + initialize it to the start constants of the SHA1 algorithm. This + must be called before using hash in the call to sha1_hash. */ +void +sha1_init_ctx (struct sha1_ctx *ctx) +{ + ctx->A = 0x67452301; + ctx->B = 0xefcdab89; + ctx->C = 0x98badcfe; + ctx->D = 0x10325476; + ctx->E = 0xc3d2e1f0; + + ctx->total[0] = ctx->total[1] = 0; + ctx->buflen = 0; +} + +/* Copy the 4 byte value from v into the memory location pointed to by *cp, + If your architecture allows unaligned access this is equivalent to + * (uint32_t *) cp = v */ +static inline void +set_uint32 (char *cp, uint32_t v) +{ + memcpy (cp, &v, sizeof v); +} + +/* Put result from CTX in first 20 bytes following RESBUF. The result + must be in little endian byte order. */ +void * +sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf) +{ + char *r = resbuf; + set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A)); + set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B)); + set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C)); + set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D)); + set_uint32 (r + 4 * sizeof ctx->E, SWAP (ctx->E)); + + return resbuf; +} + +/* Process the remaining bytes in the internal buffer and the usual + prolog according to the standard and write the result to RESBUF. */ +void * +sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf) +{ + /* Take yet unprocessed bytes into account. */ + uint32_t bytes = ctx->buflen; + size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4; + + /* Now count remaining bytes. */ + ctx->total[0] += bytes; + if (ctx->total[0] < bytes) + ++ctx->total[1]; + + /* Put the 64-bit file length in *bits* at the end of the buffer. */ + ctx->buffer[size - 2] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); + ctx->buffer[size - 1] = SWAP (ctx->total[0] << 3); + + memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes); + + /* Process last bytes. */ + sha1_process_block (ctx->buffer, size * 4, ctx); + + return sha1_read_ctx (ctx, resbuf); +} + +void +sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx) +{ + /* When we already have some bits in our internal buffer concatenate + both inputs first. */ + if (ctx->buflen != 0) + { + size_t left_over = ctx->buflen; + size_t add = 128 - left_over > len ? len : 128 - left_over; + + memcpy (&((char *) ctx->buffer)[left_over], buffer, add); + ctx->buflen += add; + + if (ctx->buflen > 64) + { + sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx); + + ctx->buflen &= 63; + /* The regions in the following copy operation cannot overlap. */ + memcpy (ctx->buffer, + &((char *) ctx->buffer)[(left_over + add) & ~63], + ctx->buflen); + } + + buffer = (const char *) buffer + add; + len -= add; + } + + /* Process available complete blocks. */ + if (len >= 64) + { +#if !_STRING_ARCH_unaligned +# define alignof(type) offsetof (struct { char c; type x; }, x) +# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0) + if (UNALIGNED_P (buffer)) + while (len > 64) + { + sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); + buffer = (const char *) buffer + 64; + len -= 64; + } + else +#endif + { + sha1_process_block (buffer, len & ~63, ctx); + buffer = (const char *) buffer + (len & ~63); + len &= 63; + } + } + + /* Move remaining bytes in internal buffer. */ + if (len > 0) + { + size_t left_over = ctx->buflen; + + memcpy (&((char *) ctx->buffer)[left_over], buffer, len); + left_over += len; + if (left_over >= 64) + { + sha1_process_block (ctx->buffer, 64, ctx); + left_over -= 64; + memcpy (ctx->buffer, &ctx->buffer[16], left_over); + } + ctx->buflen = left_over; + } +} + +/* --- Code below is the primary difference between md5.c and sha1.c --- */ + +/* SHA1 round constants */ +#define K1 0x5a827999 +#define K2 0x6ed9eba1 +#define K3 0x8f1bbcdc +#define K4 0xca62c1d6 + +/* Round functions. Note that F2 is the same as F4. */ +#define F1(B,C,D) ( D ^ ( B & ( C ^ D ) ) ) +#define F2(B,C,D) (B ^ C ^ D) +#define F3(B,C,D) ( ( B & C ) | ( D & ( B | C ) ) ) +#define F4(B,C,D) (B ^ C ^ D) + +/* Process LEN bytes of BUFFER, accumulating context into CTX. + It is assumed that LEN % 64 == 0. + Most of this code comes from GnuPG's cipher/sha1.c. */ + +void +sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx) +{ + const uint32_t *words = buffer; + size_t nwords = len / sizeof (uint32_t); + const uint32_t *endp = words + nwords; + uint32_t x[16]; + uint32_t a = ctx->A; + uint32_t b = ctx->B; + uint32_t c = ctx->C; + uint32_t d = ctx->D; + uint32_t e = ctx->E; + + /* First increment the byte count. RFC 1321 specifies the possible + length of the file up to 2^64 bits. Here we only compute the + number of bytes. Do a double word increment. */ + ctx->total[0] += len; + if (ctx->total[0] < len) + ++ctx->total[1]; + +#define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n)))) + +#define M(I) ( tm = x[I&0x0f] ^ x[(I-14)&0x0f] \ + ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \ + , (x[I&0x0f] = rol(tm, 1)) ) + +#define R(A,B,C,D,E,F,K,M) do { E += rol( A, 5 ) \ + + F( B, C, D ) \ + + K \ + + M; \ + B = rol( B, 30 ); \ + } while(0) + + while (words < endp) + { + uint32_t tm; + int t; + for (t = 0; t < 16; t++) + { + x[t] = SWAP (*words); + words++; + } + + R( a, b, c, d, e, F1, K1, x[ 0] ); + R( e, a, b, c, d, F1, K1, x[ 1] ); + R( d, e, a, b, c, F1, K1, x[ 2] ); + R( c, d, e, a, b, F1, K1, x[ 3] ); + R( b, c, d, e, a, F1, K1, x[ 4] ); + R( a, b, c, d, e, F1, K1, x[ 5] ); + R( e, a, b, c, d, F1, K1, x[ 6] ); + R( d, e, a, b, c, F1, K1, x[ 7] ); + R( c, d, e, a, b, F1, K1, x[ 8] ); + R( b, c, d, e, a, F1, K1, x[ 9] ); + R( a, b, c, d, e, F1, K1, x[10] ); + R( e, a, b, c, d, F1, K1, x[11] ); + R( d, e, a, b, c, F1, K1, x[12] ); + R( c, d, e, a, b, F1, K1, x[13] ); + R( b, c, d, e, a, F1, K1, x[14] ); + R( a, b, c, d, e, F1, K1, x[15] ); + R( e, a, b, c, d, F1, K1, M(16) ); + R( d, e, a, b, c, F1, K1, M(17) ); + R( c, d, e, a, b, F1, K1, M(18) ); + R( b, c, d, e, a, F1, K1, M(19) ); + R( a, b, c, d, e, F2, K2, M(20) ); + R( e, a, b, c, d, F2, K2, M(21) ); + R( d, e, a, b, c, F2, K2, M(22) ); + R( c, d, e, a, b, F2, K2, M(23) ); + R( b, c, d, e, a, F2, K2, M(24) ); + R( a, b, c, d, e, F2, K2, M(25) ); + R( e, a, b, c, d, F2, K2, M(26) ); + R( d, e, a, b, c, F2, K2, M(27) ); + R( c, d, e, a, b, F2, K2, M(28) ); + R( b, c, d, e, a, F2, K2, M(29) ); + R( a, b, c, d, e, F2, K2, M(30) ); + R( e, a, b, c, d, F2, K2, M(31) ); + R( d, e, a, b, c, F2, K2, M(32) ); + R( c, d, e, a, b, F2, K2, M(33) ); + R( b, c, d, e, a, F2, K2, M(34) ); + R( a, b, c, d, e, F2, K2, M(35) ); + R( e, a, b, c, d, F2, K2, M(36) ); + R( d, e, a, b, c, F2, K2, M(37) ); + R( c, d, e, a, b, F2, K2, M(38) ); + R( b, c, d, e, a, F2, K2, M(39) ); + R( a, b, c, d, e, F3, K3, M(40) ); + R( e, a, b, c, d, F3, K3, M(41) ); + R( d, e, a, b, c, F3, K3, M(42) ); + R( c, d, e, a, b, F3, K3, M(43) ); + R( b, c, d, e, a, F3, K3, M(44) ); + R( a, b, c, d, e, F3, K3, M(45) ); + R( e, a, b, c, d, F3, K3, M(46) ); + R( d, e, a, b, c, F3, K3, M(47) ); + R( c, d, e, a, b, F3, K3, M(48) ); + R( b, c, d, e, a, F3, K3, M(49) ); + R( a, b, c, d, e, F3, K3, M(50) ); + R( e, a, b, c, d, F3, K3, M(51) ); + R( d, e, a, b, c, F3, K3, M(52) ); + R( c, d, e, a, b, F3, K3, M(53) ); + R( b, c, d, e, a, F3, K3, M(54) ); + R( a, b, c, d, e, F3, K3, M(55) ); + R( e, a, b, c, d, F3, K3, M(56) ); + R( d, e, a, b, c, F3, K3, M(57) ); + R( c, d, e, a, b, F3, K3, M(58) ); + R( b, c, d, e, a, F3, K3, M(59) ); + R( a, b, c, d, e, F4, K4, M(60) ); + R( e, a, b, c, d, F4, K4, M(61) ); + R( d, e, a, b, c, F4, K4, M(62) ); + R( c, d, e, a, b, F4, K4, M(63) ); + R( b, c, d, e, a, F4, K4, M(64) ); + R( a, b, c, d, e, F4, K4, M(65) ); + R( e, a, b, c, d, F4, K4, M(66) ); + R( d, e, a, b, c, F4, K4, M(67) ); + R( c, d, e, a, b, F4, K4, M(68) ); + R( b, c, d, e, a, F4, K4, M(69) ); + R( a, b, c, d, e, F4, K4, M(70) ); + R( e, a, b, c, d, F4, K4, M(71) ); + R( d, e, a, b, c, F4, K4, M(72) ); + R( c, d, e, a, b, F4, K4, M(73) ); + R( b, c, d, e, a, F4, K4, M(74) ); + R( a, b, c, d, e, F4, K4, M(75) ); + R( e, a, b, c, d, F4, K4, M(76) ); + R( d, e, a, b, c, F4, K4, M(77) ); + R( c, d, e, a, b, F4, K4, M(78) ); + R( b, c, d, e, a, F4, K4, M(79) ); + + a = ctx->A += a; + b = ctx->B += b; + c = ctx->C += c; + d = ctx->D += d; + e = ctx->E += e; + } +} diff --git a/libUseful-2.0/sha1.h b/libUseful-2.0/sha1.h new file mode 100644 index 0000000..5bea6a5 --- /dev/null +++ b/libUseful-2.0/sha1.h @@ -0,0 +1,81 @@ +/* Declarations of functions and data types used for SHA1 sum + library functions. + Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2011 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifndef SHA1_H +# define SHA1_H 1 + +# include +# include + +# ifdef __cplusplus +extern "C" { +# endif + +#define SHA1_DIGEST_SIZE 20 + +/* Structure to save state of computation between the single steps. */ +struct sha1_ctx +{ + uint32_t A; + uint32_t B; + uint32_t C; + uint32_t D; + uint32_t E; + + uint32_t total[2]; + uint32_t buflen; + uint32_t buffer[32]; +}; + + +/* Initialize structure containing state of computation. */ +extern void sha1_init_ctx (struct sha1_ctx *ctx); + +/* Starting with the result of former calls of this function (or the + initialization function update the context for the next LEN bytes + starting at BUFFER. + It is necessary that LEN is a multiple of 64!!! */ +extern void sha1_process_block (const void *buffer, size_t len, + struct sha1_ctx *ctx); + +/* Starting with the result of former calls of this function (or the + initialization function update the context for the next LEN bytes + starting at BUFFER. + It is NOT required that LEN is a multiple of 64. */ +extern void sha1_process_bytes (const void *buffer, size_t len, + struct sha1_ctx *ctx); + +/* Process the remaining bytes in the buffer and put result from CTX + in first 20 bytes following RESBUF. The result is always in little + endian byte order, so that a byte-wise output yields to the wanted + ASCII representation of the message digest. */ +extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf); + + +/* Put result from CTX in first 20 bytes following RESBUF. The result is + always in little endian byte order, so that a byte-wise output yields + to the wanted ASCII representation of the message digest. */ +extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf); + + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/libUseful-2.0/sha2.c b/libUseful-2.0/sha2.c new file mode 100644 index 0000000..fb42ade --- /dev/null +++ b/libUseful-2.0/sha2.c @@ -0,0 +1,1064 @@ +/* + * FILE: sha2.c + * AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/ + * + * Copyright (c) 2000-2001, Aaron D. Gifford + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include /* memcpy()/memset() or bcopy()/bzero() */ +#include /* assert() */ +#include "sha2.h" + +/* + * ASSERT NOTE: + * Some sanity checking code is included using assert(). On my FreeBSD + * system, this additional code can be removed by compiling with NDEBUG + * defined. Check your own systems manpage on assert() to see how to + * compile WITHOUT the sanity checking code on your system. + * + * UNROLLED TRANSFORM LOOP NOTE: + * You can define SHA2_UNROLL_TRANSFORM to use the unrolled transform + * loop version for the hash transform rounds (defined using macros + * later in this file). Either define on the command line, for example: + * + * cc -DSHA2_UNROLL_TRANSFORM -o sha2 sha2.c sha2prog.c + * + * or define below: + * + * #define SHA2_UNROLL_TRANSFORM + * + */ + + +/*** SHA-256/384/512 Machine Architecture Definitions *****************/ +/* + * BYTE_ORDER NOTE: + * + * Please make sure that your system defines BYTE_ORDER. If your + * architecture is little-endian, make sure it also defines + * LITTLE_ENDIAN and that the two (BYTE_ORDER and LITTLE_ENDIAN) are + * equivilent. + * + * If your system does not define the above, then you can do so by + * hand like this: + * + * #define LITTLE_ENDIAN 1234 + * #define BIG_ENDIAN 4321 + * + * And for little-endian machines, add: + * + * #define BYTE_ORDER LITTLE_ENDIAN + * + * Or for big-endian machines: + * + * #define BYTE_ORDER BIG_ENDIAN + * + * The FreeBSD machine this was written on defines BYTE_ORDER + * appropriately by including (which in turn includes + * where the appropriate definitions are actually + * made). + */ +#if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN) +#error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN +#endif + +/* + * Define the followingsha2_* types to types of the correct length on + * the native archtecture. Most BSD systems and Linux define u_intXX_t + * types. Machines with very recent ANSI C headers, can use the + * uintXX_t definintions from inttypes.h by defining SHA2_USE_INTTYPES_H + * during compile or in the sha.h header file. + * + * Machines that support neither u_intXX_t nor inttypes.h's uintXX_t + * will need to define these three typedefs below (and the appropriate + * ones in sha.h too) by hand according to their system architecture. + * + * Thank you, Jun-ichiro itojun Hagino, for suggesting using u_intXX_t + * types and pointing out recent ANSI C support for uintXX_t in inttypes.h. + */ +#ifdef SHA2_USE_INTTYPES_H + +typedef uint8_t sha2_byte; /* Exactly 1 byte */ +typedef uint32_t sha2_word32; /* Exactly 4 bytes */ +typedef uint64_t sha2_word64; /* Exactly 8 bytes */ + +#else /* SHA2_USE_INTTYPES_H */ + +typedef u_int8_t sha2_byte; /* Exactly 1 byte */ +typedef u_int32_t sha2_word32; /* Exactly 4 bytes */ +typedef u_int64_t sha2_word64; /* Exactly 8 bytes */ + +#endif /* SHA2_USE_INTTYPES_H */ + + +/*** SHA-256/384/512 Various Length Definitions ***********************/ +/* NOTE: Most of these are in sha2.h */ +#define SHA256_SHORT_BLOCK_LENGTH (SHA256_BLOCK_LENGTH - 8) +#define SHA384_SHORT_BLOCK_LENGTH (SHA384_BLOCK_LENGTH - 16) +#define SHA512_SHORT_BLOCK_LENGTH (SHA512_BLOCK_LENGTH - 16) + + +/*** ENDIAN REVERSAL MACROS *******************************************/ +#if BYTE_ORDER == LITTLE_ENDIAN +#define REVERSE32(w,x) { \ + sha2_word32 tmp = (w); \ + tmp = (tmp >> 16) | (tmp << 16); \ + (x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \ +} +#define REVERSE64(w,x) { \ + sha2_word64 tmp = (w); \ + tmp = (tmp >> 32) | (tmp << 32); \ + tmp = ((tmp & 0xff00ff00ff00ff00ULL) >> 8) | \ + ((tmp & 0x00ff00ff00ff00ffULL) << 8); \ + (x) = ((tmp & 0xffff0000ffff0000ULL) >> 16) | \ + ((tmp & 0x0000ffff0000ffffULL) << 16); \ +} +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + +/* + * Macro for incrementally adding the unsigned 64-bit integer n to the + * unsigned 128-bit integer (represented using a two-element array of + * 64-bit words): + */ +#define ADDINC128(w,n) { \ + (w)[0] += (sha2_word64)(n); \ + if ((w)[0] < (n)) { \ + (w)[1]++; \ + } \ +} + +/* + * Macros for copying blocks of memory and for zeroing out ranges + * of memory. Using these macros makes it easy to switch from + * using memset()/memcpy() and using bzero()/bcopy(). + * + * Please define either SHA2_USE_MEMSET_MEMCPY or define + * SHA2_USE_BZERO_BCOPY depending on which function set you + * choose to use: + */ +#if !defined(SHA2_USE_MEMSET_MEMCPY) && !defined(SHA2_USE_BZERO_BCOPY) +/* Default to memset()/memcpy() if no option is specified */ +#define SHA2_USE_MEMSET_MEMCPY 1 +#endif +#if defined(SHA2_USE_MEMSET_MEMCPY) && defined(SHA2_USE_BZERO_BCOPY) +/* Abort with an error if BOTH options are defined */ +#error Define either SHA2_USE_MEMSET_MEMCPY or SHA2_USE_BZERO_BCOPY, not both! +#endif + +#ifdef SHA2_USE_MEMSET_MEMCPY +#define MEMSET_BZERO(p,l) memset((p), 0, (l)) +#define MEMCPY_BCOPY(d,s,l) memcpy((d), (s), (l)) +#endif +#ifdef SHA2_USE_BZERO_BCOPY +#define MEMSET_BZERO(p,l) bzero((p), (l)) +#define MEMCPY_BCOPY(d,s,l) bcopy((s), (d), (l)) +#endif + + +/*** THE SIX LOGICAL FUNCTIONS ****************************************/ +/* + * Bit shifting and rotation (used by the six SHA-XYZ logical functions: + * + * NOTE: The naming of R and S appears backwards here (R is a SHIFT and + * S is a ROTATION) because the SHA-256/384/512 description document + * (see http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf) uses this + * same "backwards" definition. + */ +/* Shift-right (used in SHA-256, SHA-384, and SHA-512): */ +#define R(b,x) ((x) >> (b)) +/* 32-bit Rotate-right (used in SHA-256): */ +#define S32(b,x) (((x) >> (b)) | ((x) << (32 - (b)))) +/* 64-bit Rotate-right (used in SHA-384 and SHA-512): */ +#define S64(b,x) (((x) >> (b)) | ((x) << (64 - (b)))) + +/* Two of six logical functions used in SHA-256, SHA-384, and SHA-512: */ +#define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) +#define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + +/* Four of six logical functions used in SHA-256: */ +#define Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) +#define Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) +#define sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x))) +#define sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x))) + +/* Four of six logical functions used in SHA-384 and SHA-512: */ +#define Sigma0_512(x) (S64(28, (x)) ^ S64(34, (x)) ^ S64(39, (x))) +#define Sigma1_512(x) (S64(14, (x)) ^ S64(18, (x)) ^ S64(41, (x))) +#define sigma0_512(x) (S64( 1, (x)) ^ S64( 8, (x)) ^ R( 7, (x))) +#define sigma1_512(x) (S64(19, (x)) ^ S64(61, (x)) ^ R( 6, (x))) + +/*** INTERNAL FUNCTION PROTOTYPES *************************************/ +/* NOTE: These should not be accessed directly from outside this + * library -- they are intended for private internal visibility/use + * only. + */ +void SHA512_Last(SHA512_CTX*); +void SHA256_Transform(SHA256_CTX*, const sha2_word32*); +void SHA512_Transform(SHA512_CTX*, const sha2_word64*); + + +/*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/ +/* Hash constant words K for SHA-256: */ +const static sha2_word32 K256[64] = { + 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, + 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, + 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL, + 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL, + 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, + 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, + 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, + 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL, + 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL, + 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL, + 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, + 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, + 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL, + 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL, + 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, + 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL +}; + +/* Initial hash value H for SHA-256: */ +const static sha2_word32 sha256_initial_hash_value[8] = { + 0x6a09e667UL, + 0xbb67ae85UL, + 0x3c6ef372UL, + 0xa54ff53aUL, + 0x510e527fUL, + 0x9b05688cUL, + 0x1f83d9abUL, + 0x5be0cd19UL +}; + +/* Hash constant words K for SHA-384 and SHA-512: */ +const static sha2_word64 K512[80] = { + 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, + 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL, + 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, + 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, + 0xd807aa98a3030242ULL, 0x12835b0145706fbeULL, + 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL, + 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, + 0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL, + 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL, + 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, + 0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL, + 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL, + 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, + 0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL, + 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL, + 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, + 0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL, + 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL, + 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, + 0x81c2c92e47edaee6ULL, 0x92722c851482353bULL, + 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL, + 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, + 0xd192e819d6ef5218ULL, 0xd69906245565a910ULL, + 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL, + 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, + 0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL, + 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL, + 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, + 0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL, + 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL, + 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, + 0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL, + 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL, + 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, + 0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL, + 0x113f9804bef90daeULL, 0x1b710b35131c471bULL, + 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, + 0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL, + 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL, + 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL +}; + +/* Initial hash value H for SHA-384 */ +const static sha2_word64 sha384_initial_hash_value[8] = { + 0xcbbb9d5dc1059ed8ULL, + 0x629a292a367cd507ULL, + 0x9159015a3070dd17ULL, + 0x152fecd8f70e5939ULL, + 0x67332667ffc00b31ULL, + 0x8eb44a8768581511ULL, + 0xdb0c2e0d64f98fa7ULL, + 0x47b5481dbefa4fa4ULL +}; + +/* Initial hash value H for SHA-512 */ +const static sha2_word64 sha512_initial_hash_value[8] = { + 0x6a09e667f3bcc908ULL, + 0xbb67ae8584caa73bULL, + 0x3c6ef372fe94f82bULL, + 0xa54ff53a5f1d36f1ULL, + 0x510e527fade682d1ULL, + 0x9b05688c2b3e6c1fULL, + 0x1f83d9abfb41bd6bULL, + 0x5be0cd19137e2179ULL +}; + +/* + * Constant used by SHA256/384/512_End() functions for converting the + * digest to a readable hexadecimal character string: + */ +static const char *sha2_hex_digits = "0123456789abcdef"; + + +/*** SHA-256: *********************************************************/ +void SHA256_Init(SHA256_CTX* context) { + if (context == (SHA256_CTX*)0) { + return; + } + MEMCPY_BCOPY(context->state, sha256_initial_hash_value, SHA256_DIGEST_LENGTH); + MEMSET_BZERO(context->buffer, SHA256_BLOCK_LENGTH); + context->bitcount = 0; +} + +#ifdef SHA2_UNROLL_TRANSFORM + +/* Unrolled SHA-256 round macros: */ + +#if BYTE_ORDER == LITTLE_ENDIAN + +#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \ + REVERSE32(*data++, W256[j]); \ + T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \ + K256[j] + W256[j]; \ + (d) += T1; \ + (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ + j++ + + +#else /* BYTE_ORDER == LITTLE_ENDIAN */ + +#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \ + T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \ + K256[j] + (W256[j] = *data++); \ + (d) += T1; \ + (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ + j++ + +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + +#define ROUND256(a,b,c,d,e,f,g,h) \ + s0 = W256[(j+1)&0x0f]; \ + s0 = sigma0_256(s0); \ + s1 = W256[(j+14)&0x0f]; \ + s1 = sigma1_256(s1); \ + T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + K256[j] + \ + (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); \ + (d) += T1; \ + (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ + j++ + +void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { + sha2_word32 a, b, c, d, e, f, g, h, s0, s1; + sha2_word32 T1, *W256; + int j; + + W256 = (sha2_word32*)context->buffer; + + /* Initialize registers with the prev. intermediate value */ + a = context->state[0]; + b = context->state[1]; + c = context->state[2]; + d = context->state[3]; + e = context->state[4]; + f = context->state[5]; + g = context->state[6]; + h = context->state[7]; + + j = 0; + do { + /* Rounds 0 to 15 (unrolled): */ + ROUND256_0_TO_15(a,b,c,d,e,f,g,h); + ROUND256_0_TO_15(h,a,b,c,d,e,f,g); + ROUND256_0_TO_15(g,h,a,b,c,d,e,f); + ROUND256_0_TO_15(f,g,h,a,b,c,d,e); + ROUND256_0_TO_15(e,f,g,h,a,b,c,d); + ROUND256_0_TO_15(d,e,f,g,h,a,b,c); + ROUND256_0_TO_15(c,d,e,f,g,h,a,b); + ROUND256_0_TO_15(b,c,d,e,f,g,h,a); + } while (j < 16); + + /* Now for the remaining rounds to 64: */ + do { + ROUND256(a,b,c,d,e,f,g,h); + ROUND256(h,a,b,c,d,e,f,g); + ROUND256(g,h,a,b,c,d,e,f); + ROUND256(f,g,h,a,b,c,d,e); + ROUND256(e,f,g,h,a,b,c,d); + ROUND256(d,e,f,g,h,a,b,c); + ROUND256(c,d,e,f,g,h,a,b); + ROUND256(b,c,d,e,f,g,h,a); + } while (j < 64); + + /* Compute the current intermediate hash value */ + context->state[0] += a; + context->state[1] += b; + context->state[2] += c; + context->state[3] += d; + context->state[4] += e; + context->state[5] += f; + context->state[6] += g; + context->state[7] += h; + + /* Clean up */ + a = b = c = d = e = f = g = h = T1 = 0; +} + +#else /* SHA2_UNROLL_TRANSFORM */ + +void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { + sha2_word32 a, b, c, d, e, f, g, h, s0, s1; + sha2_word32 T1, T2, *W256; + int j; + + W256 = (sha2_word32*)context->buffer; + + /* Initialize registers with the prev. intermediate value */ + a = context->state[0]; + b = context->state[1]; + c = context->state[2]; + d = context->state[3]; + e = context->state[4]; + f = context->state[5]; + g = context->state[6]; + h = context->state[7]; + + j = 0; + do { +#if BYTE_ORDER == LITTLE_ENDIAN + /* Copy data while converting to host byte order */ + REVERSE32(*data++,W256[j]); + /* Apply the SHA-256 compression function to update a..h */ + T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j]; +#else /* BYTE_ORDER == LITTLE_ENDIAN */ + /* Apply the SHA-256 compression function to update a..h with copy */ + T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++); +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + T2 = Sigma0_256(a) + Maj(a, b, c); + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + + j++; + } while (j < 16); + + do { + /* Part of the message block expansion: */ + s0 = W256[(j+1)&0x0f]; + s0 = sigma0_256(s0); + s1 = W256[(j+14)&0x0f]; + s1 = sigma1_256(s1); + + /* Apply the SHA-256 compression function to update a..h */ + T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + + (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); + T2 = Sigma0_256(a) + Maj(a, b, c); + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + + j++; + } while (j < 64); + + /* Compute the current intermediate hash value */ + context->state[0] += a; + context->state[1] += b; + context->state[2] += c; + context->state[3] += d; + context->state[4] += e; + context->state[5] += f; + context->state[6] += g; + context->state[7] += h; + + /* Clean up */ + a = b = c = d = e = f = g = h = T1 = T2 = 0; +} + +#endif /* SHA2_UNROLL_TRANSFORM */ + +void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { + unsigned int freespace, usedspace; + + if (len == 0) { + /* Calling with no data is valid - we do nothing */ + return; + } + + /* Sanity check: */ + assert(context != (SHA256_CTX*)0 && data != (sha2_byte*)0); + + usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH; + if (usedspace > 0) { + /* Calculate how much free space is available in the buffer */ + freespace = SHA256_BLOCK_LENGTH - usedspace; + + if (len >= freespace) { + /* Fill the buffer completely and process it */ + MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace); + context->bitcount += freespace << 3; + len -= freespace; + data += freespace; + SHA256_Transform(context, (sha2_word32*)context->buffer); + } else { + /* The buffer is not yet full */ + MEMCPY_BCOPY(&context->buffer[usedspace], data, len); + context->bitcount += len << 3; + /* Clean up: */ + usedspace = freespace = 0; + return; + } + } + while (len >= SHA256_BLOCK_LENGTH) { + /* Process as many complete blocks as we can */ + SHA256_Transform(context, (sha2_word32*)data); + context->bitcount += SHA256_BLOCK_LENGTH << 3; + len -= SHA256_BLOCK_LENGTH; + data += SHA256_BLOCK_LENGTH; + } + if (len > 0) { + /* There's left-overs, so save 'em */ + MEMCPY_BCOPY(context->buffer, data, len); + context->bitcount += len << 3; + } + /* Clean up: */ + usedspace = freespace = 0; +} + +void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { + sha2_word32 *d = (sha2_word32*)digest; + unsigned int usedspace; + + /* Sanity check: */ + assert(context != (SHA256_CTX*)0); + + /* If no digest buffer is passed, we don't bother doing this: */ + if (digest != (sha2_byte*)0) { + usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH; +#if BYTE_ORDER == LITTLE_ENDIAN + /* Convert FROM host byte order */ + REVERSE64(context->bitcount,context->bitcount); +#endif + if (usedspace > 0) { + /* Begin padding with a 1 bit: */ + context->buffer[usedspace++] = 0x80; + + if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) { + /* Set-up for the last transform: */ + MEMSET_BZERO(&context->buffer[usedspace], SHA256_SHORT_BLOCK_LENGTH - usedspace); + } else { + if (usedspace < SHA256_BLOCK_LENGTH) { + MEMSET_BZERO(&context->buffer[usedspace], SHA256_BLOCK_LENGTH - usedspace); + } + /* Do second-to-last transform: */ + SHA256_Transform(context, (sha2_word32*)context->buffer); + + /* And set-up for the last transform: */ + MEMSET_BZERO(context->buffer, SHA256_SHORT_BLOCK_LENGTH); + } + } else { + /* Set-up for the last transform: */ + MEMSET_BZERO(context->buffer, SHA256_SHORT_BLOCK_LENGTH); + + /* Begin padding with a 1 bit: */ + *context->buffer = 0x80; + } + /* Set the bit count: */ + *(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount; + + /* Final transform: */ + SHA256_Transform(context, (sha2_word32*)context->buffer); + +#if BYTE_ORDER == LITTLE_ENDIAN + { + /* Convert TO host byte order */ + int j; + for (j = 0; j < 8; j++) { + REVERSE32(context->state[j],context->state[j]); + *d++ = context->state[j]; + } + } +#else + MEMCPY_BCOPY(d, context->state, SHA256_DIGEST_LENGTH); +#endif + } + + /* Clean up state data: */ + MEMSET_BZERO(context, sizeof(SHA256_CTX)); + usedspace = 0; +} + +char *SHA256_End(SHA256_CTX* context, char buffer[]) { + sha2_byte digest[SHA256_DIGEST_LENGTH], *d = digest; + int i; + + /* Sanity check: */ + assert(context != (SHA256_CTX*)0); + + if (buffer != (char*)0) { + SHA256_Final(digest, context); + + for (i = 0; i < SHA256_DIGEST_LENGTH; i++) { + *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; + *buffer++ = sha2_hex_digits[*d & 0x0f]; + d++; + } + *buffer = (char)0; + } else { + MEMSET_BZERO(context, sizeof(SHA256_CTX)); + } + MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH); + return buffer; +} + +char* SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIGEST_STRING_LENGTH]) { + SHA256_CTX context; + + SHA256_Init(&context); + SHA256_Update(&context, data, len); + return SHA256_End(&context, digest); +} + + +/*** SHA-512: *********************************************************/ +void SHA512_Init(SHA512_CTX* context) { + if (context == (SHA512_CTX*)0) { + return; + } + MEMCPY_BCOPY(context->state, sha512_initial_hash_value, SHA512_DIGEST_LENGTH); + MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH); + context->bitcount[0] = context->bitcount[1] = 0; +} + +#ifdef SHA2_UNROLL_TRANSFORM + +/* Unrolled SHA-512 round macros: */ +#if BYTE_ORDER == LITTLE_ENDIAN + +#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ + REVERSE64(*data++, W512[j]); \ + T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \ + K512[j] + W512[j]; \ + (d) += T1, \ + (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)), \ + j++ + + +#else /* BYTE_ORDER == LITTLE_ENDIAN */ + +#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ + T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \ + K512[j] + (W512[j] = *data++); \ + (d) += T1; \ + (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ + j++ + +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + +#define ROUND512(a,b,c,d,e,f,g,h) \ + s0 = W512[(j+1)&0x0f]; \ + s0 = sigma0_512(s0); \ + s1 = W512[(j+14)&0x0f]; \ + s1 = sigma1_512(s1); \ + T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + K512[j] + \ + (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); \ + (d) += T1; \ + (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ + j++ + +void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { + sha2_word64 a, b, c, d, e, f, g, h, s0, s1; + sha2_word64 T1, *W512 = (sha2_word64*)context->buffer; + int j; + + /* Initialize registers with the prev. intermediate value */ + a = context->state[0]; + b = context->state[1]; + c = context->state[2]; + d = context->state[3]; + e = context->state[4]; + f = context->state[5]; + g = context->state[6]; + h = context->state[7]; + + j = 0; + do { + ROUND512_0_TO_15(a,b,c,d,e,f,g,h); + ROUND512_0_TO_15(h,a,b,c,d,e,f,g); + ROUND512_0_TO_15(g,h,a,b,c,d,e,f); + ROUND512_0_TO_15(f,g,h,a,b,c,d,e); + ROUND512_0_TO_15(e,f,g,h,a,b,c,d); + ROUND512_0_TO_15(d,e,f,g,h,a,b,c); + ROUND512_0_TO_15(c,d,e,f,g,h,a,b); + ROUND512_0_TO_15(b,c,d,e,f,g,h,a); + } while (j < 16); + + /* Now for the remaining rounds up to 79: */ + do { + ROUND512(a,b,c,d,e,f,g,h); + ROUND512(h,a,b,c,d,e,f,g); + ROUND512(g,h,a,b,c,d,e,f); + ROUND512(f,g,h,a,b,c,d,e); + ROUND512(e,f,g,h,a,b,c,d); + ROUND512(d,e,f,g,h,a,b,c); + ROUND512(c,d,e,f,g,h,a,b); + ROUND512(b,c,d,e,f,g,h,a); + } while (j < 80); + + /* Compute the current intermediate hash value */ + context->state[0] += a; + context->state[1] += b; + context->state[2] += c; + context->state[3] += d; + context->state[4] += e; + context->state[5] += f; + context->state[6] += g; + context->state[7] += h; + + /* Clean up */ + a = b = c = d = e = f = g = h = T1 = 0; +} + +#else /* SHA2_UNROLL_TRANSFORM */ + +void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { + sha2_word64 a, b, c, d, e, f, g, h, s0, s1; + sha2_word64 T1, T2, *W512 = (sha2_word64*)context->buffer; + int j; + + /* Initialize registers with the prev. intermediate value */ + a = context->state[0]; + b = context->state[1]; + c = context->state[2]; + d = context->state[3]; + e = context->state[4]; + f = context->state[5]; + g = context->state[6]; + h = context->state[7]; + + j = 0; + do { +#if BYTE_ORDER == LITTLE_ENDIAN + /* Convert TO host byte order */ + REVERSE64(*data++, W512[j]); + /* Apply the SHA-512 compression function to update a..h */ + T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j]; +#else /* BYTE_ORDER == LITTLE_ENDIAN */ + /* Apply the SHA-512 compression function to update a..h with copy */ + T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + (W512[j] = *data++); +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + T2 = Sigma0_512(a) + Maj(a, b, c); + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + + j++; + } while (j < 16); + + do { + /* Part of the message block expansion: */ + s0 = W512[(j+1)&0x0f]; + s0 = sigma0_512(s0); + s1 = W512[(j+14)&0x0f]; + s1 = sigma1_512(s1); + + /* Apply the SHA-512 compression function to update a..h */ + T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + + (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); + T2 = Sigma0_512(a) + Maj(a, b, c); + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + + j++; + } while (j < 80); + + /* Compute the current intermediate hash value */ + context->state[0] += a; + context->state[1] += b; + context->state[2] += c; + context->state[3] += d; + context->state[4] += e; + context->state[5] += f; + context->state[6] += g; + context->state[7] += h; + + /* Clean up */ + a = b = c = d = e = f = g = h = T1 = T2 = 0; +} + +#endif /* SHA2_UNROLL_TRANSFORM */ + +void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { + unsigned int freespace, usedspace; + + if (len == 0) { + /* Calling with no data is valid - we do nothing */ + return; + } + + /* Sanity check: */ + assert(context != (SHA512_CTX*)0 && data != (sha2_byte*)0); + + usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH; + if (usedspace > 0) { + /* Calculate how much free space is available in the buffer */ + freespace = SHA512_BLOCK_LENGTH - usedspace; + + if (len >= freespace) { + /* Fill the buffer completely and process it */ + MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace); + ADDINC128(context->bitcount, freespace << 3); + len -= freespace; + data += freespace; + SHA512_Transform(context, (sha2_word64*)context->buffer); + } else { + /* The buffer is not yet full */ + MEMCPY_BCOPY(&context->buffer[usedspace], data, len); + ADDINC128(context->bitcount, len << 3); + /* Clean up: */ + usedspace = freespace = 0; + return; + } + } + while (len >= SHA512_BLOCK_LENGTH) { + /* Process as many complete blocks as we can */ + SHA512_Transform(context, (sha2_word64*)data); + ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3); + len -= SHA512_BLOCK_LENGTH; + data += SHA512_BLOCK_LENGTH; + } + if (len > 0) { + /* There's left-overs, so save 'em */ + MEMCPY_BCOPY(context->buffer, data, len); + ADDINC128(context->bitcount, len << 3); + } + /* Clean up: */ + usedspace = freespace = 0; +} + +void SHA512_Last(SHA512_CTX* context) { + unsigned int usedspace; + + usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH; +#if BYTE_ORDER == LITTLE_ENDIAN + /* Convert FROM host byte order */ + REVERSE64(context->bitcount[0],context->bitcount[0]); + REVERSE64(context->bitcount[1],context->bitcount[1]); +#endif + if (usedspace > 0) { + /* Begin padding with a 1 bit: */ + context->buffer[usedspace++] = 0x80; + + if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) { + /* Set-up for the last transform: */ + MEMSET_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH - usedspace); + } else { + if (usedspace < SHA512_BLOCK_LENGTH) { + MEMSET_BZERO(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace); + } + /* Do second-to-last transform: */ + SHA512_Transform(context, (sha2_word64*)context->buffer); + + /* And set-up for the last transform: */ + MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH - 2); + } + } else { + /* Prepare for final transform: */ + MEMSET_BZERO(context->buffer, SHA512_SHORT_BLOCK_LENGTH); + + /* Begin padding with a 1 bit: */ + *context->buffer = 0x80; + } + /* Store the length of input data (in bits): */ + *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1]; + *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0]; + + /* Final transform: */ + SHA512_Transform(context, (sha2_word64*)context->buffer); +} + +void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { + sha2_word64 *d = (sha2_word64*)digest; + + /* Sanity check: */ + assert(context != (SHA512_CTX*)0); + + /* If no digest buffer is passed, we don't bother doing this: */ + if (digest != (sha2_byte*)0) { + SHA512_Last(context); + + /* Save the hash data for output: */ +#if BYTE_ORDER == LITTLE_ENDIAN + { + /* Convert TO host byte order */ + int j; + for (j = 0; j < 8; j++) { + REVERSE64(context->state[j],context->state[j]); + *d++ = context->state[j]; + } + } +#else + MEMCPY_BCOPY(d, context->state, SHA512_DIGEST_LENGTH); +#endif + } + + /* Zero out state data */ + MEMSET_BZERO(context, sizeof(SHA512_CTX)); +} + +char *SHA512_End(SHA512_CTX* context, char buffer[]) { + sha2_byte digest[SHA512_DIGEST_LENGTH], *d = digest; + int i; + + /* Sanity check: */ + assert(context != (SHA512_CTX*)0); + + if (buffer != (char*)0) { + SHA512_Final(digest, context); + + for (i = 0; i < SHA512_DIGEST_LENGTH; i++) { + *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; + *buffer++ = sha2_hex_digits[*d & 0x0f]; + d++; + } + *buffer = (char)0; + } else { + MEMSET_BZERO(context, sizeof(SHA512_CTX)); + } + MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH); + return buffer; +} + +char* SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA512_DIGEST_STRING_LENGTH]) { + SHA512_CTX context; + + SHA512_Init(&context); + SHA512_Update(&context, data, len); + return SHA512_End(&context, digest); +} + + +/*** SHA-384: *********************************************************/ +void SHA384_Init(SHA384_CTX* context) { + if (context == (SHA384_CTX*)0) { + return; + } + MEMCPY_BCOPY(context->state, sha384_initial_hash_value, SHA512_DIGEST_LENGTH); + MEMSET_BZERO(context->buffer, SHA384_BLOCK_LENGTH); + context->bitcount[0] = context->bitcount[1] = 0; +} + +void SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) { + SHA512_Update((SHA512_CTX*)context, data, len); +} + +void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { + sha2_word64 *d = (sha2_word64*)digest; + + /* Sanity check: */ + assert(context != (SHA384_CTX*)0); + + /* If no digest buffer is passed, we don't bother doing this: */ + if (digest != (sha2_byte*)0) { + SHA512_Last((SHA512_CTX*)context); + + /* Save the hash data for output: */ +#if BYTE_ORDER == LITTLE_ENDIAN + { + /* Convert TO host byte order */ + int j; + for (j = 0; j < 6; j++) { + REVERSE64(context->state[j],context->state[j]); + *d++ = context->state[j]; + } + } +#else + MEMCPY_BCOPY(d, context->state, SHA384_DIGEST_LENGTH); +#endif + } + + /* Zero out state data */ + MEMSET_BZERO(context, sizeof(SHA384_CTX)); +} + +char *SHA384_End(SHA384_CTX* context, char buffer[]) { + sha2_byte digest[SHA384_DIGEST_LENGTH], *d = digest; + int i; + + /* Sanity check: */ + assert(context != (SHA384_CTX*)0); + + if (buffer != (char*)0) { + SHA384_Final(digest, context); + + for (i = 0; i < SHA384_DIGEST_LENGTH; i++) { + *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; + *buffer++ = sha2_hex_digits[*d & 0x0f]; + d++; + } + *buffer = (char)0; + } else { + MEMSET_BZERO(context, sizeof(SHA384_CTX)); + } + MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH); + return buffer; +} + +char* SHA384_Data(const sha2_byte* data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH]) { + SHA384_CTX context; + + SHA384_Init(&context); + SHA384_Update(&context, data, len); + return SHA384_End(&context, digest); +} + diff --git a/libUseful-2.0/sha2.h b/libUseful-2.0/sha2.h new file mode 100644 index 0000000..bf759ad --- /dev/null +++ b/libUseful-2.0/sha2.h @@ -0,0 +1,197 @@ +/* + * FILE: sha2.h + * AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/ + * + * Copyright (c) 2000-2001, Aaron D. Gifford + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: sha2.h,v 1.1 2001/11/08 00:02:01 adg Exp adg $ + */ + +#ifndef __SHA2_H__ +#define __SHA2_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * Import u_intXX_t size_t type definitions from system headers. You + * may need to change this, or define these things yourself in this + * file. + */ +#include + +#ifdef SHA2_USE_INTTYPES_H + +#include + +#endif /* SHA2_USE_INTTYPES_H */ + + +/*** SHA-256/384/512 Various Length Definitions ***********************/ +#define SHA256_BLOCK_LENGTH 64 +#define SHA256_DIGEST_LENGTH 32 +#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) +#define SHA384_BLOCK_LENGTH 128 +#define SHA384_DIGEST_LENGTH 48 +#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1) +#define SHA512_BLOCK_LENGTH 128 +#define SHA512_DIGEST_LENGTH 64 +#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) + + +/*** SHA-256/384/512 Context Structures *******************************/ +/* NOTE: If your architecture does not define either u_intXX_t types or + * uintXX_t (from inttypes.h), you may need to define things by hand + * for your system: + */ +#if 0 +typedef unsigned char u_int8_t; /* 1-byte (8-bits) */ +typedef unsigned int u_int32_t; /* 4-bytes (32-bits) */ +typedef unsigned long long u_int64_t; /* 8-bytes (64-bits) */ +#endif +/* + * Most BSD systems already define u_intXX_t types, as does Linux. + * Some systems, however, like Compaq's Tru64 Unix instead can use + * uintXX_t types defined by very recent ANSI C standards and included + * in the file: + * + * #include + * + * If you choose to use then please define: + * + * #define SHA2_USE_INTTYPES_H + * + * Or on the command line during compile: + * + * cc -DSHA2_USE_INTTYPES_H ... + */ +#ifdef SHA2_USE_INTTYPES_H + +typedef struct _SHA256_CTX { + uint32_t state[8]; + uint64_t bitcount; + uint8_t buffer[SHA256_BLOCK_LENGTH]; +} SHA256_CTX; +typedef struct _SHA512_CTX { + uint64_t state[8]; + uint64_t bitcount[2]; + uint8_t buffer[SHA512_BLOCK_LENGTH]; +} SHA512_CTX; + +#else /* SHA2_USE_INTTYPES_H */ + +typedef struct _SHA256_CTX { + u_int32_t state[8]; + u_int64_t bitcount; + u_int8_t buffer[SHA256_BLOCK_LENGTH]; +} SHA256_CTX; +typedef struct _SHA512_CTX { + u_int64_t state[8]; + u_int64_t bitcount[2]; + u_int8_t buffer[SHA512_BLOCK_LENGTH]; +} SHA512_CTX; + +#endif /* SHA2_USE_INTTYPES_H */ + +typedef SHA512_CTX SHA384_CTX; + + +/*** SHA-256/384/512 Function Prototypes ******************************/ +#ifndef NOPROTO +#ifdef SHA2_USE_INTTYPES_H + +void SHA256_Init(SHA256_CTX *); +void SHA256_Update(SHA256_CTX*, const uint8_t*, size_t); +void SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*); +char* SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]); +char* SHA256_Data(const uint8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]); + +void SHA384_Init(SHA384_CTX*); +void SHA384_Update(SHA384_CTX*, const uint8_t*, size_t); +void SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*); +char* SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]); +char* SHA384_Data(const uint8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]); + +void SHA512_Init(SHA512_CTX*); +void SHA512_Update(SHA512_CTX*, const uint8_t*, size_t); +void SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); +char* SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]); +char* SHA512_Data(const uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]); + +#else /* SHA2_USE_INTTYPES_H */ + +void SHA256_Init(SHA256_CTX *); +void SHA256_Update(SHA256_CTX*, const u_int8_t*, size_t); +void SHA256_Final(u_int8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*); +char* SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]); +char* SHA256_Data(const u_int8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]); + +void SHA384_Init(SHA384_CTX*); +void SHA384_Update(SHA384_CTX*, const u_int8_t*, size_t); +void SHA384_Final(u_int8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*); +char* SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]); +char* SHA384_Data(const u_int8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]); + +void SHA512_Init(SHA512_CTX*); +void SHA512_Update(SHA512_CTX*, const u_int8_t*, size_t); +void SHA512_Final(u_int8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); +char* SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]); +char* SHA512_Data(const u_int8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]); + +#endif /* SHA2_USE_INTTYPES_H */ + +#else /* NOPROTO */ + +void SHA256_Init(); +void SHA256_Update(); +void SHA256_Final(); +char* SHA256_End(); +char* SHA256_Data(); + +void SHA384_Init(); +void SHA384_Update(); +void SHA384_Final(); +char* SHA384_End(); +char* SHA384_Data(); + +void SHA512_Init(); +void SHA512_Update(); +void SHA512_Final(); +char* SHA512_End(); +char* SHA512_Data(); + +#endif /* NOPROTO */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __SHA2_H__ */ + diff --git a/libUseful-2.0/socket.c b/libUseful-2.0/socket.c new file mode 100644 index 0000000..f2c6090 --- /dev/null +++ b/libUseful-2.0/socket.c @@ -0,0 +1,867 @@ +#include "includes.h" + +#include + +#ifdef HAVE_LIBSSL +#include +#include +#include +#include +#include + +#endif + +#include "ConnectionChain.h" + + +int IsSockConnected(int sock) +{ +struct sockaddr_in sa; +int salen, result; + +if (sock==-1) return(FALSE); +salen=sizeof(sa); +result=getpeername(sock,(struct sockaddr *) &sa, &salen); +if (result==0) return(TRUE); +if (errno==ENOTCONN) return(SOCK_CONNECTING); +return(FALSE); +} + + +int InitServerSock(char *Address, int Port) +{ +int sock; +struct sockaddr_in sa; +int salen; +int result; + +sock=socket(AF_INET,SOCK_STREAM,0); +if (sock <0) return(-1); + +result=1; +salen=sizeof(result); +setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,&result,salen); + +sa.sin_port=htons(Port); +sa.sin_family=AF_INET; +if (StrLen(Address) > 0) sa.sin_addr.s_addr=StrtoIP(Address); +else sa.sin_addr.s_addr=INADDR_ANY; + +salen=sizeof(struct sockaddr_in); +result=bind(sock,(struct sockaddr *) &sa, salen); + +if (result==0) +{ + result=listen(sock,10); +} + +if (result==0) return(sock); +else +{ +close(sock); +return(-1); +} +} + + + +int InitUnixServerSock(char *Path) +{ +int sock; +struct sockaddr_un sa; +int salen; +int result; + +sock=socket(AF_UNIX,SOCK_STREAM,0); +if (sock <0) return(-1); +result=1; +salen=sizeof(result); +strcpy(sa.sun_path,Path); +sa.sun_family=AF_UNIX; +salen=sizeof(struct sockaddr_un); +result=bind(sock,(struct sockaddr *) &sa, salen); + +if (result==0) +{ + result=listen(sock,10); +} + +if (result==0) return(sock); +else +{ +close(sock); +return(-1); +} +} + + +int TCPServerSockAccept(int ServerSock, int *Addr) +{ +struct sockaddr_in sa; +int salen; +int sock; + +salen=sizeof(sa); +sock=accept(ServerSock,(struct sockaddr *) &sa,&salen); +if (Addr) *Addr=sa.sin_addr.s_addr; +return(sock); +} + +int UnixServerSockAccept(int ServerSock) +{ +struct sockaddr_un sa; +int salen; +int sock; + +salen=sizeof(sa); +sock=accept(ServerSock,(struct sockaddr *) &sa,&salen); +return(sock); +} + + + + + +int IsAddress(char *Str) +{ +int len,count; +len=StrLen(Str); +if (len <1) return(FALSE); +for (count=0; count < len; count++) +{ + if ((! isdigit(Str[count])) && (Str[count] !='.')) + { + return(FALSE); + } +} + +return(TRUE); +} + + +int GetSockDetails(int sock, char **LocalAddress, int *LocalPort, char **RemoteAddress, int *RemotePort) +{ +int salen, result; +struct sockaddr_in sa; + +*LocalPort=0; +*RemotePort=0; +*LocalAddress=CopyStr(*LocalAddress,""); +*RemoteAddress=CopyStr(*RemoteAddress,""); + +salen=sizeof(struct sockaddr_in); +result=getsockname(sock, (struct sockaddr *) &sa, &salen); + +if (result==0) +{ + *LocalAddress=CopyStr(*LocalAddress,IPtoStr(sa.sin_addr.s_addr)); + *LocalPort=ntohs(sa.sin_port); + + //Set Address to be the same as control sock, as it might not be INADDR_ANY + result=getpeername(sock, (struct sockaddr *) &sa, &salen); + + if (result==0) + { + *RemoteAddress=CopyStr(*RemoteAddress,IPtoStr(sa.sin_addr.s_addr)); + *RemotePort=sa.sin_port; + } + + //We've got the local sock, so lets still call it a success + result=0; +} + +if (result==0) return(TRUE); +return(FALSE); +} + + + + + + +/* Users will probably only use this function if they want to reconnect */ +/* a broken connection, or reuse a socket for multiple connections, hence */ +/* the name... */ +int ReconnectSock(int sock, char *Host, int Port, int Flags) +{ +int salen, result; +struct sockaddr_in sa; +struct hostent *hostdata; + +sa.sin_family=AF_INET; +sa.sin_port=htons(Port); + +if (IsAddress(Host)) +{ +inet_aton(Host, (struct in_addr *) &sa.sin_addr); +} +else +{ + hostdata=gethostbyname(Host); + if (!hostdata) + { + return(-1); + } +sa.sin_addr=*(struct in_addr *) *hostdata->h_addr_list; +} + +salen=sizeof(sa); +if (Flags & CONNECT_NONBLOCK) +{ +fcntl(sock,F_SETFL,O_NONBLOCK); +} + +result=connect(sock,(struct sockaddr *)&sa, salen); +if (result==0) result=TRUE; + +if ((result==-1) && (Flags & CONNECT_NONBLOCK) && (errno == EINPROGRESS)) result=FALSE; +return(result); +} + + +int ConnectToHost(char *Host, int Port,int Flags) +{ +int sock, result; + +sock=socket(AF_INET,SOCK_STREAM,0); +if (sock <0) return(-1); +result=ReconnectSock(sock,Host,Port,Flags); +if (result==-1) +{ +close(sock); +return(-1); +} + +return(sock); + +} + + + + +int CheckForTerm(DownloadContext *CTX, char inchar) +{ + + if (inchar == CTX->TermStr[CTX->TermPos]) + { + CTX->TermPos++; + if (CTX->TermPos >=strlen(CTX->TermStr)) + { + CTX->TermPos=0; + return(TRUE); + } + } + else + { + if (CTX->TermPos >0) + { + STREAMWriteBytes(CTX->Output, CTX->TermStr,CTX->TermPos); + CTX->TermPos=0; + return(CheckForTerm(CTX,inchar)); + } + } +return(FALSE); +} + + + +int ProcessIncommingBytes(DownloadContext *CTX) +{ +int inchar, FoundTerm=FALSE, err; + + inchar=STREAMReadChar(CTX->Input); + + if (inchar==EOF) return(TRUE); + + FoundTerm=CheckForTerm(CTX,(char) inchar); + while ((inchar !=EOF) && (! FoundTerm)) + { + if (CTX->TermPos==0) STREAMWriteChar(CTX->Output, (char) inchar); + inchar=STREAMReadChar(CTX->Input); + err=errno; + FoundTerm=CheckForTerm(CTX, (char) inchar); + } +if (inchar==EOF) return(TRUE); +if (FoundTerm) return(TRUE); +return(FALSE); +} + + +int DownloadToTermStr2(STREAM *Connection, STREAM *SaveFile, char *TermStr) +{ +DownloadContext CTX; + +CTX.TermStr=CopyStr(NULL,TermStr); +CTX.Input=Connection; +CTX.Output=SaveFile; +CTX.TermPos=0; + +while(ProcessIncommingBytes(&CTX) !=TRUE); + +DestroyString(CTX.TermStr); +return(TRUE); +} + +int DownloadToDot(STREAM *Connection, STREAM *SaveFile) +{ +DownloadToTermStr2(Connection,SaveFile,"\r\n.\r\n"); +} + + +int DownloadToTermStr(STREAM *Connection, STREAM *SaveFile, char *TermStr) +{ +char *Tempstr=NULL; + +Tempstr=STREAMReadLine(Tempstr,Connection); +while (Tempstr) +{ + if (strcmp(Tempstr,TermStr)==0) +{ + break; +} + STREAMWriteLine(Tempstr,SaveFile); + Tempstr=STREAMReadLine(Tempstr,Connection); +} +return(TRUE); +} + +char *LookupHostIP(char *Host) +{ +struct hostent *hostdata; + + hostdata=gethostbyname(Host); + if (!hostdata) + { + return(NULL); + } + +//inet_ntoa shouldn't need this cast to 'char *', but it emitts a warning +//without it +return((char *) inet_ntoa(*(struct in_addr *) *hostdata->h_addr_list)); +} + + +char *GetRemoteIP(int sock) +{ +struct sockaddr_in sa; +int salen, result; + +salen=sizeof(struct sockaddr_in); +result=getpeername(sock,(struct sockaddr *) &sa, &salen); +if (result==-1) +{ +if (errno==ENOTSOCK) return("127.0.0.1"); +else return("0.0.0.0"); +} + +return((char *) inet_ntoa(sa.sin_addr)); +} + + +char *IPStrToHostName(char *IPAddr) +{ +struct sockaddr_in sa; +struct hostent *hostdata=NULL; + +inet_aton(IPAddr,& sa.sin_addr); +hostdata=gethostbyaddr(&sa.sin_addr.s_addr,sizeof((sa.sin_addr.s_addr)),AF_INET); +if (hostdata) return(hostdata->h_name); +else return(""); +} + + + + +char *IPtoStr(unsigned long Address) +{ +struct sockaddr_in sa; +sa.sin_addr.s_addr=Address; +return((char *) inet_ntoa(sa.sin_addr)); + +} + +unsigned long StrtoIP(char *Str) +{ +struct sockaddr_in sa; +if (inet_aton(Str,&sa.sin_addr)) return(sa.sin_addr.s_addr); +return(0); +} + + +int STREAMIsConnected(STREAM *S) +{ +int result=FALSE; + +if (! S) return(FALSE); +result=IsSockConnected(S->in_fd); +if (result==TRUE) +{ + if (S->State & SS_CONNECTING) + { + S->State |= SS_CONNECTED; + S->State &= (~SS_CONNECTING); + } +} +if ((result==SOCK_CONNECTING) && (! (S->State & SS_CONNECTING))) result=FALSE; +return(result); +} + + + +int STREAMDoPostConnect(STREAM *S, int Flags) +{ +int result=FALSE; +char *ptr; +struct timeval tv; + +if (! S) return(FALSE); +if ((S->in_fd > -1) && (S->Timeout > 0) ) +{ + tv.tv_sec=S->Timeout; + tv.tv_usec=0; + if (FDSelect(S->in_fd, SELECT_WRITE, &tv) != SELECT_WRITE) + { + close(S->in_fd); + S->in_fd=-1; + S->out_fd=-1; + } + else if (! (Flags & CONNECT_NONBLOCK)) STREAMSetNonBlock(S, FALSE); +} + +if (S->in_fd > -1) +{ +S->Type=STREAM_TYPE_TCP; +result=TRUE; +STREAMSetFlushType(S,FLUSH_LINE,0); +//if (Flags & CONNECT_SOCKS_PROXY) result=DoSocksProxyTunnel(S); +if (Flags & CONNECT_SSL) DoSSLClientNegotiation(S, Flags); + +ptr=GetRemoteIP(S->in_fd); +if (ptr) STREAMSetValue(S,"PeerIP",ptr); +} + +return(result); +} + + + +int STREAMConnectToHost(STREAM *S, char *DesiredHost, int DesiredPort,int Flags) +{ +ListNode *Curr; +char *Token=NULL, *ptr; +int result=FALSE; +int HopNo=0, val=0; +ListNode *LastHop=NULL; + +S->Path=FormatStr(S->Path,"tcp:%s:%d",DesiredHost,DesiredPort); +//Find the last hop, used to decide what ssh command to use +Curr=ListGetNext(S->Values); +while (Curr) +{ +ptr=GetToken(Curr->Tag,":",&Token,0); +if (strcasecmp(Token,"ConnectHop")==0) LastHop=Curr; +Curr=ListGetNext(Curr); +} + +STREAMSetFlushType(S,FLUSH_LINE,0); +Curr=ListGetNext(S->Values); +while (Curr) +{ +ptr=GetToken(Curr->Tag,":",&Token,0); + +if (strcasecmp(Token,"ConnectHop")==0) result=STREAMProcessConnectHop(S, (char *) Curr->Item,Curr==LastHop); + +HopNo++; +if (! result) break; +Curr=ListGetNext(Curr); +} + +//If we're not handling the connection through 'Connect hops' then +//just connect to host +if ((HopNo==0) && StrLen(DesiredHost)) +{ + if (Flags & CONNECT_NONBLOCK) S->Flags |= SF_NONBLOCK; + val=Flags; + + //STREAMDoPostConnect handles this + if (S->Timeout > 0) val |= CONNECT_NONBLOCK; + + S->in_fd=ConnectToHost(DesiredHost,DesiredPort,val); + + S->out_fd=S->in_fd; + if (S->in_fd > -1) result=TRUE; +} + +if (result==TRUE) +{ + if (Flags & CONNECT_NONBLOCK) + { + S->State |=SS_CONNECTING; + S->Flags |=SF_NONBLOCK; + } + else + { + S->State |=SS_CONNECTED; + result=STREAMDoPostConnect(S, Flags); + } +} + + +return(result); +} + + + + +#ifdef HAVE_LIBSSL +void STREAM_INTERNAL_SSL_ADD_SECURE_KEYS(STREAM *S, SSL_CTX *ctx) +{ +ListNode *Curr; +char *VerifyFile=NULL, *VerifyPath=NULL; + +Curr=ListGetNext(LibUsefulValuesGetHead()); +while (Curr) +{ + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_CERT_FILE:",14)==0)) + { + SSL_CTX_use_certificate_chain_file(ctx,(char *) Curr->Item); + } + + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_KEY_FILE:",13)==0)) + { + SSL_CTX_use_PrivateKey_file(ctx,(char *) Curr->Item,SSL_FILETYPE_PEM); + } + + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_VERIFY_CERTDIR",18)==0)) + { + VerifyPath=CopyStr(VerifyPath,(char *) Curr->Item); + } + + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_VERIFY_CERTFILE",19)==0)) + { + VerifyFile=CopyStr(VerifyFile,(char *) Curr->Item); + } + + Curr=ListGetNext(Curr); +} + + + +Curr=ListGetNext(S->Values); +while (Curr) +{ + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_CERT_FILE:",14)==0)) + { + SSL_CTX_use_certificate_chain_file(ctx,(char *) Curr->Item); + } + + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_KEY_FILE:",13)==0)) + { + SSL_CTX_use_PrivateKey_file(ctx,(char *) Curr->Item,SSL_FILETYPE_PEM); + } + + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_VERIFY_CERTDIR",18)==0)) + { + VerifyPath=CopyStr(VerifyPath,(char *) Curr->Item); + } + + if ((StrLen(Curr->Tag)) && (strncasecmp(Curr->Tag,"SSL_VERIFY_CERTFILE",19)==0)) + { + VerifyFile=CopyStr(VerifyFile,(char *) Curr->Item); + } + + + Curr=ListGetNext(Curr); +} + + +SSL_CTX_load_verify_locations(ctx,VerifyFile,VerifyPath); + +DestroyString(VerifyFile); +DestroyString(VerifyPath); + +} +#endif + + +void HandleSSLError() +{ +int val; + +#ifdef HAVE_LIBSSL + val=ERR_get_error(); + fprintf(stderr,"Failed to create SSL_CTX: %s\n",ERR_error_string(val,NULL)); + fflush(NULL); +#endif +} + + +int INTERNAL_SSL_INIT() +{ +static int InitDone=FALSE; + +#ifdef HAVE_LIBSSL +if (InitDone) return(TRUE); + SSL_library_init(); +#ifdef USE_OPENSSL_ADD_ALL_ALGORITHMS + OpenSSL_add_all_algorithms(); +#endif + SSL_load_error_strings(); + + InitDone=TRUE; + return(TRUE); +#endif + +return(FALSE); +} + + +int SSLAvailable() +{ + return(INTERNAL_SSL_INIT()); +} + + + +int DoSSLClientNegotiation(STREAM *S, int Flags) +{ +int result=FALSE, val; +#ifdef HAVE_LIBSSL +SSL_METHOD *Method; +SSL_CTX *ctx; +SSL *ssl; +//struct x509 *cert=NULL; +X509 *cert=NULL; + +if (S) +{ +INTERNAL_SSL_INIT(); +// SSL_load_ciphers(); + Method=SSLv23_client_method(); + if (! Method) Method=SSLv2_client_method(); + ctx=SSL_CTX_new(Method); + if (! ctx) HandleSSLError(); + else + { + STREAM_INTERNAL_SSL_ADD_SECURE_KEYS(S,ctx); + ssl=SSL_new(ctx); + SSL_set_fd(ssl,S->in_fd); + STREAMSetItem(S,"LIBUSEFUL-SSL-CTX",ssl); + result=SSL_connect(ssl); + S->Flags|=SF_SSL; + + val=SSL_get_verify_result(ssl); + + switch(val) + { + case X509_V_OK: STREAMSetValue(S,"SSL-Certificate-Verify","OK"); break; + case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: STREAMSetValue(S,"SSL-Certificate-Verify","unable to get issuer"); break; + case X509_V_ERR_UNABLE_TO_GET_CRL: STREAMSetValue(S,"SSL-Certificate-Verify","unable to get certificate CRL"); break; + case X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: STREAMSetValue(S,"SSL-Certificate-Verify","unable to decrypt certificate's signature"); break; + case X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: STREAMSetValue(S,"SSL-Certificate-Verify","unable to decrypt CRL's signature"); break; + case X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: STREAMSetValue(S,"SSL-Certificate-Verify","unable to decode issuer public key"); break; + case X509_V_ERR_CERT_SIGNATURE_FAILURE: STREAMSetValue(S,"SSL-Certificate-Verify","certificate signature invalid"); break; + case X509_V_ERR_CRL_SIGNATURE_FAILURE: STREAMSetValue(S,"SSL-Certificate-Verify","CRL signature invalid"); break; + case X509_V_ERR_CERT_NOT_YET_VALID: STREAMSetValue(S,"SSL-Certificate-Verify","certificate is not yet valid"); break; + case X509_V_ERR_CERT_HAS_EXPIRED: STREAMSetValue(S,"SSL-Certificate-Verify","certificate has expired"); break; + case X509_V_ERR_CRL_NOT_YET_VALID: STREAMSetValue(S,"SSL-Certificate-Verify","CRL is not yet valid the CRL is not yet valid."); break; + case X509_V_ERR_CRL_HAS_EXPIRED: STREAMSetValue(S,"SSL-Certificate-Verify","CRL has expired the CRL has expired."); break; + case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: STREAMSetValue(S,"SSL-Certificate-Verify","invalid notBefore value"); break; + case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: STREAMSetValue(S,"SSL-Certificate-Verify","invalid notAfter value"); break; + case X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: STREAMSetValue(S,"SSL-Certificate-Verify","invalid CRL lastUpdate value"); break; + case X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: STREAMSetValue(S,"SSL-Certificate-Verify","invalid CRL nextUpdate value"); break; + case X509_V_ERR_OUT_OF_MEM: STREAMSetValue(S,"SSL-Certificate-Verify","out of memory"); break; + case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: STREAMSetValue(S,"SSL-Certificate-Verify","self signed certificate"); break; + case X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: STREAMSetValue(S,"SSL-Certificate-Verify","self signed certificate in certificate chain"); break; + case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: STREAMSetValue(S,"SSL-Certificate-Verify","cant find root certificate in local database"); break; + case X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: STREAMSetValue(S,"SSL-Certificate-Verify","ERROR: unable to verify the first certificate"); break; + case X509_V_ERR_CERT_CHAIN_TOO_LONG: STREAMSetValue(S,"SSL-Certificate-Verify","certificate chain too long"); break; + case X509_V_ERR_CERT_REVOKED: STREAMSetValue(S,"SSL-Certificate-Verify","certificate revoked"); break; + case X509_V_ERR_INVALID_CA: STREAMSetValue(S,"SSL-Certificate-Verify","invalid CA certificate"); break; + case X509_V_ERR_PATH_LENGTH_EXCEEDED: STREAMSetValue(S,"SSL-Certificate-Verify","path length constraint exceeded"); break; + case X509_V_ERR_INVALID_PURPOSE: STREAMSetValue(S,"SSL-Certificate-Verify","unsupported certificate purpose"); break; + case X509_V_ERR_CERT_UNTRUSTED: STREAMSetValue(S,"SSL-Certificate-Verify","certificate not trusted"); break; + case X509_V_ERR_CERT_REJECTED: STREAMSetValue(S,"SSL-Certificate-Verify","certificate rejected"); break; + case X509_V_ERR_SUBJECT_ISSUER_MISMATCH: STREAMSetValue(S,"SSL-Certificate-Verify","subject issuer mismatch"); break; + case X509_V_ERR_AKID_SKID_MISMATCH: STREAMSetValue(S,"SSL-Certificate-Verify","authority and subject key identifier mismatch"); break; + case X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: STREAMSetValue(S,"SSL-Certificate-Verify","authority and issuer serial number mismatch"); break; + case X509_V_ERR_KEYUSAGE_NO_CERTSIGN: STREAMSetValue(S,"SSL-Certificate-Verify","key usage does not include certificate signing"); break; + case X509_V_ERR_APPLICATION_VERIFICATION: STREAMSetValue(S,"SSL-Certificate-Verify","application verification failure"); break; + } + } + +cert=SSL_get_peer_certificate(ssl); +if (cert) +{ + STREAMSetValue(S,"SSL-Certificate-Issuer",X509_NAME_oneline( X509_get_issuer_name(cert),NULL, 0)); +} +} + +STREAMSetValue(S,"SSL-Cipher",STREAMQuerySSLCipher(S)); + +#endif +return(result); +} + + +int DoSSLServerNegotiation(STREAM *S, int Flags) +{ +int result=FALSE; +#ifdef HAVE_LIBSSL +SSL_METHOD *Method; +SSL_CTX *ctx; +SSL *ssl; + + +if (S) +{ +INTERNAL_SSL_INIT(); + Method=SSLv23_server_method(); + if (! Method) Method=SSLv2_server_method(); + if (Method) + { + ctx=SSL_CTX_new(Method); + + if (ctx) + { + STREAM_INTERNAL_SSL_ADD_SECURE_KEYS(S,ctx); + ssl=SSL_new(ctx); + SSL_set_fd(ssl,S->in_fd); + STREAMSetItem(S,"LIBUSEFUL-SSL-CTX",ssl); + SSL_set_verify(ssl,SSL_VERIFY_NONE,NULL); + SSL_set_accept_state(ssl); + result=SSL_accept(ssl); + if (result != TRUE) + { + result=SSL_get_error(ssl,result); + result=ERR_get_error(); + fprintf(stderr,"error: %s\n",ERR_error_string(result,NULL)); + result=FALSE; + } + S->Flags|=SF_SSL; + } + } +} + +#endif +return(result); +} + + +const char *STREAMQuerySSLCipher(STREAM *S) +{ +void *ptr; + +if (! S) return(NULL); +ptr=STREAMGetItem(S,"LIBUSEFUL-SSL-CTX"); +if (! ptr) return(NULL); + +#ifdef HAVE_LIBSSL + +return(SSL_get_cipher((SSL *) ptr)); +#else +return(NULL); +#endif +} + + +int STREAMIsPeerAuth(STREAM *S) +{ +void *ptr; + +#ifdef HAVE_LIBSSL +ptr=STREAMGetItem(S,"LIBUSEFUL-SSL-CTX"); +if (! ptr) return(FALSE); + +if (SSL_get_verify_result((SSL *) ptr)==X509_V_OK) +{ + if (SSL_get_peer_certificate((SSL *) ptr) !=NULL) return(TRUE); +} +#endif +return(FALSE); +} + + + +int OpenUDPSock(int Port) +{ + int result; + struct sockaddr_in addr; + int fd; + + addr.sin_family=AF_INET; +// addr.sin_addr.s_addr=Interface; + addr.sin_addr.s_addr=INADDR_ANY; + addr.sin_port=htons(Port); + + fd=socket(AF_INET, SOCK_DGRAM,0); + result=bind(fd,(struct sockaddr *) &addr, sizeof(addr)); + if (result !=0) + { + close(fd); + return(-1); + } + return(fd); +} + + +int STREAMSendDgram(STREAM *S, char *Host, int Port, char *Bytes, int len) +{ +struct sockaddr_in sa; +int salen; +struct hostent *hostdata; + +sa.sin_port=htons(Port); +sa.sin_family=AF_INET; +inet_aton(Host,& sa.sin_addr); +salen=sizeof(sa); + +if (IsAddress(Host)) +{ + inet_aton(Host, (struct in_addr *) &sa.sin_addr); +} +else +{ + hostdata=gethostbyname(Host); + if (!hostdata) + { + return(-1); + } +sa.sin_addr=*(struct in_addr *) *hostdata->h_addr_list; +} + + +return(sendto(S->out_fd,Bytes,len,0,(struct sockaddr *) &sa,salen)); +} + + + +STREAM *STREAMOpenUDP(int Port,int NonBlock) +{ +int fd; +STREAM *Stream; + +fd=OpenUDPSock(Port); +if (fd <0) return(NULL); +Stream=STREAMFromFD(fd); +Stream->Path=FormatStr(Stream->Path,"udp::%d",Port); +Stream->Type=STREAM_TYPE_UDP; +return(Stream); +} + + + +/* This is a simple function to decide if a string is an IP address as */ +/* opposed to a host/domain name. */ + +int IsIPAddress(char *Str) +{ +int len,count; +len=strlen(Str); +if (len <1) return(FALSE); +for (count=0; count < len; count++) + if ((! isdigit(Str[count])) && (Str[count] !='.')) return(FALSE); + return(TRUE); +} + + diff --git a/libUseful-2.0/socket.h b/libUseful-2.0/socket.h new file mode 100644 index 0000000..6d1bfd3 --- /dev/null +++ b/libUseful-2.0/socket.h @@ -0,0 +1,80 @@ +#ifndef LIBUSEFUL_SOCK +#define LIBUSEFUL_SOCK + +#include +#include "file.h" + +#define CONNECT_NONBLOCK 1 +#define CONNECT_SSL 2 +#define CONNECT_HTTP_PROXY 4 +#define CONNECT_SOCKS_PROXY 8 + +#define SOCK_CONNECTED 1 +#define SOCK_CONNECTING -1 + +#ifdef __cplusplus +extern "C" { +#endif + + + +/* Server Socket Funcs*/ +int InitServerSock(char *Address, int Port); +int InitUnixServerSock(char *Path); +int TCPServerSockAccept(int ServerSock,int *Addr); +int UnixServerSockAccept(int ServerSock); + +int GetSockDetails(int fd, char **LocalAddress, int *LocalPort, char **RemoteAddress, int *RemotePort); + +/* Client Socket Funcs*/ +int IsSockConnected(int sock); +int ReconnectSock(int sock, char *Host, int Port, int Flags); +int ConnectToHost(char *Host, int Port, int Flags); +/* int CheckForData(int sock); */ +int SendText(int sock, char *Text); +int ReadText(int sock, char *Buffer, int MaxLen); +int ReadToCR(int fd, char *Buffer, int MaxLen); + + +STREAM *STREAMOpenUDP(int Port,int NonBlock); +int STREAMSendDgram(STREAM *S, char *Host, int Port, char *Bytes, int len); +int STREAMConnectToHost(STREAM *S, char *Host, int Port, int Flags); +int STREAMIsConnected(STREAM *S); +int DoPostConnect(STREAM *S, int Flags); +int DoSSLClientNegotiation(STREAM *S, int Flags); +int DoSSLServerNegotiation(STREAM *S, int Flags); +const char *STREAMQuerySSLCipher(STREAM *S); +int STREAMIsPeerAuth(STREAM *S); + +/* Stuff relating to standard inet download procedure (until \r\n.\r\n) */ +typedef struct +{ +STREAM *Input; +STREAM *Output; +char *TermStr; +int TermPos; +} DownloadContext; + +int ProcessIncommingBytes(DownloadContext *); +//int DownloadToDot(int sock, FILE *SaveFile); +int DownloadToDot(STREAM *Connection, STREAM *SaveFile); +int DownloadToTermStr(STREAM *Connection, STREAM *SaveFile, char *TermStr); +void ParseConnectDetails(char *Str, char **Type, char **Host, char **Port, char **User, char **Pass, char **InitDir); + + +/* IP Address and host lookup functions */ +char *LookupHostIP(char *Host); +char *GetRemoteIP(int sock); +char *IPStrToHostName(char *); +char *IPtoStr(unsigned long); +unsigned long StrtoIP(char *); +int IsIPAddress(char *); + +int SSLAvailable(); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/sound.c b/libUseful-2.0/sound.c new file mode 100644 index 0000000..114c0ee --- /dev/null +++ b/libUseful-2.0/sound.c @@ -0,0 +1,640 @@ +#include +#include +#include "sound.h" +#include "file.h" +#include "string.h" +#include "defines.h" +#include "includes.h" + + +typedef struct +{ +uint32_t DataStart; +uint32_t DataSize; +uint32_t Format; +uint32_t SampleRate; +uint32_t Channels; +} AUHeader; + + + +typedef struct +{ +char RIFF[4]; +uint32_t FileSize; +char Format[4]; +char Block[4]; +uint32_t ChunkSize; +uint16_t AudioFormat; +uint16_t Channels; +uint32_t SampleRate; +uint32_t ByteRate; +uint16_t BlockAlign; +uint16_t BitsPerSample; +char DataHeader[4]; +uint32_t DataSize; +} WAVHeader; + + + +char *VolTypeStrings[]={"master","pcm","cd","mic","line","video","phonein","phoneout","all",NULL}; +typedef enum {VOL_MASTER,VOL_PCM,VOL_CD,VOL_MIC,VOL_LINE1,VOL_VIDEO,VOL_PHONEIN,VOL_PHONEOUT,VOL_ALL} TVOLUME_CHANNELS; + + + +#define SAMPLE_SIGNED 1 + + + +int SoundReformat(char **Out, char *In, int Len, TAudioInfo *AI) +{ +int len, i; + +//Expand mono to both channels +if (AI->Channels==1) +{ + len=Len*2; + *Out=SetStrLen(*Out, Len*2); + for (i=0; i < Len; i++) + { + Out[i*2]=In[i]; + Out[i*2+1]=In[i]; + } +} + + +return(len); +} + + +TAudioInfo *AudioInfoCreate(unsigned int Format, unsigned int Channels, unsigned int SampleRate, unsigned int SampleSize, unsigned int DataSize) +{ +TAudioInfo *AI; + +AI=(TAudioInfo *) calloc(1,sizeof(TAudioInfo)); + +AI->Format=Format; +AI->Channels=Channels; +AI->SampleRate=SampleRate; +AI->SampleSize=SampleSize; +AI->DataSize=DataSize; + +return(AI); +} + + +/* ------------------------ SOUND FILE FORMATS --------------- */ +TAudioInfo *SoundReadWAV(STREAM *S) +{ +WAVHeader Wav; +TAudioInfo *AudioInfo; + + +AudioInfo=(TAudioInfo *) calloc(1,sizeof(TAudioInfo)); + +STREAMReadBytes(S,(char *) &Wav,sizeof(WAVHeader)); + +AudioInfo->Channels=Wav.Channels; +AudioInfo->SampleRate=Wav.SampleRate; + +AudioInfo->DataSize=Wav.DataSize; + +if (Wav.BitsPerSample==16) +{ + AudioInfo->SampleSize=2; + AudioInfo->Format=AFMT_S16_LE; +} +else +{ + AudioInfo->SampleSize=1; + AudioInfo->Format=AFMT_U8; +} + +return(AudioInfo); +} + + +void SoundWriteWAVHeader(STREAM *S, TAudioInfo *AI) +{ + WAVHeader WavHead; + + strcpy(WavHead.RIFF,"RIFF"); + strcpy(WavHead.Format,"WAVE"); + strcpy(WavHead.Block,"fmt "); + WavHead.FileSize=AI->DataSize+44; + WavHead.AudioFormat=1; + WavHead.Channels=AI->Channels; + WavHead.SampleRate=AI->SampleRate; + WavHead.BlockAlign=4; + WavHead.ByteRate=WavHead.SampleRate * WavHead.BlockAlign; + WavHead.BitsPerSample=AI->SampleSize * 8; + WavHead.ChunkSize=WavHead.BitsPerSample; + strcpy(WavHead.DataHeader,"data"); + WavHead.DataSize=AI->DataSize; + + + STREAMWriteBytes(S,(char *) &WavHead,sizeof(WAVHeader)); +} + + + +TAudioInfo *SoundReadAU(STREAM *S) +{ +AUHeader Header; +TAudioInfo *AudioInfo; + +AudioInfo=(TAudioInfo *) calloc(1,sizeof(TAudioInfo)); +STREAMReadBytes(S,(char *) &Header,sizeof(AUHeader)); + +//AU uses big endian +Header.DataSize=htonl(Header.DataSize); +Header.DataStart=htonl(Header.DataStart); +Header.Channels=htonl(Header.Channels); +Header.SampleRate=htonl(Header.SampleRate); +Header.Format=htonl(Header.Format); + + +AudioInfo->Channels=Header.Channels; +AudioInfo->SampleRate=Header.SampleRate; +AudioInfo->DataSize=Header.DataSize; + + +switch(Header.Format) +{ + case 1: + AudioInfo->Format=AFMT_MU_LAW; + break; + + case 2: + AudioInfo->Format=AFMT_S8; + break; + + case 3: + AudioInfo->Format=AFMT_S16_BE; + break; +} + +STREAMSeek(S,(double) Header.DataStart,SEEK_SET); +return(AudioInfo); +} + + + + +#ifdef HAVE_OSS + +#include +/* ------------------------ OSS Functions -------------------- */ +int OpenOSSDevice(char *Dev, int Type, TAudioInfo *Info) +{ + int fd, i; + unsigned char *data; + int val; + + if (Type==OUTPUT) val=O_WRONLY; + else val=O_RDONLY; + + + if (StrLen(Dev)==0) fd=open("/dev/dsp",val); + else fd=open(Dev,val); + + if (fd==-1) return(-1); + if (fd==-1) return(-1); + + +/* Tell the sound card that the sound about to be played is stereo. 0=mono 1=stereo */ + + val=Info->Channels-1; + if (val < 0) val=0; + if ( ioctl(fd, SNDCTL_DSP_STEREO,&val) == -1 ) + { + perror("ioctl stereo"); + return -1; + } + + /* Inform the sound card of the audio format */ + if ( ioctl(fd, SNDCTL_DSP_SETFMT,&Info->Format) == -1 ) + { + perror("ioctl format"); + return -1; + } + + /* Set the DSP playback rate, sampling rate of the raw PCM audio */ + if (ioctl(fd, SNDCTL_DSP_SPEED,&Info->SampleRate) == -1 ) + { + perror("ioctl sample rate"); + return -1; + } + + /* + if (Flags & O_RDWR) + { + if (ioctl(fd, SNDCTL_DSP_SETDUPLEX,0) == -1 ) + { + perror("ioctl set duplex"); + return -1; + } + } + */ + + return(fd); +} + +int OpenOSSInput(char *Dev, TAudioInfo *Info) +{ +return(OpenOSSDevice(Dev,INPUT,Info)); +} + + +int OpenOSSOutput(char *Dev, TAudioInfo *Info) +{ +return(OpenOSSDevice(Dev,OUTPUT,Info)); +} + + + +int OSSAlterVolumeType(char *device, int Type, int delta) +{ +int left_val, right_val, val, mixfd=0; + +mixfd=open(device, O_RDWR); +if (mixfd > -1) +{ +switch (Type) +{ + case VOL_MASTER: + ioctl(mixfd,MIXER_READ(SOUND_MIXER_VOLUME),&val); + break; + + case VOL_PCM: + ioctl(mixfd,MIXER_READ(SOUND_MIXER_PCM),&val); + break; + + case VOL_CD: + ioctl(mixfd,MIXER_READ(SOUND_MIXER_CD),&val); + break; + + case VOL_MIC: + ioctl(mixfd,MIXER_READ(SOUND_MIXER_MIC),&val); + break; + + case VOL_VIDEO: + ioctl(mixfd,MIXER_READ(SOUND_MIXER_VIDEO),&val); + break; + + case VOL_PHONEIN: + ioctl(mixfd,MIXER_READ(SOUND_MIXER_PHONEIN),&val); + break; + + case VOL_PHONEOUT: + ioctl(mixfd,MIXER_READ(SOUND_MIXER_PHONEOUT),&val); + break; + + case VOL_LINE1: + ioctl(mixfd,MIXER_READ(SOUND_MIXER_LINE1),&val); + break; +} + +left_val=val & 0xFF; +right_val=(val & 0xFF00) >> 8; + +left_val+=delta; +if (left_val < 0) left_val=0; +if (left_val > 255) left_val=255; + +right_val+=delta; +if (right_val < 0) right_val=0; +if (right_val > 255) right_val=255; + +right_val=right_val << 8; +val=right_val + left_val; + +switch (Type) +{ + case VOL_MASTER: + ioctl(mixfd,MIXER_WRITE(SOUND_MIXER_VOLUME),&val); + break; + + case VOL_PCM: + ioctl(mixfd,MIXER_WRITE(SOUND_MIXER_PCM),&val); + break; + + case VOL_CD: + ioctl(mixfd,MIXER_WRITE(SOUND_MIXER_CD),&val); + break; + + case VOL_MIC: + ioctl(mixfd,MIXER_WRITE(SOUND_MIXER_MIC),&val); + break; + + case VOL_VIDEO: + ioctl(mixfd,MIXER_WRITE(SOUND_MIXER_VIDEO),&val); + break; + + case VOL_PHONEIN: + ioctl(mixfd,MIXER_WRITE(SOUND_MIXER_PHONEIN),&val); + break; + + case VOL_PHONEOUT: + ioctl(mixfd,MIXER_WRITE(SOUND_MIXER_PHONEOUT),&val); + break; + + case VOL_LINE1: + ioctl(mixfd,MIXER_WRITE(SOUND_MIXER_LINE1),&val); + break; +} + +close(mixfd); +} + +return(left_val); +} + + +int OSSAlterVolume(char *device, char *type_str, int delta) +{ +int type; +type=MatchTokenFromList(type_str,VolTypeStrings,0); +if ((type==VOL_ALL) || (type==-1)) +{ +OSSAlterVolumeType(device, VOL_MASTER, delta); +OSSAlterVolumeType(device, VOL_PCM, delta); +} +else OSSAlterVolumeType(device, type, delta); +} + + +int OSSPlaySoundFile(char *DevPath, char *FilePath, int Vol) +{ +STREAM *S; +char *Buffer=NULL, *Tempstr=NULL; +int result, fd=-1, mixfd=-1; +int Flags, val, oldvol; +char FourCharacter[5]; +TAudioInfo *AudioInfo=NULL; + +S=STREAMOpenFile(FilePath,O_RDONLY); +if (! S) return(FALSE); +STREAMReadBytes(S,FourCharacter,4); +FourCharacter[4]='\0'; +STREAMSeek(S,0,SEEK_SET); +if (strcmp(FourCharacter,".snd")==0) AudioInfo=SoundReadAU(S); +else if (strcmp(FourCharacter,"RIFF")==0) AudioInfo=SoundReadWAV(S); + +if (AudioInfo==NULL) +{ + STREAMClose(S); + return(FALSE); +} + +//Must do all the above before we do open oss! +fd=OpenOSSOutput(DevPath, AudioInfo); +if (fd==-1) +{ + STREAMClose(S); + return(FALSE); +} + +if (Vol != VOLUME_LEAVEALONE) +{ + mixfd=open("/dev/dsp", O_RDWR); + if (mixfd > -1) + { + ioctl(mixfd,SOUND_MIXER_READ_PCM,&oldvol); + if (Vol > 255) result=255; + else result=Vol; + val=(result) | (result <<8); + ioctl(mixfd,SOUND_MIXER_WRITE_PCM,&val); + } +} + +Buffer=SetStrLen(Buffer,1024); +result=STREAMReadBytes(S,Buffer,1024); + +/* +if (AudioInfo->Channels==1) +{ + Tempstr=SetStrLen(Tempstr,result); + memcpy(Tempstr,Buffer,result); + result=SoundReformat(&Buffer, Tempstr, result, AudioInfo); +} +*/ + +val=0; +while (result > 0) +{ +write(fd,Buffer,result); +val+=result; +if ((AudioInfo->DataSize > 0) && (val >= AudioInfo->DataSize)) break; +result=STREAMReadBytes(S,Buffer,1024); +} + +close(fd); +if (mixfd > -1) +{ +ioctl(mixfd,SOUND_MIXER_WRITE_PCM,&oldvol); +close(mixfd); +} + +DestroyString(Buffer); +DestroyString(Tempstr); + +STREAMClose(S); +return(TRUE); +} + +#endif + + +/* ------------------------ ESound Functions -------------------- */ + +#ifdef HAVE_LIBESD +#include + +int ESDGetConnection() +{ +static int ConFD=-1; + +if (ConFD==-1) ConFD=esd_open_sound(NULL); +return(ConFD); +} + + +void ESDSendFileData(int ConFD, char *SoundFilePath, int Vol) +{ +char *Tempstr=NULL; +int id; + +Tempstr=CopyStr(Tempstr,"ColLib:"); +Tempstr=CatStr(Tempstr,SoundFilePath); + +id=esd_sample_getid(ConFD,Tempstr); +if (id < 0) +{ + id=esd_file_cache(ConFD,"ColLib",SoundFilePath); +} +if (Vol != VOLUME_LEAVEALONE) esd_set_default_sample_pan(ConFD,id,Vol,Vol); +esd_sample_play(ConFD,id); + +DestroyString(Tempstr); +} + +#endif + + + +int ESDPlaySoundFile(char *SoundFilePath, int Vol) +{ +int result, fd; + +if (StrLen(SoundFilePath) < 1) return(FALSE); +#ifdef HAVE_LIBESD + +fd=ESDGetConnection(); +if (fd > -1) +{ +ESDSendFileData(fd,SoundFilePath,Vol); +return(TRUE); +} + +#endif + +return(FALSE); +} + +/* +//Dont understand ESD volumes yet. + +int ESDAlterVolume(char *Device, int Vol) +{ +int result, fd; + +if (StrLen(Device) < 1) return; +#ifdef HAVE_LIBESD + +fd=ESDGetConnection(); +if (fd > -1) +{ + +return(TRUE); +} + +#endif + +return(FALSE); +} + +*/ + + +//---------------- Wrapper functions -------------// + + +int SoundOpenOutput(char *Dev, TAudioInfo *Info) +{ +int fd=-1; + +#ifdef HAVE_LIBESD +esd_format_t esd_format; + +if ((StrLen(Dev)==0) || (strncmp(Dev,"esd:",4)==0)) +{ +esd_format=ESD_STREAM | ESD_PLAY; + +if (Info->Channels==2) esd_format |= ESD_STEREO; +else esd_format |= ESD_MONO; + +if (Info->SampleSize==2) esd_format |= ESD_BITS16; +else esd_format |= ESD_BITS8; + +if (StrLen(Dev) > 4) setenv("ESPEAKER",Dev+4,TRUE); +else setenv("ESPEAKER","localhost",TRUE); +fd=esd_play_stream(esd_format, Info->SampleRate, NULL, "testing"); +} + +#endif + +#ifdef HAVE_OSS +if (fd < 0) fd=OpenOSSOutput(Dev, Info); +#endif + +return(fd); +} + + +int SoundOpenInput(char *Dev, TAudioInfo *Info) +{ +int fd=-1; + +#ifdef HAVE_LIBESD +esd_format_t esd_format; + +if ((StrLen(Dev)==0) || (strncmp(Dev,"esd:",4)==0)) +{ +esd_format=ESD_STREAM | ESD_RECORD; + +if (Info->Channels==2) esd_format |= ESD_STEREO; +else esd_format |= ESD_MONO; + +if (Info->SampleSize==2) esd_format |= ESD_BITS16; +else esd_format |= ESD_BITS8; + +if (StrLen(Dev) > 4) setenv("ESPEAKER",Dev+4,TRUE); +else setenv("ESPEAKER","localhost",TRUE); +fd=esd_record_stream(esd_format, Info->SampleRate, NULL, "testing"); +} + +#endif + +#ifdef HAVE_OSS +if (fd < 0) fd=OpenOSSInput(Dev, Info); +#endif + +return(fd); +} + + + +int SoundPlayFile(char *Output, char *Path, int Vol, int Flags) +{ +int result=0, pid=0; + + +if (Flags & PLAYSOUND_NONBLOCK) +{ + pid=fork(); + if (pid==0) CloseOpenFiles(); +} +if (pid==0) +{ +result=ESDPlaySoundFile(Path, Vol); + +#ifdef HAVE_OSS +if (! result) result=OSSPlaySoundFile(Output, Path, Vol); +#endif + +if (Flags & PLAYSOUND_NONBLOCK) _exit(0); +} + +return(result); +} + +int SoundAlterVolume(char *ReqDev, char *VolType, int delta) +{ +char *device=NULL; +int val; + +if (StrLen(ReqDev)) device=CopyStr(device,ReqDev); +else device=CopyStr(device,"/dev/mixer"); + +#ifdef HAVE_OSS +val=OSSAlterVolume(device, VolType, delta); +#endif + +DestroyString(device); +return(val); + +} + + + diff --git a/libUseful-2.0/sound.h b/libUseful-2.0/sound.h new file mode 100644 index 0000000..99defee --- /dev/null +++ b/libUseful-2.0/sound.h @@ -0,0 +1,81 @@ +#ifndef LIBUSEFUL_SOUND_H +#define LIBUSEFUL_SOUND_H + +#include "file.h" + +typedef struct +{ +unsigned int Format; +unsigned int Channels; +unsigned int SampleRate; +unsigned int SampleSize; +unsigned int DataSize; +}TAudioInfo; + +#define VOLUME_LEAVEALONE -1 +#define PLAYSOUND_NONBLOCK 1 + + +#define OUTPUT 0 +#define INPUT 1 + + +/* For systems that lack 'soundcard.h' but still have some kind of sound */ +/* We define enough audio formats for us to use internally */ +#ifndef AFMT_MU_LAW +# define AFMT_MU_LAW 0x00000001 +#endif + +#ifndef AFMT_A_LAW +# define AFMT_A_LAW 0x00000002 +#endif + +# define AFMT_IMA_ADPCM 0x00000004 + +#ifndef AFMT_U8 +# define AFMT_U8 0x00000008 +#endif + +#ifndef AFMT_S8 +# define AFMT_S8 0x00000040 +#endif + +#ifndef AFMT_S16_LE +# define AFMT_S16_LE 0x00000010 /* Little endian signed 16*/ +#endif + +#ifndef AFMT_S16_BE +# define AFMT_S16_BE 0x00000010 /* Little endian signed 16*/ +#endif + + +#ifndef AFMT_U16_BE +# define AFMT_U16_LE 0x00000080 /* Little endian U16 */ +#endif + +#ifndef AFMT_U16_BE +# define AFMT_U16_BE 0x00000100 /* Big endian U16 */ +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +TAudioInfo *AudioInfoCreate(unsigned int Format, unsigned int Channels, unsigned int SampleRate, unsigned int SampleSize, unsigned int DataSize); +int SoundPlayFile(char *Device, char *Path, int Vol, int Flags); +int SoundAlterVolume(char *Device, char *Channel, int delta); +int SoundOpenOutput(char *Dev, TAudioInfo *Info); +int SoundOpenInput(char *Dev, TAudioInfo *Info); +TAudioInfo *SoundReadWAV(STREAM *S); +TAudioInfo *SoundReadAU(STREAM *S); +void SoundWriteWAVHeader(STREAM *S, TAudioInfo *AI); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/string.c b/libUseful-2.0/string.c new file mode 100644 index 0000000..89c59be --- /dev/null +++ b/libUseful-2.0/string.c @@ -0,0 +1,773 @@ +#include "includes.h" + +#ifndef va_copy +#define va_copy(dest, src) (dest) = (src) +#endif + +/* +int StrLen(char *Str) +{ +if (! Str) return(0); +return(strlen(Str)); +} +*/ + + +char *DestroyString(char *string) +{ +if (string) free(string); +// we return a null to be put into the string ptr +return(0); +} + + + +int CompareStr(const char *S1, const char *S2) +{ +int len1, len2; +len1=StrLen(S1); +len2=StrLen(S2); +if ((len1==0) && (len2==0)) return(0); + +if (len1==0) return(-1); +if (len2==0) return(1); + +return(strcmp(S1,S2)); +} + + + +char *CopyStrLen(char *Dest, const char *Src,int len) +{ +char *ptr; +ptr=CopyStr(Dest,Src); +if (StrLen(ptr) >len) ptr[len]=0; +return(ptr); +} + +char *CatStrLen(char *Dest, const char *Src,int len) +{ +char *ptr; +int catlen=0; + +catlen=StrLen(Dest); +ptr=CatStr(Dest,Src); +catlen+=len; +if (StrLen(ptr) > catlen) ptr[catlen]=0; +return(ptr); +} + + +char *CopyStr(char *Dest, const char *Src) +{ +int len; +char *ptr; + +if (Dest) *Dest=0; +return(CatStr(Dest,Src)); +} + + + +char *VCatStr(char *Dest, const char *Str1, va_list args) +{ +//initialize these to keep valgrind happy +int len=0; +char *ptr=NULL; +const char *sptr=NULL; + +if (Dest !=NULL) +{ +len=StrLen(Dest); +ptr=Dest; +} +else +{ + len=10; + ptr=(char *) calloc(10,1); +} + +if (! Str1) return(ptr); +for (sptr=Str1; sptr !=NULL; sptr=va_arg(args,const char *)) +{ +len+=StrLen(sptr)+1; +len=len*2; + + +ptr=(char *) realloc(ptr,len); +if (ptr && sptr) strcat(ptr,sptr); +} + +return(ptr); +} + +char *MCatStr(char *Dest, const char *Str1, ...) +{ +char *ptr=NULL; +va_list args; + +va_start(args,Str1); +ptr=VCatStr(Dest,Str1,args); +va_end(args); + +return(ptr); +} + + +char *MCopyStr(char *Dest, const char *Str1, ...) +{ +char *ptr=NULL; +va_list args; + +ptr=Dest; +if (ptr) *ptr='\0'; +va_start(args,Str1); +ptr=VCatStr(ptr,Str1,args); +va_end(args); + +return(ptr); +} + +char *CatStr(char *Dest, const char *Src) +{ +int len; +char *ptr; + +if (Dest !=NULL) +{ +len=StrLen(Dest); +ptr=Dest; +} +else +{ + len=10; + ptr=(char *) calloc(10,1); +} + +if (StrLen(Src)==0) return(ptr); +len+=StrLen(Src); +len++; + +ptr=(char *)realloc(ptr,len); +if (ptr && Src) strcat(ptr,Src); +return(ptr); +} + + + +//Clone string is really intended to be passed into the 'ListClone' function +//in the manner of a copy constructor, for most uses it's best to stick to +//CopyStr + +char *CloneStr(const char *Str) +{ +return(CopyStr(NULL,Str)); +} + + +char *VFormatStr(char *InBuff, const char *InputFmtStr, va_list args) +{ +int inc=100, count=1, result=0; +char *Tempstr=NULL, *FmtStr=NULL; +va_list argscopy; + +Tempstr=InBuff; + +//Take a copy of the supplied Format string and change it. +//Do not allow '%n', it's useable for exploits +FmtStr=CopyStr(FmtStr,InputFmtStr); +EraseString(FmtStr, "%n"); + + +inc=4 * StrLen(FmtStr); //this should be a good average +for (count=1; count < 100; count++) +{ + result=inc * count +1; + Tempstr=SetStrLen(Tempstr, result); + + //the vsnprintf function DESTROYS the arg list that is passed to it. + //This is just plain WRONG, it's a long-standing bug. The solution is to + //us va_copy to make a new one every time and pass that in. + va_copy(argscopy,args); + result=vsnprintf(Tempstr,result,FmtStr,argscopy); + va_end(argscopy); + + /* old style returns -1 to say couldn't fit data into buffer.. so we */ + /* have to guess again */ + if (result==-1) continue; + + /* new style returns how long buffer should have been.. so we resize it */ + if (result > (inc * count)) + { + Tempstr=SetStrLen(Tempstr, result+10); + result=vsnprintf(Tempstr,result+10,FmtStr,args); + } + + break; +} + +DestroyString(FmtStr); + + +return(Tempstr); +} + + + +char *FormatStr(char *InBuff, const char *FmtStr, ...) +{ +int inc=100, count=1, result; +char *tempstr=NULL; +va_list args; + +va_start(args,FmtStr); +tempstr=VFormatStr(InBuff,FmtStr,args); +va_end(args); +return(tempstr); +} + + +char *AddCharToStr(char *Dest,char Src) +{ +char temp[2]; +char *ptr=NULL; + +temp[0]=Src; +temp[1]=0; +ptr=CatStr(Dest,temp); +return(ptr); +} + + +inline char *AddCharToBuffer(char *Dest, int DestLen, char Char) +{ +char *actb_ptr; + +//if (Dest==NULL || ((DestLen % 100)==0)) +actb_ptr=(char *) realloc((void *) Dest,DestLen +110); +//else actb_ptr=Dest; + +actb_ptr[DestLen]=Char; +actb_ptr[DestLen+1]='\0'; + +return(actb_ptr); +} + + +inline char *AddBytesToBuffer(char *Dest, int DestLen, char *Bytes, int NoOfBytes) +{ +char *actb_ptr=NULL; + +//if (Dest==NULL || ((DestLen % 100)==0)) +actb_ptr=(char *) realloc((void *) Dest,DestLen + NoOfBytes +10); +//else actb_ptr=Dest; + +memcpy(actb_ptr+DestLen,Bytes,NoOfBytes); + +return(actb_ptr); +} + + + +char *SetStrLen(char *Str,int len) +{ +/* Note len+1 to allow for terminating NULL */ +if (Str==NULL) return((char *) calloc(1,len+1)); +else return( (char *) realloc(Str,len+1)); +} + + +char *strlwr(char *str) +{ +int count, len; +len=StrLen(str); +for (count=0; count < len; count++) str[count]=tolower(str[count]); +return(str); +} + +char *strupr(char *str) +{ +int count, len; +len=StrLen(str); +for (count=0; count < len; count++) str[count]=toupper(str[count]); +return(str); +} + +char *strrep(char *str, char oldchar, char newchar) +{ +int count, len; +len=StrLen(str); +for (count=0; count < len; count++) +{ +if (str[count]==oldchar) str[count]=newchar; +} +return(str); +} + +char *strmrep(char *str, char *oldchars, char newchar) +{ +int count, len; +len=StrLen(str); +for (count=0; count < len; count++) +{ +if (strchr(oldchars,str[count])) str[count]=newchar; +} +return(str); +} + +void StripTrailingWhitespace(char *String) +{ +int count,len; + +len=StrLen(String); +if (len==0) return; +for(count = len-1; (count >-1) && isspace(String[count]); count--) String[count]=0; +} + + +void StripLeadingWhitespace(char *String) +{ +int count,len; + +len=StrLen(String); +if (len==0) return; +for(count = 0; (count -1); count--) +{ + if ((Line[count]=='\r') || (Line[count]=='\n')) Line[count]=0; + else break; +} + +} + + +void StripQuotes(char *Str) +{ +int len; +char *ptr, StartQuote='\0'; + +ptr=Str; +while (isspace(*ptr)) ptr++; +len=StrLen(ptr); + +if ((*ptr=='"') || (*ptr=='\'')) StartQuote=*ptr; + +if ((len > 0) && (StartQuote != '\0')) +{ +if (ptr[len-1]==StartQuote) ptr[len-1]='\0'; +memmove(Str,ptr+1,len); +} + +} + + +char *EnquoteStr(char *Out, const char *In) +{ +const char *ptr; +char *ReturnStr=NULL; +int len=0; + +ptr=In; +ReturnStr=CopyStr(Out,""); + +while (ptr && (*ptr != '\0')) +{ + switch (*ptr) + { + case '\\': + case '"': + case '\'': + ReturnStr=AddCharToBuffer(ReturnStr,len,'\\'); + len++; + ReturnStr=AddCharToBuffer(ReturnStr,len, *ptr); + len++; + break; + + + case '\r': + ReturnStr=AddCharToBuffer(ReturnStr,len,'\\'); + len++; + ReturnStr=AddCharToBuffer(ReturnStr,len, 'r'); + len++; + break; + + + case '\n': + ReturnStr=AddCharToBuffer(ReturnStr,len,'\\'); + len++; + ReturnStr=AddCharToBuffer(ReturnStr,len, 'n'); + len++; + break; + + default: + ReturnStr=AddCharToBuffer(ReturnStr,len, *ptr); + len++; + break; + } + ptr++; + +} +return(ReturnStr); +} + + + +int MatchTokenFromList(const char *Token,char **List, int Flags) +{ +int count, len; + +for (count=0; List[count] !=NULL; count++) +{ + len=StrLen(List[count]); + if (len==0) continue; + if (StrLen(Token) < len) continue; + + if (Flags & MATCH_TOKEN_PART) + { + if (Flags & MATCH_TOKEN_CASE) + { + if (strncmp(Token,List[count],len)==0) return(count); + } + else if (strncasecmp(Token,List[count],len)==0) return(count); + } + else + { + if (StrLen(Token) != len) continue; + if (Flags & MATCH_TOKEN_CASE) + { + if(strcmp(Token,List[count])==0) return(count); + } + else if (strcasecmp(Token,List[count])==0) return(count); + } +} +return(-1); +} + + + +int MatchLineStartFromList(const char *Token,char **List) +{ +int count, len; + +for (count=0; List[count] !=NULL; count++) +{ + len=StrLen(List[count]); + + if ( + (len >0) && + (strncasecmp(Token,List[count],len)==0) + ) return(count); +} +return(-1); +} + +#define SEP_CHAR_SPACE -1 + +//Handle Quotes. If we start with a quote, sweep through to find the end of the quotes +char *HandleQuotes(char *String) +{ +char *ptr; +char StartQuote='\0'; + +ptr=String; +if ((*ptr)=='\"') StartQuote=*ptr; +if ((*ptr)=='\'') StartQuote=*ptr; +if (StartQuote) +{ + ptr++; + while ((*ptr) != StartQuote) + { + if ((*ptr)=='\0') return(ptr); + if ((*ptr)=='\\') ptr++; + ptr++; + } + ptr++; +} +return(ptr); +} + + +//This function searches for the separator +int GetTokenSepMatch(char *Pattern, char **start, char **end, int Flags) +{ +char *pptr, *eptr; +int MatchChar, InQuotes=FALSE; + + +pptr=Pattern; + + +if (Flags & GETTOKEN_QUOTES) *start=HandleQuotes(*start); +if (*start==*end) return(FALSE); + +eptr=*start; +while (1) +{ +//if we run out of pattern, then we got a match +if (*pptr=='\0') +{ + *end=eptr; + return(TRUE); +} + +//if ((*eptr=='"') && (Flags & GETTOKEN_QUOTES)) *eptr=HandleQuotes(*eptr); + +//if we run out of string, then we got a part match, but its not +//a match, so we return fail +if ((*eptr)=='\0') +{ + return(FALSE); +} + +if (*eptr=='\\' ) +{ + //if we got a quoted character we can't have found + //the separator, so return false + eptr++; + return(FALSE); +} + + +if (*pptr=='\\') +{ + pptr++; + if (*pptr=='S') MatchChar=SEP_CHAR_SPACE; + else MatchChar=*pptr; +} +else MatchChar=*pptr; + + +if (MatchChar==SEP_CHAR_SPACE) +{ + if (! isspace(*eptr)) return(FALSE); + while (isspace(*(eptr+1))) eptr++; +} +else if (*eptr != *pptr) return(FALSE); + +pptr++; +eptr++; +} +return(FALSE); +} + + + +char *GetNextSeparator(char *Pattern, char **Sep, int Flags) +{ +char *ptr; +int len=0; + +ptr=Pattern; +if (*ptr=='\0') return(NULL); +*Sep=CopyStr(*Sep,""); + +ptr=Pattern; +while ((*ptr != '\0') && (*ptr !='|')) +{ + *Sep=AddCharToBuffer(*Sep,len,*ptr); + len++; + ptr++; +} + +if (*ptr == '|') ptr++; + +return(ptr); +} + + +int GetTokenFindSeparator(char *Pattern, char *String, const char **SepStart, const char **SepEnd, int Flags) +{ +char *start_ptr=NULL, *end_ptr=NULL; +char *Sep=NULL, *SepPtr, *ptr; + +start_ptr=String; + +while (*start_ptr != '\0') +{ +if (*start_ptr=='\\') +{ + start_ptr++; + start_ptr++; +} + +if (Flags & GETTOKEN_MULTI_SEPARATORS) +{ +ptr=GetNextSeparator(Pattern,&Sep,Flags); +SepPtr=Sep; +} +else +{ + SepPtr=Pattern; + ptr=Pattern+StrLen(Pattern); +} + +while (ptr) +{ +if (GetTokenSepMatch(SepPtr,&start_ptr, &end_ptr, Flags)) +{ + *SepStart=start_ptr; + *SepEnd=end_ptr; + DestroyString(Sep); + return(TRUE); +} + +if (Flags & GETTOKEN_MULTI_SEPARATORS) +{ +ptr=GetNextSeparator(ptr,&Sep,Flags); +SepPtr=Sep; +} +else ptr=NULL; + +} + +if ((*start_ptr) !='\0') start_ptr++; +} + +DestroyString(Sep); +return(FALSE); +} + + +char *GetToken(const char *SearchStr, const char *Separator, char **Token, int Flags) +{ +char *Tempstr=NULL; +const char *SepStart=NULL, *SepEnd=NULL; +const char *ptr, *ssptr; +int len=0; + + +/* this is a safety measure so that there is always something in Token*/ +*Token=CopyStr(*Token,""); + +len=StrLen(SearchStr); +if (len < 1) return(NULL); + +if (! GetTokenFindSeparator((char *) Separator,(char *) SearchStr,&SepStart,&SepEnd, Flags)) +{ + SepStart=SearchStr+len; +} + + +//strip any leading quotes +ptr=SearchStr; +*Token=CopyStrLen(*Token,ptr,SepStart-ptr); + +if (Flags & GETTOKEN_QUOTES) +{ + StripQuotes(*Token); +} + + +//return empty string, but not null +if (StrLen(SepEnd) < 1) +{ + SepEnd=SearchStr+StrLen((char *) SearchStr); +} + +return((char *) SepEnd); +} + + +#define ESC 0x1B + +char *DeQuoteStr(char *Buffer, const char *Line) +{ +char *out, *in; +int olen=0; + +if (Line==NULL) return(NULL); +out=CopyStr(Buffer,""); +in=(char *) Line; + +while(in && (*in != '\0') ) +{ + if (*in=='\\') + { + in++; + switch (*in) + { + case 'e': + out=AddCharToBuffer(out,olen,ESC); + olen++; + break; + + + case 'n': + out=AddCharToBuffer(out,olen,'\n'); + olen++; + break; + + case 'r': + out=AddCharToBuffer(out,olen,'\r'); + olen++; + break; + + case 't': + out=AddCharToBuffer(out,olen,'\t'); + olen++; + break; + + + case '\\': + default: + out=AddCharToBuffer(out,olen,*in); + olen++; + break; + + } + } + else + { + out=AddCharToBuffer(out,olen,*in); + olen++; + } + in++; +} + +return(out); +} + + + +char *QuoteCharsInStr(char *Buffer, const char *String, const char *QuoteChars) +{ +char *Tempstr=NULL; +int si, ci, slen, clen, olen=0; + +slen=StrLen(String); +clen=StrLen(QuoteChars); + +Tempstr=CopyStr(Buffer,""); + +for (si=0; si < slen; si++) +{ + for (ci=0; ci < clen; ci++) + { + if (String[si]==QuoteChars[ci]) + { + Tempstr=AddCharToBuffer(Tempstr,olen, '\\'); + olen++; + break; + } + } + Tempstr=AddCharToBuffer(Tempstr,olen,String[si]); + olen++; +} + +return(Tempstr); +} + + diff --git a/libUseful-2.0/string.h b/libUseful-2.0/string.h new file mode 100644 index 0000000..0b5f238 --- /dev/null +++ b/libUseful-2.0/string.h @@ -0,0 +1,61 @@ +#ifndef LIBUSEFUL_STRING +#define LIBUSEFUL_STRING + +#include +#include //for strlen, used below in StrLen + +#define GETTOKEN_QUOTES 1 +#define GETTOKEN_MULTI_SEPARATORS 2 + +#define MATCH_TOKEN_PART 1 +#define MATCH_TOKEN_CASE 2 + +#ifdef __cplusplus +extern "C" { +#endif + +//A few very simple and frequently used functions can be reduced +//down to macros using weird stuff like the ternary condition +//operator '?' and the dreaded comma operator ',' +#define StrLen(str) ( str ? strlen(str) : 0 ) + +//int StrLen(char *Str); +char *DestroyString(char *); +int CompareStr(const char *S1, const char *S2); +char *CopyStrLen(char *,const char *,int); +char *CopyStr(char *, const char *); +char *MCatStr(char *, const char *, ...); +char *MCopyStr(char *, const char *, ...); +char *CatStr(char *, const char *); +char *CatStrLen(char *,const char *,int); +char *VFormatStr(char *,const char *,va_list); +char *FormatStr(char *,const char *,...); +char *AddCharToStr(char *,char); +char *AddCharToBuffer(char *Buffer, int BuffLen, char Char); +char *AddBytesToBuffer(char *Buffer, int BuffLen, char *Bytes, int Len); +char *SetStrLen(char *,int); +char *strupr(char *); +char *strlwr(char *); +char *strrep(char *,char, char); +char *strmrep(char *str, char *oldchars, char newchar); +char *CloneString(const char *); +void StripTrailingWhitespace(char *); +void StripLeadingWhitespace(char *); +void StripCRLF(char *); +void StripQuotes(char *); +char *QuoteCharsInStr(char *Buffer, const char *String,const char *QuoteChars); +char *DeQuoteStr(char *Buffer, const char *Line); +char *EnquoteStr(char *Out, const char *In); +int MatchTokenFromList(const char *Token,char **List, int Flags); +int MatchLineStartFromList(const char *Token,char **List); +char *GetToken(const char *SearchStr, const char *Delim, char **Token, int Flags); + +#ifdef __cplusplus +} +#endif + + + + +#endif + diff --git a/libUseful-2.0/tar.c b/libUseful-2.0/tar.c new file mode 100644 index 0000000..57abb23 --- /dev/null +++ b/libUseful-2.0/tar.c @@ -0,0 +1,285 @@ +#include "tar.h" +#include +#include +#include + + +#define TAR_RECORDSIZE 512 + +#define FILE_MODE_OFFSET 100 +#define USER_OFFSET 108 +#define GROUP_OFFSET 116 +#define SIZE_OFFSET 124 +#define MTIME_OFFSET 136 +#define CHECKSUM_OFFSET 148 +#define FTYPE_OFFSET 157 + +typedef struct +{ /* byte offset */ + char name[100]; /* 0 */ + char mode[8]; /* 100 */ + char uid[8]; /* 108 */ + char gid[8]; /* 116 */ + char size[12]; /* 124 */ + char mtime[12]; /* 136 */ + char chksum[8]; /* 148 */ + char typeflag; /* 156 */ + char linkname[100]; /* 157 */ + char magic[6]; /* 257 */ + char version[2]; /* 263 */ + char uname[32]; /* 265 */ + char gname[32]; /* 297 */ + char devmajor[8]; /* 329 */ + char devminor[8]; /* 337 */ + char prefix[155]; /* 345 */ + /* 500 */ + char pad[12]; +} TTarHeader; + + +int TarReadHeader(STREAM *S, ListNode *Vars) +{ +char *Tempstr=NULL, *ptr; +int len, result, RetVal=FALSE; +TTarHeader *Head; + +len=sizeof(TTarHeader); +Head=(TTarHeader *) calloc(1,len); +result=STREAMReadBytes(S,Head,len); +printf("HEAD: %d %s\n",result,(char *) Head); +if (result == len) +{ +Tempstr=CopyStr(Tempstr,Head->prefix); +Tempstr=CatStr(Tempstr,Head->name); +SetVar(Vars,"Path",Tempstr); + +//Convert 'Size' from octal. Yes, octal. +Tempstr=FormatStr(Tempstr,"%d",strtol(Head->size,NULL,8)); +SetVar(Vars,"Size",Tempstr); + +//mode is in octal too +Tempstr=FormatStr(Tempstr,"%d",strtol(Head->mode,NULL,8)); +SetVar(Vars,"Mode",Tempstr); + +//mtime in, yes, you guessed it, octal +Tempstr=FormatStr(Tempstr,"%d",strtol(Head->mtime,NULL,8)); +SetVar(Vars,"Mtime",Tempstr); + + +SetVar(Vars,"Type","file"); +StripTrailingWhitespace(Head->magic); +if (strcmp(Head->magic,"ustar")==0) +{ +switch (Head->typeflag) +{ + case '1': SetVar(Vars,"Type","hardlink"); break; + case '2': SetVar(Vars,"Type","symlink"); break; + case '3': SetVar(Vars,"Type","chardev"); break; + case '4': SetVar(Vars,"Type","blkdev"); break; + case '5': SetVar(Vars,"Type","directory"); break; +} + +} +RetVal=TRUE; +} + +DestroyString(Tempstr); +free(Head); + +return(RetVal); +} + + +void TarUnpack(STREAM *Tar) +{ +ListNode *Vars; +char *Path=NULL, *Tempstr=NULL, *ptr; +int bytes_read, bytes_total, val, result; +STREAM *S; + +Vars=ListCreate(); +while (TarReadHeader(Tar, Vars)) +{ + Path=CopyStr(Path,GetVar(Vars,"Path")); + if (StrLen(Path)) + { + ptr=GetVar(Vars,"Type"); + if (ptr) + { + if (strcmp(ptr,"directory")==0) + { + mkdir(Path,atoi(GetVar(Vars,"Mode"))); + } + else if (strcmp(ptr,"file")==0) + { + MakeDirPath(Path,0700); + S=STREAMOpenFile(Path,O_WRONLY|O_CREAT|O_TRUNC); + if (S) fchmod(S->out_fd,atoi(GetVar(Vars,"Mode"))); + bytes_read=0; + bytes_total=atoi(GetVar(Vars,"Size")); + Tempstr=SetStrLen(Tempstr,BUFSIZ); + while (bytes_read < bytes_total) + { + val=bytes_total - bytes_read; + if (val > BUFSIZ) val=BUFSIZ; + if ((val % 512)==0) result=val; + else result=((val / 512) + 1) * 512; + result=STREAMReadBytes(Tar,Tempstr,result); + if (result > val) result=val; + if (S) STREAMWriteBytes(S,Tempstr,result); + bytes_read+=result; + } + STREAMClose(S); + } + } + } + ListClear(Vars,DestroyString); +} + +ListDestroy(Vars,DestroyString); +DestroyString(Tempstr); +DestroyString(Path); +} + + + +void TarWriteHeader(STREAM *S, char *Path, struct stat *FStat) +{ +char *Tempstr=NULL, *ptr; +int i, chksum=0; +TTarHeader *Head; +struct passwd *pwd; +struct group *grp; + +Head=(TTarHeader *) calloc(1,sizeof(TTarHeader)); + + ptr=Path; + if (*ptr=='/') ptr++; + memcpy(Head->name,ptr,StrLen(ptr)); + + sprintf(Head->mode,"%07o",FStat->st_mode); + sprintf(Head->uid,"%07o",FStat->st_uid); + sprintf(Head->gid,"%07o",FStat->st_gid); + sprintf(Head->size,"%011o",FStat->st_size); + sprintf(Head->mtime,"%011o",FStat->st_mtime); + + if (S_ISDIR(FStat->st_mode)) Head->typeflag='5'; + else if (S_ISLNK(FStat->st_mode)) Head->typeflag='2'; + else if (S_ISCHR(FStat->st_mode)) Head->typeflag='3'; + else if (S_ISBLK(FStat->st_mode)) Head->typeflag='4'; + else if (S_ISFIFO(FStat->st_mode)) Head->typeflag='6'; + else Head->typeflag='0'; + + memset(Head->chksum,' ',8); + + strcpy(Head->magic,"ustar "); + //memcpy(Head->version,"00",2); + + pwd=getpwuid(FStat->st_uid); + if (pwd) strcpy(Head->uname,pwd->pw_name); + + grp=getgrgid(FStat->st_gid); + if (grp) strcpy(Head->gname,grp->gr_name); + + if ( (Head->typeflag == '3') || (Head->typeflag == '4') ) + { + sprintf(Head->devmajor,"%07o",major(FStat->st_rdev)); + sprintf(Head->devminor,"%07o",minor(FStat->st_rdev)); + } + + ptr=(char *) Head; + for (i=0; i < 512; i++) chksum+=*(ptr+i); + sprintf(Head->chksum,"%06o\0",chksum); + + +STREAMWriteBytes(S,(char *) Head,512); + +DestroyString(Tempstr); +free(Head); +} + + + +void TarWriteFooter(STREAM *Tar) +{ +char *Tempstr=NULL; + +Tempstr=SetStrLen(Tempstr,TAR_RECORDSIZE); +memset(Tempstr,0,TAR_RECORDSIZE); +STREAMWriteBytes(Tar,Tempstr,TAR_RECORDSIZE); +STREAMWriteBytes(Tar,Tempstr,TAR_RECORDSIZE); + +DestroyString(Tempstr); +} + + + + +void TarAddFile(STREAM *Tar, STREAM *File) +{ +char *Buffer=NULL; +int result; + +Buffer=SetStrLen(Buffer,TAR_RECORDSIZE); + +memset(Buffer,0,TAR_RECORDSIZE); +result=STREAMReadBytes(File,Buffer,TAR_RECORDSIZE); +while (result > 0) +{ + STREAMWriteBytes(Tar,Buffer,TAR_RECORDSIZE); + memset(Buffer,0,TAR_RECORDSIZE); + result=STREAMReadBytes(File,Buffer,TAR_RECORDSIZE); +} + +DestroyString(Buffer); +} + + + +void TarInternalProcessFiles(STREAM *Tar, char *FilePattern) +{ +glob_t Glob; +char *Tempstr=NULL, *ptr; +struct stat FStat; +int i; +STREAM *S; + +ptr=GetToken(FilePattern,"\\S",&Tempstr,GETTOKEN_QUOTES); +if (ptr) glob(Tempstr,0,NULL,&Glob); +while (ptr) +{ + ptr=GetToken(ptr,"\\S",&Tempstr,GETTOKEN_QUOTES); + if (ptr) glob(Tempstr,GLOB_APPEND,NULL,&Glob); +} + +for (i=0; i < Glob.gl_pathc; i++) +{ + stat(Glob.gl_pathv[i],&FStat); + if (S_ISDIR(FStat.st_mode)) + { + Tempstr=MCopyStr(Tempstr,Glob.gl_pathv[i],"/*",NULL); + TarInternalProcessFiles(Tar, Tempstr); + } + else + { + S=STREAMOpenFile(Glob.gl_pathv[i],O_RDONLY); + if (S) + { + TarWriteHeader(Tar, Glob.gl_pathv[i],&FStat); + TarAddFile(Tar, S); + STREAMClose(S); + } + } +} + + +globfree(&Glob); +DestroyString(Tempstr); +} + + +void TarFiles(STREAM *Tar, char *FilePattern) +{ + TarInternalProcessFiles(Tar, FilePattern); + TarWriteFooter(Tar); +} diff --git a/libUseful-2.0/tar.h b/libUseful-2.0/tar.h new file mode 100644 index 0000000..b1c8388 --- /dev/null +++ b/libUseful-2.0/tar.h @@ -0,0 +1,23 @@ +#ifndef LIBUSEFUL_TAR_H +#define LIBUSEFUL_TAR_H + +#include "includes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int TarReadHeader(STREAM *S, ListNode *Vars); +void TarUnpack(STREAM *Tar); +void TarWriteHeader(STREAM *S, char *FileName, struct stat *FStat); +void TarWriteFooter(STREAM *Tar); +void TarAddFile(STREAM *Tar, STREAM *File); +void TarFiles(STREAM *Tar, char *FilePattern); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/tartest.c b/libUseful-2.0/tartest.c new file mode 100644 index 0000000..4118b6d --- /dev/null +++ b/libUseful-2.0/tartest.c @@ -0,0 +1,48 @@ +#include "libUseful.h" + + +main(int argc, char *argv[]) +{ +STREAM *S, *Out; +ListNode *Vars; +char *Path=NULL, *Tempstr=NULL, *ptr; +int bytes_read, bytes_total, val, result; + + +S=STREAMOpenFile(argv[1],O_RDONLY); + +Out=STREAMFromFD(1); +Vars=ListCreate(); +while (TarReadHeader(S, Vars)) +{ + Path=CopyStr(Path,GetVar(Vars,"Path")); +printf("PATH: %s %s %s\n",Path,GetVar(Vars,"Size"),GetVar(Vars,"Type")); + if (StrLen(Path)) + { + ptr=GetVar(Vars,"Type"); + if (ptr && (strcmp(ptr,"file")==0)) + { + bytes_read=0; + bytes_total=atoi(GetVar(Vars,"Size")); + Tempstr=SetStrLen(Tempstr,BUFSIZ); + while (bytes_read < bytes_total) + { + val=bytes_total - bytes_read; + if (val > BUFSIZ) val=BUFSIZ; + if ((val % 512)==0) result=val; + else result=((val / 512) + 1) * 512; + result=STREAMReadBytes(S,Tempstr,result); + if (result > val) result=val; + printf("READ: %d\n",val); fflush(NULL); + if (Out) STREAMWriteBytes(Out,Tempstr,result); + bytes_read+=result; + } + } + } + ListClear(Vars,DestroyString); +} + +ListDestroy(Vars,DestroyString); +DestroyString(Tempstr); +DestroyString(Path); +} diff --git a/libUseful-2.0/unix_socket.c b/libUseful-2.0/unix_socket.c new file mode 100644 index 0000000..b333c03 --- /dev/null +++ b/libUseful-2.0/unix_socket.c @@ -0,0 +1,76 @@ +#include "unix_socket.h" +#include +#include +#include + +int InitUnixServerSocket(const char *Path, int ConType) +{ + int result; + struct sockaddr_un addr; + int sockfd=-1, SockType; + + result=1; + if (ConType==STREAM_TYPE_UNIX) SockType=SOCK_STREAM; + else SockType=SOCK_DGRAM; + + memset(&addr,0,sizeof(struct sockaddr_un)); + addr.sun_family=AF_UNIX; + strcpy(addr.sun_path,Path); + + sockfd=socket(AF_UNIX, SockType, 0); + + if (sockfd > -1) + { + unlink(Path); + result=bind(sockfd,(struct sockaddr *) &addr, SUN_LEN(&addr)); + chmod(Path,0666); + if (result != 0) + { + close(sockfd); + return(-1); + } + else + { + if (SockType==SOCK_STREAM) listen(sockfd,5); + } + } + +return(sockfd); +} + + + +int OpenUnixSocket(const char *Path, int Type) +{ +int sock; +struct sockaddr_un sa; +int val; + +if (Type==STREAM_TYPE_UNIX) val=SOCK_STREAM; +else val=SOCK_DGRAM; + +sock=socket(AF_UNIX, val, FALSE); +if (sock==-1) return(-1); + +memset(&sa,0,sizeof(struct sockaddr_un)); +sa.sun_family=AF_UNIX; +strcpy(sa.sun_path,Path); +val=sizeof(sa); +if (connect(sock,(struct sockaddr *) &sa,val)==0) return(sock); + +close(sock); +return(-1); +} + + + +int STREAMConnectUnixSocket(STREAM *S, const char *Path, int ConType) +{ + + S->in_fd=OpenUnixSocket(Path, ConType); + if (S->in_fd==-1) return(FALSE); + S->out_fd=S->in_fd; + S->Type=ConType; + + return(TRUE); +} diff --git a/libUseful-2.0/unix_socket.h b/libUseful-2.0/unix_socket.h new file mode 100644 index 0000000..779d289 --- /dev/null +++ b/libUseful-2.0/unix_socket.h @@ -0,0 +1,21 @@ +#ifndef LIBUSEFUL_UNIXSOCK_H +#define LIBUSEFUL_UNIXSOCK_H + +#include "file.h" +#include "defines.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +int InitUnixServerSocket(const char *Path, int SockType); +int OpenUnixSocket(const char *Path, int SockType); +int STREAMConnectUnixSocket(STREAM *S, const char *Path, int SockType); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/libUseful-2.0/ziptest.c b/libUseful-2.0/ziptest.c new file mode 100644 index 0000000..1d59da4 --- /dev/null +++ b/libUseful-2.0/ziptest.c @@ -0,0 +1,53 @@ +#include "libUseful.h" + +void CompressTermcap() +{ +STREAM *In, *Out; +char *Buffer=NULL; +int result; + +Out=STREAMOpenFile("/tmp/termcap.gz",O_CREAT | O_TRUNC | O_WRONLY); +STREAMAddStandardDataProcessor(Out, "compression", "gzip", ""); + +Buffer=SetStrLen(Buffer,4096); +In=STREAMOpenFile("/etc/termcap",O_RDONLY); +result=STREAMReadBytes(In,Buffer,4096); +while (result > 0) +{ + STREAMWriteBytes(Out,Buffer,result); + result=STREAMReadBytes(In,Buffer,4096); +} +STREAMClose(Out); +STREAMClose(In); +} + +void ReadTermcap() +{ +STREAM *In, *Out; +char *Buffer=NULL; +int result; + +In=STREAMOpenFile("/tmp/termcap.gz",O_RDONLY); +STREAMAddStandardDataProcessor(In, "compression", "gzip", ""); + +Buffer=SetStrLen(Buffer,4096); +Out=STREAMOpenFile("/tmp/termcap.out",O_CREAT|O_TRUNC|O_WRONLY); +result=STREAMReadBytes(In,Buffer,4096); +while (result > 0) +{ + STREAMWriteBytes(Out,Buffer,result); + result=STREAMReadBytes(In,Buffer,4096); +} +STREAMClose(In); +STREAMClose(Out); +} + +main() +{ + printf("WRITE\n"); + CompressTermcap(); + printf("READ\n"); + ReadTermcap(); +} + +//TarFiles(Out,"*.c"); diff --git a/main.c b/main.c new file mode 100644 index 0000000..beec084 --- /dev/null +++ b/main.c @@ -0,0 +1,529 @@ +//Movgrab. A downloader for movie/media websites. +//Written by Colum Paget. +//Copyright 2010 Colum Paget. + + +/**** Gnu Public Licence ****/ +/* + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + +#include "servicetypes.h" +#include "containerfiles.h" +#include "download.h" +#include "outputfiles.h" +#include "youtube.h" +#include "dailymotion.h" +#include "cbsnews.h" +#include "ehow.h" +#include "display.h" + + + +int Flags=0; +char *ProgName=NULL, *CmdLine=NULL; +char *FormatPreference=NULL; +ListNode *DownloadQueue=NULL; +STREAM *StdIn=NULL; +char *Username=NULL, *Password=NULL; +int STREAMTimeout=30; +int Type=TYPE_NONE; + +int CheckForKeyboardInput() +{ +char *Tempstr=NULL; +int result=FALSE; + +if (STREAMCheckForBytes(StdIn)) +{ + Tempstr=STREAMReadLine(Tempstr,StdIn); + StripTrailingWhitespace(Tempstr); + if (StrLen(Tempstr)) + { + ListAddItem(DownloadQueue,CopyStr(NULL,Tempstr)); + if (! (Flags & FLAG_QUIET)) fprintf(stderr,"\r\nQUEUED: %s\n",Tempstr); + result=TRUE; + } +} +DestroyString(Tempstr); + +return(result); +} + + + + + +//-------- Go through the processes involved in getting a video file +int GrabMovie(char *Path, int MovType) +{ +int i; +char *Proto=NULL, *Server=NULL, *Doc=NULL, *Tempstr=NULL, *Title=NULL; +char *NextPath=NULL; +char *ptr, *Token=NULL; +int Port; +int RetVal=FALSE; + +if (!StrLen(Path)) return(FALSE); + +Type=MovType; +NextPath=CopyStr(NextPath,Path); +ParseURL(Path,&Proto,&Server,&Tempstr,NULL,NULL,&Doc,NULL); +Port=atoi(Tempstr); + +if (strcasecmp(Proto,"https")==0) +{ + if (SSLAvailable) Flags |= FLAG_HTTPS; + else + { + printf("SSL NOT COMPILED IN! Switching from 'https' to 'http'\n"); + NextPath=MCopyStr(NextPath,"http://",Server,"/",ptr); + } +} + +if (Type==TYPE_NONE) +{ +if (GetContainerFileType(Path) != -1) Type=TYPE_CONTAINERFILE; +else Type=IdentifyServiceType(Server); +} + + +if (Type==TYPE_NONE) +{ +if (! (Flags & FLAG_QUIET)) fprintf(stderr,"Unrecognized url type. Falling Back to 'generic youtube frontend'.\n Try using the -t option to force the service type ( \"movgrab -?\" for more details )\n"); +Type=TYPE_GENERIC; +} + +if (Type==TYPE_CONTAINERFILE) RetVal=DownloadContainer(NextPath,Title,Flags); +else +{ +NextPath=SiteSpecificPreprocessing(NextPath, Path, Proto, Server, Port, Doc, &Type, &Title, &Flags); + +if (DownloadPage(NextPath, Type,Title,Flags)) RetVal=TRUE; +} + +DestroyString(Tempstr); +DestroyString(Server); +DestroyString(Doc); +DestroyString(NextPath); +DestroyString(Token); +DestroyString(Title); +DestroyString(Proto); + +return(RetVal); +} + + + +char *GatherMatchingFormats(char *Buffer, char *Type, ListNode *Vars) +{ +ListNode *Curr; +char *Tempstr=NULL; + +Tempstr=CopyStr(Buffer,""); +Curr=ListGetNext(Vars); +while (Curr) +{ +if (strncmp(Curr->Tag,"item:",5)==0) +{ +if ((StrLen(Type)==0) || (strncmp(Curr->Tag,Type,StrLen(Type))==0)) Tempstr=MCatStr(Tempstr,Curr->Tag+5," ",NULL); +} + +Curr=ListGetNext(Curr); +} + +return(Tempstr); +} + +int FmtIDMatches(char *FmtID, char *CurrItem, char *ItemData) +{ + if (strncmp(CurrItem,"item:",5) !=0) return(FALSE); + if (StrLen(FmtID)==0) return(TRUE); + if (strcmp(FmtID,"item:*")==0) return(TRUE); + if ((strncmp(CurrItem,FmtID,StrLen(FmtID))==0) && (StrLen(ItemData))) return(TRUE); + return(FALSE); +} + + + +//this function compares the video formats found on the page to the list of +//preferences expressed by the user with the '-f' flag, and contained in the +//global variable 'FormatPreference' +int SelectDownloadFormat(ListNode *Vars, int WebsiteType, int DisplaySize) +{ +ListNode *Curr; +char *ptr, *Tempstr=NULL, *Fmt=NULL, *FmtID=NULL, *Selected=NULL, *p_ItemFormat; +int RetVal=-1, FoundMatch=FALSE, i; + +Tempstr=GatherMatchingFormats(Tempstr,"",Vars); + if (! (Flags & FLAG_QUIET)) + { + for (i=0; i < 3; i++) + { + if (DisplayAvailableFormats(Vars, Tempstr, DisplaySize)) break; + printf("Connection Refused, sleeping for 20 secs before retry\n"); + sleep(10); + } + } + + ptr=GetToken(FormatPreference,",",&Fmt,0); + while (ptr) + { + if (StrLen(Fmt)) FmtID=MCopyStr(FmtID,"item:",Fmt,NULL); + else FmtID=CopyStr(FmtID,""); + + if (Flags & FLAG_DEBUG) fprintf(stderr," %s ",Fmt); + + FoundMatch=FALSE; + Curr=ListGetNext(Vars); + while (Curr) + { + + if (FmtIDMatches(FmtID,Curr->Tag, (char *) Curr->Item)) + { + if (Flags & (FLAG_DEBUG)) + { + Tempstr=GatherMatchingFormats(Tempstr,FmtID,Vars); + fprintf(stderr,"... YES! %s\n",Tempstr); + } + + FoundMatch=TRUE; + //where available a local filetype overrides a reference + if ((RetVal==-1) || (RetVal==TYPE_REFERENCE)) + { + Selected=CopyStr(Selected,Curr->Tag); + SetVar(Vars,"ID",(char *) Curr->Item); + } + break; + } + Curr=ListGetNext(Curr); + } + if ((! FoundMatch) && (Flags & (FLAG_DEBUG))) fprintf(stderr,"... no\n",Fmt); + ptr=GetToken(ptr,",",&Fmt,0); + } + + +if (StrLen(Selected)) +{ + if (strcmp(Selected,"item:reference")==0) RetVal=TYPE_REFERENCE; + else RetVal=WebsiteType; +} + +if (! (Flags & FLAG_TEST_SITES)) +{ +if (RetVal==-1) fprintf(stderr,"No suitable download format found from '%s'\n\n",FormatPreference); +else if (RetVal==TYPE_REFERENCE) fprintf(stderr,"Reference to another site: %s\n",GetVar(Vars,"ID")); +else fprintf(stderr,"Selected format %s\n",Selected); +} + + +//+5 to get past leading 'item:' in variable name +if (StrLen(Selected)) SetVar(Vars,"DownloadFormat",Selected+5); + +DestroyString(Selected); +DestroyString(Tempstr); +DestroyString(Fmt); +return(RetVal); +} + + + +void PrintVersion() +{ +fprintf(stdout,"\nMovgrab: version %s\n",Version); +} + + +void PrintUsage() +{ +int i; + +PrintVersion(); +fprintf(stdout,"Author: Colum Paget\n"); +fprintf(stdout,"Email: colums.projects@gmail.com\n"); +fprintf(stdout,"Blog: http://idratherhack.blogspot.com \n"); +fprintf(stdout,"\n"); +fprintf(stdout,"Usage: movgrab [-t ] -a [:] [-p http://username:password@x.x.x.x:80 ] [-r] [-b] [-x] [-q] [-st ] [-f ] [-v] [-P] [-Pp] [-o ] [+o ] url\n"); +fprintf(stdout," movgrab -test-sites\n"); +fprintf(stdout,"\n'-v' increases verbosity/debug level\n"); +fprintf(stdout,"'-v -v' prints out all webpages encountered\n"); +fprintf(stdout,"'-v -v -v' maximum debugging\n"); +fprintf(stdout,"'-version' Program version\n"); +fprintf(stdout,"'--version' Program version\n"); +fprintf(stdout,"'-T' Test mode, don't do final download\n"); +fprintf(stdout,"'-P ' Player program (e.g. \"mplayer\")\n"); +fprintf(stdout,"'-Pp' Percent download to launch player at (default 25%)\n"); +fprintf(stdout,"'-a' Authentication info in Username:Password format.\n"); +fprintf(stdout,"'-q' QUIET. No progress/informative output.\n"); +fprintf(stdout,"'-b' Background. Fork into background and nohup\n"); +fprintf(stdout,"'-p' address of http/https/sstunnel proxy server in URL format.\n"); +fprintf(stdout,"'-proxy' address of http/https/sstunnel proxy server in URL format.\n"); +fprintf(stdout,"'-w' Wait for addresses to be entered on stdin.\n"); +fprintf(stdout,"'-st' Connection inactivity timeout in seconds. Set high for sites that 'throttle'\n"); +fprintf(stdout,"'-t' specifies website type.\n"); +fprintf(stdout,"'-r' Resume download (only works when writing a single file, not with +o).\n"); +fprintf(stdout,"'-f' specifies preferred video/audio formats for sites that offer more than one\n"); +fprintf(stdout," example: flv:640x480,flv,mp4,mp3\n"); +fprintf(stdout," Use -T to get a list of formats the site offers\n"); +fprintf(stdout," Use * to mean 'any format' (the default)\n"); +fprintf(stdout," example: flv:640x480,mp4:640x480,*\n"); +fprintf(stdout,"'-o' specifies output file ( '-' for stdout)\n"); +fprintf(stdout,"'+o' add an output file to list of output files ( '-' for stdout)\n"); +fprintf(stdout,"'-x' try to avoid 'family filter' on some sites\n"); +fprintf(stdout,"'-n' For pages with multiple movies (not movie formats, but movies) specifes item selection for download. Argument has the form:\n"); +fprintf(stdout," -n all Download all\n"); +fprintf(stdout," -n 2 Download 2nd item\n"); +fprintf(stdout," -n 2-5 Download 2nd to 5th item\n"); +fprintf(stdout," -n 2- Download from 2nd item onwards\n"); +fprintf(stdout," -n -8 Download from 1st to 8th item\n"); +fprintf(stdout,"-test-sites Test downloading from each supported website"); +fprintf(stdout,"\nThe '-t' argument is optional, Movgrab will try to guess the download type from the provided url.\n\n"); + +fprintf(stdout,"The url should be that of the page that the movie would normally appear on. Movgrab examines the page for embed tags and other information that would normally cause the movie to play on that page.\n"); + +fprintf(stdout,"\nDownload types are:\n"); +for (i=1; DownloadTypes[i] !=NULL; i++) fprintf(stdout,"%-20s %s\n",DownloadTypes[i],DownloadNames[i]); + +fprintf(stdout,"\nIf a website is not in the list, try 'movgrab -t generic '\n"); +fprintf(stdout,"\nMovgrab can also be used to stream from internet radio and pipe it into a player. E.g.'\n movgrab -o - -q -proxy ssltunnel://guest:s3cr3t@sshserver:1022 http://schizoid.in/schizoid-psy.pls | mpg123 -\n"); +fprintf(stdout,"\nFeel free to email me and tell me if you've used this software!\n"); + +fprintf(stdout,"\nThanks for bug reports go to: Philip Pi, Mark Gamar, Rich Kcsa, 'Rampant Badger', 'nibbles', 'deeice', Omair Eshkenazi, Matthias B, Ashish Disawal, Timo Juhani Lindfors, Abhisek Sanyal and others.\n"); +fprintf(stdout,"\nSpecial thanks to:\n"); +fprintf(stdout," 'legatvs' for clive (http://clive.sourceforge.net) another downloader into whose code I had to look to figure out how to get youtube and daily motion working again.\n"); +fprintf(stdout," Robert Crowley (http://oldcoder.org/) For all sorts of bug reports and advice.\n"); +} + + +int ParseType(char *Type) +{ +int i, result=TYPE_NONE; + +for (i=0; DownloadTypes[i] !=NULL; i++) +{ + if (strcasecmp(Type,DownloadTypes[i])==0) result=i; +} +return(result); +} + + +void ParseCommandLine(int argc, char *argv[], ListNode *DL_List, int *OverrideType) +{ +int i,j, DebugLevel=0; +char *ptr; + +ProgName=CopyStr(ProgName,argv[0]); +CmdLine=argv[0]; + + +for (i=1; i < argc; i++) +{ + if (strcmp(argv[i],"-p")==0) Proxy=CopyStr(Proxy,argv[++i]); + else if (strcmp(argv[i],"-proxy")==0) Proxy=CopyStr(Proxy,argv[++i]); + else if (strcmp(argv[i],"-a")==0) + { + ptr=GetToken(argv[++i],":",&Username,0); + ptr=GetToken(ptr,":",&Password,0); + } + else if (strcmp(argv[i],"-v")==0) + { + DebugLevel++; + } + else if (strcmp(argv[i],"-o")==0) + { + i++; + AddOutputFile(argv[i], TRUE); + if (strcmp(argv[i],"-")==0) Flags |= FLAG_STDOUT; + } + else if (strcmp(argv[i],"+o")==0) + { + i++; + AddOutputFile(argv[i], FALSE); + if (strcmp(argv[i],"-")==0) Flags |= FLAG_STDOUT; + } + else if (strcmp(argv[i],"-n")==0) + { + ItemSelectionArg=CopyStr(ItemSelectionArg,argv[++i]); + } + else if (strcmp(argv[i],"-t")==0) *OverrideType=ParseType(argv[++i]); + else if (strcmp(argv[i],"-f")==0) FormatPreference=CopyStr(FormatPreference,argv[++i]); + else if (strcmp(argv[i],"-q")==0) Flags |= FLAG_QUIET; + else if (strcmp(argv[i],"-b")==0) Flags |= FLAG_BACKGROUND; + else if (strcmp(argv[i],"-r")==0) Flags |= FLAG_RESUME; + else if (strcmp(argv[i],"-x")==0) Flags |= FLAG_PORN; + else if (strcmp(argv[i],"-T")==0) Flags |= FLAG_TEST; + else if (strcmp(argv[i],"-w")==0) Flags |= FLAG_STDIN; + else if (strcmp(argv[i],"-st")==0) STREAMTimeout=atoi(argv[++i]); + else if (strcmp(argv[i],"-P")==0) Player=CopyStr(Player,argv[++i]); + else if (strcmp(argv[i],"-Pp")==0) PlayerLaunchPercent=atoi(argv[++i]); + else if (strcmp(argv[i],"-?")==0) Flags |= FLAG_PRINT_USAGE; + else if (strcmp(argv[i],"-h")==0) Flags |= FLAG_PRINT_USAGE; + else if (strcmp(argv[i],"-help")==0) Flags |= FLAG_PRINT_USAGE; + else if (strcmp(argv[i],"--help")==0) Flags |= FLAG_PRINT_USAGE; + else if (strcmp(argv[i],"-version")==0) Flags |= FLAG_PRINT_VERSION; + else if (strcmp(argv[i],"--version")==0) Flags |= FLAG_PRINT_VERSION; + else if (strcmp(argv[i],"-test-sites")==0) + { + Flags |= FLAG_TEST_SITES | FLAG_QUIET; + for (j=1; TestLinks[j] !=NULL; j++) + { + if (StrLen(TestLinks[j])) ListAddNamedItem(DL_List,DownloadTypes[j],CopyStr(NULL,TestLinks[j])); + + } + ItemSelectionArg=CopyStr(ItemSelectionArg,"0"); + } + else + { + ListAddItem(DL_List,CopyStr(NULL,argv[i])); + } + +} + + +if (Flags & FLAG_BACKGROUND) +{ +Flags |= FLAG_QUIET; +demonize(); +} + +if (Flags & FLAG_QUIET) DebugLevel=0; + +if (DebugLevel==1) Flags |= FLAG_DEBUG1; +if (DebugLevel==2) Flags |= FLAG_DEBUG2; +if (DebugLevel > 2) Flags |= FLAG_DEBUG3; +} + +void CheckSettings() +{ +char *Token=NULL, *ptr; +char *ProxyTypes[]={"http","https","sshtunnel",NULL}; +int i; + +if ((! isatty(1)) && (! (Flags & FLAG_STDOUT))) +{ +fprintf(stderr,"\nWARNING: Stdout does not seem to be a terminal, so it could be a pipe to another program. But you've not used '-o -' or '+o -' to redirect output into a pipe. Hence output will be written to a file. If you're piping into a player app, and there's no sound/video, then you need to add '-o -'\n\n"); +} + +if (StrLen(Proxy)) +{ + ptr=GetToken(Proxy,":",&Token,0); + if (MatchTokenFromList(Token,ProxyTypes,0)==-1) + { + fprintf(stderr,"\nWARNING: Unknown proxy type '%s'. Probably won't work. Known types are: ",Proxy); + for (i=0; ProxyTypes[i] != NULL; i++) fprintf(stderr," %s,",ProxyTypes[i]); + fprintf(stderr,"\n\n"); + } +} + +DestroyString(Token); +} + + +void ParseEnvironmentVariables() +{ +char *Tempstr=NULL; + +Tempstr=CopyStr(Tempstr,getenv("http_proxy")); +if (StrLen(Tempstr)) +{ + if ( + (strncasecmp(Tempstr,"http:",5) !=0) && + (strncasecmp(Tempstr,"https:",6) !=0) + ) Proxy=MCopyStr(Proxy,"http:",Tempstr,NULL); + else Proxy=CopyStr(Proxy,Tempstr); +} +else +{ + Tempstr=CopyStr(Tempstr,getenv("ssh_tunnel")); + if (StrLen(Tempstr)) + { + if (strncasecmp(Tempstr,"sshtunnel:",10)==0) Proxy=CopyStr(Proxy,Tempstr); + else if (strncasecmp(Tempstr,"ssh:",4)==0) Proxy=MCopyStr(Proxy,"sshtunnel:",Tempstr+4,NULL); + else Proxy=MCopyStr(Proxy,"sshtunnel:",Tempstr,NULL); + } +} + +DestroyString(Tempstr); +} + + + +main(int argc, char *argv[]) +{ +ListNode *Curr, *Next; +int OverrideType=TYPE_NONE; +char *Tempstr=NULL; +int result; + +HTTPSetFlags(HTTP_NOCOMPRESS); +StdIn=STREAMFromFD(0); +STREAMSetTimeout(StdIn,0); +ParseEnvironmentVariables(); + +DownloadQueue=ListCreate(); +Tempstr=MCopyStr(Tempstr,"Movgrab ",Version,NULL); +HTTPSetUserAgent(Tempstr); +FormatPreference=CopyStr(FormatPreference,"mp4,flv,webm,m4v,mov,mpg,mpeg,wmv,avi,3gp,reference,mp3,m4a,wma,stream"); +AddOutputFile("", TRUE); + +ParseCommandLine(argc, argv, DownloadQueue, &OverrideType); +CheckSettings(); + + +if (Flags & FLAG_PRINT_USAGE) PrintUsage(); +else if (Flags & FLAG_PRINT_VERSION) PrintVersion(); +else if (! (Flags & FLAG_STDIN)) +{ + if (ListSize(DownloadQueue)==0) PrintUsage(); +} + + +while (1) +{ + if ((Flags & FLAG_STDIN) && (ListSize(DownloadQueue)==0) ) + { + Tempstr=STREAMReadLine(Tempstr,StdIn); + StripTrailingWhitespace(Tempstr); + ListAddItem(DownloadQueue,CopyStr(NULL,Tempstr)); + } + + Curr=ListGetNext(DownloadQueue); + while (Curr) + { + if (Flags & FLAG_TEST_SITES) + { + fprintf(stderr,"Checking %-20s ",Curr->Tag); + fflush(NULL); + } + + result=GrabMovie((char *) Curr->Item,OverrideType); + Next=ListGetNext(Curr); //must do this after grab movie + //incase more items added while grabbing + + if (Flags & FLAG_TEST_SITES) + { + if (result) fprintf(stderr," okay\n"); + else fprintf(stderr," BROKEN\n"); + } + + ListDeleteNode(Curr); + + Curr=Next; + } + + if (Flags & FLAG_TEST_SITES) break; + if (! (Flags & FLAG_STDIN)) break; +} + +} diff --git a/outputfiles.c b/outputfiles.c new file mode 100644 index 0000000..7022a09 --- /dev/null +++ b/outputfiles.c @@ -0,0 +1,262 @@ +#include "outputfiles.h" + + +ListNode *OutputFiles; + + +//---------------- Functions to do with files and file names ---------- + +//Strip out characters that make it difficult to specify a file on the +//command line, such as '&' or ';' '>' that mean something to the shell +char *MakeFilesystemSafeName(char *Buffer, char *Path) +{ +char *Str=NULL; +char BadChars[]="'\"()/?*&<>; "; +char *ptr; + +Str=CopyStr(Buffer,""); +ptr=Path; +while (ptr && (*ptr != '\0')) +{ + if (strchr(BadChars,*ptr)) Str=AddCharToStr(Str,'_'); + else Str=AddCharToStr(Str,*ptr); + ptr++; +} +return(Str); +} + + +//guess the extension of a file, some sites don't have extensions +//on their filenames +char *GuessExtn(char *ContentType, char *Format, char *ID) +{ +static char *Extn=NULL; +char *ptr; + +Extn=CopyStr(Extn,".flv"); + +if (StrLen(ID)) +{ + ptr=strchr(ID,'.'); + if (StrLen(ptr)) Extn=CopyStr(Extn,ptr); +} + +if (StrLen(Format)) Extn=MCopyStr(Extn,".",Format,NULL); + +if (StrLen(ContentType)) +{ +ptr=NULL; +if (strcasecmp(ContentType,"audio/mp3")==0) ptr=".mp3"; +else if (strcasecmp(ContentType,"audio/mpeg")==0) ptr=".mp3"; +else if (strcasecmp(ContentType,"video/x-flv")==0) ptr=".flv"; +else if (strcasecmp(ContentType,"video/flv")==0) ptr=".flv"; +else if (strcasecmp(ContentType,"video/mp4")==0) ptr=".mp4"; +else if (strcasecmp(ContentType,"video/3gpp")==0) ptr=".3gp"; +else if (strcasecmp(ContentType,"audio/webm")==0) ptr=".webm"; +else if (strcasecmp(ContentType,"video/webm")==0) ptr=".webm"; +if (StrLen(ptr)) Extn=CopyStr(Extn,ptr); +} + +return(Extn); +} + + +//URL is used to provide a unique MD5 so that two downloads from +//different sites with the same title don't overwrite each other +char *GetSaveFilePath(char *RetStr, char *Title, char *URL) +{ +char *ptr=NULL; +char *Tempstr=NULL, *MD5=NULL; + + +if (StrLen(Title)) ptr=Title; +else +{ + //Assume the filename is the document part of the url + ptr=strrchr(URL,'?'); + if (ptr) *ptr='\0'; + + + ptr=strrchr(URL,'/'); + if (ptr) ptr++; + else ptr=URL; +} + +Tempstr=MakeFilesystemSafeName(RetStr, ptr); +ptr=strrchr(Tempstr,'.'); + +//some titles might have '.' in them, but not have an extension +//only assume it's an extension if it's under six chars long +if (ptr && (StrLen(ptr) < 6)) *ptr='\0'; + +if (! (Flags & FLAG_RESUME)) +{ + HashBytes(&MD5,"md5",URL,StrLen(URL),ENCODE_HEX); + Tempstr=MCatStr(Tempstr,"-",MD5,NULL); +} + +//Some stupid sites start pagenames with a space, and we don't want this in the filename +StripLeadingWhitespace(Tempstr); + +DestroyString(MD5); + +return(Tempstr); +} + + +//Open the file we are going to save the move to. Check in the user +//filename preference stored in the global variable 'SaveFilePath' +//If that's set to '-' then open stdout and write to that, if it's +//set to anything else, then use that as the filename. Otherwise +//build the filename from available info. +STREAM *OpenSaveFile(char *Path, double *FileSize, int ResumeDownload) +{ +STREAM *S=NULL; +struct stat FStat; + +*FileSize=0; + +if (strcmp(Path,"-")==0) +{ + S=STREAMFromFD(1); + STREAMSetTimeout(S,0); +} +else +{ + S=STREAMOpenFile(Path,O_CREAT | O_RDWR); + + if (! STREAMLock(S,LOCK_EX|LOCK_NB)) + { + if (! (Flags & FLAG_QUIET)) fprintf(stderr,"Already downloading this item!\n"); + fflush(NULL); + exit(0); + } + + //Filesize can be used to resume a part download + if (ResumeDownload) + { + fstat(S->in_fd,&FStat); + *FileSize=(double) FStat.st_size; + STREAMSeek(S,0,SEEK_END); + } +} + + +return(S); +} + +STREAM *OpenCacheFile(char *Title, char *URL) +{ +char *Tempstr=NULL; +STREAM *S=NULL; +glob_t Glob; + +Tempstr=GetSaveFilePath(Tempstr, Title, URL); +Tempstr=CatStr(Tempstr,".*"); + +glob(Tempstr,0,0,&Glob); + +if (Glob.gl_pathc > 0) +{ +S=STREAMOpenFile(Glob.gl_pathv[0],O_RDONLY); +} + +globfree(&Glob); + +DestroyString(Tempstr); + +return(S); +} + +void OpenOutputFiles(char *Title, char *URL, double *FileSize) +{ +char *Tempstr=NULL; +ListNode *Curr; +int val=0, Resume=FALSE; + +if ((Flags & FLAG_RESUME) && (ListSize(OutputFiles)==1)) Resume=TRUE; + +Curr=ListGetNext(OutputFiles); +while (Curr) +{ + if (StrLen(Curr->Tag)==0) + { + Tempstr=GetSaveFilePath(Tempstr, Title, URL); + Curr->Item=OpenSaveFile(Tempstr, FileSize, Resume); + } + else if (strcmp(Curr->Tag,"-")==0) Curr->Item=STREAMFromFD(1); + else Curr->Item=OpenSaveFile(Curr->Tag, FileSize, Resume); + +Curr=ListGetNext(Curr); +} + + +DestroyString(Tempstr); +} + + +void WriteOutputFiles(char *Data, int Len) +{ +ListNode *Curr; + +Curr=ListGetNext(OutputFiles); +while (Curr) +{ +if (Curr->Item) STREAMWriteBytes((STREAM *) Curr->Item,Data,Len); +Curr=ListGetNext(Curr); +} +} + +void CloseOutputFiles(char *Extn) +{ +ListNode *Curr; +char *Tempstr=NULL; +STREAM *S; + +Curr=ListGetNext(OutputFiles); +while (Curr) +{ +if ((Curr->Item) && (strcmp(Curr->Tag,"-") !=0)) +{ + S=(STREAM *) Curr->Item; + if (! StrLen(Curr->Tag)) + { + Tempstr=MCopyStr(Tempstr,S->Path,Extn,NULL); + rename(S->Path,Tempstr); + } + STREAMClose(S); +} +Curr=ListGetNext(Curr); +} +DestroyString(Tempstr); +} + + +void AddOutputFile(char *Path, int SingleOutput) +{ +//if 'SingleOutput' is set then overwrite any existing outputs, this should be the +//only one +if (SingleOutput) ListClear(OutputFiles,NULL); + +if (! OutputFiles) OutputFiles=ListCreate(); +ListAddNamedItem(OutputFiles,Path,NULL); + + +} + + +char *OutputFilesGetFilePath() +{ +ListNode *Curr; +STREAM *S; + +Curr=ListGetNext(OutputFiles); +while (Curr) +{ +S=(STREAM *) Curr->Item; +if (S && (strcmp(Curr->Tag,"-") !=0)) return(S->Path); +Curr=ListGetNext(Curr); +} + +return(""); +} diff --git a/outputfiles.h b/outputfiles.h new file mode 100644 index 0000000..00be7f6 --- /dev/null +++ b/outputfiles.h @@ -0,0 +1,14 @@ + +#ifndef MOVGRAB_OUTPUT_FILES +#define MOVGRAB_OUTPUT_FILES + +#include "common.h" + +char *OutputFilesGetFilePath(); +void OpenOutputFiles(char *Title, char *URL, double *FileSize); +void WriteOutputFiles(char *Data, int Len); +void AddOutputFile(char *Path, int SingleOutput); +char *GuessExtn(char *ContentType, char *Format, char *ID); + + +#endif diff --git a/servicetypes.c b/servicetypes.c new file mode 100644 index 0000000..6603f6f --- /dev/null +++ b/servicetypes.c @@ -0,0 +1,2364 @@ +#include "servicetypes.h" +#include "containerfiles.h" + +/* +This file and it's header (servicetypes.h) holds all the functions and data +related to individual services/sites. When adding a site you need to add to +the arrays 'DownloadTypes', 'DownloadNames' and 'TestLinks' and to the +enumerated type in servicetypes.h tht matches to 'DownloadTypes'. + +Then site specific +*/ + + + +//Site type names used at the command line etc +char *DownloadTypes[]={"none","generic","youtube","metacafe","dailymotion","break","ehow","vimeo","vbox7","blip.tv","ted","myvideo","mytopclip","redbalcony","mobango","yale","princeton","reuters","liveleak","academicearth","photobucket","aljazeera","mefeedia","iviewtube","washingtonpost","cbsnews","france24","euronews","metatube","motionfeeds","escapist","guardian","redorbit","scivee","izlese","uctv.tv","royalsociety.tv","britishacademy","kitp","dotsub","astronomy.com","teachertube.com","discovery","bloomberg","nationalgeographic","videobash","ibtimes","smh","videojug","animehere","funnyordie",NULL}; + +//Longer names used in display +char *DownloadNames[]={"none", +"Generic: Search in page for http://*.flv, http://*.mp3, http//*.mp4 etc, etc, etc", +"YouTube: http://www.youtube.com", +"Metacafe: http://www.metacafe.com", +"Daily Motion: http://www.dailymotion.com", +"www.break.com", +"www.ehow.com", +"www.vimeo.com", +"www.vbox7.com", +"www.blip.tv", +"www.ted.com", +"www.myvideo.de", +"www.mytopclip.com", +"www.redbalcony.com", +"www.mobango.com", +"Yale University: http://oyc.yale.edu", +"Princeton University: http://www.princeton.edu/WebMedia/", +"Reuters: http://www.reuters.com/", +"Liveleak: http://www.liveleak.com", +"Academic Earth: http://www.academicearth.org", +"Photobucket: http://www.photobucket.com", +"Aljazeera: english.aljazeera.net", +"mefeedia.com", +"iViewTube: www.iviewtube.com", +"Washington Post: www.washingtonpost.com", +"CBS News: www.cbsnews.com", +"France24: www.france24.com", +"Euronews: www.euronews.net", +"www.metatube.com", +"www.motionfeeds.com", +"www.escapistmagazine.com", +"www.guardian.co.uk", +"www.redorbit.com", +"www.scivee.tv", +"www.izlese.org", +"University of California Television: http://www.uctv.tv/", +"http://royalsociety.org/", +"http://britac.studyserve.com", +"KAVLI INSTITUTE: http://online.itp.ucsb.edu/plecture/", +"dotsub.com", +"astronomy.com", +"teachertube.com", +"dsc.discovery.com", +"www.bloomberg.com (not bloomberg.tv)", +"National Geographic (http://video.nationalgeographic.com)", +"videobash", +"International Business Times", +"Sidney Morning Herald", +"www.videojug.com", +"www.animehere.com", +"Funny or Die (http://www.funnyordie.com)", +NULL}; + +//"http://vimeo.com/33204284", +//links used by the -test-sites feature to test if a download site still +//works with movgrab +char *TestLinks[]={"", "", +"http://www.youtube.com/watch?v=Vxp3seoRNgY", +"http://www.metacafe.com/watch/6063075/how_to_use_chopsticks/", +"http://www.dailymotion.com/video/x5790e_hubblecast-16-galaxies-gone-wild_tech", +"http://www.break.com/index/ninja-cat.html", +"http://www.ehow.com/video_6819748_creamy-thyme-scrambled-eggs-recipe.html", +"broken", +"http://www.vbox7.com/play:1417ad5a", +"http://blip.tv/greshamcollege/whengalaxiescollide_carolincrawford-6575570", +"http://www.ted.com/talks/janine_benyus_shares_nature_s_designs.html", +"http://www.myvideo.de/watch/9949/tornados", +"http://www.mytopclip.com/videos/32501/flip-over-card-trick-revealed", +"http://www.redbalcony.com/?vid=29433", +"http://www.mobango.com/media_details/struck_in_tsunami/%21tKpzdHIo5E%3D/", +"http://oyc.yale.edu/economics/game-theory/contents/sessions/session-1-introduction-five-first-lessons", +"http://www.princeton.edu/WebMedia/flash/lectures/20100428_publect_taibbi_tett.shtml", +"http://www.reuters.com/news/video/story?videoId=193471398&videoChannel=4", +"http://www.liveleak.com/view?i=a7b_1299633723", +"http://www.academicearth.org/lectures/interaction-with-physical-environment", +"http://gs147.photobucket.com/groups/r299/QM25Y4IJEP/?action=view¤t=BlackSwan1.mp4", +"http://english.aljazeera.net/programmes/countingthecost/2011/02/2011219142816937101.html", +"http://www.mefeedia.com/video/36135458", +"http://www.iviewtube.com/v/152128/insane-hail-storm-oklahoma-city", +"http://www.washingtonpost.com/business/on-leadership-modern-day-machiavellis-/2011/02/18/ABYgckH_video.html", +"http://www.cbsnews.com/video/watch/?id=7357739n", +"http://www.france24.com/en/20110219-beyond-business-cybercriminality-iphone-mobile-security", +"http://www.euronews.com/news/bulletin/", +"http://www.metatube.com/en/videos/cid2/Funny-Videos/53210/Rail-Jump-Fail/", +"http://www.motionfeeds.com/10401/helsinki-travel-guide.html", +"http://www.escapistmagazine.com/videos/view/zero-punctuation/1776-Red-Dead-Redemption", +"http://www.guardian.co.uk/world/video/2011/may/13/fukushima-radiation-dairy-farmers-video", +"http://www.redorbit.com/news/video/science_2/2598565/unlocking_mysteries_of_sharks/index.html", +"http://www.scivee.tv/node/5300", +"http://www.izlese.org/hot-girl-hot-cars-911-turbo-vs-mercedes-s550-vs-rally-car.html", +"http://www.uctv.tv/search-details.aspx?showID=20888", +"http://royalsociety.tv/rsPlayer.aspx?presentationid=474", +"broken", +"http://online.itp.ucsb.edu/plecture/bmonreal11/", +"http://dotsub.com/view/5d90ef11-d5e5-42fb-8263-a4c128fb64df", +"http://www.astronomy.com/News-Observing/Liz%20and%20Bills%20Cosmic%20Adventures/2011/02/Episode%202.aspx", +"http://www.teachertube.com/viewVideo.php?video_id=114089&title=Marco_Polo", +"http://dsc.discovery.com/videos/how-the-universe-works-birth-of-a-black-hole.html", +"http://www.bloomberg.com/video/72477250/", +"http://video.nationalgeographic.com/video/environment/environment-natural-disasters/earthquakes/earthquake-101/", +"http://www.videobash.com/video_show/wing-suit-amazing-footage-6086", +"http://tv.ibtimes.com/woolly-mammoth-skeleton-discovered-near-paris-nicknamed-helmut-7190", +"http://www.smh.com.au/technology/sci-tech/newly-discovered-planets-include-superearth-20110913-1k7tl.html", +"http://www.videojug.com/film/how-to-do-the-best-card-trick-in-the-world", +"http://www.animehere.com/accel-world-episode-1.html", +"http://www.funnyordie.com/videos/032785be3a/genie-on-hard-times-with-parker-posey?playlist=featured_videos", +NULL}; + + +int SelectDownloadFormat(ListNode *Vars, int WebsiteType, int DisplaySize); + + +//Guess service type from servername in URL +int IdentifyServiceType(char *Server) +{ +int Type=0; + +if ( + (strstr(Server,"youtube")) + ) Type=TYPE_YOUTUBE; + +if (strcmp(Server,"www.metacafe.com")==0) +{ + Type=TYPE_METACAFE; +} +else if (strcmp(Server,"www.break.com")==0) +{ + Type=TYPE_BREAK_COM; +} +else if (strstr(Server,".ehow.")) +{ + Type=TYPE_EHOW; +} +else if (strcmp(Server,"www.dailymotion.com")==0) +{ + Type=TYPE_DAILYMOTION; +} +else if (strcmp(Server,"www.ted.com")==0) +{ + Type=TYPE_TED; +} +else if (strcmp(Server,"oyc.yale.edu")==0) +{ + Type=TYPE_YALE; +} +else if (strcmp(Server,"www.princeton.edu")==0) +{ + Type=TYPE_PRINCETON; +} +else if (strcmp(Server,"www.academicearth.org")==0) +{ + Type=TYPE_ACADEMIC_EARTH; +} +else if (strstr(Server,"photobucket.com")) +{ + Type=TYPE_PHOTOBUCKET; +} +else if (strstr(Server,"vbox7.com")) +{ + Type=TYPE_VBOX7; +} +else if (strstr(Server,"myvideo")) +{ + Type=TYPE_MYVIDEO; +} +else if (strstr(Server,"redbalcony.com")) +{ + Type=TYPE_REDBALCONY; +} +else if (strstr(Server,"mobango.com")) +{ + Type=TYPE_MOBANGO; +} +else if (strstr(Server,"izlese.org")) +{ + Type=TYPE_IZLESE; +} +else if (strstr(Server,"mytopclip.com")) +{ + Type=TYPE_MYTOPCLIP; +} +else if (strstr(Server,"liveleak")) +{ + Type=TYPE_LIVELEAK; +} +else if (strstr(Server,"ibtimes")) +{ + Type=TYPE_IBTIMES; +} +else if (strstr(Server,"smh.com.au")) +{ + Type=TYPE_SMH; +} +else if (strstr(Server,"blip.tv")) +{ + Type=TYPE_BLIPTV; +} +else if (strstr(Server,"vimeo.com")) +{ + Type=TYPE_VIMEO; +} +else if (strstr(Server,"reuters")) +{ + Type=TYPE_REUTERS; +} +else if (strstr(Server,"mefeedia.com")) +{ + Type=TYPE_MEFEEDIA; +} +else if (strstr(Server,"ucsd.tv")) +{ + Type=TYPE_UCTV; +} +else if (strstr(Server,"uctv.tv")) +{ + Type=TYPE_UCTV; +} +else if (strstr(Server,"aljazeera.net")) +{ + Type=TYPE_ALJAZEERA; +} +else if (strstr(Server,"iviewtube.com")) +{ + Type=TYPE_IVIEWTUBE; +} +else if (strstr(Server,"washingtonpost")) +{ + Type=TYPE_WASHINGTONPOST; +} +else if (strstr(Server,"cbsnews")) +{ + Type=TYPE_CBSNEWS; +} +else if (strstr(Server,"france24")) +{ + Type=TYPE_FRANCE24; +} +else if (strstr(Server,"euronews")) +{ + Type=TYPE_EURONEWS; +} +else if (strstr(Server,"metatube")) +{ + Type=TYPE_METATUBE; +} +else if (strstr(Server,"motionfeeds")) +{ + Type=TYPE_MOTIONFEEDS; +} +else if (strstr(Server,"guardian")) +{ + Type=TYPE_GUARDIAN; +} +else if (strstr(Server,"redorbit")) +{ + Type=TYPE_REDORBIT; +} +else if (strstr(Server,"scivee")) +{ + Type=TYPE_SCIVEE; +} +else if (strstr(Server,"escapistmagazine.com")) +{ + Type=TYPE_ESCAPIST; +} +else if (strcmp(Server,"royalsociety.tv")==0) +{ + Type=TYPE_ROYALSOCIETY_STAGE2; +} +else if (strcmp(Server,"royalsociety.org")==0) +{ + Type=TYPE_ROYALSOCIETY; +} +else if (strcmp(Server,"britac.studyserve.com")==0) +{ + Type=TYPE_BRITISHACADEMY; +} +else if (strcmp(Server,"online.itp.ucsb.edu")==0) +{ + Type=TYPE_KAVLIINSTITUTE; +} +else if (strcmp(Server,"dotsub.com")==0) +{ + Type=TYPE_DOTSUB; +} +else if (strstr(Server,"astronomy.com")) +{ + Type=TYPE_ASTRONOMYCOM; +} +else if (strstr(Server,"teachertube.com")) +{ + Type=TYPE_TEACHERTUBE; +} +else if (strstr(Server,"discovery.com")) +{ + Type=TYPE_DISCOVERY; +} +else if (strstr(Server,"nationalgeographic.com")) +{ + Type=TYPE_NATGEO; +} +else if (strstr(Server,"bloomberg.com")) +{ + Type=TYPE_BLOOMBERG; +} +else if (strstr(Server,"www.videobash.com")) +{ + Type=TYPE_VIDEOBASH; +} +else if (strstr(Server,"www.videojug.com")) +{ + Type=TYPE_VIDEOJUG; +} +else if (strstr(Server,"animehere.com")) +{ + Type=TYPE_ANIMEHERE; +} +else if (strstr(Server,"funnyordie.com")) +{ + Type=TYPE_FUNNYORDIE; +} +else if (strstr(Server,".google.")) +{ + Type=TYPE_GOOGLE_URL; +} + +return(Type); +} + + + +//A couple of old functions related to specific sites. As these sites no longer +//work it is likely that these functions will be removed some day +int DoVBOX7(char *ID, char *Title) +{ +char *Dir=NULL, *Tempstr=NULL; +int i, RetVal=FALSE; + +Dir=CopyStrLen(Dir,ID,2); + +for (i=1; i < 50; i++) +{ + if (i==0) Tempstr=FormatStr(Tempstr,"http://media.vbox7.com/s/%s/%s.flv",Dir,ID); + else Tempstr=FormatStr(Tempstr,"http://media%02d.vbox7.com/s/%s/%s.flv",i,Dir,ID); + if (DownloadItem(Tempstr, Title, Flags)) + { + RetVal=TRUE; + break; + } +} + +DestroyString(Dir); +DestroyString(Tempstr); + +return(RetVal); +} + + +char *ExtractMetacafeMediaURL(char *RetStr, char *Data, char *Start, char *End) +{ +char *Tempstr=NULL, *Token=NULL, *ptr; + + + ptr=strstr(Data,Start); + ptr+=StrLen(Start); + ptr=GetToken(ptr,End,&Token,0); + Tempstr=HTTPUnQuote(Tempstr,Token); + RetStr=MCopyStr(RetStr,Tempstr,"?__gda__=",NULL); + ptr=GetToken(Data,"gdaKey=",&Token,0); + ptr=GetToken(ptr,"&",&Token,0); + RetStr=CatStr(RetStr,Token); + +DestroyString(Tempstr); +DestroyString(Token); + + +return(RetStr); +} + + +// These functions used by escapist magazine, but the method might be more +// generic than just that one side +void ParseFlashPlaylistItem(char *Data,ListNode *Vars) +{ +char *Name=NULL, *Value=NULL, *URL=NULL, *Type=NULL, *ptr; + +strrep(Data,'\'',' '); +ptr=GetNameValuePair(Data,",",":",&Name,&Value); +while (ptr) +{ +StripTrailingWhitespace(Name); +StripLeadingWhitespace(Name); +StripQuotes(Name); + +StripTrailingWhitespace(Value); +StripLeadingWhitespace(Value); +StripQuotes(Value); + + +if (StrLen(Name)) +{ + if (strcmp(Name,"eventCategory")==0) Type=CopyStr(Type,Value); + if (strcmp(Name,"url")==0) URL=CopyStr(URL,Value); +} + +ptr=GetNameValuePair(ptr,",",":",&Name,&Value); +} + +if (StrLen(Type) && (strcmp(Type,"Video")==0)) SetVar(Vars,"item:mp4",URL); + +DestroyString(Name); +DestroyString(Value); +DestroyString(URL); +DestroyString(Type); + +} + + +void ParseFlashPlaylist(char *Data, ListNode *Vars) +{ +char *Tempstr=NULL, *Item=NULL, *ptr; + +//This clips the playlist structure out into Tempstr +ptr=GetToken(Data,"{'playlist':[",&Tempstr,0); +ptr=GetToken(ptr,"]",&Tempstr,0); + +ptr=GetToken(Tempstr,"{",&Item,0); +while (ptr) +{ +//'Item' no contains one playlist item +ptr=GetToken(ptr,"}",&Item,0); +ParseFlashPlaylistItem(Item,Vars); + +ptr=GetToken(ptr,"{",&Item,0); +} + +DestroyString(Tempstr); +DestroyString(Item); +} + + + +//This function is called before we even pull the first page from a site +//it is a good place to do any site-specific stuff like rewriting the +//site URL to a form that's better for movgrab +char *SiteSpecificPreprocessing(char *RetBuff, char *Path, char *Proto, char *Server, int Port, char *Doc, int *Type, char **Title, int *Flags) +{ +char *Tempstr=NULL; +char *NextPath=NULL; +char *ptr, *Token=NULL; + +NextPath=CopyStr(RetBuff,Path); + +if (*Type==TYPE_YOUTUBE) +{ + + //hmm.. have we been given the http://www.youtube.com/v/ or https://www.youtube.com/embed/ format? + + if (strncmp(Doc,"/v/",3)==0) Token=CopyStr(Token,Doc+3); + else if (strncmp(Doc,"/embed/",7)==0) Token=CopyStr(Token,Doc+7); + else if (strncmp(Doc,"/watch?v=",9)==0) Token=CopyStr(Token,Doc+9); + else + { + *Type=TYPE_YOUTUBE_PLAYLIST; + NextPath=MCopyStr(NextPath,Proto,"://",Server,"/",Doc,NULL); + } + + if (*Type == TYPE_YOUTUBE) + { + //strip any http arguments + ptr=strrchr(Token,'?'); + if (ptr) *ptr='\0'; + + NextPath=MCopyStr(NextPath,Proto,"://www.youtube.com/get_video_info?&video_id=",Token,"&el=detailpage&ps=default&eurl=&gl=US&hl=enB",NULL); + } + + //Do we have authentication info? + //if (StrLen(Username) && StrLen(Password)) YoutubeLogin(Username,Password); + +} +else if (*Type==TYPE_METACAFE) +{ + ptr=GetToken(Doc,"watch/",&Token,0); + ptr=GetToken(ptr,"/",&Token,0); + if (strchr(Token,'-')) + { + //Movie is embedded from elsewhere + if (strncmp(Token,"yt",2)==0) + { + ptr=strrchr(Token,'-'); + if (ptr) + { + ptr++; + // *Type=TYPE_NONE; + // Tempstr=MCopyStr(Tempstr,"http://www.youtube.com/watch?v=",ptr,NULL); + // GrabMovie(Tempstr); + + *Type=TYPE_YOUTUBE; + NextPath=MCopyStr(NextPath,"http://www.youtube.com/watch?v=",ptr,NULL); + + } + } + else if (! (*Flags & FLAG_QUIET)) fprintf(stderr,"Movie is not genuinely stored on metacafe, it is embedded from elsewhere, but it's not youtube, so I don't know how to download it. Sorry.\n"); + } + else + { + STREAM *S; + + if (*Flags & FLAG_PORN) + { + //Initial 'turn off family filter' + Tempstr=FormatStr(Tempstr,"%s://%s:%d/f/index.php?inputType=filter&controllerGroup=user&filters=0&submit=Continue+-+I%27m+over+18",Proto,Server,Port); + S=HTTPMethod("POST",Tempstr,"",""); + STREAMClose(S); + + //But we have to do it twice, probably something to do with cookies + NextPath=FormatStr(NextPath,"http://%s:%d/f/index.php?inputType=filter&controllerGroup=user&filters=0&Continue=Continue+-+I%27m+over+18&prevURL=%s",Server,Port,Path); + } + else NextPath=CopyStr(NextPath,Path); + } +} +else if (*Type==TYPE_DAILYMOTION) +{ + if (*Flags & FLAG_PORN) + { + Tempstr=HTTPQuote(Tempstr,Doc); + NextPath=FormatStr(NextPath,"http://%s:%d/family_filter?urlback=/%s&enable=false",Server,Port,Tempstr); + } + else NextPath=CopyStr(NextPath,Path); +} +else if (*Type==TYPE_PRINCETON) +{ + ptr=strrchr(Doc,'/'); + if (ptr) + { + ptr++; + *Title=CopyStr(*Title,ptr); + ptr=strrchr(*Title,'.'); + if (ptr) *ptr='\0'; + } + NextPath=CopyStr(NextPath,Path); +} +else if (*Type==TYPE_VIMEO) +{ + NextPath=MCopyStr(NextPath,"http://player.vimeo.com/video/",Doc,NULL); +} +else if (*Type==TYPE_GOOGLE_URL) +{ + ptr=strstr(Path,"url?q="); + if (ptr) + { + ptr+=6; + ptr=GetToken(ptr,"&",&Token,NULL); + NextPath=HTTPUnQuote(NextPath,Token); + *Type==TYPE_REFERENCE; + } +} +else +{ + NextPath=CopyStr(NextPath,Path); +} + +DestroyString(Tempstr); +DestroyString(Token); + +return(NextPath); +} + + + + +//For websites with multiple videos on a page (not multiple formats of the +//same video, but actual different videos) decide which one to get +void HandleMultipleMedia(int Type,char *Server,int Flags,ListNode *Vars,int MediaCount) +{ +char *Tempstr=NULL, *ptr; +int i, startpos, endpos; + +startpos=0; +endpos=MediaCount; + + if (MediaCount==1) endpos=1; + else if (StrLen(ItemSelectionArg)==0) + { + if (! (Flags & FLAG_QUIET)) + { + fprintf(stderr,"\nMultiple downloads exist on this page.\n"); + fprintf(stderr,"Please select by using the command-line argument -n \n"); + fprintf(stderr," e.g. -n all\n"); + fprintf(stderr," -n 0-4\n"); + fprintf(stderr," -n 3-\n\n"); + for (i=0; i < MediaCount; i++) + { + Tempstr=FormatStr(Tempstr,"ID:%d",i); + ptr=GetVar(Vars,Tempstr); + if (ptr) ptr=strrchr(ptr,'.'); + if (! ptr) ptr="?"; + + Tempstr=FormatStr(Tempstr,"Title:%d",i); + fprintf(stderr," % 4d: %4s %s\n",i,ptr,GetVar(Vars,Tempstr)); + } + fprintf(stderr,"\n"); + } + endpos=startpos; + } + else if (strcmp(ItemSelectionArg,"all")==0) + { + //do nothing + } + else if (strchr(ItemSelectionArg,'-')) + { + ptr=GetToken(ItemSelectionArg,"-",&Tempstr,0); + if (StrLen(Tempstr)) startpos=atoi(Tempstr); + else startpos=0; + if (StrLen(ptr)) endpos=atoi(ptr); + else endpos=MediaCount; + } + else + { + startpos=atoi(ItemSelectionArg); + endpos=startpos+1; + } + + for (i=startpos; i < endpos; i++) + { + Tempstr=FormatStr(Tempstr,"ID:%d",i); + ptr=GetVar(Vars,Tempstr); + SetVar(Vars,"ID",ptr); + //GetNextURL(Type, Server, Flags, Vars); + GrabMovie(ptr, TYPE_YOUTUBE); + } + +DestroyString(Tempstr); +} + + + + + +//Called after the first page has been downloaded from the site +//Decides what to do next (Download another page, download the actual +//media item, give up, etc. + +int GetNextURL(int Type, char *Server, int Flags, ListNode *Vars) +{ +char *Tempstr=NULL, *Title=NULL, *Fmt=NULL, *ptr; +int RetVal=FALSE; + +Title=CopyStr(Title,GetVar(Vars,"Title")); +Fmt=CopyStr(Fmt,GetVar(Vars,"DownloadFormat")); + +switch (Type) +{ +case TYPE_REFERENCE: + Tempstr=CopyStr(Tempstr,GetVar(Vars,"ID")); + if (GetContainerFileType(Tempstr) != -1) RetVal=DownloadContainer(Tempstr, Title, Flags); + else RetVal=GrabMovie(Tempstr,TYPE_NONE); +break; + +case TYPE_YOUTUBE: + Tempstr=CopyStr(Tempstr,GetVar(Vars,"ID")); + RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); +break; + +case TYPE_YOUTUBE_PLAYLIST: + Tempstr=CopyStr(Tempstr,GetVar(Vars,"ID")); + RetVal=DownloadPage(Tempstr,TYPE_YOUTUBE, Title, Flags); +break; + + +case TYPE_BREAK_COM: + Tempstr=CopyStr(Tempstr,GetVar(Vars,"ID")); + RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); +break; + +case TYPE_EHOW: + ptr=GetVar(Vars,"ID"); + if (strncmp(ptr,"http:",5)==0) RetVal=DownloadItem(ptr,Title, Fmt, Flags); + else + { + Tempstr=SubstituteVarsInString(Tempstr,"http://$(Server):$(Port)/embedvars.aspx?isEhow=true&show_related=true&id=$(ID)",Vars,0); + RetVal=DownloadPage(Tempstr,TYPE_EHOW_STAGE2, Title,Flags); + } +break; + +case TYPE_EHOW_STAGE2: + RetVal=DownloadItem(GetVar(Vars,"ID"), Title, Fmt, Flags); +break; + + +case TYPE_METACAFE: +#define METACAFE_OVER_18 "allowAdultContent=1&submit=Continue+-+I%27m+over+18" + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)&$(METACAFE_OVER_18)",Vars,0); + RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); +break; + + +case TYPE_DAILYMOTION: + Tempstr=SubstituteVarsInString(Tempstr,"http://www.dailymotion.com/services/oembed?url=$(ID)&format=xml",Vars,0); + RetVal=DownloadPage(Tempstr,TYPE_DAILYMOTION_STAGE2,Title,Flags); +break; + +case TYPE_DAILYMOTION_STAGE2: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + RetVal=DownloadPage(Tempstr,TYPE_DAILYMOTION_STAGE3,Title,Flags); +break; + +case TYPE_DAILYMOTION_STAGE3: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); +break; + +case TYPE_VIDEOJUG: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + RetVal=DownloadPage(Tempstr,TYPE_VIDEOJUG_STAGE2,Title,Flags); +break; + +case TYPE_VIDEOJUG_STAGE2: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + RetVal=DownloadPage(Tempstr,TYPE_VIDEOJUG_STAGE3,Title,Flags); +break; + +case TYPE_VIDEOJUG_STAGE3: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); +break; + + + +case TYPE_MOBANGO: + //Tempstr=SubstituteVarsInString(Tempstr,"http://www.mobango.com/$(ID)",Vars,0); + RetVal=DownloadItem(GetVar(Vars,"ID"), Title, Fmt, Flags); +break; + +case TYPE_WASHINGTONPOST_JSON: + RetVal=DownloadPage(GetVar(Vars,"ID"),TYPE_WASHINGTONPOST_STAGE2,Title,Flags); +break; + +case TYPE_WASHINGTONPOST_STAGE2: + Tempstr=SubstituteVarsInString(Tempstr,"$(server)$(flvurl)",Vars,0); + RetVal=DownloadItem(Tempstr,Title, Fmt, Flags); +break; + + +case TYPE_MYVIDEO: + Tempstr=SubstituteVarsInString(Tempstr,"$(MyVidURL)/$(ID).flv",Vars,0); + RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); +break; + +case TYPE_VBOX7: + RetVal=DoVBOX7(GetVar(Vars,"ID"), Title); +break; + +case TYPE_VIMEO: + RetVal=DownloadPage(GetVar(Vars,"ID"),TYPE_VIMEO_STAGE2,Title,Flags); +break; + +case TYPE_VIMEO_STAGE2: + Tempstr=SubstituteVarsInString(Tempstr,"$(BASE)/$(ID)",Vars,0); + RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); +break; + + +case TYPE_YALE: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + RetVal=DownloadItem(Tempstr,Title, Fmt, Flags); +break; + +case TYPE_BLIPTV: + Tempstr=FormatStr(Tempstr,"http://%s/%s",Server,GetVar(Vars,"ID")); + RetVal=DownloadPage(Tempstr,TYPE_BLIPTV_STAGE2, Title,Flags); +break; + +case TYPE_ESCAPIST: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + RetVal=DownloadPage(Tempstr,TYPE_ESCAPIST_STAGE2, Title,Flags); +break; + +case TYPE_REDBALCONY: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + RetVal=DownloadPage(Tempstr,TYPE_REDBALCONY_STAGE2, Title,Flags); +break; + + +case TYPE_REDORBIT: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + RetVal=DownloadPage(Tempstr,TYPE_REDORBIT_STAGE2, Title,Flags); +break; + +case TYPE_ROYALSOCIETY: + ptr=GetVar(Vars,"ID"); + if (ptr && (strncmp(ptr,"http:",5)==0)) RetVal=DownloadItem(ptr,Title, Fmt, Flags); + else + { + Tempstr=SubstituteVarsInString(Tempstr,"http://royalsociety.tv/rsPlayer.aspx?presentationid=$(ID)",Vars,0); + RetVal=DownloadPage(Tempstr,TYPE_ROYALSOCIETY_STAGE2, Title,Flags); + } +break; + +case TYPE_ROYALSOCIETY_STAGE2: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + RetVal=DownloadM3U(Tempstr, Title, Flags); +break; + + +case TYPE_BRITISHACADEMY: + Tempstr=SubstituteVarsInString(Tempstr,"http://britac.studyserve.com/home/$(ID)",Vars,0); + RetVal=DownloadPage(Tempstr,TYPE_BRITISHACADEMY_STAGE2, Title,Flags); +break; + +case TYPE_BRITISHACADEMY_STAGE2: + Tempstr=SubstituteVarsInString(Tempstr,"http://britac.studyserve.com/home/lectures/$(ID)",Vars,0); + RetVal=DownloadASX(Tempstr, Title,Flags); +break; + +case TYPE_KAVLIINSTITUTE: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + RetVal=DownloadPage(Tempstr,TYPE_KAVLIINSTITUTE_STAGE2, Title,Flags); +break; + +case TYPE_EURONEWS: + Tempstr=SubstituteVarsInString(Tempstr,"http://video.euronews.net/$(ID).flv",Vars,0); + RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); +break; + +case TYPE_DOTSUB: + Tempstr=SubstituteVarsInString(Tempstr,"$(SERV)$(ID)",Vars,0); + RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); +break; + +case TYPE_ASTRONOMYCOM: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + RetVal=DownloadPage(Tempstr,TYPE_ASTRONOMYCOM_STAGE2, Title,Flags); +break; + +case TYPE_TEACHERTUBE: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); +break; + +case TYPE_BLOOMBERG: + Tempstr=SubstituteVarsInString(Tempstr,"http://videos.bloomberg.com/$(ID).flv",Vars,0); + RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); +break; + +case TYPE_VIDEOBASH: + Tempstr=SubstituteVarsInString(Tempstr,"http://$(ID)",Vars,0); + RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); +break; + +case TYPE_ANIMEHERE: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + RetVal=DownloadPage(Tempstr,TYPE_ANIMEHERE_STAGE2, Title,Flags); +break; + +case TYPE_KAVLIINSTITUTE_STAGE2: +case TYPE_SCIVEE: +case TYPE_BLIPTV_STAGE2: +case TYPE_GENERIC: +case TYPE_MYTOPCLIP: +case TYPE_PRINCETON: +case TYPE_TED: +case TYPE_NATGEO: +case TYPE_UCTV: +case TYPE_IZLESE: +case TYPE_REUTERS: +case TYPE_LIVELEAK: +case TYPE_IBTIMES: +case TYPE_SMH: +case TYPE_ACADEMIC_EARTH: +case TYPE_PHOTOBUCKET: +case TYPE_ALJAZEERA: +case TYPE_IVIEWTUBE: +case TYPE_WASHINGTONPOST: +case TYPE_CBSNEWS: +case TYPE_FRANCE24: +case TYPE_METATUBE: +case TYPE_MOTIONFEEDS: +case TYPE_GUARDIAN: +case TYPE_ESCAPIST_STAGE2: +case TYPE_REDORBIT_STAGE2: +case TYPE_REDBALCONY_STAGE2: +case TYPE_ASTRONOMYCOM_STAGE2: +case TYPE_ANIMEHERE_STAGE2: + Tempstr=SubstituteVarsInString(Tempstr,"$(ID)",Vars,0); + + RetVal=DownloadItem(Tempstr, Title, Fmt, Flags); +break; +} + + +DestroyString(Tempstr); +DestroyString(Title); +DestroyString(Fmt); + +return(RetVal); +} + + +void BlipTVExtractFromLine(char *Line, ListNode *Vars) +{ +char *ptr, *Type=NULL, *Width=NULL, *Height=NULL, *Tempstr=NULL; + + GenericExtractFromLine(Line, "width","width=\"","\"",Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); + GenericExtractFromLine(Line, "height","height=\"","\"",Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); + GenericExtractFromLine(Line, "url","url=\"","\"",Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); + + ptr=GetVar(Vars,"url"); + if (StrLen(ptr)) + { + ptr=strrchr(ptr,'.'); + if (ptr) Type=CopyStr(Type,ptr+1); + } + + ptr=GetVar(Vars,"width"); + if (StrLen(ptr)) + { + Width=CopyStr(Width,ptr); + Height=CopyStr(Height,GetVar(Vars,"height")); + Tempstr=MCopyStr(Tempstr,"item:",Type,":",Width,"x",Height,NULL); + SetVar(Vars,Tempstr,GetVar(Vars,"url")); + } + +DestroyString(Type); +DestroyString(Width); +DestroyString(Height); +DestroyString(Tempstr); +} + + + +// This is the main function that 'screen scrapes' a webpage looking for +// information that it can use to get a video +int ExtractItemInfo(STREAM *S, int Type, char *URL, char *Title, int Flags) +{ +char *Tempstr=NULL, *Token=NULL, *VarName=NULL, *Server=NULL; +ListNode *Vars=NULL; +char *ptr, *ptr2; +int MediaCount=0, i, Port; +int RetVal=FALSE, State=0; + +#define GENERIC_TITLE_START "" +#define GENERIC_TITLE_END "" + +ParseURL(URL,NULL,&Server,&Token,NULL,NULL,NULL,NULL); +Port=atoi(Token); + +Vars=ListCreate(); +SetVar(Vars,"Server",Server); + + +Tempstr=FormatStr(Tempstr,"%d",Port); +SetVar(Vars,"Port",Tempstr); +SetVar(Vars,"Title",Title); + + if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"\n------- DOWNLOADING DOCUMENT ------\n"); +Tempstr=STREAMReadLine(Tempstr, S); +while (Tempstr) +{ + StripTrailingWhitespace(Tempstr); + StripLeadingWhitespace(Tempstr); + + if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"%s\n",Tempstr); +switch (Type) +{ + +case TYPE_YOUTUBE: +//#define YOUTUBE_PTR "new SWFObject(\"/player2.swf?" + +//#define YOUTUBE_PTR "var swfArgs = {" +#define YOUTUBE_DIV "url_encoded_fmt_stream_map=" +#define YOUTUBE_TITLE_START "&title=" +#define YOUTUBE_TITLE_END "&" + + if (strstr(Tempstr,YOUTUBE_TITLE_START)) + { + GenericExtractFromLine(Tempstr, "Title",YOUTUBE_TITLE_START, YOUTUBE_TITLE_END, Vars,EXTRACT_DEQUOTE); + } + + + if (strstr(Tempstr,YOUTUBE_DIV)) + { + if (StrLen(GetVar(Vars,"item:flv"))==0) + { + GenericExtractFromLine(Tempstr, "yt:url_fmt",YOUTUBE_DIV, "&", Vars,EXTRACT_DEQUOTE); + Tempstr=CopyStr(Tempstr,GetVar(Vars,"yt:url_fmt")); + + DecodeYouTubeFormats(Tempstr,Vars); + } + } + +break; + + +case TYPE_YOUTUBE_PLAYLIST: +#define YOUTUBE_PLAYLIST_ITEM "/watch?v=" +#define YOUTUBE_PLAYLIST_ITEM_END "\"" + +if (strstr(Tempstr,YOUTUBE_PLAYLIST_ITEM)) +{ + GenericExtractFromLine(Tempstr, "tmp",YOUTUBE_PLAYLIST_ITEM,YOUTUBE_PLAYLIST_ITEM_END,Vars,EXTRACT_DEHTMLQUOTE | EXTRACT_NOSPACES); + Tempstr=FormatStr(Tempstr,"http://%s:%d/watch?v=%s",Server,Port,GetVar(Vars,"tmp")); + VarName=FormatStr(VarName,"ID:%d",MediaCount); + SetVar(Vars,VarName,Tempstr); + MediaCount++; +printf("PL! %s\n",Tempstr); +} +break; + + +case TYPE_METACAFE: +#define METACAFE_ITEM "&mediaData=" +#define METACAFE_MEDIA_URL ",\"mediaURL\":\"" + if (strstr(Tempstr,GENERIC_TITLE_START)) + { + GenericExtractFromLine(Tempstr, "Title",GENERIC_TITLE_START,GENERIC_TITLE_END, Vars,EXTRACT_DEQUOTE); + } + + + if (strstr(Tempstr,METACAFE_ITEM)) + { + GenericExtractFromLine(Tempstr, "metacafe:mediaData",METACAFE_ITEM,"&", Vars, EXTRACT_DEQUOTE); + ptr=GetVar(Vars,"metacafe:mediaData"); + GenericExtractFromLine(ptr, "item:mp4",METACAFE_MEDIA_URL,"\"", Vars, EXTRACT_DESLASHQUOTE|EXTRACT_GUESSTYPE); + } +break; + + +case TYPE_BLIPTV: +#define BLIPTV_LINE "" +#define EHOW_TITLE_END "" +#define EHOW_ITEM2 "showPlayer({" + + if (strstr(Tempstr,EHOW_ITEM)) + { + GenericExtractFromLine(Tempstr, "item:flv",EHOW_ITEM,EHOW_ITEM_END,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); + } + + if (strstr(Tempstr,EHOW_HD_ITEM)) + { + GenericExtractFromLine(Tempstr, "item:flv:hd",EHOW_HD_ITEM,EHOW_HD_ITEM_END,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); + } + + + ptr=strstr(Tempstr,EHOW_ITEM2); + if (ptr) + { + EhowExtractShowPlayer(S,ptr,Vars); + } + + + ptr=strstr(Tempstr,EHOW_TITLE); + if (ptr) + { + GenericExtractFromLine(Tempstr, "Title",EHOW_TITLE,EHOW_TITLE_END,Vars,EXTRACT_DEQUOTE); + } +break; + +case TYPE_EHOW_STAGE2: +#define EHOW_STAGE2_ITEM "source=" +#define EHOW_STAGE2_ITEM_END "&" + + ptr=strstr(Tempstr,EHOW_STAGE2_ITEM); + if (ptr) + { + GenericExtractFromLine(Tempstr, "item:flv",EHOW_STAGE2_ITEM,EHOW_STAGE2_ITEM_END,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); + } + + ptr=strstr(Tempstr,EHOW_TITLE); + if (ptr) + { + GenericExtractFromLine(Tempstr, "Title",EHOW_TITLE,EHOW_TITLE_END,Vars,EXTRACT_DEQUOTE); + } +break; + + + +case TYPE_VIMEO: +//"smil":{"url":"http:\/\/player.vimeo.com\/config\/46727983.smil" +#define VIMEO1_ITEM "smil\":{\"url\":\"" +#define VIMEO1_ITEM_END "\"" + + ptr=strstr(Tempstr,VIMEO1_ITEM); + if (ptr) + { + GenericExtractFromLine(Tempstr, "ID",VIMEO1_ITEM,VIMEO1_ITEM_END,Vars,EXTRACT_DESLASHQUOTE | EXTRACT_NOSPACES); + } + + +break; + + +case TYPE_VIMEO_STAGE2: +#define VIMEO1_BASE "<iframe" +#define VIDEOJUG_S2_ITEM "src=\"" +#define VIDEOJUG_S2_ITEM_END "\"" + + if (strstr(Tempstr,VIDEOJUG_S2_LINE)) + { + GenericExtractFromLine(Tempstr, "ID",VIDEOJUG_S2_ITEM,VIDEOJUG_S2_ITEM_END,Vars,EXTRACT_NOSPACES); + } +break; + +case TYPE_VIDEOJUG_STAGE3: +#define VIDEOJUG_S3_LINE "var html5Embed =" +#define VIDEOJUG_S3_ITEM "src=\"" +#define VIDEOJUG_S3_ITEM_END "\"" + + if (strstr(Tempstr,VIDEOJUG_S3_LINE)) + { + GenericExtractFromLine(Tempstr, "ID",VIDEOJUG_S3_ITEM,VIDEOJUG_S3_ITEM_END,Vars,EXTRACT_NOSPACES); + } +break; + + + +case TYPE_DAILYMOTION: +#define DAILYMOTION_ITEM "oembed?url=" +#define DAILYMOTION_ITEM_END "&format=xml" +#define DAILYMOTION_TITLE_START "" +#define IZLESE_TITLE_END "" +#define IZLESE_TITLE2_START "" +#define IZLESE_TITLE2_END "" + +case TYPE_IZLESE: +if (strstr(Tempstr,IZLESE_ITEM_START) && strstr(Tempstr,IZLESE_ITEM_END)) +{ + GenericExtractFromLine(Tempstr, "tmp",IZLESE_ITEM_START,IZLESE_ITEM_END,Vars,EXTRACT_DEQUOTE | EXTRACT_NOSPACES); + ptr=GetVar(Vars,"tmp"); + if (ptr) + { + //put 'http' back on + Tempstr=MCopyStr(Tempstr,"http",ptr,NULL); + + } + + if (strstr(ptr,"youtube")) + { + SetVar(Vars,"item:reference",Tempstr); + } + else + { + SetVar(Vars,"item:flv",Tempstr); + } + +} + + +if (strstr(Tempstr,IZLESE_TITLE_START)) +{ + GenericExtractFromLine(Tempstr, "Title",IZLESE_TITLE_START,IZLESE_TITLE_END,Vars,EXTRACT_DEQUOTE); +} + +if (strstr(Tempstr,IZLESE_TITLE2_START)) +{ + GenericExtractFromLine(Tempstr, "Title",IZLESE_TITLE2_START,IZLESE_TITLE2_END,Vars,EXTRACT_DEQUOTE); +} + + +break; + + + +#define REUTERS_FLV_ITEM_START "'flv':" +#define REUTERS_MP4_ITEM_START "'mpeg':" +#define REUTERS_TITLE "'headline':" + +case TYPE_REUTERS: + ptr=strstr(Tempstr,REUTERS_FLV_ITEM_START); + if (ptr) + { + GenericExtractFromLine(Tempstr, "item:flv",REUTERS_FLV_ITEM_START,",",Vars,EXTRACT_WITHIN_QUOTES | EXTRACT_NOSPACES); + } + + ptr=strstr(Tempstr,REUTERS_MP4_ITEM_START); + if (ptr) + { + GenericExtractFromLine(Tempstr, "item:mp4",REUTERS_MP4_ITEM_START,",",Vars,EXTRACT_WITHIN_QUOTES | EXTRACT_NOSPACES); + } + + + ptr=strstr(Tempstr,REUTERS_TITLE); + if (ptr) + { + GenericExtractFromLine(Tempstr, "Title",REUTERS_TITLE,",",Vars,EXTRACT_WITHIN_QUOTES | EXTRACT_NOSPACES); + } +break; + + +#define AE_YT_ITEM1_START "href=\"http://www.youtube.com/watch?v=" +#define AE_YT_ITEM1_END "\"" + +case TYPE_ACADEMIC_EARTH: + ptr=strstr(Tempstr,AE_YT_ITEM1_START); + if (ptr) + { + GenericExtractFromLine(Tempstr, "item:reference",AE_YT_ITEM1_START,AE_YT_ITEM1_END,Vars, EXTRACT_NOSPACES); + + Tempstr=MCopyStr(Tempstr,"http://youtube.com/watch?v=",GetVar(Vars,"item:reference"),NULL); + SetVar(Vars,"item:reference",Tempstr); + } + +break; + + +#define PHOTOBUCKET_START "\"fullsizeUrl\":\"" +#define PHOTOBUCKET_END "\"" + +case TYPE_PHOTOBUCKET: + ptr=strstr(Tempstr,PHOTOBUCKET_START); + if (ptr) + { + GenericExtractFromLine(Tempstr, "item:mp4",PHOTOBUCKET_START,PHOTOBUCKET_END,Vars, EXTRACT_DESLASHQUOTE | EXTRACT_GUESSTYPE); + } +break; + + +#define LIVELEAK_ITEM_START "file: \"" +#define LIVELEAK_ITEM_END "'\"" +case TYPE_LIVELEAK: +ptr=strstr(Tempstr,LIVELEAK_ITEM_START); +if (ptr) +{ + GenericExtractFromLine(Tempstr, "item:flv",LIVELEAK_ITEM_START,LIVELEAK_ITEM_END,Vars,EXTRACT_WITHIN_QUOTES | EXTRACT_NOSPACES | EXTRACT_GUESSTYPE); +} + +if (strstr(Tempstr,GENERIC_TITLE_START)) +{ + GenericExtractFromLine(Tempstr, "Title",GENERIC_TITLE_START,GENERIC_TITLE_END,Vars,EXTRACT_DEQUOTE); +} +break; + + + +//#define IBTIMES_ITEM_START "" +#define ROYALSOCIETY_TITLE_END "